source: trunk/scripts/git-hooks/super/build-pre-receive @ 2349

Last change on this file since 2349 was 2349, checked in by price, 16 years ago

begin to sketch git pre-receive hook

  • Property svn:executable set to *
File size: 2.3 KB
Line 
1#!/bin/bash
2
3read oldrev newrev head
4if [ $head != 'dev' ]; then
5  echo "error: head not recognized: $head" >&2
6  exit 1
7fi
8
9git ls-tree $newrev packages/ \
10 | grep ^160000\ commit \
11 | while read x y newsubrev packagepath; do
12     # XXX deal with new packages
13     # XX deal with removed packages
14     oldsubrev=$(git ls-tree $oldrev $packagepath | perl -lane 'print $F[2]')
15     if [ $newsubrev == $oldsubrev ]; then
16       continue
17     fi
18
19     echo "must build $packagepath at new version $newsubrev"
20   done
21
22
23
24
25
26exit 0
27
28distribution=hardy
29svnuri="$(invirt-getconf svn.uri)"
30
31set -e
32if  [ $# -eq 0 ] ; then
33        echo " usage: invirt-build-release package_name [package_name [...]]"
34        exit 1
35fi
36
37for package; do
38    rm -rf build-release/$package
39    svn export $svnuri/trunk/packages/$package build-release/$package
40    cd build-release/$package
41   
42    eval $(perl -ne 'print if s/^(Version|Source|Distribution): /\1=/' \
43             <(dpkg-parsechangelog))
44    dpkg-buildpackage -us -uc -rfakeroot -S
45    cd ..
46    eval $(perl -ne 'print if s/^(Architecture): /\1=/' ${Source}_${Version}.dsc)
47    case $Architecture in
48      all)
49        sbuild -d $distribution --arch-all   ${Source}_${Version}.dsc;;
50      any)
51        sbuild -d $distribution --arch amd64 --arch-all ${Source}_${Version}.dsc
52        sbuild -d $distribution --arch i386  ${Source}_${Version}.dsc;;
53      *)
54        echo "invirt-build-release: arch '$Architecture' unimplemented" >&2
55        exit 1
56    esac
57
58    if ! svn ls $svnuri/package_tags/$Source >/dev/null 2>&1; then
59        svn mkdir $svnuri/package_tags/$Source \
60            -m "Create package tags directory"
61    fi
62    if ! svn ls $svnuri/package_tags/$Source/$Version >/dev/null 2>&1; then
63        svn cp $svnuri/trunk/packages/$package $svnuri/package_tags/$Source/$Version \
64            -m "Tag $Version of $Source"
65    else
66        echo "$(basename $0): tag already exists, not making again"
67    fi
68   
69    [ $Distribution = 'unstable' ] \
70        || echo "$(basename $0): warning: Distribution is $Distribution, script expects unstable"
71    changesfile=`pwd`/${Source}_*${Version}*.changes
72    for i in $changesfile; do
73        reprepro-env include unstable $i
74        reprepro-env copy stable unstable $(sed -ne 's/^Binary: //p' $i)
75    done
76    reprepro-env copy stable unstable $Source
77   
78    cd ..
79    rm -rf build-release/$package
80done
Note: See TracBrowser for help on using the repository browser.