On Sun, 2014-01-19 at 11:39:50 +0000, Ian Jackson wrote:
> Guillem Jover writes ("Re: Bug#735975: Dpkg::Control::Hash: would like more 
> subtle pgp check"):
> ...
> > Starting with version 1.17.0 the Dpkg::Control::Hash module records
> > that fact in the is_pgp_signed option. This is not documented, so you
> > might not want to rely on it, expecting to be an internal detail. But
> > I can make it part of the public interface by documenting it in the
> > next release, as it seems useful outside of Dpkg::Source::Package too.
> 
> Great.
> 
> > The way to retrieve it, as of now is:
> >   $ctrl->get_option('is_pgp_signed');
> > Would that be enough for your needs?
> 
> Yes, that would be exactly the kind of thing I want.

Ok, then I'm documenting that for 1.17.7.

> Since I want to make dgit easy to use even on older releases of Debian
> (and derivatives thereof), I will want to have some kind of way of
> telling whether the version of Dpkg::Control::Hash supports this
> feature.
>
> Experimentation with squeeze and sid[1] shows me that when the feature
> is supported but the message isn't signed, that get_option returns
> 0, whereas if the feature isn't supported it returns undef.  Can I
> rely on this or is there a better way ?

Yes, you could rely on this, but there's actually another option, in
this case you could use Dpkg::Source::Package instead which has a
is_signed() method since its inception (it only got documented as a
public interface in 1.16.1, but that interface has never changed).
The drawback is that your code might need to end up parsing the .dsc
file twice, but that should not be such a performance issue.

> [1]
> perl -e 'use Data::Dumper; use Dpkg::Control::Hash; my $h = new
>  Dpkg::Control::Hash; $h->load("debian/control") or die; my $y =
>  $h->get_option("is_pgp_signed"); print Dumper($y);'

BTW, you might want to use instead, something like:

,---
my $dsc = Dpkg::Control->new(type => CTRL_PKG_SRC);
`---

which will set a correct name for error messages and similar, and
field ordering for that type.

Thanks,
Guillem


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to