Package: sbuild
Version: 0.60.0-2
Severity: normal
Tags: patch
Justification: Policy 9.3.2
User: [email protected]
Usertags: origin-ubuntu maverick ubuntu-patch

Hi,

In ubuntu we applied the following changes:

- buildd: Declare Replaces and Breaks on ubuntu-dev-tools (<= 0.83) as
  both packages contain /usr/bin/buildd. (LP: #558461)
- lib/Sbuild/Build.pm, Utility.pm: remove assumptions about filenames
  in dsc (Closes: 559533).

And we believe you might be interested too. Attaching the patch with those 
changes.
diff -pruN 0.60.0-2/debian/control 0.60.0-2ubuntu1/debian/control
--- 0.60.0-2/debian/control	2010-02-23 22:34:33.000000000 +0000
+++ 0.60.0-2ubuntu1/debian/control	2010-07-24 00:34:27.000000000 +0100
@@ -1,7 +1,8 @@
 Source: sbuild
 Section: devel
 Priority: extra
 Maintainer: Debian buildd-tools Developers <[email protected]>
 Uploaders: Michael Banck <[email protected]>, Roger Leigh <[email protected]>, Francesco Paolo Lovergine <[email protected]>
 Build-Depends: debhelper (>> 7.0.0)
 Standards-Version: 3.8.4
@@ -59,7 +60,8 @@ Package: buildd
 Architecture: all
 Depends: ${misc:Depends}, ${perl:Depends}, libsbuild-perl, adduser, sbuild (= ${source:Version}), dupload, cron, exim4 | mail-transport-agent
 Suggests: wanna-build
-Replaces: sbuild
+Replaces: sbuild, ubuntu-dev-tools (<= 0.83)
+Breaks: ubuntu-dev-tools (<= 0.83)
 Description: Daemon for automatically building Debian binary packages from Debian sources
  The sbuild suite of programs (wanna-build, buildd and sbuild) are
  used to build binary packages from source packages.  The wanna-build
diff -pruN 0.60.0-2/lib/Sbuild/Build.pm 0.60.0-2ubuntu1/lib/Sbuild/Build.pm
--- 0.60.0-2/lib/Sbuild/Build.pm	2010-07-24 00:38:13.000000000 +0100
+++ 0.60.0-2ubuntu1/lib/Sbuild/Build.pm	2010-07-24 00:34:27.000000000 +0100
@@ -44,7 +44,7 @@ use Sbuild::Sysconfig qw($version $relea
 use Sbuild::Conf;
 use Sbuild::LogBase qw($saved_stdout);
 use Sbuild::Sysconfig;
-use Sbuild::Utility qw(check_url download parse_file);
+use Sbuild::Utility qw(check_url download dsc_files);
 use Sbuild::AptitudeBuildDepSatisfier;
 use Sbuild::InternalBuildDepSatisfier;
 
@@ -453,7 +453,7 @@ sub fetch_source_files {
     my $ver = $self->get('OVersion');
     my $arch = $self->get('Arch');
 
-    my ($files, @other_files, $dscarchs, $dscpkg, $dscver, @fetched);
+    my ($dscarchs, $dscpkg, $dscver, @fetched);
 
     my $build_depends = "";
     my $build_depends_indep = "";
@@ -479,7 +479,8 @@ sub fetch_source_files {
 	$file = download($self->get('DSC')) or
 	    $self->log_error("Could not download " . $self->get('DSC')) and
 	    return 0;
-	my @cwd_files = $self->dsc_files($file);
+	debug("Parsing $dsc\n");
+	my @cwd_files = dsc_files($file);
 	if (-f "$dir/$dsc") {
 	    # Copy the local source files into the build directory.
 	    $self->log_subsubsection("Local sources");
@@ -669,10 +670,6 @@ sub fetch_source_files {
     $dsctext =~ /^Version:\s*(.*)$/mi and $dscver = $1;
     $self->set_version("${dscpkg}_${dscver}");
 
-    $dsctext =~ /^Files:\s*\n((\s+.*\s*\n)+)/mi and $files = $1;
-    @other_files = map { (split( /\s+/, $_ ))[3] } split( "\n", $files );
-    $files =~ /(\Q$pkg\E.*orig.tar.gz)/mi and $orig = $1;
-
     $self->log_subsubsection("Check arch");
     if (!$dscarchs) {
 	$self->log("$dsc has no Architecture: field -- skipping arch check!\n");
@@ -712,19 +709,15 @@ sub build {
 
     my $dscfile = $self->get('DSC File');
     my $dscdir = $self->get('DSC Dir');
-    my $pkgv = $self->get('Package_Version');
+    my $pkg = $self->get('Package');
     my $build_dir = $self->get('Chroot Build Dir');
     my $arch = $self->get('Arch');
 
     my( $rv, $changes );
     local( *PIPE, *F, *F2 );
 
-    $pkgv = $self->fixup_pkgv($pkgv);
     $self->log_subsection("Build");
     $self->set('This Space', 0);
-    $pkgv =~ /^([a-zA-Z\d.+-]+)_([a-zA-Z\d:.+~-]+)/;
-    # Note, this version contains ".dsc".
-    my ($pkg, $version) = ($1,$2);
 
     my $tmpunpackdir = $dscdir;
     $tmpunpackdir =~ s/-.*$/.orig.tmp-nest/;
@@ -1793,18 +1786,6 @@ sub check_watches {
     $self->log("\n");
 }
 
-
-sub fixup_pkgv {
-    my $self = shift;
-    my $pkgv = shift;
-
-    $pkgv =~ s,^.*/,,; # strip path
-    $pkgv =~ s/\.(dsc|diff\.gz|tar\.gz|deb)$//; # strip extension
-    $pkgv =~ s/_[a-zA-Z\d+~-]+\.(changes|deb)$//; # strip extension
-
-    return $pkgv;
-}
-
 sub format_deps {
     my $self = shift;
 
@@ -1919,27 +1900,6 @@ sub debian_files_list {
     return @list;
 }
 
-sub dsc_files {
-    my $self = shift;
-    my $dsc = shift;
-    my @files;
-
-    debug("Parsing $dsc\n");
-
-    # The parse_file() subroutine returns a ref to an array of hashrefs.
-    my $stanzas = parse_file($dsc);
-
-    # A dsc file would only ever contain one stanza, so we only deal with
-    # the first entry which is a ref to a hash of fields for the stanza.
-    my $stanza = @{$stanzas}[0];
-
-    # We're only interested in the name of the files in the Files field.
-    my $entry = ${$stanza}{'Files'};
-    @files = grep(/\.tar\.gz$|\.diff\.gz$/, split(/\s/, $entry));
-
-    return @files;
-}
-
 # Figure out chroot architecture
 sub chroot_arch {
     my $self = shift;
diff -pruN 0.60.0-2/lib/Sbuild/Utility.pm 0.60.0-2ubuntu1/lib/Sbuild/Utility.pm
--- 0.60.0-2/lib/Sbuild/Utility.pm	2010-02-23 22:34:33.000000000 +0000
+++ 0.60.0-2ubuntu1/lib/Sbuild/Utility.pm	2010-07-24 00:34:27.000000000 +0100
@@ -47,6 +47,8 @@ sub get_dist ($);
 sub setup ($$);
 sub cleanup ($);
 sub shutdown ($);
+sub parse_file ($);
+sub dsc_files ($);
 
 my $current_session;
 
@@ -56,7 +58,7 @@ BEGIN {
 
     @ISA = qw(Exporter);
 
-    @EXPORT = qw(setup cleanup shutdown check_url download parse_file);
+    @EXPORT = qw(setup cleanup shutdown check_url download parse_file dsc_files);
 
     $SIG{'INT'} = \&shutdown;
     $SIG{'TERM'} = \&shutdown;
@@ -358,7 +360,7 @@ sub _get_proxy {
 # It can also be used on files like Packages or Sources files in a Debian
 # archive.
 # This subroutine returns an array of hashes. Each hash is a stanza.
-sub parse_file {
+sub parse_file ($) {
     # Takes one parameter, the file to parse.
     my ($file) = @_;
 
@@ -420,4 +422,26 @@ sub parse_file {
     return \...@array_of_fields;
 }
 
+sub dsc_files ($) {
+    my $dsc = shift;
+
+    my @files;
+
+    # The parse_file() subroutine returns a ref to an array of hashrefs.
+    my $stanzas = parse_file($dsc);
+
+    # A dsc file would only ever contain one stanza, so we only deal with
+    # the first entry which is a ref to a hash of fields for the stanza.
+    my $stanza = @{$stanzas}[0];
+
+    # We're only interested in the name of the files in the Files field.
+    my $entry = ${$stanza}{'Files'};
+
+    foreach my $line (split("\n", $entry)) {
+	push @files, $1 if $line =~ /(\S+)\s*$/;
+    }
+
+    return @files;
+}
+
 1;

Reply via email to