Tags 457977 + patch
thanks

Hi,

I spent some time to implement this feature request. However the actual
implementation differs from what has been asked for in the way that its
not '-b' but instead '--build'. That is because '-b' is already in use
by the backup option.

I would feel lucky if some of the devscripts maintainers would integrate
this :-)

Patch attached.

Best Regards,
Patrick
Index: debian/changelog
===================================================================
--- debian/changelog	(Revision 922)
+++ debian/changelog	(Arbeitskopie)
@@ -26,7 +26,11 @@
   [ Christoph Berg ]
   * debcommit: also look for \t in the diff for GNU-style changelogs.
 
- -- Adam D. Barratt <[EMAIL PROTECTED]>  Mon, 28 Jan 2008 22:58:38 +0000
+  [ Patrick Schoenfeld ]
+  * dget: Implement --build parameter to immediately build a package after its
+    download (Closes: #457977)
+
+ -- Patrick Schoenfeld <[EMAIL PROTECTED]>  Tue, 29 Jan 2008 21:58:50 +0100
 
 devscripts (2.10.13) unstable; urgency=low
 
Index: scripts/dget.pl
===================================================================
--- scripts/dget.pl	(Revision 922)
+++ scripts/dget.pl	(Arbeitskopie)
@@ -64,6 +64,7 @@
    -b, --backup    Move files that would be overwritten to ./backup
    -q, --quiet     Suppress wget/curl output
    -x, --extract   Run dpkg-source -x on downloaded source (first form only)
+   --build         Build package with dpkg-buildpackage after download
    --path DIR      Check these directories in addition to the apt archive;
                    if DIR='' then clear current list (may be used multiple
                    times)
@@ -369,6 +370,7 @@
 GetOptions(
     "b|backup"   =>  \$opt->{'backup'},
     "q|quiet"    =>  \$opt->{'quiet'},
+	"build"      =>  \$opt->{'build'},
     "x|extract"  =>  \$opt->{'unpack_source'},
     "insecure"   =>  \$opt->{'insecure'},
     "no-cache"   =>  \$opt->{'no-cache'},
@@ -402,7 +404,18 @@
 
     if ($arg =~ /^((?:copy|file|ftp|http|rsh|rsync|ssh|www).*)\/([^\/]+\.\w+)$/) {
 	get_file($1, $2, "unlink") or exit 1;
-	if ($found_dsc and $opt->{'unpack_source'}) {
+	print $opt->{'build'} . "\n";
+	if ($found_dsc and $opt->{'build'}) {
+		my @output = `dpkg-source -x $found_dsc`;
+		foreach (@output) {
+			if ( /^dpkg-source: extracting .* in .*/ ) {
+				/^dpkg-source: extracting .* in (.*)$/;
+				chdir $1;
+				system 'dpkg-buildpackage', '-b', '-us';
+			}
+		}
+	}
+	elsif ($found_dsc and $opt->{'unpack_source'}) {
 	    system 'dpkg-source', '-x', $found_dsc;
 	}
 
@@ -480,6 +493,10 @@
 Run B<dpkg-source -x> on the downloaded source package.  This can only
 be used with the first method of calling B<dget>.
 
+=item B<--build>
+
+Run B<dpkg-buildpackage -b -uc> on the downloaded source package.
+
 =item B<--path> DIR[:DIR...]
 
 In addition to I</var/cache/apt/archives>, B<dget> uses the

Reply via email to