* Add pull-debian-source script

- debian/control: Add perl-modules and libwww-perl as Depends
  - debian/copyright:
    + Add myself to the Upstream Authors and Copyright sections
    + Add pull-debian-source to the License section
  - Add doc/pull-debian-source.1
This commit is contained in:
Nathan Handler 2008-12-20 16:36:35 -06:00
parent f21ff09fe2
commit 39bf024a2f
5 changed files with 151 additions and 3 deletions

11
debian/changelog vendored
View File

@ -1,3 +1,14 @@
ubuntu-dev-tools (0.50) UNRELEASED; urgency=low
* Add pull-debian-source script
- debian/control: Add perl-modules and libwww-perl as Depends
- debian/copyright:
+ Add myself to the Upstream Authors and Copyright sections
+ Add pull-debian-source to the License section
- Add doc/pull-debian-source.1
-- Nathan Handler <nhandler@ubuntu.com> Sat, 20 Dec 2008 16:32:27 -0600
ubuntu-dev-tools (0.49) jaunty; urgency=low
[ Sarah Hobbs ]

2
debian/control vendored
View File

@ -15,7 +15,7 @@ Architecture: all
Section: devel
Depends: ${python:Depends}, binutils, devscripts, sudo, python-debian,
python-launchpad-bugs (>= 0.2.25), dctrl-tools, lsb-release, diffstat,
dpkg-dev, ${misc:Depends}
dpkg-dev, ${misc:Depends}, perl-modules, libwww-perl
Recommends: bzr, pbuilder | sbuild, reportbug (>= 3.39ubuntu1),
ca-certificates, genisoimage
Conflicts: devscripts (<< 2.10.7ubuntu5)

6
debian/copyright vendored
View File

@ -21,6 +21,7 @@ Upstream Authors:
Soren Hansen <soren@ubuntu.com>
Steve Kowalik <stevenk@ubuntu.com>
Terence Simpson <stdin@stdin.me.uk>
Nathan Handler <nhandler@ubuntu.com>
Copyright:
@ -37,6 +38,7 @@ Copyright:
(C) 2007, Terence Simpson <stdin@stdin.me.uk>
(C) 2008, Iain Lane <iain@orangesquash.org.uk>
(C) 2008, Jonathan Patrick Davies <jpds@ubuntu.com>
(C) 2008, Nathan handler <nhandler@ubuntu.com>
Licenses:
@ -57,7 +59,7 @@ On Debian and Ubuntu systems, the complete text of the GNU General Public
License v2 can be found in `/usr/share/common-licenses/GPL-2'.
dch-repeat, get-branches, get-build-deps, massfile, mk-sbuild-lv, ppaput,
pull-debian-debdiff, pull-lp-source, suspicious-source and what-patch are
pull-debian-debdiff, pull-debian-source, pull-lp-source, suspicious-source and what-patch are
licensed under the GNU General Public License, version 3:
This program is free software: you can redistribute it and/or modify
@ -74,5 +76,5 @@ License v3 can be found in `/usr/share/common-licenses/GPL-3'.
The following of the scripts can be used, at your option, regarding any
later version of the previously specified license: 404main, dch-repeat, dgetlp,
get-build-deps, mk-sbuild-lv, pull-debian-debdiff, pull-lp-source,
get-build-deps, mk-sbuild-lv, pull-debian-debdiff, pull-debian-source, pull-lp-source,
reverse-build-depends, suspicious-source, what-patch.

33
doc/pull-debian-source.1 Normal file
View File

@ -0,0 +1,33 @@
.TH PULL\-DEBIAN\-SOURCE "1" "20 December 2008" "ubuntu-dev-tools"
.SH NAME
pull\-debian\-source \- download a source package from Debian
.SH SYNOPSIS
.B pull\-debian\-source \fR[\fB\-h\fR]\fB <\fBsource package\fR> [\fItarget release\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.
.SH OPTIONS
Listed below are the command line options for pull\-debian\-source:
.TP
.B \-h, \-\-help
Display the usage instructions and exit.
.TP
.B <source package>
This is the source package that you would like to be downloaded from Debian.
.TP
.B [target release]
This is the release that you would like the source package to be downloaded from.
This value defaults to 'unstable'.
.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.

102
pull-debian-source Executable file
View File

@ -0,0 +1,102 @@
#!/usr/bin/perl
# Script Name: pull-debian-source
# Author: Nathan Handler <nhandler@ubuntu.com>
# Usage: pull-debian-source <source package> [release]
# Copyright (C) 2008 Nathan Handler <nhandler@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.
#
# 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.
#
# On Debian GNU/Linux systems, the complete text of the GNU General
# Public License can be found in the /usr/share/common-licenses/GPL file.
use warnings;
use strict;
use LWP::Simple;
use File::Basename;
my($package)=$ARGV[0] || &usage();
&usage() if(($package=~m/\-\-help/i) || ($package=~m/\-h/i));
my($release)=$ARGV[1] || 'unstable';
&checkRelease($release);
my($dsc)=&getDSC(&getMadison(&getURL($package,$release)));
print "$dsc\n";
exec("dget $dsc");
sub checkRelease {
my($release)=shift || die("No Release Passed To checkRelease!\n");
chomp $release;
my %releases=(
'etch' => 1,
'stable' => 1,
'lenny' => 1,
'testing' => 1,
'sid' => 1,
'unstable' => 1,
'experimental' => 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';
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("Could Not Get $url") unless (defined $madison && $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)='http://ftp.debian.org/debian/pool/main/';
my(@madison)=split(/\n/,$madison);
foreach my $line (@madison) {
my($package,$version,$release,$archs)=split(/\|/,$line,4);
$package=~s/\s*//g;
$version=~s/\s*//g;
$release=~s/\s*//g;
$archs=~s/\s*//g;
if($archs=~m/source/) {
print "Package: $package\nVersion: $version\nRelease: $release\nArchitectures: $archs\n";
my($firstLetter)=substr($package,0,1);
my($url)=$baseURL . $firstLetter . '/' . $package . '/' . $package . '_' . $version . '.dsc';
return $url;
}
}
die("Unable To Find Source Package On Madison\n");
}
sub usage {
my($name)=basename($0);
die("USAGE: $name [-h] <source package> [target release]\n");
}
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");
}