OSDN Git Service

streamline_config.pl: make spacing consistent
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Tue, 29 Jun 2021 02:33:44 +0000 (19:33 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 29 Jun 2021 17:53:45 +0000 (10:53 -0700)
Patch series "streamline_config.pl: Fix Perl spacing".

Talking with John Hawley about how vim and emacs deal with Perl files with
respect to tabs and spaces, I found that some of my Perl code in the
kernel had inconsistent spacing.  The way emacs handles Perl by default is
to use 4 spaces per indent, but make all 8 spaces into a single tab.  Vim
does not do this by default.  But if you add the vim variable control:

 # vim: softtabstop=4

to a perl file, it makes vim behave the same way as emacs.

The first patch is to change all 8 spaces into a single tab (mostly from
people editing the file with vim).  The next patch adds the softtabstop
variable to make vim act like emacs by default.

This patch (of 2):

As Perl code tends to have 4 space indentation, but uses tabs for every 8
spaces, make that consistent in the streamline_config.pl code.  Replace
all 8 spaces with a single tab.

Link: https://lkml.kernel.org/r/20210322214032.133596267@goodmis.org
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Cc: "John (Warthog9) Hawley" <warthog9@kernel.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/kconfig/streamline_config.pl

index 911c72a..2e65aa9 100755 (executable)
@@ -601,12 +601,12 @@ if (defined($ENV{'LMC_KEEP'})) {
 sub in_preserved_kconfigs {
     my $kconfig = $config2kfile{$_[0]};
     if (!defined($kconfig)) {
-        return 0;
+       return 0;
     }
     foreach my $excl (@preserved_kconfigs) {
-        if($kconfig =~ /^$excl/) {
-            return 1;
-        }
+       if($kconfig =~ /^$excl/) {
+           return 1;
+       }
     }
     return 0;
 }
@@ -629,52 +629,52 @@ foreach my $line (@config_file) {
     }
 
     if (/CONFIG_MODULE_SIG_KEY="(.+)"/) {
-        my $orig_cert = $1;
-        my $default_cert = "certs/signing_key.pem";
-
-        # Check that the logic in this script still matches the one in Kconfig
-        if (!defined($depends{"MODULE_SIG_KEY"}) ||
-            $depends{"MODULE_SIG_KEY"} !~ /"\Q$default_cert\E"/) {
-            print STDERR "WARNING: MODULE_SIG_KEY assertion failure, ",
-                "update needed to ", __FILE__, " line ", __LINE__, "\n";
-            print;
-        } elsif ($orig_cert ne $default_cert && ! -f $orig_cert) {
-            print STDERR "Module signature verification enabled but ",
-                "module signing key \"$orig_cert\" not found. Resetting ",
-                "signing key to default value.\n";
-            print "CONFIG_MODULE_SIG_KEY=\"$default_cert\"\n";
-        } else {
-            print;
-        }
-        next;
+       my $orig_cert = $1;
+       my $default_cert = "certs/signing_key.pem";
+
+       # Check that the logic in this script still matches the one in Kconfig
+       if (!defined($depends{"MODULE_SIG_KEY"}) ||
+           $depends{"MODULE_SIG_KEY"} !~ /"\Q$default_cert\E"/) {
+           print STDERR "WARNING: MODULE_SIG_KEY assertion failure, ",
+               "update needed to ", __FILE__, " line ", __LINE__, "\n";
+           print;
+       } elsif ($orig_cert ne $default_cert && ! -f $orig_cert) {
+           print STDERR "Module signature verification enabled but ",
+               "module signing key \"$orig_cert\" not found. Resetting ",
+               "signing key to default value.\n";
+           print "CONFIG_MODULE_SIG_KEY=\"$default_cert\"\n";
+       } else {
+           print;
+       }
+       next;
     }
 
     if (/CONFIG_SYSTEM_TRUSTED_KEYS="(.+)"/) {
-        my $orig_keys = $1;
-
-        if (! -f $orig_keys) {
-            print STDERR "System keyring enabled but keys \"$orig_keys\" ",
-                "not found. Resetting keys to default value.\n";
-            print "CONFIG_SYSTEM_TRUSTED_KEYS=\"\"\n";
-        } else {
-            print;
-        }
-        next;
+       my $orig_keys = $1;
+
+       if (! -f $orig_keys) {
+           print STDERR "System keyring enabled but keys \"$orig_keys\" ",
+               "not found. Resetting keys to default value.\n";
+           print "CONFIG_SYSTEM_TRUSTED_KEYS=\"\"\n";
+       } else {
+           print;
+       }
+       next;
     }
 
     if (/^(CONFIG.*)=(m|y)/) {
-        if (in_preserved_kconfigs($1)) {
-            dprint "Preserve config $1";
-            print;
-            next;
-        }
+       if (in_preserved_kconfigs($1)) {
+           dprint "Preserve config $1";
+           print;
+           next;
+       }
        if (defined($configs{$1})) {
            if ($localyesconfig) {
-               $setconfigs{$1} = 'y';
+               $setconfigs{$1} = 'y';
                print "$1=y\n";
                next;
            } else {
-               $setconfigs{$1} = $2;
+               $setconfigs{$1} = $2;
            }
        } elsif ($2 eq "m") {
            print "# $1 is not set\n";