]> git.ozlabs.org Git - next-scripts/commitdiff
make some stuff common
authorStephen Rothwell <sfr@canb.auug.org.au>
Mon, 20 May 2013 07:28:41 +0000 (17:28 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 20 May 2013 07:28:41 +0000 (17:28 +1000)
common.sh [new file with mode: 0644]
do_build
do_last_build
do_merge
do_patch
do_revert
merge_akpm
merge_fix
merge_old_version

diff --git a/common.sh b/common.sh
new file mode 100644 (file)
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
index b36d6b2fec75421005c14381585ac6b49603bbb6..ae2135a460a411bc6d95a90a15abf9752571acfa 100755 (executable)
--- 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
 
index 0717f2de572a50b776dce7a8c7a4e03f4fbaacdf..3cb4113e7cff58d2ef519257cfbb2b83c10bad95 100755 (executable)
@@ -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
 
index 21cdf118bfe8b9e90dbc0f299d05ec05a5f7549c..66e0b5eb7ca7f82dfcdb970808de08d956705fd2 100755 (executable)
--- 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()
 {
index e17c79c23c2b9e1d2ed377baa7054a2744408857..c48dcb23ddd57e1dfab0e3101ca1391e4df48bbb 100755 (executable)
--- 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()
 {
index a66225b605a784ac896ce70a88563b5e964d26d3..d5e585dd3cc2a61e97f7c4091251f445fc0ac55d 100755 (executable)
--- 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()
 {
index 8de8b7463b7891d710ef9e85ea167b8b94a48908..dc8a88c232532ed717cb9cd7704174fcc71e600e 100755 (executable)
@@ -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()
 {
index 27db62fd6e079806b68a04ce83b58c3cf24fca2f..7e6ff2b366efd5b640ef1251e88d88b0af65f387 100755 (executable)
--- 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()
 {
index 6ba9fd02252f3511e6ef2e040103e354421930b8..117c8ea5b3e2cd6a3f81d7f5d60c0019abbb24dd 100755 (executable)
@@ -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()
 {