From 826b096c8c0a07617ddd6aa321cdbae99ad0b668 Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Sat, 25 Apr 2009 20:52:51 -0400 Subject: [PATCH] Make a bunch of other changes to the invirtificator: - Don't require it to be run twice for each architecture - Figure out on its own if a package is arch any or arch all - Deal with packages with a non-zero epoch - Upload to unstable instead of "hardy" - we don't have a "hardy" svn path=/trunk/third/common/; revision=2300 --- invirtificator.sh | 67 ++++++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 31 deletions(-) diff --git a/invirtificator.sh b/invirtificator.sh index 1f102d4..04f0106 100644 --- a/invirtificator.sh +++ b/invirtificator.sh @@ -3,22 +3,12 @@ set -e -# Process arguments. -dist_arch=$1; shift -a= -if [ "$1" = "-A" ]; then a=-A; shift; fi -chroot=$dist_arch-sbuild - -if [ -z "$dist_arch" -o $# -eq 0 ]; then - echo 'No arguments!' >&2 - exit 2 -fi +dist=hardy +chroot=$dist-amd64 -dist=$(echo "$dist_arch" | sed 's/^\(.*\)-\([^-]*\)$/\1/') -arch=$(echo "$dist_arch" | sed 's/^\(.*\)-\([^-]*\)$/\2/') : ${section=invirt-system} : ${ivname=$name} -: ${release=-proposed} +: ${release=unstable} # Create a chroot and define functions for using it. sid=$(schroot -b -c "$chroot") @@ -65,26 +55,28 @@ rename_source () { perl -0pe "s/^$name/$ivname/" -i debian/changelog } -cmd_source () { - if [ "$a" != "-A" ]; then - echo "Not building source package for $dist_arch." >&2 - return +find_arch () { + if grep -iq '^Architecture: all' "${ivname}_$ivfilever.dsc"; then + a=-A fi - echo "Building source for $ivname-$ivversion on $dist_arch" >&2 +} + +cmd_source () { + echo "Building source for $ivname-$ivfilever on ${dist}-amd64" >&2 - if ! [ -e "${name}_$version.dsc" ]; then + if ! [ -e "${name}_$filever.dsc" ]; then sch apt-get -d source "$name" fi - if ! [ -e "${ivname}_$ivversion.dsc" ]; then + if ! [ -e "${ivname}_$ivfilever.dsc" ]; then ( tmpdir=$(mktemp -td "invirtify.$$.XXXXXXXXXX") trap 'rm -rf "$tmpdir"' EXIT - origversion=$(echo "$version" | sed 's/-[^-]*$//') + origversion=$(echo "$filever" | sed 's/-[^-]*$//') cp -a "${name}_$origversion.orig.tar.gz" "$tmpdir/" dscdir=$(pwd) cd "$tmpdir/" - dpkg-source -x "$dscdir/${name}_$version.dsc" "$tmpdir/$name-$origversion" + dpkg-source -x "$dscdir/${name}_$filever.dsc" "$tmpdir/$name-$origversion" cd "$tmpdir/$name-$origversion" dch_done= hack_package @@ -96,12 +88,12 @@ cmd_source () { [ -n "$dch_done" ] schr apt-get -q -y install devscripts pbuilder schr /usr/lib/pbuilder/pbuilder-satisfydepends - sch debuild -S -sa -us -uc -i -I.svn && cp -a "../${ivname}_$ivversion"* "$dscdir" + sch debuild -S -sa -us -uc -i -I.svn && cp -a "../${ivname}_$ivfilever"* "$dscdir" ) [ $? -eq 0 ] || exit 1 if [ -n "$IV_CHECK_DIFFS" ]; then - interdiff -z "${name}_$version.diff.gz" "${ivname}_$ivversion.diff.gz" | \ + interdiff -z "${name}_$filever.diff.gz" "${ivname}_$ivfilever.diff.gz" | \ enscript --color --language=ansi --highlight=diffu --output=- -q | \ less -R echo -n "Press Enter to continue: " >&2 @@ -111,7 +103,14 @@ cmd_source () { } cmd_binary () { - sbuildhack "$dist_arch" $a "${ivname}_$ivversion.dsc" + find_arch + + if [ "$a" = "-A" ]; then + sbuild -d "$dist" --arch-all "${ivname}_$ivfilever.dsc" + else + sbuild -d "$dist" --arch amd64 "${ivname}_$ivfilever.dsc" + sbuild -d "$dist" --arch i386 "${ivname}_$ivfilever.dsc" + fi } v () { @@ -120,10 +119,13 @@ v () { } cmd_upload () { - if [ "$a" = "-A" ]; then - v reprepro-env include "${dist}${release}" "${ivname}_${ivversion}_source.changes" + find_arch + + v reprepro-env include "${release}" "${ivname}_${ivfilever}_source.changes" + v reprepro-env include "${release}" "${ivname}_${ivfilever}_amd64.changes" + if [ -z "$a" ]; then + v reprepro-env include "${release}" "${ivname}_${ivfilever}_i386.changes" fi - v reprepro-env include "${dist}${release}" "${ivname}_${ivversion}_${arch}.changes" } version=$( @@ -145,19 +147,22 @@ version=$( ) ivversion=$version$ivversionappend +filever=$(echo "$version" | perl -pe 's/([^:]*:)?//') +ivfilever=$(echo "$ivversion" | perl -pe 's/([^:]*:)?//') + # Look for binary packages built from the named package with the right # version, and exit out if we find one (an architecture-specific one # if we weren't run with the -A flag). We need to look for either a # Source: or a Package: header matching $name since there is no # Source: header for a package whose name matches its source. -pkgfile="/srv/repository/dists/$dist/$section/binary-$arch/Packages.gz" -if { zcat "$pkgfile" | \ +pkgfiles="/srv/repository/dists/$release/$section/binary-*/Packages.gz" +if { zcat $pkgfiles | \ dpkg-awk -f - "Package:^$ivname\$" "Version:^$(quote "$ivversion")\$" -- Architecture; zcat $pkgfiles | \ dpkg-awk -f - "Source:^$ivname\$" "Version:^$(quote "$ivversion")\$" -- Architecture; } \ | if [ "$a" = "-A" ]; then cat; else fgrep -vx 'Architecture: all'; fi \ | grep -q .; then - echo "$ivname $ivversion already exists for $dist_arch." >&2 + echo "$ivname $ivversion already exists." >&2 exit 0 fi -- 1.7.9.5