From 6f9551f1cbb75f5af3c8f7a2ca7c420c82a3a5f9 Mon Sep 17 00:00:00 2001 From: Stefano Rivera Date: Tue, 15 Nov 2011 01:26:16 +0200 Subject: [PATCH] pbuilder-dist: Enable non-release pockets by default (LP: #781003) --- debian/changelog | 5 ++-- doc/pbuilder-dist.1 | 25 ++++++++++++---- pbuilder-dist | 73 ++++++++++++++++++++++++++++++++++++++------- 3 files changed, 84 insertions(+), 19 deletions(-) diff --git a/debian/changelog b/debian/changelog index cfbea78..5996c54 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,8 +8,9 @@ ubuntu-dev-tools (0.135) UNRELEASED; urgency=low -Allow creating experimental chroots again (LP: #885499) - experimental shouldn't be the default in experimental chroots. - Add --eatmydata flag (LP: #888440) - * pbuilder-dist: Support using non-master mirrors. Thanks Mathieu Parent. - (LP: #824285) + * pbuilder-dist: + - Support using non-master mirrors. Thanks Mathieu Parent. (LP: #824285) + - Enable non-release pockets by default (LP: #781003) * New scripts: - reverse-depends: Replaces reverse-build-depends. Uses an UbuntuWire webservice for determining all reverse(-build)-dependencies for a diff --git a/doc/pbuilder-dist.1 b/doc/pbuilder-dist.1 index 0b79e47..d0fe06e 100644 --- a/doc/pbuilder-dist.1 +++ b/doc/pbuilder-dist.1 @@ -37,7 +37,7 @@ Replace this with the codename of the version of Ubuntu or Debian you want to us This optional parameter will attempt to construct a chroot in a foreign architecture. For some architecture pairs (e.g. i386 on an amd64 install), the chroot will be created natively. For others (e.g. armel on an i386 -install), qemu-static and binfmt-misc will be used. Note that some +install), qemu\-static and binfmt\-misc will be used. Note that some combinations (e.g. amd64 on an i386 install) require special separate kernel handling, and may break in unexpected ways. .TP @@ -58,26 +58,38 @@ building is the action you want to do. .SH OPTIONS .TP -\fB--main-only\fP (deprecated: \fBmainonly\fP) +\fB\-\-main\-only\fP (deprecated: \fBmainonly\fP) If you specify this option, only packages from the \fImain\fP (in Debian) or \fImain\fP and \fIrestricted\fP (in Ubuntu) components will be used. By default, all official components are enabled. This only has effect when creating a new environment. .TP -\fB--debug-echo\fP +\fB\-\-debug\-echo\fP The generated \fBpbuilder\fP/\fBcowbuilder\fP command will be printed to the standard output instead of being executed. This is useful for debugging. .TP -\fB--buildresult\fP \fBDIRECTORY\fP (pbuilder-dist only) +\fB\-\-buildresult\fP \fBDIRECTORY\fP (pbuilder\-dist only) If this option is specified, the resultant files of the \fBpbuilder\fP build are placed in \fBDIRECTORY\fP. +.TP +\fB\-\-release\-only\fP +Only use the release pocket. +Default for development releases. +.TP +\fB\-\-security\-only\fP +Only use the release and security pockets. +Suitable environment for preparing security updates. +.TP +\fB\-\-updates\-only\fP +Only use the release, security, and updates pocket. +Not the proposed\-updates pocket. .SH EXAMPLES .TP pbuilder\-dist gutsy create Creates a \fBpbuilder\fP environment for Ubuntu Gutsy, with all components enabled. .TP -pbuilder\-sid mainonly create +pbuilder\-sid \-\-main\-only create Creates a \fBpbuilder\fP environment for Debian Sid, with only the main component. .TP pbuilder\-feisty build ./sample_1.0\-0ubuntu1.dsc @@ -108,6 +120,7 @@ By default, \fBpbuilder\-dist\fP use the master Debian and Ubuntu mirrors. The pbuilder \fBMIRRORSITE\fP and \fBOTHERMIRROR\fP variables are supported, as are the standard ubuntu\-dev\-tools variables: \fBUBUNTUTOOLS_DEBIAN_MIRROR\fP, \fBPBUILDER_DIST_DEBIAN_MIRROR\fP, +\fBUBUNTUTOOLS_DEBSEC_MIRROR\fP, \fBPBUILDER_DIST_DEBSEC_MIRROR\fP, \fBUBUNTUTOOLS_UBUNTU_MIRROR\fP, \fBPBUILDER_DIST_UBUNTU\fP, \fBUBUNTUTOOLS_UBUNTU_PORTS_MIRROR\fP, and \fBPBUILDER_DIST_UBUNTU_PORTS_MIRROR\fP. @@ -120,7 +133,7 @@ can make use of them, for example, in \fBpbuilderrc\fP. .SH BUGS If you experience any problem with this script contact me on rainct@ubuntu.com -or file a bug at https://bugs.launchpad.net/ubuntu/+source/ubuntu-dev-tools. +or file a bug at https://bugs.launchpad.net/ubuntu/+source/ubuntu\-dev\-tools. .PP Please ensure first that the problem is really this script and not an issue with \fBpbuilder\fP or \fBcowbuilder\fP themselves. diff --git a/pbuilder-dist b/pbuilder-dist index 3d0e00b..7c31d64 100755 --- a/pbuilder-dist +++ b/pbuilder-dist @@ -33,7 +33,7 @@ import os import sys from devscripts.logger import Logger -from distro_info import DebianDistroInfo +from distro_info import DebianDistroInfo, UbuntuDistroInfo import ubuntutools.misc from ubuntutools.config import UDTConfig @@ -54,6 +54,11 @@ class PbuilderDist: # and 'non-free' for Debian. self.extra_components = True + # Extra pockets, useful on stable releases + self.enable_security = True + self.enable_updates = True + self.enable_proposed = True + # File where the log of the last operation will be saved. self.logfile = None @@ -240,28 +245,61 @@ class PbuilderDist: if self.target_distro in self._debian_distros: mirror = os.environ.get('MIRRORSITE', config.get_value('DEBIAN_MIRROR')) - arguments += ['--mirror', mirror] components = 'main' if self.extra_components: components += ' contrib non-free' else: mirror = os.environ.get('MIRRORSITE', config.get_value('UBUNTU_MIRROR')) - ports_mirror = os.environ.get('MIRRORSITE', + if self.build_architecture not in ('amd64', 'i386'): + mirror = os.environ.get('MIRRORSITE', config.get_value('UBUNTU_PORTS_MIRROR')) - if self.build_architecture in ('amd64', 'i386'): - arguments += ['--mirror', mirror] - elif (self.build_architecture == 'powerpc' - and self.target_distro == 'dapper'): - arguments += ['--mirror', mirror] - else: - arguments += ['--mirror', ports_mirror] components = 'main restricted' if self.extra_components: components += ' universe multiverse' + arguments += ['--mirror', mirror] + + othermirrors = [] + if self.target_distro in self._debian_distros: + di = DebianDistroInfo() + if (di.codename(self.target_distro) or self.target_distro + in (di.devel(), 'experimental')): + self.enable_security = False + self.enable_updates = False + self.enable_proposed = False + + if self.enable_security: + othermirrors.append('deb %s %s/updates %s' + % (config.get_value('DEBSEC_MIRROR'), + self.target_distro, components)) + if self.enable_updates: + othermirrors.append('deb %s %s-updates %s' + % (mirror, self.target_distro, components)) + if self.enable_proposed: + othermirrors.append('deb %s %s-proposed-updates %s' + % (mirror, self.target_distro, components)) + else: + if self.target_distro == UbuntuDistroInfo().devel(): + self.enable_security = False + self.enable_updates = False + self.enable_proposed = False + + if self.enable_security: + othermirrors.append('deb %s %s-security %s' + % (mirror, self.target_distro, components)) + if self.enable_updates: + othermirrors.append('deb %s %s-updates %s' + % (mirror, self.target_distro, components)) + if self.enable_proposed: + othermirrors.append('deb %s %s-proposed %s' + % (mirror, self.target_distro, components)) + if 'OTHERMIRROR' in os.environ: - arguments += ['--othermirror', os.environ['OTHERMIRROR']] + othermirrors += os.environ['OTHERMIRROR'].split('|') + + if othermirrors: + arguments += ['--othermirror', '|'.join(othermirrors)] # Work around LP:#599695 if (ubuntutools.misc.system_distribution() == 'Debian' @@ -381,6 +419,19 @@ def main(): else: args.remove('--main-only') + if '--release-only' in sys.argv: + args.remove('--release-only') + app.enable_security = False + app.enable_updates = False + app.enable_proposed = False + elif '--security-only' in sys.argv: + args.remove('--security-only') + app.enable_updates = False + app.enable_proposed = False + elif '--updates-only' in sys.argv: + args.remove('--updates-only') + app.enable_proposed = False + if len(args) < 1: Logger.error('Insufficient number of arguments.') show_help(1)