From 448faad0f04d7f56e5b708ff76213fe0f92c2ae2 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Thu, 14 May 2015 17:19:03 +0200 Subject: 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 --- scripts/Dpkg/Dist/Files.pm | 2 +- scripts/t/Dpkg_Dist_Files.t | 29 ++++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) (limited to 'scripts') 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', @@ -116,6 +126,23 @@ is($dist->get_file('unknown'), undef, 'Get unknown file'); 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 -- cgit v1.2.3