summaryrefslogtreecommitdiff
path: root/scripts/t
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2017-08-20 02:22:16 +0200
committerGuillem Jover <guillem@debian.org>2017-10-17 02:27:01 +0200
commit0b1391fd2c30e9ad955fde84c90c30509877b5c4 (patch)
treea97a4a0a05096fdaf66ec6ae2a7e7ab3f684133a /scripts/t
parent9e5e03e9a6ddf74bb22ffc5ea8794a14a592d6b6 (diff)
downloaddpkg-0b1391fd2c30e9ad955fde84c90c30509877b5c4.tar.gz
Dpkg::Source::Package: Auto-convert binary signatures to OpenPGP ASCII Armor
When we are building a source package, if we find a binary signature in the form of a .sig file, we should try to auto-convert it to the format that we expect to include in the source package, which is an OpenPGP ASCII Armor.
Diffstat (limited to 'scripts/t')
-rw-r--r--scripts/t/Dpkg_OpenPGP.t56
-rw-r--r--scripts/t/Dpkg_OpenPGP/package_1.0.orig.tar0
-rw-r--r--scripts/t/Dpkg_OpenPGP/package_1.0.orig.tar.asc16
-rw-r--r--scripts/t/Dpkg_OpenPGP/package_1.0.orig.tar.sigbin0 -> 566 bytes
4 files changed, 72 insertions, 0 deletions
diff --git a/scripts/t/Dpkg_OpenPGP.t b/scripts/t/Dpkg_OpenPGP.t
new file mode 100644
index 000000000..ee78da6d3
--- /dev/null
+++ b/scripts/t/Dpkg_OpenPGP.t
@@ -0,0 +1,56 @@
+#!/usr/bin/perl
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+use strict;
+use warnings;
+
+use Test::More tests => 3;
+use Test::Dpkg qw(:paths);
+
+use File::Compare;
+
+use Dpkg::ErrorHandling;
+
+BEGIN {
+ use_ok('Dpkg::OpenPGP');
+}
+
+report_options(quiet_warnings => 1);
+
+my $datadir = test_get_data_path('t/Dpkg_OpenPGP');
+my $tmpdir = 't.tmp/Dpkg_OpenPGP';
+
+mkdir $tmpdir;
+
+openpgp_sig_to_asc("$datadir/package_1.0.orig.tar.sig",
+ "$tmpdir/package_1.0.orig.tar.sig2asc");
+
+ok(compare("$tmpdir/package_1.0.orig.tar.sig2asc",
+ "$datadir/package_1.0.orig.tar.asc") == 0,
+ 'binary signature converted to OpenPGP ASCII Armor');
+
+# Grab the output messages.
+eval {
+ openpgp_sig_to_asc("$datadir/package_1.0.orig.tar.asc",
+ "$tmpdir/package_1.0.orig.tar.asc2asc");
+};
+
+ok(compare("$tmpdir/package_1.0.orig.tar.asc2asc",
+ "$datadir/package_1.0.orig.tar.asc") == 0,
+ 'OpenPGP ASCII Armor copied to destination');
+
+# TODO: Add actual test cases.
+
+1;
diff --git a/scripts/t/Dpkg_OpenPGP/package_1.0.orig.tar b/scripts/t/Dpkg_OpenPGP/package_1.0.orig.tar
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/scripts/t/Dpkg_OpenPGP/package_1.0.orig.tar
diff --git a/scripts/t/Dpkg_OpenPGP/package_1.0.orig.tar.asc b/scripts/t/Dpkg_OpenPGP/package_1.0.orig.tar.asc
new file mode 100644
index 000000000..06f2ab066
--- /dev/null
+++ b/scripts/t/Dpkg_OpenPGP/package_1.0.orig.tar.asc
@@ -0,0 +1,16 @@
+-----BEGIN PGP SIGNATURE-----
+
+iQIzBAABCgAdFiEETz509DYFDBD1aWV0uXK/PqSuV6MFAlnijuMACgkQuXK/PqSu
+V6Oiuw/+P0+5BMH/WfsyhDrykF90tp2q6+eQvbgny8Mo1SJT647cS0bXFrZqd1Zr
+22hFouKLbbqmJVm7GqIyWzg6mWvRJ85tvKMhwaUHiNKBrwOguw6crk8TdRidvS1p
+m7E70wYdoPGvLt0Sr7nDWyaj82r3QkqTWTMxiD9jD4Z3w5Ztz08rpho6CJcGcAlv
+09WGRVo+AiQLDRT70T7598lilHviFNGJdC9sVOrkEyFVDJZirnTvqXgqTJAy5Lve
+DjTnfYAzmivtsQUXkYIj31XWLsiFa5mfpl6FSmFUSBPXALO++sZrL+mQZoUqnBv/
+bxCg3RYbPA6dpZ9IB/gyAvvEOEECeA4v5gDqGn67FeZsALPOEhvAYclkMtLOQBxr
+sJD9GPCQtT2QfObmaUlqabXASNjzguayprh+a8CJChyBKWSvn6LoSdsBzesPT/bh
+DJenc5M9jvIVShiwqQYCdYotebdKYDIvelblz0TbaTs5RZNGrizgj4Mrl0CaKVHs
+51M8Vpb+w1TM+jm3b+5Na+v9TuS0TxGKI1FTyfjZMjF92AF3A13KanSWMg+37eE1
+R1R4pPuJ2s4xYULQNh+BTHlrGso43nxzc2gkJbsPRa6n3fZFRVdYfkIJgv4kzaQD
+Lgsnhzrz1onBWvfnFWlJaRZ/ti4/3EEHAFvt25ZLMyJC2WOCG4I=
+=N2cG
+-----END PGP SIGNATURE-----
diff --git a/scripts/t/Dpkg_OpenPGP/package_1.0.orig.tar.sig b/scripts/t/Dpkg_OpenPGP/package_1.0.orig.tar.sig
new file mode 100644
index 000000000..a15acecde
--- /dev/null
+++ b/scripts/t/Dpkg_OpenPGP/package_1.0.orig.tar.sig
Binary files differ