From 177525d26e31806d71653f74bbec13574b97892c Mon Sep 17 00:00:00 2001 From: Andreas Mohr Date: Sun, 3 Apr 2011 20:58:28 +0200 Subject: eradicate bashisms in scripts/patch-kernel Silence a remaining annoying (or worse, irritating - "is my entire patched tree broken now!?") bashism-related message that occurs when /bin/sh is configured to instead deploy dash, a POSIX-compliant shell, as is the pretty much standard case on e.g. Debian. Current kernel version is 2.6.38 ( Flesh-Eating Bats with Fangs) ===> linux-2.6.38.patch-kernel_test/scripts/patch-kernel: line 253: [: =: unary operator expected <=== cannot find patch file: patch-2.6.39 Signed-off-by: Andreas Mohr Signed-off-by: Michal Marek --- scripts/patch-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/patch-kernel b/scripts/patch-kernel index 46a59cae3a0a..20fb25c23382 100755 --- a/scripts/patch-kernel +++ b/scripts/patch-kernel @@ -250,7 +250,7 @@ while : # incrementing SUBLEVEL (s in v.p.s) do CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL" EXTRAVER= - if [ $STOPFULLVERSION = $CURRENTFULLVERSION ]; then + if [ x$STOPFULLVERSION = x$CURRENTFULLVERSION ]; then echo "Stopping at $CURRENTFULLVERSION base as requested." break fi -- cgit v1.2.3-59-g8ed1b From 6088e9ffa29a92e7b80fdba44929f3225c4c0357 Mon Sep 17 00:00:00 2001 From: Peter Foley Date: Tue, 26 Apr 2011 19:07:56 -0400 Subject: kbuild: don't warn about include/linux/version.h not including itself This patch makes checkversion.pl not warn that include/linux/version.h dosen't include itself. Signed-off-by: Peter Foley [mmarek: simplified to use 'next if' syntax] Signed-off-by: Michal Marek --- scripts/checkversion.pl | 1 + 1 file changed, 1 insertion(+) (limited to 'scripts') diff --git a/scripts/checkversion.pl b/scripts/checkversion.pl index b444e89a0095..5e490a8ceca5 100755 --- a/scripts/checkversion.pl +++ b/scripts/checkversion.pl @@ -12,6 +12,7 @@ $| = 1; my $debugging; foreach my $file (@ARGV) { + next if $file =~ "include/linux/version\.h"; # Open this file. open( my $f, '<', $file ) or die "Can't open $file: $!\n"; -- cgit v1.2.3-59-g8ed1b From de7b0b4110795be914e6cafdfec4276b2618cc78 Mon Sep 17 00:00:00 2001 From: Jim Cromie Date: Mon, 23 May 2011 12:44:55 -0600 Subject: export_report: do collectcfiles work in perl itself Avoid spawning a shell pipeline doing cat, grep, sed, and do it all inside perl. The <*.c> globbing construct works at least as far back as 5.8.9 Note that this is not just an optimization; the sed command in the pipeline was unterminated, due to lack of escape on the end-of-line (\$) in the regex, resulting in this: $ perl ../linux-2.6/scripts/export_report.pl > /dev/null sed: -e expression #1, char 5: unterminated `s' command sh: .mod.c/: not found Comments on an earlier patch sought an all-perl implementation. Signed-off-by: Jim Cromie cc: Michal Marek , cc: linux-kbuild@vger.kernel.org cc: Arnaud Lacombe lacombar@gmail.com cc: Stephen Hemminger shemminger@vyatta.com Signed-off-by: Michal Marek --- scripts/export_report.pl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/export_report.pl b/scripts/export_report.pl index 04dce7c15f83..f97899c87923 100644 --- a/scripts/export_report.pl +++ b/scripts/export_report.pl @@ -49,8 +49,14 @@ sub usage { } sub collectcfiles { - my @file - = `cat .tmp_versions/*.mod | grep '.*\.ko\$' | sed s/\.ko$/.mod.c/`; + my @file; + while (<.tmp_versions/*.mod>) { + open my $fh, '<', $_ or die "cannot open $_: $!\n"; + push (@file, + grep s/\.ko/.mod.c/, # change the suffix + grep m/.+\.ko/, # find the .ko path + <$fh>); # lines in opened file + } chomp @file; return @file; } -- cgit v1.2.3-59-g8ed1b From bdabc7a345db97b3839c2c3deef40023cf8017ef Mon Sep 17 00:00:00 2001 From: Jim Cromie Date: Mon, 23 May 2011 12:44:56 -0600 Subject: export_report: sort SECTION 2 output Sort SECTION 2 modules by name. Within those module listings, sort the symbol providers by name, and remove the count, as it is misleading; its the kernel-wide count of uses of that symbol, not the count pertaining to the module being outlined. (this can be seen by grepping the output for a single symbol). The count is still used to sort the symbols. Signed-off-by: Jim Cromie Signed-off-by: Michal Marek --- scripts/export_report.pl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/export_report.pl b/scripts/export_report.pl index f97899c87923..48398a19fbbc 100644 --- a/scripts/export_report.pl +++ b/scripts/export_report.pl @@ -25,11 +25,12 @@ sub alphabetically { sub print_depends_on { my ($href) = @_; print "\n"; - while (my ($mod, $list) = each %$href) { + for my $mod (sort keys %$href) { + my $list = $href->{$mod}; print "\t$mod:\n"; foreach my $sym (sort numerically @{$list}) { my ($symbol, $no) = split /\s+/, $sym; - printf("\t\t%-25s\t%-25d\n", $symbol, $no); + printf("\t\t%-25s\n", $symbol); } print "\n"; } @@ -166,7 +167,8 @@ modules. Each module lists the modules, and the symbols from that module that it uses. Each listed symbol reports the number of modules using it\n"); print "~"x80 , "\n"; -while (my ($thismod, $list) = each %MODULE) { +for my $thismod (sort keys %MODULE) { + my $list = $MODULE{$thismod}; my %depends; $thismod =~ s/\.mod\.c/.ko/; print "\t\t\t$thismod\n"; -- cgit v1.2.3-59-g8ed1b From ca995cbf77f3df599b7e751c2d08d90787c65c45 Mon Sep 17 00:00:00 2001 From: Jim Cromie Date: Mon, 23 May 2011 12:44:57 -0600 Subject: export_report: use warn() to issue WARNING, so they go to stderr Also count CONFIG_MODVERSIONS warnings, and print a NOTE at start of SECTION 2 if any were issued. Section 2 will be empty if the build is lacking this CONFIG_ item, and user may have missed the warnings, as they're off screen. Signed-off-by: Jim Cromie Signed-off-by: Michal Marek --- scripts/export_report.pl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/export_report.pl b/scripts/export_report.pl index 48398a19fbbc..8f79b701de87 100644 --- a/scripts/export_report.pl +++ b/scripts/export_report.pl @@ -102,6 +102,8 @@ close($module_symvers); # # collect the usage count of each symbol. # +my $modversion_warnings = 0; + foreach my $thismod (@allcfiles) { my $module; @@ -132,7 +134,8 @@ foreach my $thismod (@allcfiles) { } } if ($state != 2) { - print "WARNING:$thismod is not built with CONFIG_MODVERSION enabled\n"; + warn "WARNING:$thismod is not built with CONFIG_MODVERSIONS enabled\n"; + $modversion_warnings++; } close($module); } @@ -166,6 +169,9 @@ printf("SECTION 2:\n\tThis section reports export-symbol-usage of in-kernel modules. Each module lists the modules, and the symbols from that module that it uses. Each listed symbol reports the number of modules using it\n"); +print "\nNOTE: Got $modversion_warnings CONFIG_MODVERSIONS warnings\n\n" + if $modversion_warnings; + print "~"x80 , "\n"; for my $thismod (sort keys %MODULE) { my $list = $MODULE{$thismod}; -- cgit v1.2.3-59-g8ed1b