From d74688f04c1f55bc8d309319117678251a136385 Mon Sep 17 00:00:00 2001 From: "Siegfried-Angel Gevatter Pujals (RainCT)" Date: Wed, 8 Aug 2007 21:22:44 +0200 Subject: [PATCH 1/7] pbuilder-dist: fixed problem when using more than one architecture. --- pbuilder-dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pbuilder-dist b/pbuilder-dist index 6daf90d..2c0e1f0 100755 --- a/pbuilder-dist +++ b/pbuilder-dist @@ -143,7 +143,7 @@ then fi sudo pbuilder $OPERATION \ - --basetgz $BASE_DIR/$DISTRIBUTION-base.tgz \ + --basetgz $BASE_DIR/$DISTRIBUTION-$( ([ "$BINARCH" != "" ] && echo $BINARCH) || echo $ARCH )-base.tgz \ --distribution $DISTRIBUTION \ $( [ -z $BINARCH ] || echo "--binary-arch $BINARCH" ) \ --buildresult $BASE_DIR/${DISTRIBUTION}_result \ From e5e47f31173b373d831c941f82e15f44e33b8112 Mon Sep 17 00:00:00 2001 From: "Siegfried-Angel Gevatter Pujals (RainCT)" Date: Wed, 8 Aug 2007 22:21:17 +0200 Subject: [PATCH 2/7] (pbuilder-dist: improved architecture detection, thanks to geser.) --- pbuilder-dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pbuilder-dist b/pbuilder-dist index 2c0e1f0..b3e849b 100755 --- a/pbuilder-dist +++ b/pbuilder-dist @@ -24,7 +24,7 @@ BASE_DIR="$HOME/pbuilder" EXTRACOMP=1 -ARCH=`dpkg-architecture | grep "DEB_HOST_ARCH=" | cut -f2 -d '='` +ARCH=`dpkg-architecture -qDEB_HOST_ARCH` help() { From b358cfe47c379a6c8875ef71995cb3380c9c498a Mon Sep 17 00:00:00 2001 From: "Siegfried-Angel Gevatter Pujals (RainCT)" Date: Wed, 8 Aug 2007 23:55:10 +0200 Subject: [PATCH 3/7] pbuilder-dist: fixed another problem when working with more than one architecture. Added an option to store the last log. Added an option to use the same cache directory for .deb's as apt-get when possible. --- pbuilder-dist | 45 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/pbuilder-dist b/pbuilder-dist index b3e849b..d07d2f6 100755 --- a/pbuilder-dist +++ b/pbuilder-dist @@ -23,13 +23,22 @@ BASE_DIR="$HOME/pbuilder" # contrib and non-free in Debian.) EXTRACOMP=1 +# Save the log of the last operation in a dot-file? ('.lastlog' in BASE_DIR) +SAVELOG=0 + +# Allow this script to use /var/cache/apt/archives/ when possible +SYSCACHE=1 + + +################################ ARCH=`dpkg-architecture -qDEB_HOST_ARCH` +SYSDIST=`lsb_release -cs` help() { echo "Insufficient number of arguments." - echo "Usage: $0 "$( [ "$1" != 'show-dist-flag' ] || echo " " )$( [ $ARCH != "amd64" ] || echo "[i386|amd64] " )"[mainonly|allcomp] " + echo "Usage: $0 "$( [ "$1" != 'show-dist-flag' ] || echo " " )$( [ $ARCH != "amd64" ] || echo "[i386|amd64] " )"[mainonly|allcomp] [withlog|nolog] " exit 1 } @@ -55,8 +64,7 @@ fi if [ $1 = "i386" ] || [ $1 = "amd64" ] then - if [ $ARCH = "amd64" ] - then + if [ $ARCH = "amd64" ]; then BINARCH=$1 else echo "Warning: Architecture switching is not supported on your system; ignoring argument." @@ -66,17 +74,24 @@ then fi -if [ $1 = "mainonly" ] -then +if [ $1 = "mainonly" ]; then EXTRACOMP=0 shift 1 -elif [ $1 = "allcomp" ] -then +elif [ $1 = "allcomp" ]; then EXTRACOMP=1 shift 1 fi +if [ $1 = "withlog" ]; then + SAVELOG=0 + shift 1 +elif [ $1 = "nolog" ]; then + SAVELOG=1 + shift 1 +fi + + distdata() { if [ "$1" = "debian" ] @@ -136,15 +151,23 @@ case $OPERATION in ;; esac +FOLDERBASE="${DISTRIBUTION}-$( ([ "$BINARCH" != "" ] && echo $BINARCH) || echo $ARCH )" -if [ ! -d $BASE_DIR/${DISTRIBUTION}_result ] +if [ ! -d $BASE_DIR/${FOLDERBASE}_result ] then - mkdir -p $BASE_DIR/${DISTRIBUTION}_result + mkdir -p $BASE_DIR/${FOLDERBASE}_result +fi + +if [ $SYSCACHE != 0 ] && [ "$SYSDIST" = "$DISTRIBUTION" ] && [ "$ARCH" = "$BINARCH" -o -z $BINARCH ] +then + DEBCACHE='/var/cache/apt/archives/' fi sudo pbuilder $OPERATION \ - --basetgz $BASE_DIR/$DISTRIBUTION-$( ([ "$BINARCH" != "" ] && echo $BINARCH) || echo $ARCH )-base.tgz \ + --basetgz $BASE_DIR/$FOLDERBASE-base.tgz \ --distribution $DISTRIBUTION \ $( [ -z $BINARCH ] || echo "--binary-arch $BINARCH" ) \ - --buildresult $BASE_DIR/${DISTRIBUTION}_result \ + $( [ $SAVELOG = 0 ] || echo "--logfile $BASE_DIR/.lastlog" ) \ + $( [ -z $DEBCACHE ] || echo "--aptcache $DEBCACHE" ) \ + --buildresult $BASE_DIR/$FOLDERBASE_result \ --othermirror "deb $ARCHIVE $DISTRIBUTION $COMPONENTS" $@ From afc07098e38968498e0f0a3da5889cdf03a0b6ad Mon Sep 17 00:00:00 2001 From: "Siegfried-Angel Gevatter Pujals (RainCT)" Date: Thu, 9 Aug 2007 19:20:36 +0200 Subject: [PATCH 4/7] pbuilder-dist: some fixes. --- pbuilder-dist | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pbuilder-dist b/pbuilder-dist index d07d2f6..7dfe1d2 100755 --- a/pbuilder-dist +++ b/pbuilder-dist @@ -84,10 +84,10 @@ fi if [ $1 = "withlog" ]; then - SAVELOG=0 + SAVELOG=1 shift 1 elif [ $1 = "nolog" ]; then - SAVELOG=1 + SAVELOG=0 shift 1 fi @@ -137,6 +137,7 @@ OPERATION=$1 case $OPERATION in create|update|build|clean|login|execute) + shift 1 ;; *) @@ -165,9 +166,10 @@ fi sudo pbuilder $OPERATION \ --basetgz $BASE_DIR/$FOLDERBASE-base.tgz \ + $@ \ --distribution $DISTRIBUTION \ $( [ -z $BINARCH ] || echo "--binary-arch $BINARCH" ) \ $( [ $SAVELOG = 0 ] || echo "--logfile $BASE_DIR/.lastlog" ) \ $( [ -z $DEBCACHE ] || echo "--aptcache $DEBCACHE" ) \ --buildresult $BASE_DIR/$FOLDERBASE_result \ - --othermirror "deb $ARCHIVE $DISTRIBUTION $COMPONENTS" $@ + --othermirror "\"deb $ARCHIVE $DISTRIBUTION $COMPONENTS\"" From 78e374dc940b816d0ac497e2a028cf05fcf075cd Mon Sep 17 00:00:00 2001 From: "Siegfried-Angel Gevatter Pujals (RainCT)" Date: Thu, 9 Aug 2007 19:42:40 +0200 Subject: [PATCH 5/7] pbuilder-dist: some fixes. --- pbuilder-dist | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pbuilder-dist b/pbuilder-dist index d07d2f6..889a714 100755 --- a/pbuilder-dist +++ b/pbuilder-dist @@ -12,9 +12,6 @@ # / version, rename it to 'pbuilder-dapper', 'pbuilder-feisty', 'pbuilder-gutsy', # or whatever it is. If you have an amd64, you can also use names like # 'pbuilder-feisty-i386', etc. -# -# The only variable you really might need to change is BASE_DIR, if you -# don't want pbuilder stuff in your home directory. # Base directory where pbuilder will put all the files it creates BASE_DIR="$HOME/pbuilder" @@ -84,10 +81,10 @@ fi if [ $1 = "withlog" ]; then - SAVELOG=0 + SAVELOG=1 shift 1 elif [ $1 = "nolog" ]; then - SAVELOG=1 + SAVELOG=0 shift 1 fi @@ -137,6 +134,7 @@ OPERATION=$1 case $OPERATION in create|update|build|clean|login|execute) + shift 1 ;; *) @@ -169,5 +167,6 @@ sudo pbuilder $OPERATION \ $( [ -z $BINARCH ] || echo "--binary-arch $BINARCH" ) \ $( [ $SAVELOG = 0 ] || echo "--logfile $BASE_DIR/.lastlog" ) \ $( [ -z $DEBCACHE ] || echo "--aptcache $DEBCACHE" ) \ - --buildresult $BASE_DIR/$FOLDERBASE_result \ - --othermirror "deb $ARCHIVE $DISTRIBUTION $COMPONENTS" $@ + --buildresult $BASE_DIR/${FOLDERBASE}_result \ + --othermirror "\"deb $ARCHIVE $DISTRIBUTION $COMPONENTS\"" \ + $@ From 1da77082b521a6805d8e2ad6c33714e7cd8ce510 Mon Sep 17 00:00:00 2001 From: "Siegfried-Angel Gevatter Pujals (RainCT)" Date: Tue, 14 Aug 2007 12:22:02 +0200 Subject: [PATCH 6/7] pbuilder-dist: fix for amd64 arch changing. --- pbuilder-dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pbuilder-dist b/pbuilder-dist index 889a714..6050f53 100755 --- a/pbuilder-dist +++ b/pbuilder-dist @@ -164,7 +164,7 @@ fi sudo pbuilder $OPERATION \ --basetgz $BASE_DIR/$FOLDERBASE-base.tgz \ --distribution $DISTRIBUTION \ - $( [ -z $BINARCH ] || echo "--binary-arch $BINARCH" ) \ + $( [ -z $BINARCH ] || echo "--debootstrapopts \"--arch\" --debootstrapopts \"$BINARCH\"" ) \ $( [ $SAVELOG = 0 ] || echo "--logfile $BASE_DIR/.lastlog" ) \ $( [ -z $DEBCACHE ] || echo "--aptcache $DEBCACHE" ) \ --buildresult $BASE_DIR/${FOLDERBASE}_result \ From 5eb32eee8ec508bd11c8489fca085fb80c5af1ba Mon Sep 17 00:00:00 2001 From: "Siegfried-Angel Gevatter Pujals (RainCT)" Date: Thu, 16 Aug 2007 20:51:42 +0200 Subject: [PATCH 7/7] Addded a manpage for pbuilder-dist and let debian/control install it. --- debian/rules | 2 + doc/pbuilder-dist.1 | 104 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+) create mode 100644 doc/pbuilder-dist.1 diff --git a/debian/rules b/debian/rules index ba84311..7ed7af5 100755 --- a/debian/rules +++ b/debian/rules @@ -4,3 +4,5 @@ DEB_PYTHON_SYSTEM := pycentral include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/python-distutils.mk + +DEB_INSTALL_MANPAGES_ubuntu-dev-tools = doc/*.1 diff --git a/doc/pbuilder-dist.1 b/doc/pbuilder-dist.1 new file mode 100644 index 0000000..97c0ccd --- /dev/null +++ b/doc/pbuilder-dist.1 @@ -0,0 +1,104 @@ +.\" Title: pbuilder-dist +.\" Author: Siegfried-Angel Gevatter Pujals +.\" Contact details: siggi.gevatter@gmail.com +.\" August 16, 2007 +.\" +.TH PBUILDER-DIST 1 "August 16, 2007" +.\" +.SH NAME +pbuilder-dist \- multi-distribution pbuilder wrapper +.\" +.SH SYNOPSIS +\fBpbuilder-dist\fP \fIdistribution\fR [\fBi386\fP|\fBamd64\fP] [\fBmainonly\fP|\fBallcomp\fP] +[\fBwithlog\fP|\fBnolog\fP] \fIoperation\fR [\fI...\fR] +.\" +.SH DESCRIPTION +\fBpbuilder-dist\fP is a wrapper that makes it easy to use pbuilder with many different +versions of Ubuntu and / or Debian. +.PP +It is common to symlink this script in order to give it many names in the form of +\fBpbuilder-\fIdistribution\fP\fR (\fBpbuilder-\fIdistribution\fR-\fIarchitecture\fP\fR on amd64 +systems), like for example \fBpbuilder-feisty\fP, \fBpbuilder-sid\fP, \fBpbuilder-gutsy-i386\fP, etc. +.\" +.SH USAGE +There are many arguments listed on the synopsis. Each of them, if used, has to be used +exactly in the same order as it appears there. In case you renamed the script to +\fBpbuilder-\fIdistribution\fP\fR, do not use the \fBdistribution\fP parameter; same with +\fBi386\fP / \fBamd64\fP if the name also contains -\fIarchitecture\fR. +.TP +\fBdistribution\fP +Replace this with the codename of the version of Ubuntu or Debian you want to use. +.TP +\fBi386\fP / \fBamd64\fP +Only available on amd64 systems. This is optional; default is \fBamd64\fP. If \fBi386\fP is +specified, an i386 environment will be used. +.TP +\fBmainonly\fP / \fBallcomp\fP +This is optional; default is \fBallcomp\fP. If you specify \fBmainonly\fP, only packages from +the main (in Debian) or main and restricted (in Ubuntu) components will be used. With the +later one, all official components will be enabled. This only has effect when creating a new +environment. +.TP +\fBwithlog\fP / \fBnolog\fP +This is optional; default is \fBnolog\fP. When \fBwithlog\fP is used, \fBpbuilder\fP will save the +output produced by the current action in a dot-file called \fB.lastlog\fP in it's base directory +(see the FILES section). If this file already exists, it will be overwritten. +.TP +\fBoperation\fP +Replace this with the action you want \fBpbuilder\fP to do (create, update, build, clean, login +or execute). Check it's manpage for more details. +.TP +\fB[...]\fP +.br +Replace this with other parameters, if needed. For example, if \fBbuild\fP is the option, +you will need to also specify a .dsc file. +.PP +The default value of all optional parameters (except the architecture) can be changed by +editing the first lines of the script. +.\" +.SH EXAMPLES +.TP +pbuilder-dist gutsy create +Creates a \fBpbuilder\fP environment for Ubuntu Gutsy, with all components enabled. +.TP +pbuilder-sid mainonly create +Creates a \fBpbuilder\fP environment for Debian Sid, with only the main component. +.TP +pbuilder-feisty build ./sample_1.0-0ubuntu1.dsc +Builds the specified package on an already existing Ubuntu Feisty environment. +.TP +pbuilder-dist feisty withlog build ./sample_1.0-0ubuntu1.dsc +Same as above, but stores \fBpbuilder\fP's output on a file. +.TP +pbuilder-etch i386 update +Updates an existing i386-architecture Debian Etch environment on an amd64 system. +.\" +.SH FILES +By default, \fBpbuilder-dist\fP will store all the files it generates in \fB~/pbuilder/\fP. This can +be changed modifying the BASE_DIR value on the top of the script to any other directory you +want. If it doesn't exist, it will be created on the run. +.\" +.SH BUGS +There are no known bugs at the moment. If you experience any problem with this script +contact me on siggi.gevatter@gmail.com. Please ensure first that the problem is really this +script and not an issue with \fBpbuilder\fP. +.\" +.SH AUTHORS +\fBpbuilder-dist\fP was originally written by Jamin W. Collins and +Jordan Mantha . +.PP +On August 2007 it was mostly rewritten, and extended, by Siegfried-Angel Gevatter Pujals +. +.\" +.SH SEE ALSO +\fBpbuilder\fR, \fBpbuilderrc\fR +.\" +.SH COPYRIGHT +This manual page was written by Siegfried-Angel Gevatter Pujals (RainCT) + for YOU. +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU General Public License, +Version 2 or any later version published by the Free Software Foundation. +.PP +On Debian based systems, the complete text of the GNU General Public +License can be found in \fB/usr/share/common-licenses/GPL\fP.