Rename mirror variables, add Ubuntu

This commit is contained in:
Stefano Rivera 2010-12-24 03:04:42 +02:00
parent cf68c75fa8
commit 8e27317b65
6 changed files with 40 additions and 32 deletions

View File

@ -42,13 +42,13 @@ Display the usage instructions and exit.
.BR \-f ", " \-\-fetch
Simply download the specified version and exit.
.TP
.B \-d \fIDEBMIRROR\fR, \fB\-\-debmirror\fR=\fIDEBMIRROR\fR
.B \-d \fIDEBIAN_MIRROR\fR, \fB\-\-deban\-mirror\fR=\fIDEBIAN_MIRROR\fR
Use the specified mirror.
Should be in the form \fBhttp://ftp.debian.org/debian\fR.
If the package isn't found on this mirror, \fBpull\-debian\-source\fR
will fall back to the default mirror.
.TP
.B \-s \fIDEBSECMIRROR\fR, \fB\-\-debsecmirror\fR=\fIDEBSECMIRROR\fR
.B \-s \fIDEBSEC_MIRROR\fR, \fB\-\-debsec\-mirror\fR=\fIDEBSEC_MIRROR\fR
Use the specified Debian security mirror.
Should be in the form \fBhttp://security.debian.org\fR.
If the package isn't found on this mirror, \fBpull\-debian\-source\fR
@ -75,11 +75,11 @@ configuration files.
In each case, the script\-specific variable takes precedence over the
package\-wide variable.
.TP
.BR PULL_DEBIAN_DEBDIFF_DEBMIRROR ", " UBUNTUTOOLS_DEBMIRROR
The default value for \fB\-\-debmirror\fR.
.BR PULL_DEBIAN_DEBDIFF_DEBIAN_MIRROR ", " UBUNTUTOOLS_DEBIAN_MIRROR
The default value for \fB\-\-debian\-mirror\fR.
.TP
.BR PULL_DEBIAN_DEBDIFF_DEBMIRROR ", " UBUNTUTOOLS_DEBSECMIRROR
The default value for \fB\-\-debsecmirror\fR.
.BR PULL_DEBIAN_DEBDIFF_DEBSEC_MIRROR ", " UBUNTUTOOLS_DEBSEC_MIRROR
The default value for \fB\-\-debsec\-mirror\fR.
.TP
.BR PULL_DEBIAN_DEBDIFF_MIRROR_FALLBACK ", " UBUNTUTOOLS_MIRROR_FALLBACK
The default value for \fB\-\-no\-fallback\fR.

View File

@ -25,7 +25,7 @@ This value defaults to 'unstable'.
.BR \-h ", " \-\-help
Display the usage instructions and exit.
.TP
.B \-m \fIDEBMIRROR\fR, \fB\-\-mirror\fR=\fIDEBMIRROR\fR
.B \-m \fIDEBIAN_MIRROR\fR, \fB\-\-mirror\fR=\fIDEBIAN_MIRROR\fR
Use the specified mirror.
Should be in the form \fBhttp://ftp.debian.org/debian\fR.
If the package isn't found on this mirror, \fBpull\-debian\-source\fR
@ -52,7 +52,7 @@ configuration files.
In each case, the script\-specific variable takes precedence over the
package\-wide variable.
.TP
.BR PULL_DEBIAN_SOURCE_DEBMIRROR ", " UBUNTUTOOLS_DEBMIRROR
.BR PULL_DEBIAN_SOURCE_DEBIAN_MIRROR ", " UBUNTUTOOLS_DEBIAN_MIRROR
The default value for \fB\-\-mirror\fR.
.TP
.BR PULL_DEBIAN_SOURCE_MIRROR_FALLBACK ", " UBUNTUTOOLS_MIRROR_FALLBACK

View File

@ -56,18 +56,24 @@ The currently recognised package\-wide variables are:
This specifies the preferred test\-builder, one of
.BR pbuilder " (default), " sbuild ", " pbuilder\-dist .
.TP
.B UBUNTUTOOLS_DEBMIRROR
.B UBUNTUTOOLS_DEBIAN_MIRROR
The preferred Debian archive mirror.
Should be of the form \fBhttp://ftp.debian.org/debian\fR (no trailing
slash).
If not specified, the master will be used.
.TP
.B UBUNTUTOOLS_DEBSECMIRROR
.B UBUNTUTOOLS_DEBSEC_MIRROR
The preferred Debian security archive mirror.
Should be of the form \fBhttp://security.debian.org\fR (no trailing
slash).
If not specified, the master will be used.
.TP
.B UBUNTUTOOLS_UBUNTU_MIRROR
The preferred Ubuntu archive mirror.
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_LPINSTANCE
The launchpad instance to communicate with. e.g. \fBproduction\fR
(default) or \fBstaging\fR.

View File

