[dpkg] 125/192: scripts: Use split() with ' ' instead of /\s+/

Ximin Luo infinity0 at debian.org
Tue Oct 17 11:04:09 UTC 2017


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch pu/reproducible_builds
in repository dpkg.

commit ff837f376cf97167e65b2b41e2e16103c98a911f
Author: Guillem Jover <guillem at debian.org>
Date:   Sun Sep 17 12:01:45 2017 +0200

    scripts: Use split() with ' ' instead of /\s+/
---
 debian/changelog                  | 1 +
 scripts/Dpkg/Arch.pm              | 2 +-
 scripts/Dpkg/BuildProfiles.pm     | 4 ++--
 scripts/Dpkg/Shlibs/SymbolFile.pm | 2 +-
 scripts/dpkg-buildpackage.pl      | 4 ++--
 scripts/dpkg-source.pl            | 2 +-
 6 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index c62d234..78fbec3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -93,6 +93,7 @@ dpkg (1.19.0) UNRELEASED; urgency=medium
       deb-triggers(5). Closes: #864882
   * Code internals:
     - Switch perl code to use -> operator for function variables.
+    - Switch perl code from split() with /\s+/ to ' '.
   * Build system:
     - Require Perl 5.20.2, the version in Debian oldstable (jessie).
     - Use new gcc-7 -Wrestrict and -Wshift-negative-value warnings if
diff --git a/scripts/Dpkg/Arch.pm b/scripts/Dpkg/Arch.pm
index 85b2761..3be9281 100644
--- a/scripts/Dpkg/Arch.pm
+++ b/scripts/Dpkg/Arch.pm
@@ -639,7 +639,7 @@ Parse an architecture list.
 sub debarch_list_parse
 {
     my $arch_list = shift;
-    my @arch_list = split /\s+/, $arch_list;
+    my @arch_list = split ' ', $arch_list;
 
     foreach my $arch (@arch_list) {
         if (debarch_is_illegal($arch)) {
diff --git a/scripts/Dpkg/BuildProfiles.pm b/scripts/Dpkg/BuildProfiles.pm
index 3f8580b..8684077 100644
--- a/scripts/Dpkg/BuildProfiles.pm
+++ b/scripts/Dpkg/BuildProfiles.pm
@@ -60,7 +60,7 @@ sub get_build_profiles {
     return @build_profiles if $cache_profiles;
 
     if (Dpkg::Build::Env::has('DEB_BUILD_PROFILES')) {
-        @build_profiles = split /\s+/, Dpkg::Build::Env::get('DEB_BUILD_PROFILES');
+        @build_profiles = split ' ', Dpkg::Build::Env::get('DEB_BUILD_PROFILES');
     }
     $cache_profiles = 1;
 
@@ -93,7 +93,7 @@ sub parse_build_profiles {
 
     $string =~ s/^\s*<\s*(.*)\s*>\s*$/$1/;
 
-    return map { [ split /\s+/ ] } split /\s*>\s+<\s*/, $string;
+    return map { [ split ' ' ] } split /\s*>\s+<\s*/, $string;
 }
 
 =item evaluate_restriction_formula(\@formula, \@profiles)
diff --git a/scripts/Dpkg/Shlibs/SymbolFile.pm b/scripts/Dpkg/Shlibs/SymbolFile.pm
index 60fd80f..d03ce25 100644
--- a/scripts/Dpkg/Shlibs/SymbolFile.pm
+++ b/scripts/Dpkg/Shlibs/SymbolFile.pm
@@ -408,7 +408,7 @@ sub merge_symbols {
     my %include_groups = ();
     my $groups = $self->get_field($soname, 'Ignore-Blacklist-Groups');
     if (defined $groups) {
-        $include_groups{$_} = 1 foreach (split /\s+/, $groups);
+        $include_groups{$_} = 1 foreach (split ' ', $groups);
     }
 
     my %dynsyms;
diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl
index 75ea4d6..bb750f0 100755
--- a/scripts/dpkg-buildpackage.pl
+++ b/scripts/dpkg-buildpackage.pl
@@ -226,7 +226,7 @@ while (@ARGV) {
 	$parallel_force = 0;
     } elsif (/^(?:-r|--root-command=)(.*)$/) {
 	my $arg = $1;
-	@rootcommand = split /\s+/, $arg;
+	@rootcommand = split ' ', $arg;
     } elsif (/^--check-command=(.*)$/) {
 	$check_command = $1;
     } elsif (/^--check-option=(.*)$/) {
@@ -339,7 +339,7 @@ while (@ARGV) {
 	warning(g_('-E and -W are deprecated, they are without effect'));
     } elsif (/^-R(.*)$/ or /^--rules-target=(.*)$/) {
 	my $arg = $1;
-	@debian_rules = split /\s+/, $arg;
+	@debian_rules = split ' ', $arg;
     } else {
 	usageerr(g_('unknown option or argument %s'), $_);
     }
diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl
index b49be89..a4316fb 100755
--- a/scripts/dpkg-source.pl
+++ b/scripts/dpkg-source.pl
@@ -285,7 +285,7 @@ if ($options{opmode} =~ /^(build|print-format|(before|after)-build|commit)$/) {
 
         my $pkg_summary = sprintf('%s %s %s %s', $p, $type, $sect, $prio);
 
-        $pkg_summary .= ' arch=' . join ',', split /\s+/, $arch;
+        $pkg_summary .= ' arch=' . join ',', split ' ', $arch;
 
         if (defined $profile) {
             # If the string does not contain brackets then it is using the

-- 
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