Changeset 2355 for trunk/scripts


Ignore:
Timestamp:
Jun 13, 2009, 5:46:28 PM (15 years ago)
Author:
price
Message:

integrate most of invirt-build-receive into build-pre-receive

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/scripts/git-hooks/super/build-pre-receive

    r2349 r2355  
    11#!/bin/bash
     2set -e
    23
    34read oldrev newrev head
    4 if [ $head != 'dev' ]; then
     5if [ $head != 'refs/heads/dev' ]; then
    56  echo "error: head not recognized: $head" >&2
    67  exit 1
    78fi
     9if read; then
     10  echo "error: one update at a time, please" >&2
     11  exit 1
     12fi
     13
     14tmpdir=$(mktemp -d /tmp/xvm-git-XXXXXX)
     15echo "build directory $tmpdir"
     16
     17# XXX fixme
     18sbuild () { echo "  SBUILD" "$@"; }
     19
     20build_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
     60git clone . $tmpdir/git
    861
    962git ls-tree $newrev packages/ \
     
    1770     fi
    1871
    19      echo "must build $packagepath at new version $newsubrev"
     72     build_package $packagepath $newsubrev
    2073   done
    21 
    22 
    23 
    2474
    2575
    2676exit 0
    2777
    28 distribution=hardy
    29 svnuri="$(invirt-getconf svn.uri)"
    30 
    31 set -e
    32 if  [ $# -eq 0 ] ; then
    33         echo " usage: invirt-build-release package_name [package_name [...]]"
    34         exit 1
    35 fi
    36 
    3778for 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"
    7179    changesfile=`pwd`/${Source}_*${Version}*.changes
    7280    for i in $changesfile; do
Note: See TracChangeset for help on using the changeset viewer.