From 2e06b9fa1987fc605256698a9243fd6f3b50d25b Mon Sep 17 00:00:00 2001 From: Stephen Rothwell Date: Mon, 20 May 2013 17:28:41 +1000 Subject: [PATCH] make some stuff common --- common.sh | 27 +++++++++++++++++++++++++++ do_build | 15 +-------------- do_last_build | 15 +-------------- do_merge | 21 +-------------------- do_patch | 20 +------------------- do_revert | 19 +------------------ merge_akpm | 20 +------------------- merge_fix | 19 +------------------ merge_old_version | 25 ++++--------------------- 9 files changed, 38 insertions(+), 143 deletions(-) create mode 100644 common.sh diff --git a/common.sh b/common.sh new file mode 100644 index 0000000..bac6dfd --- /dev/null +++ b/common.sh @@ -0,0 +1,27 @@ +# +# Common setup for linux-next scripts +# +bin_dir="$(dirname $0)" + +LOG_FILE="../merge.log" +SHA1_FILE="../SHA1s" + +build_host="ka2" +build_dir="/scratch/sfr/next" + +[ "$NEXT_BUILD_HOST" ] && build_host="$NEXT_BUILD_HOST" +[ "$NEXT_BUILD_DIR" ] && build_dir="$NEXT_BUILD_DIR" + +[ -n "$1" ] && { + build_host="$1" + shift +} +[ -n "$1" ] && { + build_dir="$1" + shift +} + +export NEXT_BUILD_HOST="$build_host" +export NEXT_BUILD_DIR="$build_dir" + +true diff --git a/do_build b/do_build index b36d6b2..ae2135a 100755 --- a/do_build +++ b/do_build @@ -1,19 +1,6 @@ #!/bin/sh -build_host="ka2" -build_dir="/scratch/sfr/next" - -[ "$NEXT_BUILD_HOST" ] && build_host="$NEXT_BUILD_HOST" -[ "$NEXT_BUILD_DIR" ] && build_dir="$NEXT_BUILD_DIR" - -[ -n "$1" ] && { - build_host="$1" - shift -} -[ -n "$1" ] && { - build_dir="$1" - shift -} +. "$(dirname $0)/common.sh" set -e diff --git a/do_last_build b/do_last_build index 0717f2d..3cb4113 100755 --- a/do_last_build +++ b/do_last_build @@ -1,19 +1,6 @@ #!/bin/sh -build_host="ka2" -build_dir="/scratch/sfr/next" - -[ "$NEXT_BUILD_HOST" ] && build_host="$NEXT_BUILD_HOST" -[ "$NEXT_BUILD_DIR" ] && build_dir="$NEXT_BUILD_DIR" - -[ -n "$1" ] && { - build_host="$1" - shift -} -[ -n "$1" ] && { - build_dir="$1" - shift -} +. "$(dirname $0)/common.sh" set -e diff --git a/do_merge b/do_merge index 21cdf11..66e0b5e 100755 --- a/do_merge +++ b/do_merge @@ -1,15 +1,5 @@ #!/bin/bash -bin_dir="$(dirname $0)" - -LOG_FILE="../merge.log" -SHA1_FILE="../SHA1s" - -build_host="ka2" -build_dir="/scratch/sfr/next" -[ "$NEXT_BUILD_HOST" ] && build_host="$NEXT_BUILD_HOST" -[ "$NEXT_BUILD_DIR" ] && build_dir="$NEXT_BUILD_DIR" - no_build=false start_from="" @@ -26,17 +16,8 @@ start_from="" } shift } -[ -n "$1" ] && { - build_host="$1" - shift -} -[ -n "$1" ] && { - build_dir="$1" - shift -} -export NEXT_BUILD_HOST="$build_host" -export NEXT_BUILD_DIR="$build_dir" +. "$(dirname $0)/common.sh" log() { diff --git a/do_patch b/do_patch index e17c79c..c48dcb2 100755 --- a/do_patch +++ b/do_patch @@ -1,13 +1,5 @@ #!/bin/bash -bin_dir="$(dirname $0)" - -LOG_FILE="../merge.log" -build_host="ka2" -build_dir="/scratch/sfr/next" -[ "$NEXT_BUILD_HOST" ] && build_host="$NEXT_BUILD_HOST" -[ "$NEXT_BUILD_DIR" ] && build_dir="$NEXT_BUILD_DIR" - no_build=false [ "$1" = "-n" ] && { shift @@ -17,17 +9,7 @@ no_build=false patch="$1" shift -[ -n "$1" ] && { - build_host="$1" - shift -} -[ -n "$1" ] && { - build_dir="$1" - shift -} - -export NEXT_BUILD_HOST="$build_host" -export NEXT_BUILD_DIR="$build_dir" +. "$(dirname $0)/common.sh" log() { diff --git a/do_revert b/do_revert index a66225b..d5e585d 100755 --- a/do_revert +++ b/do_revert @@ -1,12 +1,5 @@ #!/bin/bash -bin_dir="$(dirname $0)" - -LOG_FILE="../merge.log" -build_host="ka2" -build_dir="/scratch/sfr/next" -[ "$NEXT_BUILD_HOST" ] && build_host="$NEXT_BUILD_HOST" -[ "$NEXT_BUILD_DIR" ] && build_dir="$NEXT_BUILD_DIR" no_build=false [ "$1" = "-n" ] && { @@ -17,17 +10,7 @@ no_build=false rev=$1 shift -[ -n "$1" ] && { - build_host="$1" - shift -} -[ -n "$1" ] && { - build_dir="$1" - shift -} - -export NEXT_BUILD_HOST="$build_host" -export NEXT_BUILD_DIR="$build_dir" +. "$(dirname $0)/common.sh" log() { diff --git a/merge_akpm b/merge_akpm index 8de8b74..dc8a88c 100755 --- a/merge_akpm +++ b/merge_akpm @@ -1,14 +1,5 @@ #!/bin/bash -bin_dir="$(dirname $0)" - -LOG_FILE="../merge.log" -SHA1_FILE="../SHA1s" -build_host="ka2" -build_dir="/scratch/sfr/next" -[ "$NEXT_BUILD_HOST" ] && build_host="$NEXT_BUILD_HOST" -[ "$NEXT_BUILD_DIR" ] && build_dir="$NEXT_BUILD_DIR" - today="$(date '+%Y%m%d')" no_build=false @@ -17,17 +8,8 @@ no_build=false shift no_build=true } -[ -n "$1" ] && { - build_host="$1" - shift -} -[ -n "$1" ] && { - build_dir="$1" - shift -} -export NEXT_BUILD_HOST="$build_host" -export NEXT_BUILD_DIR="$build_dir" +. "$(dirname $0)/common.sh" log() { diff --git a/merge_fix b/merge_fix index 27db62f..7e6ff2b 100755 --- a/merge_fix +++ b/merge_fix @@ -1,13 +1,5 @@ #!/bin/bash -bin_dir="$(dirname $0)" - -LOG_FILE="../merge.log" -build_host="ka2" -build_dir="/scratch/sfr/next" -[ "$NEXT_BUILD_HOST" ] && build_host="$NEXT_BUILD_HOST" -[ "$NEXT_BUILD_DIR" ] && build_dir="$NEXT_BUILD_DIR" - no_build=false [ "$1" = "-n" ] && { shift @@ -19,17 +11,8 @@ shift echo "patch does not exist" 1>&2 exit 1 } -[ -n "$1" ] && { - build_host="$1" - shift -} -[ -n "$1" ] && { - build_dir="$1" - shift -} -export NEXT_BUILD_HOST="$build_host" -export NEXT_BUILD_DIR="$build_dir" +. "$(dirname $0)/common.sh" log() { diff --git a/merge_old_version b/merge_old_version index 6ba9fd0..117c8ea 100755 --- a/merge_old_version +++ b/merge_old_version @@ -1,14 +1,5 @@ #!/bin/bash -bin_dir="$(dirname $0)" - -LOG_FILE="../merge.log" -SHA1_FILE="../SHA1s" -build_host="ka2" -build_dir="/scratch/sfr/next" -[ "$NEXT_BUILD_HOST" ] && build_host="$NEXT_BUILD_HOST" -[ "$NEXT_BUILD_DIR" ] && build_dir="$NEXT_BUILD_DIR" - no_build=false [ "$1" = "-n" ] && { shift @@ -16,7 +7,9 @@ no_build=false } tree=$1 -ver=$2 +shift +ver=$1 +shift rev=$(git show next-${ver}:Next/SHA1s | sed -n "s/^$tree\t\t*//p") [ "$rev" ] || { @@ -24,17 +17,7 @@ rev=$(git show next-${ver}:Next/SHA1s | sed -n "s/^$tree\t\t*//p") exit 1 } -[ -n "$3" ] && { - build_host="$3" - shift -} -[ -n "$3" ] && { - build_dir="$3" - shift -} - -export NEXT_BUILD_HOST="$build_host" -export NEXT_BUILD_DIR="$build_dir" +. "$(dirname $0)/common.sh" log() { -- 2.39.2