X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=common.sh;h=8e9f484d13ef16939ab16216807ace2330d6c5ac;hb=HEAD;hp=1cd814fea35e036d1cfcc66746eb49260dda96cd;hpb=87f7336193d19fbf8b260a80c779ecc658696f59;p=next-scripts diff --git a/common.sh b/common.sh index 1cd814f..8e9f484 100644 --- a/common.sh +++ b/common.sh @@ -6,21 +6,31 @@ [ "$_next_common_included" ] && return 0 _next_common_included=1 -bin_dir="$(dirname $0)" +bin_dir=$(realpath $(dirname "$0")) +top_dir=$(dirname "$bin_dir") -LOG_FILE="../merge.log" -SHA1_FILE="../SHA1s" -CTRL_FILE="../etc/control" +[ "$LOG_FILE" ] || LOG_FILE="$top_dir/merge.log" +SHA1_FILE="$top_dir/SHA1s" +CTRL_FILE="$top_dir/etc/control" -build_host="alpine1.ozlabs.ibm.com" -build_dir="/home/michael/linux-next/tmpfs/next" -gcc_version="4.9.3" -j_factor=640 -ssh_key_file="~/work/topics/korg/ssh/korg-mpe" -gpg_key="C8E1A580" +build_host="ash" +build_dir="/home/sfr/next/next" +gcc_version="4.9.0" +j_factor=$(nproc) +gpg_key=89F91C0A41D5C07A +kup_gpg_key=015042F34957D06C -[ "$NEXT_BUILD_HOST" ] && build_host="$NEXT_BUILD_HOST" +[ "$NEXT_BUILD_HOST" ] && { + build_host="$NEXT_BUILD_HOST" + [ "$build_host" = "none" ] && build_host="" +} [ "$NEXT_BUILD_DIR" ] && build_dir="$NEXT_BUILD_DIR" +[ "$NEXT_GCC_VERSION" ] && gcc_version="$NEXT_GCC_VERSION" +gcc_ppc_version=$gcc_version +[ "$NEXT_GCC_PPC_VERSION" ] && gcc_ppc_version="$NEXT_GCC_PPC_VERSION" +gcc_ppcle_version=$gcc_ppc_version +[ "$NEXT_GCC_PPCLE_VERSION" ] && gcc_ppcle_version="$NEXT_GCC_PPCLE_VERSION" +[ "$NEXT_J_FACTOR" ] && j_factor="$NEXT_J_FACTOR" [ -n "$1" ] && { build_host="$1" @@ -31,7 +41,42 @@ gpg_key="C8E1A580" shift } -export NEXT_BUILD_HOST="$build_host" +export NEXT_BUILD_HOST="${build_host:-none}" export NEXT_BUILD_DIR="$build_dir" +export NEXT_GCC_VERSION="$gcc_version" +export NEXT_GCC_PPC_VERSION="$gcc_ppc_version" +export NEXT_GCC_PPCLE_VERSION="$gcc_ppcle_version" +export NEXT_J_FACTOR="$j_factor" + +# Support functions +get_contacts() +{ + awk -F '\t' '/^[^#]/ && $3=="'"$1"'" { print $1; }' $CTRL_FILE +} + +get_url() +{ + awk -F '\t' '/^[^#]/ && $3=="'"$1"'" { print $4; }' $CTRL_FILE +} + +get_build_flag() +{ + awk -F '\t' '/^[^#]/ && $3=="'"$1"'" { print $6; }' $CTRL_FILE +} + +check_unmerged_files() +{ + local tree="$1" + local um_files + local rm_files + + um_files=$(git diff 2>&1 | sed -n 's/^\* Unmerged path //p') + if [ "$um_files" ] && [ -f "../merge-files/$tree" ]; then + rm_files=$(grep -F "$um_files" "../merge-files/$tree") + if [ "$rm_files" ]; then + "$bin_dir/do_rm" $rm_files + fi + fi +} true