@ -32,8 +32,8 @@ except ImportError:
from ubuntutools.config import UDTConfig
from ubuntutools.logger import Logger
DEFAULT_DEBMIRROR = 'http://ftp.debian.org/debian'
DEFAULT_DEBSECMIRROR = 'http://security.debian.org'
DEFAULT_DEBIAN_MIRROR = 'http://ftp.debian.org/debian'
DEFAULT_DEBSEC_MIRROR = 'http://security.debian.org'
opts = None
@ -54,14 +54,14 @@ def build_url(mirror, package, version):
def pull(package, version, unpack=False):
"Download Debian source package version version"
urls = []
if opts.debsecmirror and opts.debsecmirror != DEFAULT_DEBSECMIRROR:
urls.append(build_url(opts.debsecmirror, package, version))
if opts.debsec_mirror and opts.debsec_mirror != DEFAULT_DEBSEC_MIRROR:
urls.append(build_url(opts.debsec_mirror, package, version))
if opts.fallback:
urls.append(build_url(DEFAULT_DEBSECMIRROR, package, version))
if opts.debmirror and opts.debmirror != DEFAULT_DEBMIRROR:
urls.append(build_url(opts.debmirror, package, version))
urls.append(build_url(DEFAULT_DEBSEC_MIRROR, package, version))
if opts.debian_mirror and opts.debian_mirror != DEFAULT_DEBIAN_MIRROR:
urls.append(build_url(opts.debian_mirror, package, version))
if opts.fallback:
urls.append(build_url(DEFAULT_DEBMIRROR, package, version))
urls.append(build_url(DEFAULT_DEBIAN_MIRROR, package, version))
for url in urls:
cmd = ('dget', '-u' + 'x' if unpack else 'd', url)
@ -146,12 +146,12 @@ def main():
p.add_option('-f', '--fetch',
dest='fetch_only', default=False, action='store_true',
help="Only fetch the source packages, don't diff.")
p.add_option('-d', '--debmirror', metavar='DEBMIRROR',
dest='debmirror',
p.add_option('-d', '--debian-mirror', metavar='DEBIAN_MIRROR',
dest='debian_mirror',
help='Preferred Debian mirror '
'(default: http://ftp.debian.org/debian)')
p.add_option('-s', '--debsecmirror', metavar='DEBSECMIRROR',
dest='debsecmirror',
p.add_option('-s', '--debsec-mirror', metavar='DEBSEC_MIRROR',
dest='debsec_mirror',
help='Preferred Debian Security mirror '
'(default: http://security.debian.org)')
p.add_option('-n', '--no-fallback',
@ -172,10 +172,10 @@ def main():
distance = args[2] if len(args) > 2 else 1
config = UDTConfig(opts.no_conf)
if opts.debmirror is None:
opts.debmirror = config.get_value('DEBMIRROR')
if opts.debsecmirror is None:
opts.debsecmirror = config.get_value('DEBSECMIRROR')
if opts.debian_mirror is None:
opts.debian_mirror = config.get_value('DEBIAN_MIRROR')
if opts.debsec_mirror is None:
opts.debsec_mirror = config.get_value('DEBSEC_MIRROR')
if opts.fallback is None:
opts.fallback = config.get_value('MIRROR_FALLBACK', boolean=True)

View File

@ -41,7 +41,8 @@ if (! $no_conf) {
my($shell_cmd);
$shell_cmd .= "[ -f /etc/devscripts.conf ] && . /etc/devscripts.conf\n";
$shell_cmd .= "[ -f ~/.devscripts ] && . ~/.devscripts\n";
foreach my $var qw(PULL_DEBIAN_SOURCE_DEBMIRROR UBUNTUTOOLS_DEBMIRROR
foreach my $var qw(PULL_DEBIAN_SOURCE_DEBIAN_MIRROR
UBUNTUTOOLS_DEBIAN_MIRROR
PULL_DEBIAN_SOURCE_MIRROR_FALLBACK
UBUNTUTOOLS_MIRROR_FALLBACK) {
$shell_cmd .= "echo $var=\$$var\n";
@ -52,8 +53,8 @@ if (! $no_conf) {
my($k, $v) = split /=/, $line, 2;
$config_values{$k} = $v;
}
$mirror = $config_values{'PULL_DEBIAN_SOURCE_DEBMIRROR'}
|| $config_values{'UBUNTUTOOLS_DEBMIRROR'}
$mirror = $config_values{'PULL_DEBIAN_SOURCE_DEBIAN_MIRROR'}
|| $config_values{'UBUNTUTOOLS_DEBIAN_MIRROR'}
if (! $mirror);
if (! $no_fallback) {
my($v) = $config_values{'PULL_DEBIAN_SOURCE_MIRROR_FALLBACK'}
@ -180,7 +181,7 @@ USAGE: $name [options] <source package> [target release]
Options:
-h, --help Show this help message and exit
-m DEBMIRROR, --mirror=DEBMIRROR
-m DEBIAN_MIRROR, --mirror=DEBIAN_MIRROR
Preferred Debian mirror
(default: http://ftp.debian.org/debian)
-n, --no-fallback If a custom mirror is provided and an error occurs

View File

@ -34,10 +34,11 @@ class UDTConfig(object):
# These are reqired to be used by at least two scripts.
defaults = {
'BUILDER': 'pbuilder',
'DEBMIRROR': None,
'DEBSECMIRROR': None,
'DEBIAN_MIRROR': None,
'DEBSEC_MIRROR': None,
'LPINSTANCE': 'production',
'MIRROR_FALLBACK': True,
'UBUNTU_MIRROR': None,
'UPDATE_BUILDER': False,
'WORKDIR': None,
}