pbuilder-dist: Support using non-master mirrors. Thanks Mathieu Parent.

(LP: #824285)
This commit is contained in:
Stefano Rivera 2011-11-13 02:32:25 +02:00
parent 9d493af4b0
commit cdec3f5868
5 changed files with 37 additions and 6 deletions

2
debian/changelog vendored
View File

@ -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 <stefanor@debian.org> Sat, 12 Nov 2011 23:28:05 +0200

View File

@ -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

View File

@ -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.

View File

@ -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):

View File

@ -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,
}