SVN devscripts commit: r520 - in trunk: . debian

Christoph Berg myon at alioth.debian.org
Wed Feb 21 17:03:24 CET 2007


Author: myon
Date: 2007-02-21 17:03:22 +0100 (Wed, 21 Feb 2007)
New Revision: 520

Modified:
   trunk/debian/changelog
   trunk/dget.pl
Log:
* dget: consult apt-get source for missing files. (Closes: #394809)

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2007-02-21 13:35:14 UTC (rev 519)
+++ trunk/debian/changelog	2007-02-21 16:03:22 UTC (rev 520)
@@ -14,10 +14,11 @@
 
   [ Christoph Berg ]
   * Also joining the team.
+  * dget: consult apt-get source for missing files. (Closes: #394809)
   * rmadison: new upstream version, supports querying other archives
     (specifically backports.org).
 
- -- Mohammed Adnène Trojette <adn+deb at diwi.org>  Wed, 21 Feb 2007 14:26:42 +0100
+ -- Christoph Berg <myon at debian.org>  Wed, 21 Feb 2007 17:01:04 +0100
 
 devscripts (2.9.27) unstable; urgency=low
 

Modified: trunk/dget.pl
===================================================================
--- trunk/dget.pl	2007-02-21 13:35:14 UTC (rev 519)
+++ trunk/dget.pl	2007-02-21 16:03:22 UTC (rev 520)
@@ -2,7 +2,7 @@
 # vim:sw=4:sta:
 
 #   dget - Download Debian source and binary packages
-#   Copyright (C) 2005-06 Christoph Berg <myon at debian.org>
+#   Copyright (C) 2005-07 Christoph Berg <myon at debian.org>
 #   Modifications Copyright (C) 2005-06 Julian Gilbey <jdg at debian.org>
 #
 #   This program is free software; you can redistribute it and/or modify
@@ -82,7 +82,7 @@
 sub version {
     print <<"EOF";
 This is $progname, from the Debian devscripts package, version ###VERSION###
-This code is copyright 2005-06 by Christoph Berg <myon\@debian.org>.
+This code is copyright 2005-07 by Christoph Berg <myon\@debian.org>.
 Modifications copyright 2005-06 by Julian Gilbey <jdg\@debian.org>.
 All rights reserved.
 This program comes with ABSOLUTELY NO WARRANTY.
@@ -181,10 +181,29 @@
 	if (wget($file, "$dir/$file")) {
 	    warn "$progname: $wget $file $dir/$file failed\n";
 	    unlink $file;
-	    return 0;
 	}
     }
 
+    # try apt-get if it is still not there
+    if (not -e $file and $file =~ m!^([a-z0-9.+-]{2,})_[^/]+\.(?:diff\.gz|tar\.gz)$!) {
+	my $cmd = "apt-get source --print-uris $1";
+	my $apt = new IO::File("$cmd |") or die "$cmd: $!";
+	while(<$apt>) {
+	    if (/'(\S+)'\s+\S+\s+\d+\s+([\da-f]+)/i and $2 eq $md5sum) {
+		if (wget($file, $1)) {
+		    warn "$progname: $wget $file $1 failed\n";
+		    unlink $file;
+		}
+	    }
+	}
+	close $apt;
+    }
+
+    # still not there, return
+    unless (-e $file) {
+	return 0;
+    }
+
     if ($file =~ /\.(?:changes|dsc)$/) {
 	parse_file($dir, $file);
     }
@@ -433,10 +452,11 @@
 downloading binary packages, B<dget> checks to see whether any of
 these files already exist.  If they do, then their md5sums are
 compared to avoid downloading them again unnecessarily.  B<dget> also
-looks for matching files in B</var/cache/apt/archives> and directories
+looks for matching files in I</var/cache/apt/archives> and directories
 given by the B<--path> option or specified in the configuration files
-(see below).  Download backends used are B<curl> and B<wget>, looked
-for in that order.
+(see below).  Finally, if downloading (.orig).tar.gz or .diff.gz files
+fails, dget consults B<apt-get source --print-uris>.  Download backends
+used are B<curl> and B<wget>, looked for in that order.
 
 B<dget> was written to make it easier to retrieve source packages from
 the web for sponsor uploads.  For checking the package with
@@ -516,7 +536,7 @@
 
 =head1 AUTHOR
 
-This program is Copyright (C) 2005-06 by Christoph Berg <myon at debian.org>.
+This program is Copyright (C) 2005-07 by Christoph Berg <myon at debian.org>.
 Modifications are Copyright (C) 2005-06 by Julian Gilbey <jdg at debian.org>.
 
 This program is licensed under the terms of the GPL, either version 2




More information about the Devscripts-devel mailing list