From b5f2c5e9e8a10d636d5455efc80dc75b4e29e2df Mon Sep 17 00:00:00 2001 From: "Siegfried-Angel Gevatter Pujals (RainCT)" Date: Wed, 7 Nov 2007 23:21:40 +0100 Subject: [PATCH] Improvements to pbuilder-dist (close bug #160769, bug 160769 and fix compatibility issue with the existing fix for bug #140964) --- debian/changelog | 4 ++++ pbuilder-dist | 44 +++++++++++++++++++++++++++++++++----------- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/debian/changelog b/debian/changelog index 0400133..f08062f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -15,6 +15,10 @@ ubuntu-dev-tools (0.21) UNRELEASED; urgency=low * submittodebian: better changelog location detection * submittodebian: user-friendly error if python-debian isn't installed * hugdaylist: improve error handling (less backtraces, more nice messages) + * pbuilder-dist: look for global variable $PBUILDFOLDER (LP: #160769) + * pbuilder-dist: check pbuilder version and only use --components if supported + * pbuilder-dist: don't chown "unknown distribution" warning if an environment + of that release already exists (LP: #160769) -- Siegfried-Angel Gevatter Pujals (RainCT) Sat, 27 Oct 2007 23:03:42 +0200 diff --git a/pbuilder-dist b/pbuilder-dist index 1b65b47..17bb323 100755 --- a/pbuilder-dist +++ b/pbuilder-dist @@ -14,9 +14,10 @@ # 'pbuilder-feisty-i386', etc. # Base directory where pbuilder will put all the files it creates +# This is overriden by the global variable $PBUILDFOLDER BASE_DIR="$HOME/pbuilder" -# Enable additional repositories by default? (universe and multiverse in Ubuntu, +# Enable additional components by default? (universe and multiverse in Ubuntu, # contrib and non-free in Debian.) EXTRACOMP=1 @@ -32,6 +33,11 @@ SYSCACHE=1 ARCH=`dpkg-architecture -qDEB_HOST_ARCH` SYSDIST=`lsb_release -cs` +if [ $PBUILDFOLDER ] && [ $PBUILDFOLDER != "" ] +then + BASE_DIR=$PBUILDFOLDER +fi + help() { echo "Insufficient number of arguments." @@ -94,10 +100,12 @@ distdata() if [ "$1" = "debian" ] then # Set Debian specific data + ISDEBIAN=True ARCHIVE="http://ftp.debian.org" COMPONENTS="main"$( [ $EXTRACOMP = 0 ] || echo " contrib non-free" ) else # Set Ubuntu specific data + ISDEBIAN=False ARCHIVE="http://archive.ubuntu.com/ubuntu" COMPONENTS="main restricted"$( [ $EXTRACOMP = 0 ] || echo " universe multiverse" ) fi @@ -114,16 +122,17 @@ case $DISTRIBUTION in ;; *) - echo "Warning: Unknown distribution «$DISTRIBUTION»." - echo -n "Continue [y/N]? " - read continue - - if [ "$continue" != 'y' ] && [ "$continue" != 'Y' ] + if [ ! -d $BASE_DIR/${DISTRIBUTION}-* ] then - echo "Aborting..." - exit 1 + echo -n "Warning: Unknown distribution «$DISTRIBUTION». Do you want to continue [y/N]? " + read continue + + if [ "$continue" != 'y' ] && [ "$continue" != 'Y' ] + then + echo "Aborting..." + exit 1 + fi fi - distdata ;; esac @@ -160,6 +169,20 @@ then DEBCACHE='/var/cache/apt/archives/' fi +# Check what version of pbuilder is installed, and if +# it's supported, use the --components option +if dpkg --compare-versions $(dpkg-query -W -f='${Version}' pbuilder) ge 0.174 +then + if [ $ISDEBIAN = True ]; then + echo "Warning: If this operation fails it might be because you changed the value of $COMPONENTS in the pbuilderrc file." + echo "See https://bugs.launchpad.net/ubuntu/+source/ubuntu-dev-tools/+bug/140964 for more information." + fi + COMPONENTS_LINE="--othermirror \"\" --components \"$COMPONENTS\"" +else + # else, do it the old way + COMPONENTS_LINE="--othermirror \"deb $ARCHIVE $DISTRIBUTION $COMPONENTS\"" +fi + sudo pbuilder $OPERATION \ --basetgz $BASE_DIR/$FOLDERBASE-base.tgz \ --distribution $DISTRIBUTION \ @@ -168,6 +191,5 @@ sudo pbuilder $OPERATION \ $( [ -z $DEBCACHE ] || echo "--aptcache $DEBCACHE" ) \ --buildresult $BASE_DIR/${FOLDERBASE}_result \ --mirror "$ARCHIVE" \ - --othermirror "" \ - --components "$COMPONENTS" \ + $COMPONENTS_LINE \ $@