[devscripts] 09/09: mk-origtargz: Use the already parsed $data to check for Files-Excluded
James McCoy
jamessan at debian.org
Thu Apr 24 04:41:20 UTC 2014
This is an automated email from the git hooks/post-receive script.
jamessan pushed a commit to branch master
in repository devscripts.
commit 0bb86058a07a83908200af96764acb6ec1b307b2
Author: James McCoy <jamessan at debian.org>
Date: Thu Apr 24 00:29:04 2014 -0400
mk-origtargz: Use the already parsed $data to check for Files-Excluded
If Files-Excluded is present in a copyright file, then it should be a
valid file for parsing by Dpkg::Control::Hash, so use
$data->{'files-excluded'} to see if the field was specified. If it was,
then we can check for a valid format, without the need to re-read the
copyright file.
Signed-off-by: James McCoy <jamessan at debian.org>
---
scripts/mk-origtargz.pl | 19 ++++++-------------
test/test_mk-origtargz | 2 +-
2 files changed, 7 insertions(+), 14 deletions(-)
diff --git a/scripts/mk-origtargz.pl b/scripts/mk-origtargz.pl
index fcf95ca..4fcff48 100755
--- a/scripts/mk-origtargz.pl
+++ b/scripts/mk-origtargz.pl
@@ -287,26 +287,19 @@ for my $copyright_file (@copyright_files) {
die "File $copyright_file not found.";
} elsif ( $data
&& defined $data->{'format'}
- && $data->{'format'} =~ m{^$okformat/?$})
+ && $data->{'files-excluded'})
{
- if ($data->{'files-excluded'})
- {
+ if ($data->{'format'} =~ m{^$okformat/?$}) {
my @rawexcluded = ($data->{"files-excluded"} =~ /(?:\A|\G\s+)((?:\\.|[^\\\s])+)/g);
# un-escape
push @exclude_globs, map { s/\\(.)/$1/g; s?/+$??; $_ } @rawexcluded;
- }
- } else {
- # be helpful
- my $has_files_excluded = 0;
- open COPYRIGHT, "debian/copyright" or die "debian/copyright $!\n";
- $has_files_excluded ||= /Files-Excluded/i while (<COPYRIGHT>);
- close COPYRIGHT;
+ } else {
print STDERR
- "WARNING: The file debian/copyright mentions Files-Excluded, but its ".
+ "WARNING: The file $copyright_file mentions Files-Excluded, but its ".
"format is not recognized. Specify Format: ".
"http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ ".
- "in order to remove files from the tarball with mk_origtargz.\n"
- if ($has_files_excluded);
+ "in order to remove files from the tarball with mk-origtargz.\n";
+ }
}
}
diff --git a/test/test_mk-origtargz b/test/test_mk-origtargz
index a43e366..11ae8c8 100755
--- a/test/test_mk-origtargz
+++ b/test/test_mk-origtargz
@@ -389,7 +389,7 @@ testCopyrightFormatWarning() {
makeDebanDir
makeWrongDebianCopyright
run_mk_origtargz foo \
- "WARNING: The file debian/copyright mentions Files-Excluded, but its format is not recognized. Specify Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ in order to remove files from the tarball with mk_origtargz." \
+ "WARNING: The file debian/copyright mentions Files-Excluded, but its format is not recognized. Specify Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ in order to remove files from the tarball with mk-origtargz." \
"Successfully symlinked ../foo-0.1.tar.gz to ../foo_0.1.orig.tar.gz." \
../foo-0.1.tar.gz
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git
More information about the devscripts-devel
mailing list