summaryrefslogtreecommitdiff
path: root/v4l
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2009-03-08 13:10:43 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-08 13:10:43 -0300
commitfc6175ddf0ccad7f5281c08b4981e8a5f26b11f7 (patch)
tree16d9f4e9d46de82c55680bf4d75a9ad31f1fe360 /v4l
parent14930d48b7b561c2900d1487500bec01d090d55b (diff)
downloadmediapointer-dvb-s2-fc6175ddf0ccad7f5281c08b4981e8a5f26b11f7.tar.gz
mediapointer-dvb-s2-fc6175ddf0ccad7f5281c08b4981e8a5f26b11f7.tar.bz2
Improve script to automatically adjust the Kconfig files
From: Mauro Carvalho Chehab <mchehab@redhat.com> There are still some more hacking to do, in order to use this automatically, since more logic is needed for dibcom and av7110 stuff. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'v4l')
-rwxr-xr-xv4l/scripts/fix_dvb_customise.pl89
1 files changed, 83 insertions, 6 deletions
diff --git a/v4l/scripts/fix_dvb_customise.pl b/v4l/scripts/fix_dvb_customise.pl
index c4c9c14bd..86a6bcf8c 100755
--- a/v4l/scripts/fix_dvb_customise.pl
+++ b/v4l/scripts/fix_dvb_customise.pl
@@ -110,10 +110,6 @@ sub get_header_deps()
print "$_ " foreach %header_deps;
print "\n";
}
-
-print "Header deps for av7110.h: ";
-print "$_ " foreach $header_deps{"av7110.h"};
-print "\n";
}
@@ -161,6 +157,8 @@ sub parse_makefiles()
########################
# Seeks files for header
#
+my %select;
+
sub found_ref($$)
{
my $file = shift;
@@ -170,7 +168,7 @@ sub found_ref($$)
$name =~ s|.*/||;
$name =~ s/flexcop-fe-tuner.c/b2c2-flexcop/;
- $name =~ s/av7110.c/av7110/;
+ $name =~ s/av7110.c/av7110.h/;
if (defined ($header_deps{$name})) {
$name = $header_deps{$name};
@@ -182,7 +180,17 @@ sub found_ref($$)
foreach my $n (@files) {
if (defined($driver_config{$n})) {
my $ref = $driver_config{$n};
- printf "$ref needs %s\n", $header;
+ printf "$ref needs %s\n", $header if ($debug);
+
+ if ($ref =~ m/(PVRUSB2|CX23885|CX88|EM28XX|SAA3134)/) {
+ $ref .="_DVB";
+ }
+
+ if (!defined($select{$ref})) {
+ $select{$ref} = $header;
+ } else {
+ $select{$ref} .= " " . $header;
+ }
$found = 1;
}
}
@@ -217,6 +225,74 @@ sub parse_headers()
close IN;
}
+########################
+# Rewrite Kconfig's
+#
+
+sub parse_kconfigs()
+{
+ my $file = $File::Find::name;
+ my $conf;
+ my $out = "";
+ my $tmp = "";
+ my $all_sels;
+
+ return if !($file =~ m/Kconfig$/);
+ return if ($file =~ m|drivers/media/dvb/frontends/|);
+
+ open IN, $file or die "Can't open $file\n";
+ while (<IN>) {
+ if (m/^config\s([A-Za-z_\-\d]+)/) {
+ $out .= $tmp;
+ if (defined($select{$1})) {
+ $conf = $select{$1};
+ $all_sels = " ". $conf. " ";
+ $tmp = $_;
+
+ printf "$file: rewriting headers for $1. It should select: %s\n", $all_sels if ($debug);
+ } else {
+ $conf = "";
+ $out .= $_;
+ $tmp = "";
+ }
+ next;
+ }
+ if (!$conf) {
+ $out .= $_;
+ next;
+ }
+
+ if (m/^\s*select\s+([A-Za-z_\-\d]+)/) {
+ my $op = $1;
+
+ if (!$all_sels =~ m/\s($op)\s/) {
+ # Drops line
+ printf "$file: droppingg line $_\n";
+
+ next;
+ } else {
+ $all_sels =~ s/\s($op)\s/ /;
+ }
+ }
+ if (m/^[\s\-]*help/) {
+ my @sel = split(/\s/, $all_sels);
+ foreach my $s (@sel) {
+ if ($s ne "") {
+ printf "$file: Adding select for $s\n";
+ $tmp .= "\tselect $s if !DVB_FE_CUSTOMISE\n";
+ }
+ }
+ }
+ $tmp .= $_;
+ }
+ close IN;
+
+ $out .=$tmp;
+ open OUT, ">$file" or die "Can't open $file\n";
+ print OUT $out;
+ close OUT;
+}
+
#####
#main
@@ -255,3 +331,4 @@ foreach my $fe (keys %$FEs) {
find({wanted => \&parse_makefiles, no_chdir => 1}, $SRC);
find({wanted => \&parse_headers, no_chdir => 1}, $SRC);
+find({wanted => \&parse_kconfigs, no_chdir => 1}, $SRC);