On Sat, Dec 05, 2009 at 02:39:38AM -0500, Andres Mejia wrote: > From 6cccbe91eb787cdf3cb77eed10be88e827b64fda Mon Sep 17 00:00:00 2001 > From: Andres Mejia <mcita...@gmail.com> > Date: Sat, 5 Dec 2009 02:35:09 -0500 > Subject: [PATCH] Allow sbuild to support new source formats
I think some bits need a little tweaking to make the matching a bit stricter, and I think there's a bit missing in one place. I'd must also give due credit to Niels Thykier for his comments on this patch on #debian-devel. > diff --git a/lib/Sbuild/Build.pm b/lib/Sbuild/Build.pm > index 6aae838..be15fd0 100644 > --- a/lib/Sbuild/Build.pm > +++ b/lib/Sbuild/Build.pm > @@ -572,7 +572,7 @@ sub fetch_source_files { > > $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; > + $files =~ /(\Q$pkg\E\.(?:orig\.)?tar\.[a-z\d]+)$/mi and $orig = $1; The tar extension is one of gz, bz2, lzma and xz according to dpkg-source(1). I'd rather do a strict match of (gz|bz2|lzma|xz). Also, does it need to match orig-component here, or is this sufficient? > $self->log_subsubsection("Check arch"); > if (!$dscarchs) { > @@ -2375,7 +2375,22 @@ sub fixup_pkgv { > my $pkgv = shift; > > $pkgv =~ s,^.*/,,; # strip path > - $pkgv =~ s/\.(dsc|diff\.gz|tar\.gz|deb)$//; # strip extension > + $pkgv =~ s{ > + \. # strip the preceding dot > + ( # for grouping the variuos suffixes > + dsc| # a dsc > + deb| # or deb > + diff\.gz| # or diff.gz > + debian\.tar\.[a-z\d]+| # or debian.tar.$extension As above, I'd rather use (gz|bz2|lzma|xz) in place of [a-z\d]+ > + ( # or some tarball > + orig # orig > + (-[\w-]+)? # followed by component part 0 or 1 time I'm not sure this is correct. From dpkg-source(1): "component can only contain alphanumeric characters and dashes ("-")". I'd rather match on the strict [[:alnum:]-] (or it's Perlish equivalent) rather than any non-whitespace. > + \. # followed by a dot > + )? # matches 0 time for native, 1 time for upstream > + tar # tar portion > + \.[a-z\d]+ # matches any extension like gz, bz2, etc. This is another case of allowing all extentions. > + )$ # must be at the end of the line > + }{}x; # strip extension > $pkgv =~ s/_[a-zA-Z\d+~-]+\.(changes|deb)$//; # strip extension > > return $pkgv; > @@ -2510,8 +2525,10 @@ sub dsc_files { > my $stanza = @{$stanzas}[0]; > > # We're only interested in the name of the files in the Files field. > + my $source = ${$stanza}{'Source'}; > + $source =~ s/\s+//msg; > my $entry = ${$stanza}{'Files'}; > - @files = grep(/\.tar\.gz$|\.diff\.gz$/, split(/\s/, $entry)); > + @files = grep(/$source/, split(/\s+/, $entry)); I'm not entirely clear on what this bit is doing. Could you possibly explain what the change is here? Many thanks, 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.
signature.asc
Description: Digital signature