Bug#779559: dpkg-source: Add test dependencies to .dsc

Martin Pitt mpitt at debian.org
Fri May 13 12:04:46 UTC 2016


Hey Guillem,

Guillem Jover [2016-05-09  3:34 +0200]:
> > But I'm not sure at which point the Xs- prefix disappears, nor when the new
> > field would become official -- is it necessary to check for it here? Or just
> > for 'Testsuite-Triggers'?
> 
> This depends on whether the field has had usage before it was known to
> dpkg-dev (in the form XS-Field), otherwise if it has just been added
> now then there's no need to check for the export markers.

This has never been used, so I dropped the Xs-* thing.

> You can use deps_iterate() from Dpkg::Deps instead.

Done.

> You could use Dpkg::Index here instead which can parse the control
> file and store a Dpkg::Control per paragraph. Eventually we might want
> to add something like Dpkg::Control::Tests(uite) or something like that.

I did this, but kept it as a separate patch. It does not make the
logic significantly easier, and requires gems like

  foreach my $rec (values %{$index->{items}}) {

(Dpkg::Index does not have any documented way of iterating over all
fields). It also needs a non-trivial get_key_func() -- while I don't
actually use the keys, not having a key_func causes nasty perl
warnings.

If you prefer this, rebase -i 'f'ixup this into the first patch.

> 
> > +        $control->{'Depends'} =~ s/(^|,)\s*(@|\@builddeps@)([[:space:],]|$)/$1$3/g;
> 
> I didn't like this part which seems a bit fragile, and has to be kept
> in sync with dependency parsing if something changes in that sense. So
> I've added a tests_dep option to deps_parse() for 1.18.7, that will
> allow package names with @ in them, then you can filter them out with
> the rest.

Very nice! Did that now.

> > +    $fields->{'Testsuite-Triggers'} = join(', ', sort keys %testdeps) if %testdeps;
> 
> No need for the conditional, the dumper will ignore undef fields.

It'll actually be an empty string, but indeed the dumper ignores that
too, so I dropped it.

Updated patches attached, rebased against master from today.  This
looks a lot more succinct and elegant now, thanks for these hints!

As before, I tested various d/t/control scenarios, with/without manual
T-T: field in d/control, package build, etc.

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-dpkg-source-Generate-Testsuite-Triggers-field-from-t.patch
Type: text/x-diff
Size: 4024 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/autopkgtest-devel/attachments/20160513/27f846e1/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-dpkg-source.pl-Use-Dpkg-Index-to-parse-debian-tests-.patch
Type: text/x-diff
Size: 2002 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/autopkgtest-devel/attachments/20160513/27f846e1/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/autopkgtest-devel/attachments/20160513/27f846e1/attachment.sig>


More information about the autopkgtest-devel mailing list