diff --git a/debian/changelog b/debian/changelog index b10061e..a75a9a3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,8 @@ ubuntu-dev-tools (0.136) 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) -- Stefano Rivera Sat, 12 Nov 2011 23:28:05 +0200 diff --git a/doc/pbuilder-dist.1 b/doc/pbuilder-dist.1 index fd98d58..0b79e47 100644 --- a/doc/pbuilder-dist.1 +++ b/doc/pbuilder-dist.1 @@ -104,6 +104,15 @@ saved in the results subdirectory of each build environment. The default authentication method is \fBsudo\fP. You can change this by setting the \fBPBUILDAUTH\fP variable. .PP +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_UBUNTU_MIRROR\fP, \fBPBUILDER_DIST_UBUNTU\fP, +\fBUBUNTUTOOLS_UBUNTU_PORTS_MIRROR\fP, and +\fBPBUILDER_DIST_UBUNTU_PORTS_MIRROR\fP. +See \fBubuntu\-dev\-tools\fP (5) for details. +.PP You may also want to know that \fBpbuilder\-dist\fP exports \fBDIST\fP and \fBARCH\fP environment variables to the invoked process, containing the name of the distribution and the architecture targeted by the current build. You @@ -117,7 +126,10 @@ Please ensure first that the problem is really this script and not an issue with \fBpbuilder\fP or \fBcowbuilder\fP themselves. .SH SEE ALSO -\fBpbuilder\fR, \fBpbuilderrc\fR, \fBcowbuilder\fR +.BR pbuilder (1), +.BR pbuilderrc (5), +.BR cowbuilder (1), +.BR ubuntu\-dev\-tools (5). .SH AUTHORS \fBpbuilder\-dist\fP and this manual page were written by Siegfried-A. Gevatter diff --git a/doc/ubuntu-dev-tools.5 b/doc/ubuntu-dev-tools.5 index adbd70f..35d83f0 100644 --- a/doc/ubuntu-dev-tools.5 +++ b/doc/ubuntu-dev-tools.5 @@ -76,6 +76,12 @@ Should be of the form \fBhttp://archive.ubuntu.com/ubuntu\fR (no trailing slash). If not specified, the master will be used. .TP +.B UBUNTUTOOLS_UBUNTU_PORTS_MIRROR +The preferred Ubuntu archive mirror. +Should be of the form \fBhttp://ports.ubuntu.com\fR (no +trailing slash). +If not specified, the master will be used. +.TP .B UBUNTUTOOLS_LPINSTANCE The launchpad instance to communicate with. e.g. \fBproduction\fR (default) or \fBstaging\fR. diff --git a/pbuilder-dist b/pbuilder-dist index 8ce0320..a4faad1 100755 --- a/pbuilder-dist +++ b/pbuilder-dist @@ -36,6 +36,7 @@ from devscripts.logger import Logger from distro_info import DebianDistroInfo import ubuntutools.misc +from ubuntutools.config import UDTConfig from ubuntutools import subprocess class PbuilderDist: @@ -232,24 +233,33 @@ class PbuilderDist: 'deb file:///var/cache/archive/ %s/' % self.target_distro, ] + config = UDTConfig() if self.target_distro in self._debian_distros: - arguments += ['--mirror', 'http://ftp.debian.org/debian'] + 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', + config.get_value('UBUNTU_PORTS_MIRROR')) if self.build_architecture in ('amd64', 'i386'): - arguments += ['--mirror', 'http://archive.ubuntu.com/ubuntu/'] + arguments += ['--mirror', mirror] elif (self.build_architecture == 'powerpc' and self.target_distro == 'dapper'): - arguments += ['--mirror', 'http://archive.ubuntu.com/ubuntu/'] + arguments += ['--mirror', mirror] else: - arguments += ['--mirror', - 'http://ports.ubuntu.com/ubuntu-ports/'] + arguments += ['--mirror', ports_mirror] components = 'main restricted' if self.extra_components: components += ' universe multiverse' + if 'OTHERMIRROR' in os.environ: + arguments += ['--othermirror', os.environ['OTHERMIRROR']] + # Work around LP:#599695 if (ubuntutools.misc.system_distribution() == 'Debian' and self.target_distro not in self._debian_distros): diff --git a/ubuntutools/config.py b/ubuntutools/config.py index 1743247..a53e293 100644 --- a/ubuntutools/config.py +++ b/ubuntutools/config.py @@ -38,6 +38,7 @@ class UDTConfig(object): 'LPINSTANCE': 'production', 'MIRROR_FALLBACK': True, 'UBUNTU_MIRROR': 'http://archive.ubuntu.com/ubuntu', + 'UBUNTU_PORTS_MIRROR': 'http://ports.ubuntu.com', 'UPDATE_BUILDER': False, 'WORKDIR': None, }