[Reproducible-commits] [dpkg] 39/90: Dpkg::Dist::Files: Allow colons (:) in added filenames
Jérémy Bobbio
lunar at moszumanska.debian.org
Sat Aug 29 18:26:12 UTC 2015
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch pu/reproducible_builds
in repository dpkg.
commit 354bdeeee01d3faf8c19e13f7fcbd6ee5cc7b83a
Author: Guillem Jover <guillem at debian.org>
Date: Sun Jul 19 16:32:08 2015 +0200
Dpkg::Dist::Files: Allow colons (:) in added filenames
Regression introduced in commit ab15fd24dd1a8207ab1463410338f24283989f7c.
Packages can contain colons in their filenames if the upstream version
contains colons.
Reported-by: Jakub Wilk <jwilk at debian.org>
---
debian/changelog | 3 +++
scripts/Dpkg/Dist/Files.pm | 4 ++--
scripts/t/Dpkg_Dist_Files.t | 42 ++++++++++++++++++++++++++----------------
3 files changed, 31 insertions(+), 18 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 487b176..01feb30 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -26,6 +26,9 @@ dpkg (1.18.2) UNRELEASED; urgency=low
- Disable the thread sanitizer when the address sanitizer is enabled
in Dpkg::Vendor::Debian as these are mutually incompatible, and make
sanitize=+all not work at all.
+ - Allow colons (:) in added filenames in Dpkg::Dist::Files, which can be
+ present when the upstream version contains colons. Regression introduced
+ in dpkg 1.18.0. Reported by Jakub Wilk <jwilk at debian.org>.
* Documentation:
- Fix grammar in dpkg-architecture(1).
Thanks to Chris Lamb <lamby at debian.org>. Closes: #787616
diff --git a/scripts/Dpkg/Dist/Files.pm b/scripts/Dpkg/Dist/Files.pm
index 8fba17f..2045a1a 100644
--- a/scripts/Dpkg/Dist/Files.pm
+++ b/scripts/Dpkg/Dist/Files.pm
@@ -52,13 +52,13 @@ sub parse_filename {
my $file;
- if ($fn =~ m/^(([-+.0-9a-z]+)_([^_]+)_([-\w]+)\.([a-z0-9.]+))$/) {
+ if ($fn =~ m/^(([-+:.0-9a-z]+)_([^_]+)_([-\w]+)\.([a-z0-9.]+))$/) {
$file->{filename} = $1;
$file->{package} = $2;
$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 8d58437..aec628e 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 => 23;
+use Test::More tests => 24;
use_ok('Dpkg::Dist::Files');
@@ -25,13 +25,13 @@ 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',
+ 'pkg-src_4:2.0+1A~rc1-1.dsc' => {
+ filename => 'pkg-src_4: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',
+ 'pkg-src_4:2.0+1A~rc1-1.tar.xz' => {
+ filename => 'pkg-src_4:2.0+1A~rc1-1.tar.xz',
section => 'source',
priority => 'extra',
},
@@ -72,6 +72,11 @@ my %expected = (
section => 'webdocs',
priority => 'optional',
},
+ 'another:filename' => {
+ filename => 'another:filename',
+ section => 'by-hand',
+ priority => 'extra',
+ },
'added-on-the-fly' => {
filename => 'added-on-the-fly',
section => 'void',
@@ -127,20 +132,25 @@ 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
+another:filename by-hand extra
+pkg-src_4:2.0+1A~rc1-1.dsc source extra
+pkg-src_4: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');
+$dist->add_file('pkg-src_4:2.0+1A~rc1-1.dsc', 'source', 'extra');
+$dist->add_file('pkg-src_4:2.0+1A~rc1-1.tar.xz', 'source', 'extra');
+$dist->add_file('another:filename', 'by-hand', 'extra');
+
+is_deeply($dist->get_file('pkg-src_4:2.0+1A~rc1-1.dsc'),
+ $expected{'pkg-src_4:2.0+1A~rc1-1.dsc'},
+ 'Get added file pkg-src_4:2.0+1A~rc1-1.dsc');
+is_deeply($dist->get_file('pkg-src_4:2.0+1A~rc1-1.tar.xz'),
+ $expected{'pkg-src_4:2.0+1A~rc1-1.tar.xz'},
+ 'Get added file pkg-src_4:2.0+1A~rc1-1.tar.xz');
+is_deeply($dist->get_file('another:filename'),
+ $expected{'another:filename'},
+ 'Get added file another:filename');
is($dist->output, $expected, 'Added source files');
$expected = <<'FILES';
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git
More information about the Reproducible-commits
mailing list