On Wed, Apr 21, 2010 at 03:48:25PM +0200, Didier 'OdyX' Raboud wrote: > I got hit by the same bug, while trying to compile a 3.0 (quilt) package. I > propose the attached simple patch, that "just works" for me.
Thanks everyone for your patches. Please could you try the attached patch and let me know if it works OK for you? This patch is different from the others in that it removes hardcoded assumptions about expected filenames in the DSC. Rather than extending the list of allowed names, it's removed entirely. This should be rather more future proof. Regards, Roger -- .''`. 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.
diff --git a/lib/Sbuild/Build.pm b/lib/Sbuild/Build.pm index ae41572..0d866c8 100644 --- a/lib/Sbuild/Build.pm +++ b/lib/Sbuild/Build.pm @@ -44,7 +44,7 @@ use Sbuild::Sysconfig qw($version $release_date); 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; @@ -432,7 +432,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 = ""; @@ -458,7 +458,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"); @@ -648,10 +649,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"); @@ -691,19 +688,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/; @@ -1772,18 +1765,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; @@ -1898,26 +1879,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 { diff --git a/lib/Sbuild/Utility.pm b/lib/Sbuild/Utility.pm index 6ae6159..49a6d16 100644 --- a/lib/Sbuild/Utility.pm +++ b/lib/Sbuild/Utility.pm @@ -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;
signature.asc
Description: Digital signature