summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2015-05-14 17:19:03 +0200
committerGuillem Jover <guillem@debian.org>2015-05-18 06:25:11 +0200
commit448faad0f04d7f56e5b708ff76213fe0f92c2ae2 (patch)
tree5f725ade62e590f17e0d8d087c8fb1b159df22cb /scripts
parent915151a10317220fcf7d3b821020c94808fad155 (diff)
downloaddpkg-448faad0f04d7f56e5b708ff76213fe0f92c2ae2.tar.gz
Dpkg::Dist::Files: Allow ~ in added filenames
When we are constructing a .changes file we add the source artifacts to the distribution manually, before loading the distribution list from debian/files. We should allow ~ in the filename as that's a valid character in a version number. Regression introduced in commit ab15fd24dd1a8207ab1463410338f24283989f7c. Reported-by: Niels Thykier <niels@thykier.net>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Dpkg/Dist/Files.pm2
-rw-r--r--scripts/t/Dpkg_Dist_Files.t29
2 files changed, 29 insertions, 2 deletions
diff --git a/scripts/Dpkg/Dist/Files.pm b/scripts/Dpkg/Dist/Files.pm
index 719026f31..8fba17f35 100644
--- a/scripts/Dpkg/Dist/Files.pm
+++ b/scripts/Dpkg/Dist/Files.pm
@@ -58,7 +58,7 @@ sub parse_filename {
$file->{version} = $3;
$file->{arch} = $4;
$file->{package_type} = $5;
- } elsif ($fn =~ m/^([-+.,_0-9a-zA-Z]+)$/) {
+ } elsif ($fn =~ m/^([-+.,_0-9a-zA-Z~]+)$/) {
$file->{filename} = $1;
} else {
$file = undef;
diff --git a/scripts/t/Dpkg_Dist_Files.t b/scripts/t/Dpkg_Dist_Files.t
index cfd700b77..8d58437b5 100644
--- a/scripts/t/Dpkg_Dist_Files.t
+++ b/scripts/t/Dpkg_Dist_Files.t
@@ -16,7 +16,7 @@
use strict;
use warnings;
-use Test::More tests => 20;
+use Test::More tests => 23;
use_ok('Dpkg::Dist::Files');
@@ -25,6 +25,16 @@ my $datadir = $srcdir . '/t/Dpkg_Dist_Files';
my $expected;
my %expected = (
+ 'pkg-src_2.0+1A~rc1-1.dsc' => {
+ filename => 'pkg-src_2.0+1A~rc1-1.dsc',
+ section => 'source',
+ priority => 'extra',
+ },
+ 'pkg-src_2.0+1A~rc1-1.tar.xz' => {
+ filename => 'pkg-src_2.0+1A~rc1-1.tar.xz',
+ section => 'source',
+ priority => 'extra',
+ },
'pkg-templ_1.2.3_arch.type' => {
filename => 'pkg-templ_1.2.3_arch.type',
package => 'pkg-templ',
@@ -117,6 +127,23 @@ is($dist->get_file('pkg-indep_0.0.1-2_all.deb'), undef, 'Get deleted file');
is($dist->output(), $expected, 'Modified dist object');
$expected = <<'FILES';
+pkg-src_2.0+1A~rc1-1.dsc source extra
+pkg-src_2.0+1A~rc1-1.tar.xz source extra
+FILES
+
+$dist->reset();
+$dist->add_file('pkg-src_2.0+1A~rc1-1.dsc', 'source', 'extra');
+$dist->add_file('pkg-src_2.0+1A~rc1-1.tar.xz', 'source', 'extra');
+
+is_deeply($dist->get_file('pkg-src_2.0+1A~rc1-1.dsc'),
+ $expected{'pkg-src_2.0+1A~rc1-1.dsc'},
+ 'Get added file pkg-src_2.0+1A~rc1-1.dsc');
+is_deeply($dist->get_file('pkg-src_2.0+1A~rc1-1.tar.xz'),
+ $expected{'pkg-src_2.0+1A~rc1-1.tar.xz'},
+ 'Get added file pkg-src_2.0+1A~rc1-1.tar.xz');
+is($dist->output, $expected, 'Added source files');
+
+$expected = <<'FILES';
pkg-arch_2.0.0_amd64.deb admin required
pkg-indep_0.0.1-2_all.deb net standard
pkg-templ_1.2.3_arch.type section priority