]> sourceware.org Git - systemtap.git/commitdiff
Allow spin-rawhide to be run from any directory
authorLukas Berk <lberk@redhat.com>
Wed, 31 Oct 2012 14:41:47 +0000 (10:41 -0400)
committerLukas Berk <lberk@redhat.com>
Wed, 31 Oct 2012 14:41:47 +0000 (10:41 -0400)
* scripts/spin-rawhide: replace HASH suffix with mktemp function
reposition constant/variable definitions to draw
  from newly cloned systemtap.git vs pwd
make STAP_MAJOR_VERSION grep more specific
make Source grep more specific

scripts/spin-rawhide

index 6ef8a505f9788e7aa7a96aef178de7352eb3343e..1f9c1aa26df3617aebe976a025ca812b5f2e50f2 100755 (executable)
@@ -1,29 +1,26 @@
 #!/usr/bin/bash 
 
-### Constants ###
-HASH=`mkpasswd -l 6 -s 0`
+### Create the directory we'll be working in###
+
+DIR=`mktemp -d stapXXX -p /tmp/`; cd $DIR
+
+# We need to differenciate between upstream sources and the later used distro sources
+# hence the specific checkout to systemtap-git
+
+git clone git://sourceware.org/git/systemtap.git systemtap-git
+cd systemtap-git
+
+# We need to use --global for the NAME and USER vars as we're
+# assuming this script can be run from anywhere (ie, not in an
+# already existing git repo)
 DATE=`date | cut -f1,2,3,6 -d" "`
 NAME=`git config --get-all user.name`
 EMAIL=`git config --get-all user.email`
-STAP_MAJOR_VERSION=`grep "Version:" systemtap.spec`
+STAP_MAJOR_VERSION=`grep "^Version:" systemtap.spec`
 CHANGELOG_VERSION=`echo $STAP_MAJOR_VERSION | cut -f2 -d" "`
 GIT_VERSION_TAG=`echo 0.$(git describe | rev | cut -f1,2 -d- --output-delimiter=. | rev)`
-STAP_DIR=/tmp/systemtap$HASH
-FEDSCM_DIR=/tmp/fedora-scm$HASH/
-FEDSCM_STAP_DIR=$FEDSCM_DIR/systemtap
-
-### lets do some sanity checks first
-if [ -z "$STAP_DIR" ]; then
-echo "Please set your systemtap directory variable (STAP_DIR)"
-exit
-fi
-
-if [ -z "$FEDSCM_STAP_DIR" ]; then
-echo "Please set your fedora-scm directory variable (FEDSCM_STAP_DIR)"
-echo "This is the directory used for fedora releases"
-exit
-fi
 
+### lets do a sanity check first
 if which fedpkg &>/dev/null; then
  :
 else
@@ -31,25 +28,20 @@ echo "Please install the fedpkg package"
 exit
 fi
 
-#Create the needed directories
-cd /tmp
-
-#Use the hash at the end to relatively ensure uniquness
-git clone git://sourceware.org/git/systemtap.git systemtap$HASH
-
-mkdir -p $FEDSCM_DIR
-cd $FEDSCM_DIR
+### Checkout the fedora sources systemtap
+cd ..
 fedpkg co systemtap
 
-cd $STAP_DIR
-git archive --prefix=systemtap-$CHANGELOG_VERSION/ -o $FEDSCM_STAP_DIR/systemtap-$CHANGELOG_VERSION-$GIT_VERSION_TAG.tar.gz HEAD
+### create a tar.gz of the latest git sources from HEAD
+cd systemtap-git
+git archive --prefix=systemtap-$CHANGELOG_VERSION/ -o ../systemtap/systemtap-$CHANGELOG_VERSION-$GIT_VERSION_TAG.tar.gz HEAD
 
 ### fedpackage stuff
 
-cd $FEDSCM_STAP_DIR
+cd ../systemtap
 
 sed -i "s/Release: .*/Release: $GIT_VERSION_TAG\%\{\?dist\}/" systemtap.spec
-sed -i "s/Source:.*/Source: %{name}-%{version}-$GIT_VERSION_TAG.tar.gz/" systemtap.spec
+sed -i "s/\^Source:.*/Source: %{name}-%{version}-$GIT_VERSION_TAG.tar.gz/" systemtap.spec
 sed -i "s/\%changelog/\%changelog\n* $DATE $NAME <$EMAIL> - $CHANGELOG_VERSION-$GIT_VERSION_TAG\n- Automated weekly rawhide release\n/" systemtap.spec
 
 echo "Please ensure that you have an up to date fedoraproject SSL certificate, you can achieve this by running fedora-cert -n"
@@ -58,8 +50,4 @@ fedpkg new-sources systemtap-$CHANGELOG_VERSION-$GIT_VERSION_TAG.tar.gz
 
 fedpkg commit -m "Automated weekly systemtap rawhide release: $GIT_VERSION_TAG" -p 
 
-fedpkg build 
-
-# cleanup
-rm -rf $STAP_DIR
-rm -rf $FEDSCM_DIR
+fedpkg build
This page took 0.029224 seconds and 5 git commands to generate.