소스 검색

scripts: Use non-destructive substitutions inside map

This avoids having to use a temporary variable, and makes the code more
clear.
Guillem Jover 11 년 전
부모
커밋
e4baa20f72
3개의 변경된 파일3개의 추가작업 그리고 6개의 파일을 삭제
  1. 1 0
      debian/changelog
  2. 1 1
      scripts/Dpkg/Source/Package/V1.pm
  3. 1 5
      scripts/Dpkg/Source/Package/V2.pm

+ 1 - 0
debian/changelog

@@ -7,6 +7,7 @@ dpkg (1.18.1) UNRELEASED; urgency=low
     Closes: #720761
   * Perl modules:
     - Add missing strict and warnings pragmas for submodules.
+    - Use non-destructive substitutions inside map.
 
   [ Updated programs translations ]
   * German (Sven Joachim).

+ 1 - 1
scripts/Dpkg/Source/Package/V1.pm

@@ -378,7 +378,7 @@ sub do_build {
 
 	my $analysis = $diff->analyze($origdir);
 	my @files = grep { ! m{^debian/} }
-		    map { my $file = $_; $file =~ s{^[^/]+/+}{}; $file }
+		    map { s{^[^/]+/+}{}r }
 		    sort keys %{$analysis->{filepatched}};
 	if (scalar @files) {
 	    warning(g_('the diff modifies the following upstream files: %s'),

+ 1 - 5
scripts/Dpkg/Source/Package/V2.pm

@@ -466,11 +466,7 @@ sub do_build {
         }
     };
     my $tar_ignore_glob = '{' . join(',',
-        map {
-            my $copy = $_;
-            $copy =~ s/,/\\,/g;
-            $copy;
-        } @{$self->{options}{tar_ignore}}) . '}';
+        map { s/,/\\,/rg } @{$self->{options}{tar_ignore}}) . '}';
     my $filter_ignore = sub {
         # Filter out files that are not going to be included in the debian
         # tarball due to ignores.