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 .BR \-f ", " \-\-fetch
Simply download the specified version and exit. Simply download the specified version and exit.
.TP .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. Use the specified mirror.
Should be in the form \fBhttp://ftp.debian.org/debian\fR. Should be in the form \fBhttp://ftp.debian.org/debian\fR.
If the package isn't found on this mirror, \fBpull\-debian\-source\fR If the package isn't found on this mirror, \fBpull\-debian\-source\fR
will fall back to the default mirror. will fall back to the default mirror.
.TP .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. Use the specified Debian security mirror.
Should be in the form \fBhttp://security.debian.org\fR. Should be in the form \fBhttp://security.debian.org\fR.
If the package isn't found on this mirror, \fBpull\-debian\-source\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 In each case, the script\-specific variable takes precedence over the
package\-wide variable. package\-wide variable.
.TP .TP
.BR PULL_DEBIAN_DEBDIFF_DEBMIRROR ", " UBUNTUTOOLS_DEBMIRROR .BR PULL_DEBIAN_DEBDIFF_DEBIAN_MIRROR ", " UBUNTUTOOLS_DEBIAN_MIRROR
The default value for \fB\-\-debmirror\fR. The default value for \fB\-\-debian\-mirror\fR.
.TP .TP
.BR PULL_DEBIAN_DEBDIFF_DEBMIRROR ", " UBUNTUTOOLS_DEBSECMIRROR .BR PULL_DEBIAN_DEBDIFF_DEBSEC_MIRROR ", " UBUNTUTOOLS_DEBSEC_MIRROR
The default value for \fB\-\-debsecmirror\fR. The default value for \fB\-\-debsec\-mirror\fR.
.TP .TP
.BR PULL_DEBIAN_DEBDIFF_MIRROR_FALLBACK ", " UBUNTUTOOLS_MIRROR_FALLBACK .BR PULL_DEBIAN_DEBDIFF_MIRROR_FALLBACK ", " UBUNTUTOOLS_MIRROR_FALLBACK
The default value for \fB\-\-no\-fallback\fR. The default value for \fB\-\-no\-fallback\fR.

View File

@ -25,7 +25,7 @@ This value defaults to 'unstable'.
.BR \-h ", " \-\-help .BR \-h ", " \-\-help
Display the usage instructions and exit. Display the usage instructions and exit.
.TP .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. Use the specified mirror.
Should be in the form \fBhttp://ftp.debian.org/debian\fR. Should be in the form \fBhttp://ftp.debian.org/debian\fR.
If the package isn't found on this mirror, \fBpull\-debian\-source\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 In each case, the script\-specific variable takes precedence over the
package\-wide variable. package\-wide variable.
.TP .TP
.BR PULL_DEBIAN_SOURCE_DEBMIRROR ", " UBUNTUTOOLS_DEBMIRROR .BR PULL_DEBIAN_SOURCE_DEBIAN_MIRROR ", " UBUNTUTOOLS_DEBIAN_MIRROR
The default value for \fB\-\-mirror\fR. The default value for \fB\-\-mirror\fR.
.TP .TP
.BR PULL_DEBIAN_SOURCE_MIRROR_FALLBACK ", " UBUNTUTOOLS_MIRROR_FALLBACK .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 This specifies the preferred test\-builder, one of
.BR pbuilder " (default), " sbuild ", " pbuilder\-dist . .BR pbuilder " (default), " sbuild ", " pbuilder\-dist .
.TP .TP
.B UBUNTUTOOLS_DEBMIRROR .B UBUNTUTOOLS_DEBIAN_MIRROR
The preferred Debian archive mirror. The preferred Debian archive mirror.
Should be of the form \fBhttp://ftp.debian.org/debian\fR (no trailing Should be of the form \fBhttp://ftp.debian.org/debian\fR (no trailing
slash). slash).
If not specified, the master will be used. If not specified, the master will be used.
.TP .TP
.B UBUNTUTOOLS_DEBSECMIRROR .B UBUNTUTOOLS_DEBSEC_MIRROR
The preferred Debian security archive mirror. The preferred Debian security archive mirror.
Should be of the form \fBhttp://security.debian.org\fR (no trailing Should be of the form \fBhttp://security.debian.org\fR (no trailing
slash). slash).
If not specified, the master will be used. If not specified, the master will be used.
.TP .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 .B UBUNTUTOOLS_LPINSTANCE
The launchpad instance to communicate with. e.g. \fBproduction\fR The launchpad instance to communicate with. e.g. \fBproduction\fR
(default) or \fBstaging\fR. (default) or \fBstaging\fR.

View File

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

View File

@ -41,7 +41,8 @@ if (! $no_conf) {
my($shell_cmd); my($shell_cmd);
$shell_cmd .= "[ -f /etc/devscripts.conf ] && . /etc/devscripts.conf\n"; $shell_cmd .= "[ -f /etc/devscripts.conf ] && . /etc/devscripts.conf\n";
$shell_cmd .= "[ -f ~/.devscripts ] && . ~/.devscripts\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 PULL_DEBIAN_SOURCE_MIRROR_FALLBACK
UBUNTUTOOLS_MIRROR_FALLBACK) { UBUNTUTOOLS_MIRROR_FALLBACK) {
$shell_cmd .= "echo $var=\$$var\n"; $shell_cmd .= "echo $var=\$$var\n";
@ -52,8 +53,8 @@ if (! $no_conf) {
my($k, $v) = split /=/, $line, 2; my($k, $v) = split /=/, $line, 2;
$config_values{$k} = $v; $config_values{$k} = $v;
} }
$mirror = $config_values{'PULL_DEBIAN_SOURCE_DEBMIRROR'} $mirror = $config_values{'PULL_DEBIAN_SOURCE_DEBIAN_MIRROR'}
|| $config_values{'UBUNTUTOOLS_DEBMIRROR'} || $config_values{'UBUNTUTOOLS_DEBIAN_MIRROR'}
if (! $mirror); if (! $mirror);
if (! $no_fallback) { if (! $no_fallback) {
my($v) = $config_values{'PULL_DEBIAN_SOURCE_MIRROR_FALLBACK'} my($v) = $config_values{'PULL_DEBIAN_SOURCE_MIRROR_FALLBACK'}
@ -180,7 +181,7 @@ USAGE: $name [options] <source package> [target release]
Options: Options:
-h, --help Show this help message and exit -h, --help Show this help message and exit
-m DEBMIRROR, --mirror=DEBMIRROR -m DEBIAN_MIRROR, --mirror=DEBIAN_MIRROR
Preferred Debian mirror Preferred Debian mirror
(default: http://ftp.debian.org/debian) (default: http://ftp.debian.org/debian)
-n, --no-fallback If a custom mirror is provided and an error occurs -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. # These are reqired to be used by at least two scripts.
defaults = { defaults = {
'BUILDER': 'pbuilder', 'BUILDER': 'pbuilder',
'DEBMIRROR': None, 'DEBIAN_MIRROR': None,
'DEBSECMIRROR': None, 'DEBSEC_MIRROR': None,
'LPINSTANCE': 'production', 'LPINSTANCE': 'production',
'MIRROR_FALLBACK': True, 'MIRROR_FALLBACK': True,
'UBUNTU_MIRROR': None,
'UPDATE_BUILDER': False, 'UPDATE_BUILDER': False,
'WORKDIR': None, 'WORKDIR': None,
} }