[buildd-tools-devel] Bug#559533: Bug#559533: sbuild: does not support new source formats

Andres Mejia mcitadel at gmail.com
Mon Dec 14 01:01:08 UTC 2009


On Sunday 13 December 2009 16:54:14 Roger Leigh wrote:
> 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 <mcitadel at 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?

A stricter match is ok. Also, it shouldn't match the debian tarball and I 
think this does now that I look at it again. Perhaps a better regex would be

/(\Q$pkg\E\.(?:orig\.|)tar\.(?:gz|bz2|lzma|xz))$/mi

Haven't tested this.

> >      $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.

The '(-[\w-]+)?' regex I found looking at dpkg-source's source code.

> > +                \. # 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?

It's getting the name of the source package via the "Source" field and 
stripping out the white space from the entry (leading space and trailing \n). 
Then it's splitting the "Files" entry by white space, and only adding the 
source package files into the @files array via the source package name, which 
should leave out the checksum and the size of the file. This is different from 
adding entries to the @files array via 'tar.gz' or 'diff.gz'.

> 
> Many thanks,
> Roger
> 

-- 
Regards,
Andres





More information about the Buildd-tools-devel mailing list