|
|
@@ -13,17 +13,32 @@
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
-use Test::More tests => 11;
|
|
|
+use Test::More tests => 20;
|
|
|
|
|
|
use strict;
|
|
|
use warnings;
|
|
|
use IO::String;
|
|
|
|
|
|
-use_ok('Dpkg::Control::Info');
|
|
|
+BEGIN {
|
|
|
+ use_ok('Dpkg::Control');
|
|
|
+ use_ok('Dpkg::Control::Info');
|
|
|
+}
|
|
|
|
|
|
my $srcdir = $ENV{srcdir} || '.';
|
|
|
my $datadir = $srcdir . '/t/700_Dpkg_Control';
|
|
|
|
|
|
+sub parse_dsc {
|
|
|
+ my ($path) = @_;
|
|
|
+
|
|
|
+ my $dsc = Dpkg::Control->new(type => CTRL_PKG_SRC);
|
|
|
+ eval {
|
|
|
+ $dsc->load($path);
|
|
|
+ 1;
|
|
|
+ } or return;
|
|
|
+
|
|
|
+ return $dsc;
|
|
|
+}
|
|
|
+
|
|
|
my $c = Dpkg::Control::Info->new("$datadir/control-1");
|
|
|
|
|
|
my $io = IO::String->new();
|
|
|
@@ -86,3 +101,25 @@ is(${$io->string_ref()},
|
|
|
Architecture: all
|
|
|
Depends: hello
|
|
|
', "Dump of second binary package of $datadir/control-1");
|
|
|
+
|
|
|
+# Check OpenPGP armored signatures in source control files
|
|
|
+
|
|
|
+my $dsc;
|
|
|
+
|
|
|
+$dsc = parse_dsc("$datadir/bogus-unsigned.dsc");
|
|
|
+is($dsc, undef, 'Unsigned .dsc w/ OpenPGP armor');
|
|
|
+
|
|
|
+$dsc = parse_dsc("$datadir/bogus-armor-trail.dsc");
|
|
|
+is($dsc, undef, 'Signed .dsc w/ bogus OpenPGP armor trailer');
|
|
|
+
|
|
|
+$dsc = parse_dsc("$datadir/bogus-armor-double.dsc");
|
|
|
+ok(defined $dsc, 'Signed .dsc w/ two OpenPGP armor signatures');
|
|
|
+is($dsc->{Source}, 'pass', 'Signed spaced .dsc package name');
|
|
|
+
|
|
|
+$dsc = parse_dsc("$datadir/bogus-armor-spaces.dsc");
|
|
|
+ok(defined $dsc, 'Signed .dsc w/ spaced OpenPGP armor');
|
|
|
+is($dsc->{Source}, 'pass', 'Signed spaced .dsc package name');
|
|
|
+
|
|
|
+$dsc = parse_dsc("$datadir/bogus-armor-nested.dsc");
|
|
|
+ok(defined $dsc, 'Signed .dsc w/ nested OpenPGP armor');
|
|
|
+is($dsc->{Source}, 'pass', 'Signed nested .dsc package name');
|