- Timestamp:
- Jun 13, 2009, 5:46:28 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/scripts/git-hooks/super/build-pre-receive
r2349 r2355 1 1 #!/bin/bash 2 set -e 2 3 3 4 read oldrev newrev head 4 if [ $head != ' dev' ]; then5 if [ $head != 'refs/heads/dev' ]; then 5 6 echo "error: head not recognized: $head" >&2 6 7 exit 1 7 8 fi 9 if read; then 10 echo "error: one update at a time, please" >&2 11 exit 1 12 fi 13 14 tmpdir=$(mktemp -d /tmp/xvm-git-XXXXXX) 15 echo "build directory $tmpdir" 16 17 # XXX fixme 18 sbuild () { echo " SBUILD" "$@"; } 19 20 build_package () { 21 packagepath=$1 22 rev=$2 23 24 package=${packagepath#packages/} 25 url=$(git config -f $tmpdir/git/.gitmodules submodule.$packagepath.url) 26 echo "building $package at new version $rev" 27 28 srcdir=$tmpdir/$package 29 mkdir $srcdir 30 # XXX remove that .git -- be sure to include it in `git submodule add` 31 git --git-dir=$url.git archive $rev | tar -xf - -C $srcdir 32 pushd $srcdir >/dev/null 33 34 eval $(perl -ne 'print if s/^(Version|Source|Distribution): /\1=/' \ 35 <(dpkg-parsechangelog)) 36 dpkg-buildpackage -us -uc -rfakeroot -S 37 cd .. 38 39 eval $(perl -ne 'print if s/^(Architecture): /\1=/' ${Source}_${Version}.dsc) 40 case $Architecture in 41 all) 42 sbuild -d $distribution --arch-all ${Source}_${Version}.dsc;; 43 any) 44 sbuild -d $distribution --arch amd64 --arch-all ${Source}_${Version}.dsc 45 sbuild -d $distribution --arch i386 ${Source}_${Version}.dsc;; 46 *) 47 echo "build-pre-receive: arch '$Architecture' unimplemented" >&2 48 exit 1 49 esac 50 51 echo "XXX tag submodule as $Version" 52 53 [ $Distribution = 'unstable' ] \ 54 || echo "$(basename $0): warning: Distribution is $Distribution, script expects unstable" 55 56 echo "built $package version $Version from commit $rev" 57 popd >/dev/null 58 } 59 60 git clone . $tmpdir/git 8 61 9 62 git ls-tree $newrev packages/ \ … … 17 70 fi 18 71 19 echo "must build $packagepath at new version $newsubrev"72 build_package $packagepath $newsubrev 20 73 done 21 22 23 24 74 25 75 26 76 exit 0 27 77 28 distribution=hardy29 svnuri="$(invirt-getconf svn.uri)"30 31 set -e32 if [ $# -eq 0 ] ; then33 echo " usage: invirt-build-release package_name [package_name [...]]"34 exit 135 fi36 37 78 for package; do 38 rm -rf build-release/$package39 svn export $svnuri/trunk/packages/$package build-release/$package40 cd build-release/$package41 42 eval $(perl -ne 'print if s/^(Version|Source|Distribution): /\1=/' \43 <(dpkg-parsechangelog))44 dpkg-buildpackage -us -uc -rfakeroot -S45 cd ..46 eval $(perl -ne 'print if s/^(Architecture): /\1=/' ${Source}_${Version}.dsc)47 case $Architecture in48 all)49 sbuild -d $distribution --arch-all ${Source}_${Version}.dsc;;50 any)51 sbuild -d $distribution --arch amd64 --arch-all ${Source}_${Version}.dsc52 sbuild -d $distribution --arch i386 ${Source}_${Version}.dsc;;53 *)54 echo "invirt-build-release: arch '$Architecture' unimplemented" >&255 exit 156 esac57 58 if ! svn ls $svnuri/package_tags/$Source >/dev/null 2>&1; then59 svn mkdir $svnuri/package_tags/$Source \60 -m "Create package tags directory"61 fi62 if ! svn ls $svnuri/package_tags/$Source/$Version >/dev/null 2>&1; then63 svn cp $svnuri/trunk/packages/$package $svnuri/package_tags/$Source/$Version \64 -m "Tag $Version of $Source"65 else66 echo "$(basename $0): tag already exists, not making again"67 fi68 69 [ $Distribution = 'unstable' ] \70 || echo "$(basename $0): warning: Distribution is $Distribution, script expects unstable"71 79 changesfile=`pwd`/${Source}_*${Version}*.changes 72 80 for i in $changesfile; do
Note: See TracChangeset
for help on using the changeset viewer.