From 519d99d40791cb5cfeafd0e173fd700b8264dbaa Mon Sep 17 00:00:00 2001 From: Stephan Hermann Date: Tue, 22 Jan 2008 18:35:56 +0100 Subject: [PATCH] * pbuilder-dist: - check if $SYSCACHE is not set and stay with the default, if SYSCACHE = 0 use the default from pbuilderrc or honor $DEBCACHE (LP: #156183) - removed $BINARCH check in pbuilder call, and set --debootstrapopts directly, it doesn't matter when it's always set. The Subshell call didn't work (LP: #175183) - added support for --http-proxy, honours now $http_proxy or $HTTP_PROXY - removed $COMPONENTS_LINE from pbuilder call, data is crippled in the pbuilder chroot. Instead of this behaviour add $BASE_DIR/etc/$DISTRIBUTION/apt.conf/ directory and install a sane sources.list, depending on the releases of Ubuntu and add --aptconfdir to pbuilder call (LP: #175183) - add support for gksudo|kdesudo|sudo depending on $DESKTOP_SESSION. (LP: #172943) * pbuilder-dist.bash_completion: (LP: #175728) - added bash_completion instructions * debian/rules: - install pbuilder-dist.bash_completion to /etc/bash_completion.d/ --- debian/changelog | 19 ++++++++ debian/rules | 4 ++ pbuilder-dist | 88 +++++++++++++++++++++++++++++------ pbuilder-dist.bash_completion | 31 ++++++++++++ 4 files changed, 128 insertions(+), 14 deletions(-) create mode 100644 pbuilder-dist.bash_completion diff --git a/debian/changelog b/debian/changelog index 2b7e971..f319469 100644 --- a/debian/changelog +++ b/debian/changelog @@ -33,6 +33,25 @@ ubuntu-dev-tools (0.25) UNRELEASED; urgency=low [ Stephan Hermann ] * mk-sbuild-lv: check for debootstrap release names in /usr/share/debootstreap/releases and not in /usr/lib/debootstrap/releases + * pbuilder-dist: + - check if $SYSCACHE is not set and stay with the default, if + SYSCACHE = 0 use the default from pbuilderrc or honor $DEBCACHE + (LP: #156183) + - removed $BINARCH check in pbuilder call, and set --debootstrapopts + directly, it doesn't matter when it's always set. The Subshell call + didn't work (LP: #175183) + - added support for --http-proxy, honours now $http_proxy or $HTTP_PROXY + - removed $COMPONENTS_LINE from pbuilder call, data is crippled in the + pbuilder chroot. + Instead of this behaviour add $BASE_DIR/etc/$DISTRIBUTION/apt.conf/ + directory and install a sane sources.list, depending on the releases of Ubuntu + and add --aptconfdir to pbuilder call (LP: #175183) + - add support for gksudo|kdesudo|sudo depending on $DESKTOP_SESSION. + (LP: #172943) + * pbuilder-dist.bash_completion: (LP: #175728) + - added bash_completion instructions + * debian/rules: + - install pbuilder-dist.bash_completion to /etc/bash_completion.d/ [ Daniel Holbach ] * hugdaylist: drop one Ubuntu filter statement. diff --git a/debian/rules b/debian/rules index c2b9d93..c9d7a1c 100755 --- a/debian/rules +++ b/debian/rules @@ -10,5 +10,9 @@ DEB_INSTALL_MANPAGES_ubuntu-dev-tools = doc/*.1 build/ubuntu-dev-tools:: docbook2x-man doc/ppaput.1.docbook; mv ppaput.1 doc +install/ubuntu-dev-tools:: + mkdir -p debian/ubuntu-dev-tools/etc/bash_completion.d/ + cp -v pbuilder-dist.bash_completion debian/ubuntu-dev-tools/etc/bash_completion.d/pbuilder-dist + clean:: rm -f doc/ppaput.1 diff --git a/pbuilder-dist b/pbuilder-dist index eef9d30..53e20e5 100755 --- a/pbuilder-dist +++ b/pbuilder-dist @@ -1,4 +1,5 @@ #!/bin/sh +set -x # Copyright by: # Jamin W. Collins # Jordan Mantha @@ -26,7 +27,10 @@ EXTRACOMP=1 SAVELOG=0 # Allow this script to use /var/cache/apt/archives/ when possible -SYSCACHE=1 +if [ -z $SYSCACHE ] +then + SYSCACHE=1 +fi ################################ @@ -102,12 +106,18 @@ distdata() then # Set Debian specific data ISDEBIAN=True - ARCHIVE="http://ftp.debian.org" + if [ -z $ARCHIVE ] + then + ARCHIVE="http://ftp.debian.org" + fi COMPONENTS="main"$( [ $EXTRACOMP = 0 ] || echo " contrib non-free" ) else # Set Ubuntu specific data ISDEBIAN=False - ARCHIVE="http://archive.ubuntu.com/ubuntu" + if [ -z $ARCHIVE ] + then + ARCHIVE="http://archive.ubuntu.com/ubuntu" + fi COMPONENTS="main restricted"$( [ $EXTRACOMP = 0 ] || echo " universe multiverse" ) fi } @@ -172,9 +182,10 @@ fi if [ $SYSCACHE != 0 ] && [ "$SYSDIST" = "$DISTRIBUTION" ] && [ "$ARCH" = "$BINARCH" -o -z $BINARCH ] then - DEBCACHE='/var/cache/apt/archives/' + 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 @@ -189,13 +200,62 @@ else COMPONENTS_LINE="--othermirror \"deb $ARCHIVE $DISTRIBUTION $COMPONENTS\"" fi -sudo pbuilder $OPERATION \ - --basetgz $BASE_DIR/$FOLDERBASE-base.tgz \ - --distribution $DISTRIBUTION \ - $( [ -z $BINARCH ] || echo "--debootstrapopts \"--arch\" --debootstrapopts \"$BINARCH\"" ) \ - $( [ $SAVELOG = 0 ] || echo "--logfile $BASE_DIR/.lastlog" ) \ - $( [ -z $DEBCACHE ] || echo "--aptcache $DEBCACHE" ) \ - --buildresult $BASE_DIR/${FOLDERBASE}_result \ - --mirror "$ARCHIVE" \ - $COMPONENTS_LINE \ - $@ +if [ -n $http_proxy ] || [ -n $HTTP_PROXY ] +then + if [ -n $http_proxy ] + then + PROXY=$http_proxy + else + PROXY=$HTTP_PROXY + fi +fi + + +if [ $ISDEBIAN = "False" ] +then + if [ ! -d $BASE_DIR/etc/$DISTRIBUTION/apt.conf/ ] + then + mkdir -p $BASE_DIR/etc/$DISTRIBUTION/apt.conf + fi + echo "deb $ARCHIVE $DISTRIBUTION $COMPONENTS" > $BASE_DIR/etc/$DISTRIBUTION/apt.conf/sources.list + case $DISTRIBUTION in + dapper|edgy|feisty|gutsy ) + cat >> $BASE_DIR/etc/$DISTRIBUTION/apt.conf/sources.list < +# +# This script can be distributed under the same license as the +# cowdancer or bash packages. +# +# adapted to pbuilder, the license is GPLv2 or later. +# Copyright 2007 Junichi Uekawa + +have pbuilder-dist && +_pbuilder-dist() +{ + local cur prev options + + COMPREPLY=() + cur=${COMP_WORDS[COMP_CWORD]} + prev=${COMP_WORDS[COMP_CWORD-1]} + options='create update build login execute dumpconfig' + + case $prev in + build) + COMPREPLY=( $( compgen -o filenames -G "$cur*.dsc" ) ) + ;; + *) + COMPREPLY=( $( compgen -W "$options" | grep "^$cur" ) ) + ;; + esac + + return 0 +} +[ "$have" ] && complete -F _pbuilder-dist -o filenames pbuilder-dist