diff options
-rwxr-xr-x | scripts/do-git-push | 64 | ||||
-rw-r--r-- | src/cyclictest/cyclictest.c | 12 |
2 files changed, 57 insertions, 19 deletions
diff --git a/scripts/do-git-push b/scripts/do-git-push index f3e2742..4a46e87 100755 --- a/scripts/do-git-push +++ b/scripts/do-git-push @@ -8,6 +8,18 @@ # Copyright 2009 Clark Williams <williams@redhat.com> # +testing=0 +TEMP=$(getopt -o t -l test -n do-git-push -- "$@") +if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi +eval set -- "$TEMP" +while true; do + case "$1" in + -t|--test) testing=1 ; shift ;; + --) shift ; break ;; + *) echo "Internal Error!"; exit 1 ;; + esac +done + if [ $# -lt 1 ] then echo "usage: do-git-push <version>" @@ -17,7 +29,14 @@ fi version=$1 accnt=clrkwllms@master.kernel.org destpath=/pub/linux/kernel/people/clrkwllms/rt-tests -branch=$(git status | awk '/^# On branch/ {print $4}') +branch=$(git symbolic-ref -q HEAD) + +if [ $testing -eq 1 ]; then + echo "version: $version" + echo "accnt: $accnt" + echo "destpath: $destpath" + echo "branch: $branch" +fi # sanity check if [ ! -d .git ] @@ -28,14 +47,14 @@ then fi # make sure we're on the master branch -if [ $branch != 'master' ]; then +if [ $branch != 'refs/heads/master' ]; then echo "must be on master branch to push!" echo "(currently on branch: $branch)" exit -1 fi # double sanity check -mkver=$(awk '/^VERSION_STRING/ {print $3}' Makefile) +mkver=$(awk '$1 == "VERSION_STRING" {print $3; exit 0}' Makefile) if [ $version != $mkver ] then echo "parameter mismatch with Makefile!" @@ -46,15 +65,24 @@ fi # check the git tag tag="v$version" -if $(git tag -l | grep "$tag" >/dev/null 2>&1) +if rev=$(git rev-parse --verify -q "$tag" >/dev/null) then - echo "using existing tag $tag" + if [ "tag" = "$(git cat-file -t $tag)" ]; then + echo "using existing tag $tag" + else + echo "$tag is not a tag" + exit -1 + fi else echo "Generating annotated tag $tag" - git tag -a $tag - if [ $? != 0 ]; then - echo "No tag message; aborting!" - exit -1 + if [ $testing -eq 0 ]; then + git tag -a $tag + if [ $? != 0 ]; then + echo "No tag message; aborting!" + exit -1 + fi + else + echo "testing: Generate Tag" fi fi @@ -65,14 +93,22 @@ then echo "Generating tarfile $tar" make release fi - -if ssh $accnt ls $destpath | grep $tar >/dev/null 2>&1 +if ssh $accnt ls $destpath/$tar >/dev/null 2>&1 then echo "Tarfile $tar already on kernel.org" else echo "Copying tarball $tar to kernel.org" - scp $tar $accnt:$destpath + if [ $testing -eq 0 ]; then + scp $tar $accnt:$destpath + else + echo "testing: copy tarball" + fi +fi + +if [ $testing -eq 0 ]; then + echo "Pushing master and tags to kernel.org" + git push --tags origin master +else + echo "testing: push git tree" fi -echo "Pushing master and tags to kernel.org" -git push --tags origin master diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c index bfb8aa9..2b4dc50 100644 --- a/src/cyclictest/cyclictest.c +++ b/src/cyclictest/cyclictest.c @@ -746,7 +746,7 @@ out: /* Print usage information */ -static void display_help(void) +static void display_help(int error) { char tracers[MAX_PATH]; @@ -805,6 +805,8 @@ static void display_help(void) " format: --policy=fifo(default) or --policy=rr\n", tracers ); + if (error) + exit(-1); exit(0); } @@ -977,7 +979,7 @@ static void process_options (int argc, char *argv[]) case 'w': tracetype = WAKEUP; break; case 'W': tracetype = WAKEUPRT; break; case 'y': handlepolicy(optarg); break; - case '?': error = 1; break; + case '?': display_help(0); break; } } @@ -1028,7 +1030,7 @@ static void process_options (int argc, char *argv[]) if (error) - display_help (); + display_help(1); } static int check_kernel(void) @@ -1183,11 +1185,11 @@ int main(int argc, char **argv) int max_cpus = sysconf(_SC_NPROCESSORS_CONF); int i, ret = -1; + process_options(argc, argv); + if (check_privs()) exit(-1); - process_options(argc, argv); - /* lock all memory (prevent paging) */ if (lockall) if (mlockall(MCL_CURRENT|MCL_FUTURE) == -1) { |