[Buildd-tools-devel] Bug#471747: Bug#471747: sbuild: must not parse dpkg-source's output

Roger Leigh rleigh at whinlatter.ukfsn.org
Thu Mar 27 20:59:28 UTC 2008


tags 471747 + patch fixed-upstream pending
thanks

Raphael Hertzog <hertzog at debian.org> writes:

> Package: sbuild
> Version: 0.57.0-1
> Severity: important
>
> sbuild parse the output of dpkg-source to find out the name of the
> directory containing the extracted source package. This is a bad idea
> as it will break as soon as dpkg-source's output changes.

I applied the following patch, explictly setting the build directory
instead of parsing the output.  Ryan, I didn't see any commit to your
SVN, so feel free to adapt this.

This will be uploaded shortly.  It's tagged in git as sbuild-0.57.1.

http://git.debian.org/?p=buildd-tools/sbuild.git;a=commit;h=0668d724b847010c41e1f47edfbf9f6bd690bae2

http://git.debian.org/?p=buildd-tools/sbuild.git;a=commitdiff;h=c1e3cbc8699da54f9f540bdabc6436a128eaa668



Regards,
Roger


diff --git a/ChangeLog b/ChangeLog
index 933518b..d4e06b0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-03-27  Roger Leigh  <rleigh at debian.org>
+
+	* bin/sbuild (build): Don't parse output of dpkg-source.  Specify
+	the build directory explicity.
+
 2008-03-08  Roger Leigh  <rleigh at debian.org>
 
 	* bin/sbuild: Pass date to open_pkg_log.  Pass current job and
diff --git a/bin/sbuild b/bin/sbuild
index 68fe0be..e319229 100755
--- a/bin/sbuild
+++ b/bin/sbuild
@@ -602,35 +602,16 @@ sub build ($$) {
 	if (-d $tmpunpackdir) {
 	    system ("rm -fr '$tmpunpackdir'");
 	}
-	$main::sub_pid = open( PIPE, "-|" );
-	if (!defined $main::sub_pid) {
-	    print PLOG "Can't spawn dpkg-source: $!\n";
-	    return 0;
-	}
-	if ($main::sub_pid == 0) {
-	    exec_command("$conf::dpkg_source -sn -x $dsc 2>&1", $main::username, 1, 0);
-	}
+	$dir = "$dsc";
+	$dir =~ s/\.dsc$//;
 	$main::sub_task = "dpkg-source";
-
-	while( <PIPE> ) {
-	    print PLOG $_;
-	    $dir = $1 if /^dpkg-source: extracting \S+ in (\S+)/;
-	    $main::pkg_fail_stage = "unpack-check"
-		if /^dpkg-source: error: file.*instead of expected/;
-	}
-	close( PIPE );
-	undef $main::sub_pid;
+	run_command("$conf::dpkg_source -sn -x $dsc $dir 2>&1", $main::username, 1, 0);
 	if ($?) {
 	    print PLOG "FAILED [dpkg-source died]\n";
 
 	    system ("rm -fr '$tmpunpackdir'") if -d $tmpunpackdir;
 	    return 0;
 	}
-	if (!$dir) {
-	    print PLOG "Couldn't find directory of $dsc in dpkg-source output\n";
-	    system ("rm -fr '$tmpunpackdir'") if -d $tmpunpackdir;
-	    return 0;
-	}
 	$dir = "$main::chroot_build_dir/$dir";
 
 	if (system( "chmod -R g-s,go+rX $dir" ) != 0) {
diff --git a/debian/changelog b/debian/changelog
index d9925bc..4565a36 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,8 +11,9 @@ sbuild (0.57.1-1) unstable; urgency=low
   * debian/schroot.install: use /usr/share in place of /usr/lib
     (Closes: #458779).
   * debian/wanna-build.install: New file: files for wanna-build.
+  * sbuild: Don't parse output of dpkg-source (Closes: #471747).
 
- -- Roger Leigh <rleigh at debian.org>  Sat, 26 Jan 2008 21:12:55 +0000
+ -- Roger Leigh <rleigh at debian.org>  Thu, 27 Mar 2008 20:42:56 +0000
 
 sbuild (0.57.0-1) unstable; urgency=low
 


-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/buildd-tools-devel/attachments/20080327/bb5764ea/attachment.pgp 


More information about the Buildd-tools-devel mailing list