From a76cd1374c24897bb6bbe6d8aba3e4f459e2de90 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 18 Jun 2008 13:22:03 -0300 Subject: Add an utility to help checking for missing dependencies From: Mauro Carvalho Chehab This tool consumes some time to run, but it is very useful on helping to check if a dependency is missing. It will print an output like: DVB_B2C2_FLEXCOP depends on DVB_CORE && 1 DVB_B2C2_FLEXCOP_PCI depends on DVB_B2C2_FLEXCOP && 1 DVB_B2C2_FLEXCOP depends on DVB_LGDT330X && 1 && DVB_PLL && 1 && DVB_MT312 && 1 && DVB_BCM3510 && 1 && DVB_STV0297 && 1 && DVB_STV0299 && 1 && DVB_ISL6421 && 1 && DVB_MT352 && 1 && DVB_CORE && 1 && MEDIA_TUNER_SIMPLE && 1 && DVB_CX24123 && 1 && DVB_NXT200X && 1 In principle, each dependency should be associated to a "depends on" or "select" clause, or a recursive "depends on". Warning: The result of this tool should be used just as a hint, since, due to performance issues, the checks will use a simple grep at the .c files, instead of a real symbol usage inspection. Signed-off-by: Mauro Carvalho Chehab --- v4l/scripts/check_deps.pl | 228 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 228 insertions(+) create mode 100755 v4l/scripts/check_deps.pl (limited to 'v4l/scripts') diff --git a/v4l/scripts/check_deps.pl b/v4l/scripts/check_deps.pl new file mode 100755 index 000000000..4071a9976 --- /dev/null +++ b/v4l/scripts/check_deps.pl @@ -0,0 +1,228 @@ +#!/usr/bin/perl + +# Copyright (C) 2008 Mauro Carvalho Chehab + + +use strict; +use File::Find; +use Fcntl ':mode'; +use FileHandle; + +my $debug=0; + +my $SRC = 'linux'; + +my %export; + +############# +# open_makefile were adapted from analyze_build.pl +# by Copyright (C) 2006 Trent Piepho + +# Print out some extra checks of Makefile correctness +my $check = 0; + +# Root of source tree +my $root; + +# List of Makefile's opened +my %makefiles = (); + +# For each module that is made up of multiple source files, list of sources +my %multi = (); +my $multi_count = 0; + +my %config; + +my %associate; + +sub open_makefile($) { + my $file = shift; + + # only open a given Makefile once + return if exists $makefiles{$file}; + $makefiles{$file} = 1; + + $file =~ m|^(.*)/[^/]*$|; + my $dir = $1; + + print "opening $root$file (dir=$dir)\n" if ($debug > 2); + my $in = new FileHandle; + open $in, '<', "$root$file" or die "Unable to open Makefile '$root$file': $!"; + + while (<$in>) { + # print STDERR "Line: $_"; + # Skip comment and blank lines + next if (/^\s*(#.*)?$/); + m/^\s*\-?include/ and die "Can't handle includes! In $file"; + + # Handle line continuations + if (/\\\n$/) { + $_ .= <$in>; + redo; + } + # Eat line continuations in string we will parse + s/\s*\\\n\s*/ /g; + # Eat comments + s/#.*$//; + + if (/^\s*obj-(\S+)\s*([:+]?)=\s*(\S.*?)\s*$/) { + print STDERR "Should use '+=' in $file:$.\n$_\n" if ($check && $2 ne '+'); + my ($var,$targets) = ($1, $3); + if ($var =~ /\$\(CONFIG_(\S+)\)$/) { + $var = $1; + } elsif ($var !~ /^[ym]$/) { + print STDERR "Confused by obj assignment '$var' in $file:$.\n$_"; + } + foreach(split(/\s+/, $targets)) { + if (m|/$|) { # Ends in /, means it's a directory + open_makefile("$dir/$_".'Makefile'); + } elsif (/^(\S+)\.o$/) { + $config{"$dir/$1"} = $var; +# printf "%s -> %s\n", $var, $1 if $debug > 1; + } else { + print STDERR "Confused by target '$_' in $file:$.\n"; + } + } + next; + } + if (/(\S+)-objs\s*([:+]?)=\s*(\S.*?)\s*$/) { + my @files = split(/\s+/, $3); + map { s|^(.*)\.o$|$dir/\1| } @files; + if ($2 eq '+') { + # Adding to files + print STDERR "Should use ':=' in $file:$.\n$_\n" if ($check && !exists $multi{"$dir/$1"}); + push @files, @{$multi{"$dir/$1"}}; + } else { + print STDERR "Setting objects twice in $file:$.\n$_\n" if ($check && exists $multi{"$dir/$1"}); + } + $multi{"$dir/$1"} = \@files; + next; + } + if (/^\s*EXTRA_CFLAGS\s*([:+]?)=\s*(\S.*?)\s*$/) { + if ($check) { + sub allI { /^-I/ or return 0 foreach split(/\s+/, $_[0]);return 1; } + my $use = allI($2) ? ':' : '+'; + print STDERR "Should use '$use=' with EXTRA_CFLAGS in $file:$.\n$_\n" + if ($1 ne $use); + } + next; + } + print STDERR "Odd line $file:$.\n$_\n" if ($check); + } + close IN; +} + +# +############# + +sub associate_multi() +{ + foreach (keys %multi) { + my $name = $_; + my @files = @{$multi{$_}}; + map { s/^(.*)$/\1.c/ } @files; + + foreach (@files) { + my $file = $_; + my $var = $config{$name}; + $associate{$file} = $var; + printf "$var -> $file\n" if $debug > 1; + } + delete $config{$name}; + } + foreach my $file (keys %config) { + my $var = $config{$file}; + $file .= ".c"; + $associate{$file} = $var; + printf "$var -> $file\n" if $debug > 1; + } +} + +sub build_exported_symbol_list { + my $file = $File::Find::name; + + return if (!($file =~ /\.c$/)); + + open IN, $file; + while () { + if (m/EXPORT_SYMBOL.*\(\s*([^\s\)]+)/) { + $export{$1} = $file; + printf "%s -> %s\n", $file , $1 if $debug > 1; + } + } + close IN; +} + + +sub find_usage_list { + my %depend; + my $file = $File::Find::name; + my $s; + + return if (!($file =~ /\.c$/)); + + open IN, $file; + printf "Checking symbols at $file\n" if $debug; + while () { + foreach my $symbol (keys %export) { + my $symb_file = $export{$symbol}; + + # Doesn't search the symbol at the file that defines it + next if ($symb_file eq $file); + + if (m/($symbol)/) { + my $var = $associate{$symb_file}; + if (!$depend{$var}) { + printf "$symbol found at $file. It depends on %s\n", $associate{$symb_file} if $debug; + $depend{$var} = 1; + } + } + } + } + close IN; + + foreach (%depend) { $s .= "$_ && "; }; + $s =~ s/\&\&\ $//; + if ($s ne "") { + print $associate{$file}." depends on $s\n"; + } +} + +print < +This code is licenced under the terms of GPLv2. + +This script seeks all .c files under linux/ for their exported symbols. For +each exported symbol, it will check what Kconfig symbol is associated. Then, it +will cross-check that symbol usage and output a Kconfig depencency table. + +WARNING: The result of this tool should be used just as a hint, since, due to +performance issues, and to simplify the tool, the checks will use a simple grep +for the symbol string at the .c files, instead of a real symbol cross-check. + +Also, the same symbol may appear twice with different dependencies. This is due +to the way it checks for symbols. The final dependency is the union (AND) of +all showed ones for that symbol. + +Further patches improving this tool are welcome. + +EOL + +print "Checking makefile rules..." if $debug; +open_makefile("$SRC/drivers/media/Makefile"); +print " ok\n" if $debug; + +print "Associating symbols with c files..." if $debug; +associate_multi(); +print " ok\n" if $debug; + +print "finding exported symbols at $SRC..." if $debug; +find({wanted => \&build_exported_symbol_list, no_chdir => 1}, $SRC); +print " ok\n" if $debug; + +print "finding usage of symbols at $SRC\n" if $debug; +find({wanted => \&find_usage_list, no_chdir => 1}, $SRC); +print "finished\n" if $debug; + -- cgit v1.2.3 From 7c32a185acc584b2db9852eb593bf85f7b13d414 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 22 Jun 2008 14:43:07 -0300 Subject: Add a new meta-tag to hghead.pl From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- v4l/scripts/hghead.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'v4l/scripts') diff --git a/v4l/scripts/hghead.pl b/v4l/scripts/hghead.pl index 1eb7355c4..6f8a814ad 100755 --- a/v4l/scripts/hghead.pl +++ b/v4l/scripts/hghead.pl @@ -125,7 +125,7 @@ while ($line = ) { next; } - if ($tag =~ m/^(acked-by|thanks-to|reviewed-by|cc):/) { + if ($tag =~ m/^(acked-by|thanks-to|reviewed-by|noticed-by|cc):/) { $signed="$signed$line"; next; } -- cgit v1.2.3 From 605f1e11883603ebdff5393dba81e084dbd41f12 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 27 Jun 2008 10:30:04 -0300 Subject: Fix a few bugs at the script From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- v4l/scripts/hghead.pl | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) (limited to 'v4l/scripts') diff --git a/v4l/scripts/hghead.pl b/v4l/scripts/hghead.pl index 6f8a814ad..7eacd7019 100755 --- a/v4l/scripts/hghead.pl +++ b/v4l/scripts/hghead.pl @@ -130,12 +130,8 @@ while ($line = ) { next; } - if ($line =~ m/^[a-zA-Z\-]*:/) { - if ($line =~ m/Changeset:\s*(.*)\n/) { - $num=$1; - } - print "# $line"; - next; + if ($tag =~ m/changeset:\s*(.*)\n/) { + $num=$1; } if ($line =~ m|^(V4L\/DVB\s*\(.+\)\s*:.*\n)|) { @@ -155,13 +151,8 @@ while ($line = ) { if ($subject =~ m|V4L\/DVB\s*(.+)|) { $subject=$1; } - if ($hgimport) { - $subject=$line; - next; - } - if ($line =~ m/^\n/) { - next; - } + $subject=$line; + next; } if ($noblank) { @@ -191,11 +182,17 @@ if (!$signed =~ m/$from/) { die; } -$body="$from\n$body"; -$body=~s/[\n\s]+$//; +$from=~s/^[\n\s]+//; +$from=~s/[\n\s]+$//; + +$subject=~s/^[\n\s]+//; +$subject=~s/[\n\s]+$//; + +$body="$body\n\n$signed"; + $body=~s/^[\n\s]+//; +$body=~s/[\n\s]+$//; # First from is used by hg to recognize commiter name print "#Committer: $maintainer_name <$maintainer_email>\n"; -print "$subject\n$body\n\n$signed"; - +print "$subject\n\n$from\n\n$body\n"; -- cgit v1.2.3 From b171b4bf6091c1b3482b7ac3c14e1672f10c6950 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 27 Jun 2008 11:19:39 -0300 Subject: Improves commit message scripts From: Mauro Carvalho Chehab This patch improves message description sanity rules: - mailimport now prefers to edit using editdiff. This helps to fix trivial CodingStyle errors at receive patches; - hghead.pl will now remove blank whitespaces if no body exists; - "make commit" will now run hghead.pl. This will do some sanity checks at commit messages: *) Will warrant that "from:" metatag exists, avoiding to have patches without proper authorship id at someone's else tree; *) Will order the tags at the expected way (subject, from, body, signatures); *) Will warrant that one and just one blank line exists between each of the four parts of the commit message. Signed-off-by: Mauro Carvalho Chehab --- v4l/scripts/hghead.pl | 3 +++ 1 file changed, 3 insertions(+) (limited to 'v4l/scripts') diff --git a/v4l/scripts/hghead.pl b/v4l/scripts/hghead.pl index 7eacd7019..02295bcef 100755 --- a/v4l/scripts/hghead.pl +++ b/v4l/scripts/hghead.pl @@ -188,6 +188,9 @@ $from=~s/[\n\s]+$//; $subject=~s/^[\n\s]+//; $subject=~s/[\n\s]+$//; +$body=~s/^[\n\s]+//; +$body=~s/[\n\s]+$//; + $body="$body\n\n$signed"; $body=~s/^[\n\s]+//; -- cgit v1.2.3 From a1f051bc9c24756e56651c89f2556edd677db014 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 28 Jun 2008 11:48:04 -0300 Subject: Fix subject identification From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- v4l/scripts/hghead.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'v4l/scripts') diff --git a/v4l/scripts/hghead.pl b/v4l/scripts/hghead.pl index 02295bcef..14c3d906f 100755 --- a/v4l/scripts/hghead.pl +++ b/v4l/scripts/hghead.pl @@ -91,7 +91,8 @@ while ($line = ) { } if ($tag =~ m/^subject:/) { - $subject="$arg\n"; + $subject = "$arg\n"; + $sub_ok = 1; next; } @@ -136,6 +137,7 @@ while ($line = ) { if ($line =~ m|^(V4L\/DVB\s*\(.+\)\s*:.*\n)|) { $subject=$1; + $sub_ok = 1; $line="\n"; } @@ -147,7 +149,6 @@ while ($line = ) { next; } $sub_ok=1; - substr( $subject, 0, 1 ) = uc (substr ($subject, 0, 1)); if ($subject =~ m|V4L\/DVB\s*(.+)|) { $subject=$1; } -- cgit v1.2.3 From 6b35bbed7973468d128122f6fb01c028c8f55904 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 28 Jun 2008 14:20:12 -0300 Subject: Fix hghead to avoid adding bogus SOB's From: Mauro Carvalho Chehab As reported by Michael Krufky: > sms1xxx: fix Siano board names > > From: Michael Krufky > > Signed-off-by: Michael Krufky > Signed-off-by: <> > > > I have to "hg export tip > file && nano file {remove last line} && hg rollback && hg revert --all && hg import file" to fix it. > > What went wrong? :-/ Signed-off-by: Mauro Carvalho Chehab --- v4l/scripts/hghead.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'v4l/scripts') diff --git a/v4l/scripts/hghead.pl b/v4l/scripts/hghead.pl index 14c3d906f..2450ad136 100755 --- a/v4l/scripts/hghead.pl +++ b/v4l/scripts/hghead.pl @@ -174,7 +174,8 @@ if ($from eq "") { die; } -if (!$maint_ok) { +if (!$maint_ok && $maintainer_name && $maintainer_email) { + print "#No maintainer's signature. Adding it.\n"; $signed=$signed."Signed-off-by: $maintainer_name <$maintainer_email>\n"; } -- cgit v1.2.3 From 84fd870c9b642ff3dacaec83f0ec924d44c6f3e9 Mon Sep 17 00:00:00 2001 From: Thierry MERLE Date: Thu, 3 Jul 2008 20:34:29 +0200 Subject: v4l2-library: v4l-dvb-do-not-strip-patch-files From: Hans de Goede The libv4l directory contains some bugfix patches / port to libv4l patches for various applications, strip-trailing-whitespaces.sh should not touch these this patch teaches strip-trailing-whitespaces.sh to not touch .patch files. Signed-off-by: Hans de Goede Signed-off-by: Thierry MERLE --- v4l/scripts/strip-trailing-whitespaces.sh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'v4l/scripts') diff --git a/v4l/scripts/strip-trailing-whitespaces.sh b/v4l/scripts/strip-trailing-whitespaces.sh index 9bd963025..cb341ce76 100755 --- a/v4l/scripts/strip-trailing-whitespaces.sh +++ b/v4l/scripts/strip-trailing-whitespaces.sh @@ -20,6 +20,12 @@ else fi for file in `eval $files`; do + case "$file" in + *.patch) + continue + ;; + esac + perl -ne ' s/[ \t]+$//; s<^ {8}> <\t>; -- cgit v1.2.3 From 7ce87336c2f386ab6c35e985a5832d21b5cd7fab Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 8 Jul 2008 00:19:19 +0200 Subject: v4l-dvb: remove support for kernels < 2.6.0 From: Hans Verkuil First phase of the backwards compatibility cleanup: stop supporting kernels older than 2.6.0. Signed-off-by: Hans Verkuil --- v4l/scripts/release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'v4l/scripts') diff --git a/v4l/scripts/release.sh b/v4l/scripts/release.sh index 557172875..4e9c810bc 100755 --- a/v4l/scripts/release.sh +++ b/v4l/scripts/release.sh @@ -9,7 +9,7 @@ ver_cx="0.0.4" # common files files_v4l="v4l*.[ch] video-buf.[ch] videodev*.h" files_tuner="tuner.[ch] tda9887.[ch]" -files_i2c="id.h audiochip.h i2c-compat.h" +files_i2c="id.h audiochip.h" files_common="$files_v4l $files_tuner $files_i2c doc" # other files -- cgit v1.2.3