mirror of
				https://git.launchpad.net/ubuntu-dev-tools
				synced 2025-11-04 07:54:03 +00:00 
			
		
		
		
	pull-debian-source: Rewritten in Python to take advantage of the new
ubuntutools library functions.
This commit is contained in:
		
						commit
						4ac501214d
					
				
							
								
								
									
										4
									
								
								debian/changelog
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								debian/changelog
									
									
									
									
										vendored
									
									
								
							@ -12,8 +12,10 @@ ubuntu-dev-tools (0.113) UNRELEASED; urgency=low
 | 
			
		||||
  * pbuilder-dist: Use ubuntutools.logger.
 | 
			
		||||
  * pbuilder-dist-simple: Remove all mention of supporting Debian.
 | 
			
		||||
    (LP: #481223)
 | 
			
		||||
  * pull-debian-source: Rewritten in Python to take advantage of the new
 | 
			
		||||
    ubuntutools library functions.
 | 
			
		||||
 | 
			
		||||
 -- Stefano Rivera <stefanor@ubuntu.com>  Sat, 22 Jan 2011 18:22:55 +0200
 | 
			
		||||
 -- Stefano Rivera <stefanor@ubuntu.com>  Sat, 22 Jan 2011 20:55:57 +0200
 | 
			
		||||
 | 
			
		||||
ubuntu-dev-tools (0.112) unstable; urgency=low
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										4
									
								
								debian/copyright
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								debian/copyright
									
									
									
									
										vendored
									
									
								
							@ -133,7 +133,6 @@ Files: dch-repeat,
 | 
			
		||||
       doc/lp-list-bugs.1,
 | 
			
		||||
       doc/manage-credentials.1,
 | 
			
		||||
       doc/mk-sbuild.1,
 | 
			
		||||
       doc/pull-debian-source.1,
 | 
			
		||||
       doc/pull-lp-source.1,
 | 
			
		||||
       doc/pull-revu-source.1,
 | 
			
		||||
       doc/ubuntu-build.1,
 | 
			
		||||
@ -143,7 +142,6 @@ Files: dch-repeat,
 | 
			
		||||
       lp-list-bugs,
 | 
			
		||||
       manage-credentials,
 | 
			
		||||
       mk-sbuild,
 | 
			
		||||
       pull-debian-source,
 | 
			
		||||
       pull-lp-source,
 | 
			
		||||
       pull-revu-source,
 | 
			
		||||
       ubuntu-build,
 | 
			
		||||
@ -180,6 +178,7 @@ Files: data/*,
 | 
			
		||||
       doc/debian-distro-info.1,
 | 
			
		||||
       doc/distro-info.1,
 | 
			
		||||
       doc/pull-debian-debdiff.1,
 | 
			
		||||
       doc/pull-debian-source.1,
 | 
			
		||||
       doc/sponsor-patch.1,
 | 
			
		||||
       doc/suspicious-source.1,
 | 
			
		||||
       doc/ubuntu-dev-tools.5,
 | 
			
		||||
@ -187,6 +186,7 @@ Files: data/*,
 | 
			
		||||
       doc/update-maintainer.1,
 | 
			
		||||
       doc/wrap-and-sort.1,
 | 
			
		||||
       pull-debian-debdiff,
 | 
			
		||||
       pull-debian-source,
 | 
			
		||||
       sponsor-patch,
 | 
			
		||||
       suspicious-source,
 | 
			
		||||
       test-data/*,
 | 
			
		||||
 | 
			
		||||
@ -1,29 +1,39 @@
 | 
			
		||||
.TH PULL\-DEBIAN\-SOURCE "1" "20 December 2008" "ubuntu-dev-tools"
 | 
			
		||||
.\" Copyright (C) 2010-2011, Stefano Rivera <stefanor@ubuntu.com>
 | 
			
		||||
.\"
 | 
			
		||||
.\" Permission to use, copy, modify, and/or distribute this software for any
 | 
			
		||||
.\" purpose with or without fee is hereby granted, provided that the above
 | 
			
		||||
.\" copyright notice and this permission notice appear in all copies.
 | 
			
		||||
.\"
 | 
			
		||||
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
 | 
			
		||||
.\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 | 
			
		||||
.\" AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
 | 
			
		||||
.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
 | 
			
		||||
.\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
 | 
			
		||||
.\" OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 | 
			
		||||
.\" PERFORMANCE OF THIS SOFTWARE.
 | 
			
		||||
.TH PULL\-DEBIAN\-SOURCE "1" "22 January 2011" "ubuntu\-dev\-tools"
 | 
			
		||||
 | 
			
		||||
.SH NAME
 | 
			
		||||
pull\-debian\-source \- download a source package from Debian
 | 
			
		||||
pull\-debian\-source \- download and extract a source package from Debian
 | 
			
		||||
 | 
			
		||||
.SH SYNOPSIS
 | 
			
		||||
.B pull\-debian\-source \fR[\fIoptions\fR] <\fIsource package\fR> [\fItarget release\fR]
 | 
			
		||||
.B pull\-debian\-source \fR[\fIoptions\fR] <\fIsource package\fR> [\fIrelease\fR]
 | 
			
		||||
 | 
			
		||||
.SH DESCRIPTION
 | 
			
		||||
\fBpull\-debian\-source\fR downloads and extracts the latest version of
 | 
			
		||||
<\fBsource package\fR> from Debian.
 | 
			
		||||
If the optional parameter [\fItarget release\fR] is specified, the latest
 | 
			
		||||
version in that release will be downloaded instead.
 | 
			
		||||
\fBpull\-debian\-source\fR downloads and extracts the current version of
 | 
			
		||||
\fIsource package\fR in the specified Debian \fIrelease\fR.
 | 
			
		||||
 | 
			
		||||
.SH OPTIONS
 | 
			
		||||
Listed below are the command line options for pull\-debian\-source:
 | 
			
		||||
.TP
 | 
			
		||||
.I source package
 | 
			
		||||
This is the source package that you would like to be downloaded from Debian.
 | 
			
		||||
The source package to download from Debian.
 | 
			
		||||
.TP
 | 
			
		||||
.I target release
 | 
			
		||||
This is the release that you would like the source package to be downloaded from.
 | 
			
		||||
This value defaults to 'unstable'.
 | 
			
		||||
.I release
 | 
			
		||||
The release to download the source package from. Defaults to
 | 
			
		||||
\fBunstable\fR.
 | 
			
		||||
.TP
 | 
			
		||||
.BR \-h ", " \-\-help
 | 
			
		||||
Display the usage instructions and exit.
 | 
			
		||||
.BR \-d ", " \-\-download\-only
 | 
			
		||||
Do not extract the source package.
 | 
			
		||||
.TP
 | 
			
		||||
.B \-m \fIDEBIAN_MIRROR\fR, \fB\-\-mirror\fR=\fIDEBIAN_MIRROR\fR
 | 
			
		||||
Use the specified mirror.
 | 
			
		||||
@ -31,9 +41,18 @@ 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 \fIDEBSEC_MIRROR\fR, \fB\-\-security\-mirror\fR=\fIDEBSEC_MIRROR\fR
 | 
			
		||||
Use the specified mirror.
 | 
			
		||||
Should be in the form \fBhttp://security.debian.org\fR.
 | 
			
		||||
If the package isn't found on this mirror, \fBpull\-debian\-source\fR
 | 
			
		||||
will fall back to the default mirror.
 | 
			
		||||
.TP
 | 
			
		||||
.B \-\-no\-conf
 | 
			
		||||
Do not read any configuration files, or configuration from environment
 | 
			
		||||
variables.
 | 
			
		||||
.TP
 | 
			
		||||
.BR \-h ", " \-\-help
 | 
			
		||||
Display the usage instructions and exit.
 | 
			
		||||
 | 
			
		||||
.SH ENVIRONMENT
 | 
			
		||||
All of the \fBCONFIGURATION VARIABLES\fR below are also supported as
 | 
			
		||||
@ -50,16 +69,12 @@ package\-wide variable.
 | 
			
		||||
.TP
 | 
			
		||||
.BR PULL_DEBIAN_SOURCE_DEBIAN_MIRROR ", " UBUNTUTOOLS_DEBIAN_MIRROR
 | 
			
		||||
The default value for \fB\-\-mirror\fR.
 | 
			
		||||
.TP
 | 
			
		||||
.BR PULL_DEBIAN_SOURCE_DEBSEC_MIRROR ", " UBUNTUTOOLS_DEBSEC_MIRROR
 | 
			
		||||
The default value for \fB\-\-security\-mirror\fR.
 | 
			
		||||
 | 
			
		||||
.SH SEE ALSO
 | 
			
		||||
.BR dget (1),
 | 
			
		||||
.BR pull\-debian\-debdiff (1),
 | 
			
		||||
.BR pull\-lp\-source (1),
 | 
			
		||||
.BR ubuntu\-dev\-tools (5)
 | 
			
		||||
 | 
			
		||||
.SH AUTHOR
 | 
			
		||||
.PP
 | 
			
		||||
\fBpull\-debian\-source\fR and this manual page were written by Nathan Handler
 | 
			
		||||
<nhandler@ubuntu.com>. The manual page was based on Iain Lane's manual page for
 | 
			
		||||
pull-lp-source.
 | 
			
		||||
Both are released under the GNU General Public License, version 3 or later.
 | 
			
		||||
 | 
			
		||||
@ -1,194 +1,78 @@
 | 
			
		||||
#!/usr/bin/perl
 | 
			
		||||
# Script Name: pull-debian-source
 | 
			
		||||
# Author: Nathan Handler <nhandler@ubuntu.com>
 | 
			
		||||
# Usage: pull-debian-source <source package> [release]
 | 
			
		||||
# Copyright (C) 2008-2009 Nathan Handler <nhandler@ubuntu.com>,
 | 
			
		||||
#                    2010 Stefano Rivera <stefanor@ubuntu.com>
 | 
			
		||||
# License: GNU General Public License
 | 
			
		||||
# This program is free software: you can redistribute it and/or modify
 | 
			
		||||
# it under the terms of the GNU General Public License as published by
 | 
			
		||||
# the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
# (at your option) any later version.
 | 
			
		||||
#!/usr/bin/python
 | 
			
		||||
#
 | 
			
		||||
# This program is distributed in the hope that it will be useful,
 | 
			
		||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
# GNU General Public License for more details.
 | 
			
		||||
# pull-debian-source -- pull a source package from Launchpad
 | 
			
		||||
# Copyright (C) 2011, Stefano Rivera <stefanor@ubuntu.com>
 | 
			
		||||
# Inspired by a tool of the same name by Nathan Handler.
 | 
			
		||||
#
 | 
			
		||||
# On Debian GNU/Linux systems, the complete text of the GNU General
 | 
			
		||||
# Public License can be found in the /usr/share/common-licenses/GPL-3 file.
 | 
			
		||||
# Permission to use, copy, modify, and/or distribute this software for any
 | 
			
		||||
# purpose with or without fee is hereby granted, provided that the above
 | 
			
		||||
# copyright notice and this permission notice appear in all copies.
 | 
			
		||||
#
 | 
			
		||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
 | 
			
		||||
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 | 
			
		||||
# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
 | 
			
		||||
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
 | 
			
		||||
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
 | 
			
		||||
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 | 
			
		||||
# PERFORMANCE OF THIS SOFTWARE.
 | 
			
		||||
 | 
			
		||||
use warnings;
 | 
			
		||||
use strict;
 | 
			
		||||
use LWP::Simple;
 | 
			
		||||
use File::Basename;
 | 
			
		||||
use Getopt::Long;
 | 
			
		||||
use AptPkg::Version;
 | 
			
		||||
import optparse
 | 
			
		||||
import sys
 | 
			
		||||
 | 
			
		||||
my($name) = basename($0);
 | 
			
		||||
my($help, $mirror, $no_conf);
 | 
			
		||||
GetOptions('h|help' => \$help,
 | 
			
		||||
           'm|mirror=s' => \$mirror,
 | 
			
		||||
           'no-conf' => \$no_conf,
 | 
			
		||||
          );
 | 
			
		||||
&usage(0) if($help);
 | 
			
		||||
my($package) = $ARGV[0] || &usage(2);
 | 
			
		||||
from ubuntutools.archive import DebianSourcePackage, rmadison
 | 
			
		||||
from ubuntutools.config import UDTConfig
 | 
			
		||||
from ubuntutools.logger import Logger
 | 
			
		||||
 | 
			
		||||
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_DEBIAN_MIRROR
 | 
			
		||||
	                   UBUNTUTOOLS_DEBIAN_MIRROR
 | 
			
		||||
	                   PULL_DEBIAN_SOURCE_MIRROR_FALLBACK
 | 
			
		||||
	                   UBUNTUTOOLS_MIRROR_FALLBACK) {
 | 
			
		||||
		$shell_cmd .= "echo $var=\$$var\n";
 | 
			
		||||
	}
 | 
			
		||||
	my $shell_out = `/bin/bash -c '$shell_cmd'`;
 | 
			
		||||
	my %config_values;
 | 
			
		||||
	foreach my $line (split /\n/, $shell_out) {
 | 
			
		||||
		my($k, $v) = split /=/, $line, 2;
 | 
			
		||||
		$config_values{$k} = $v;
 | 
			
		||||
	}
 | 
			
		||||
	$mirror = $config_values{'PULL_DEBIAN_SOURCE_DEBIAN_MIRROR'}
 | 
			
		||||
	          || $config_values{'UBUNTUTOOLS_DEBIAN_MIRROR'}
 | 
			
		||||
	          if (! $mirror);
 | 
			
		||||
}
 | 
			
		||||
my($default_mirror) = 'http://ftp.debian.org/debian';
 | 
			
		||||
my(@mirrors);
 | 
			
		||||
push @mirrors, $mirror if $mirror && $mirror ne $default_mirror;
 | 
			
		||||
push @mirrors, $default_mirror;
 | 
			
		||||
def main():
 | 
			
		||||
    usage = 'Usage: %prog <package> [release]'
 | 
			
		||||
    parser = optparse.OptionParser(usage)
 | 
			
		||||
    parser.add_option('-d', '--download-only',
 | 
			
		||||
                      dest='download_only', default=False, action='store_true',
 | 
			
		||||
                      help='Do not extract the source package')
 | 
			
		||||
    parser.add_option('-m', '--mirror', metavar='UBUNTU_MIRROR',
 | 
			
		||||
                      dest='debian_mirror',
 | 
			
		||||
                      help='Preferred Debian mirror (default: %s)'
 | 
			
		||||
                           % UDTConfig.defaults['DEBIAN_MIRROR'])
 | 
			
		||||
    parser.add_option('-s', '--security-mirror', metavar='DEBSEC_MIRROR',
 | 
			
		||||
                      dest='debsec_mirror',
 | 
			
		||||
                      help='Preferred Debian Security mirror (default: %s)'
 | 
			
		||||
                           % UDTConfig.defaults['DEBSEC_MIRROR'])
 | 
			
		||||
    parser.add_option('--no-conf',
 | 
			
		||||
                      dest='no_conf', default=False, action='store_true',
 | 
			
		||||
                      help="Don't read config files or environment variables")
 | 
			
		||||
    (options, args) = parser.parse_args()
 | 
			
		||||
    if not args:
 | 
			
		||||
        parser.error('Must specify package name')
 | 
			
		||||
    elif len(args) > 2:
 | 
			
		||||
        parser.error('Too many arguments. '
 | 
			
		||||
                     'Must only specify package and (optionally) release.')
 | 
			
		||||
 | 
			
		||||
my($release)=$ARGV[1] || 'unstable';
 | 
			
		||||
$release=&convertCodeName($release);
 | 
			
		||||
&checkRelease($release);
 | 
			
		||||
my($madison) = &getMadison(&getURL($package,$release));
 | 
			
		||||
    config = UDTConfig(options.no_conf)
 | 
			
		||||
    if options.debian_mirror is None:
 | 
			
		||||
        options.debian_mirror = config.get_value('DEBIAN_MIRROR')
 | 
			
		||||
    if options.debsec_mirror is None:
 | 
			
		||||
        options.debsec_mirror = config.get_value('DEBSEC_MIRROR')
 | 
			
		||||
 | 
			
		||||
foreach my $mirror (@mirrors) {
 | 
			
		||||
	my($dsc)=&getDSC($madison, $mirror);
 | 
			
		||||
	print "$dsc\n";
 | 
			
		||||
	system("dget -xu $dsc");
 | 
			
		||||
	exit(0) if ($? == 0);
 | 
			
		||||
}
 | 
			
		||||
exit(1);
 | 
			
		||||
    package = args[0].lower()
 | 
			
		||||
 | 
			
		||||
sub convertCodeName {
 | 
			
		||||
	my($release)=shift || die("No Release Passed To convertCodeName!\n");
 | 
			
		||||
	chomp $release;
 | 
			
		||||
	if($release=~m/^lenny$/i) {
 | 
			
		||||
		return "stable";
 | 
			
		||||
	}
 | 
			
		||||
	elsif($release=~m/^squeeze$/i) {
 | 
			
		||||
		return "testing";
 | 
			
		||||
	}
 | 
			
		||||
	elsif($release=~m/^sid$/i) {
 | 
			
		||||
		return "unstable";
 | 
			
		||||
	}
 | 
			
		||||
	elsif($release=~m/^etch$/i) {
 | 
			
		||||
		return "oldstable";
 | 
			
		||||
	}
 | 
			
		||||
	return $release;
 | 
			
		||||
}
 | 
			
		||||
sub checkRelease {
 | 
			
		||||
	my($release)=shift || die("No Release Passed To checkRelease!\n");
 | 
			
		||||
	chomp $release;
 | 
			
		||||
	my %releases=(
 | 
			
		||||
		'stable' => 1,
 | 
			
		||||
		'testing' => 1,
 | 
			
		||||
		'unstable' => 1,
 | 
			
		||||
		'experimental' => 1,
 | 
			
		||||
		'oldstable' => 1
 | 
			
		||||
	);
 | 
			
		||||
	&invalidRelease(\%releases) unless $releases{$release}
 | 
			
		||||
}
 | 
			
		||||
sub getURL{
 | 
			
		||||
	my($package)=shift || die("No Package Passed To getURL: $!\n");
 | 
			
		||||
	my($release)=shift || die("No Release Passed to getURL: $!\n");
 | 
			
		||||
	chomp $package;
 | 
			
		||||
	chomp $release;
 | 
			
		||||
	$package=lc($package);
 | 
			
		||||
	$package=~s/\+/%2b/g;
 | 
			
		||||
	$release=lc($release);
 | 
			
		||||
	my($baseURL)='http://qa.debian.org/madison.php?text=on&a=source';
 | 
			
		||||
	my($url)=$baseURL . '&package=' . $package . '&s=' . $release;
 | 
			
		||||
	return $url;
 | 
			
		||||
}
 | 
			
		||||
sub getMadison {
 | 
			
		||||
	my($url)=shift || die("No URL Passed to getMadison: $!\n");
 | 
			
		||||
	chomp $url;
 | 
			
		||||
	my($madison)=get($url);
 | 
			
		||||
	die("The source package $package isn't available in Debian testing.\nRun $name $package unstable if the package has not yet migrated from Debian unstable to Debian testing.\n") if ($release=~m/testing/ && $madison=~m/^\s*$/);
 | 
			
		||||
	return $madison;
 | 
			
		||||
}
 | 
			
		||||
sub getDSC {
 | 
			
		||||
	my($madison)=shift || die("No madison Passed to getDSC: $!\n");
 | 
			
		||||
	if($madison=~m/^[WE]:/i) {
 | 
			
		||||
		die("$madison");
 | 
			
		||||
	}
 | 
			
		||||
	my($baseURL)=shift || die ("No baseURL Passed to getDSC: $!\n");
 | 
			
		||||
	my(@madison)=split(/\n/,$madison);
 | 
			
		||||
	my %urls;
 | 
			
		||||
	my $url;
 | 
			
		||||
	foreach my $line (@madison) {
 | 
			
		||||
		$url = $baseURL . '/pool/';
 | 
			
		||||
		my($package,$version,$release,$archs)=split(/\|/,$line,4);
 | 
			
		||||
		$package=~s/\s*//g;
 | 
			
		||||
		$version=~s/\s*//g;
 | 
			
		||||
		$release=~s/\s*//g;
 | 
			
		||||
		$archs=~s/\s*//g;
 | 
			
		||||
		$version=~s/^.*?\://;
 | 
			
		||||
		if($archs=~m/source/) {
 | 
			
		||||
			print "Package: $package\nVersion: $version\nRelease: $release\nArchitectures: $archs\n";
 | 
			
		||||
			my($firstLetter);
 | 
			
		||||
			if($package=~m/^lib/) {
 | 
			
		||||
				$firstLetter="lib" . substr($package,3,1);
 | 
			
		||||
			}
 | 
			
		||||
			else {
 | 
			
		||||
				$firstLetter=substr($package,0,1);
 | 
			
		||||
			}
 | 
			
		||||
			if($release=~m/contrib/) {
 | 
			
		||||
				$url .= 'contrib/';
 | 
			
		||||
			}
 | 
			
		||||
			elsif($release=~m/non\-free/) {
 | 
			
		||||
				$url .= 'non-free/';
 | 
			
		||||
			}
 | 
			
		||||
			else {
 | 
			
		||||
				$url .= 'main/';
 | 
			
		||||
			}
 | 
			
		||||
			$url .= $firstLetter . '/' . $package . '/' . $package . '_' . $version . '.dsc';
 | 
			
		||||
			$urls{$version} = $url;
 | 
			
		||||
		}
 | 
			
		||||
    if len(args) > 1:
 | 
			
		||||
        suite = args[1].lower()
 | 
			
		||||
    else:
 | 
			
		||||
        suite = 'unstable'
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
    line = list(rmadison('debian', package, suite, 'source'))
 | 
			
		||||
    if not line:
 | 
			
		||||
        Logger.error('Unable to find %s in %s.', package, suite)
 | 
			
		||||
        sys.exit(1)
 | 
			
		||||
 | 
			
		||||
	my @vers = reverse sort AptPkg::Version::CmpVersion keys %urls;
 | 
			
		||||
    line = line[-1]
 | 
			
		||||
    srcpkg = DebianSourcePackage(package, line['version'],
 | 
			
		||||
                                 component=line['component'],
 | 
			
		||||
                                 mirrors=[options.debian_mirror,
 | 
			
		||||
                                          options.debsec_mirror])
 | 
			
		||||
    srcpkg.pull()
 | 
			
		||||
    if not options.download_only:
 | 
			
		||||
        srcpkg.unpack()
 | 
			
		||||
 | 
			
		||||
	return $urls{$vers[0]} or die("Unable To Find Source Package On Madison\n");
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
sub usage {
 | 
			
		||||
	my($exit)=shift;
 | 
			
		||||
	print <<"EOF";
 | 
			
		||||
USAGE: $name [options] <source package> [target release]
 | 
			
		||||
 | 
			
		||||
Options:
 | 
			
		||||
  -h, --help            Show this help message and exit
 | 
			
		||||
  -m DEBIAN_MIRROR, --mirror=DEBIAN_MIRROR
 | 
			
		||||
                        Preferred Debian mirror
 | 
			
		||||
                        (default: http://ftp.debian.org/debian)
 | 
			
		||||
  --no-conf             Don't read config files or environment variables
 | 
			
		||||
EOF
 | 
			
		||||
	exit($exit);
 | 
			
		||||
}
 | 
			
		||||
sub invalidRelease {
 | 
			
		||||
	my($releases)=shift || die("Invalid Release!");
 | 
			
		||||
	my(%releases)=%$releases;
 | 
			
		||||
	my($validReleases);
 | 
			
		||||
	while ( my ($key, $value) = each(%releases) ) {
 | 
			
		||||
		if($value) {
 | 
			
		||||
			$validReleases .= $key . ", ";
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	$validReleases=~s/,\s*$//;
 | 
			
		||||
	die("Invalid Release!\nValid Releases: $validReleases\n");
 | 
			
		||||
}
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
    main()
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user