summaryrefslogtreecommitdiff
path: root/v4l/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'v4l/scripts')
-rwxr-xr-xv4l/scripts/check.pl4
-rwxr-xr-xv4l/scripts/checkpatch.pl4
-rwxr-xr-xv4l/scripts/do_merge.pl178
-rw-r--r--[-rwxr-xr-x]v4l/scripts/gentree.pl16
-rwxr-xr-xv4l/scripts/make_config_compat.pl68
-rwxr-xr-xv4l/scripts/make_kconfig.pl17
6 files changed, 255 insertions, 32 deletions
diff --git a/v4l/scripts/check.pl b/v4l/scripts/check.pl
index 4958e281b..975041c4a 100755
--- a/v4l/scripts/check.pl
+++ b/v4l/scripts/check.pl
@@ -87,6 +87,10 @@ $pwd =~ s|/[^/]+\n$||;
sub print_err()
{
+ if ($err =~ m/LINUX_VERSION_CODE/) {
+ return;
+ }
+
if ($err) {
printf STDERR "%s/%s: In '%s':\n", $pwd, $file, $errline;
printf STDERR "%s/%s:%d: %s\n", $pwd, $file, $ln_numb, $err;
diff --git a/v4l/scripts/checkpatch.pl b/v4l/scripts/checkpatch.pl
index 2d5ece798..b28d2b0f3 100755
--- a/v4l/scripts/checkpatch.pl
+++ b/v4l/scripts/checkpatch.pl
@@ -1937,13 +1937,13 @@ sub process {
($op eq '>' &&
$ca =~ /<\S+\@\S+$/))
{
- $ok = 1;
+ $ok = 1;
}
# Ignore ?:
if (($opv eq ':O' && $ca =~ /\?$/) ||
($op eq '?' && $cc =~ /^:/)) {
- $ok = 1;
+ $ok = 1;
}
if ($ok == 0) {
diff --git a/v4l/scripts/do_merge.pl b/v4l/scripts/do_merge.pl
new file mode 100755
index 000000000..1a6bbb1ee
--- /dev/null
+++ b/v4l/scripts/do_merge.pl
@@ -0,0 +1,178 @@
+#!/usr/bin/perl
+
+my $merge_tree=shift or die "Should specify the pulled tree";
+
+sub hgrcuser($)
+{
+ my $file = shift;
+ my $ui = 0;
+ open IN, '<', $file;
+ while (<IN>) {
+ $ui = 1 if (/^\s*\[ui\]/);
+ if ($ui && /^\s*username\s*=\s*(\S.*?)\s*$/) {
+ close IN;
+ return($1);
+ }
+ }
+ close IN;
+ return("");
+}
+
+sub check_heads()
+{
+ my $count=0;
+ open IN, 'hg heads|';
+ while (<IN>) {
+ if (m/^[Cc]hangeset:/) {
+ $count++;
+ }
+ }
+ close IN;
+ return $count;
+}
+
+sub curr_changeset()
+{
+ my $changeset = -1;
+
+ open IN, 'hg heads|';
+ while (<IN>) {
+ if (m/^[Cc]hangeset:\s*(\d+)/) {
+ if ($changeset < 0) {
+ $changeset = $1;
+ } else {
+ if ($1 < $changeset) {
+ $changeset = $1;
+ }
+ }
+ }
+ }
+ close IN;
+ return $changeset;
+}
+
+sub check_status()
+{
+ my $count=0;
+ open IN, 'hg status -m -a -d -r|';
+ while (<IN>) {
+ $count++;
+ }
+ close IN;
+ return $count;
+}
+
+sub rollback()
+{
+ print "Rolling back hg pull $merge_tree\n";
+ system("hg rollback");
+ system("hg update -C");
+ exit -1;
+}
+
+####################
+# Determine username
+
+# Get Hg username from environment
+my $user = $ENV{HGUSER};
+
+# Didn't work? Try the repo's .hgrc file
+if ($user eq "") {
+ my $hgroot = `hg root`;
+ chomp($hgroot);
+ $user = hgrcuser("$hgroot/.hg/hgrc");
+}
+# Ok, try ~/.hgrc next
+if ($user eq "") {
+ $user = hgrcuser("$ENV{HOME}/.hgrc");
+}
+
+# Still no luck? Try some other environment variables
+if ($user eq "") {
+ my $name = $ENV{CHANGE_LOG_NAME};
+ my $email = $ENV{CHANGE_LOG_EMAIL_ADDRESS};
+ $user = "$name <$email>" if ($name ne "" || $email ne "");
+}
+
+# Last try to come up with something
+if ($user eq "") {
+ print "User not known. Can't procceed\n";
+ exit -1;
+}
+
+######################
+# Do some sanity tests
+
+print "Checking if everything is ok, before applying the new tree.\n";
+
+my $n_heads = check_heads();
+die "Your tree currently have more than one head (it has $n_heads heads). Can't procceed\n" if ($n_heads > 1);
+
+my $dirty = check_status();
+die "Your tree currently has changes. Can't procceed\n" if ($dirty);
+
+my $curr_cs = curr_changeset();
+
+###########
+# Pull tree
+
+print "hg pull $merge_tree\n";
+
+my $ret = system("hg pull $merge_tree");
+die "Couldn't pull from $merge_tree\n" if ($ret);
+
+#############################
+# Merge and commit, if needed
+
+$n_heads = check_heads();
+if ($n_heads > 2) {
+ print "The merged tree have more than one head (it has $n_heads heads). Can't procceed.\n";
+ rollback();
+}
+
+if ($n_heads == 2) {
+ print "Merging the new changesets\n";
+
+ $ret = system("hg merge");
+ if ($ret) {
+ print "hg merge failed. Can't procceed.\n";
+ rollback();
+ }
+
+ print "Committing the new tree\n";
+ # Write the commit message
+ $msg= "merge: $merge_tree\n\nFrom: $user\n\nSigned-off-by: $user\n";
+ $ret=system("hg commit -m '$msg'");
+ if ($ret) {
+ print "hg commit failed. Can't procceed.\n";
+ rollback();
+ }
+}
+
+#####################
+# Test resulting tree
+
+print "Testing if the build didn't break compilation. Only errors and warnings will be displayed. Please wait.\n";
+$ret = system ('make allmodconfig');
+if (!ret) {
+ $ret = system ('make mismatch|egrep -v "^\s*CC"|egrep -v "^\s*LD"');
+}
+if ($ret) {
+ print "Build failed. Can't procceed.\n";
+
+ # To avoid the risk of doing something really bad, let's ask the user to run hg strip
+ print "Your tree is dirty. Since hg has only one rollback level, you'll need to use, instead:";
+ print "\thg strip $curr_cs; hg update -C";
+ print "You'll need to have hg mq extension enabled for hg strip to work.\n";
+
+ exit -1;
+}
+
+##############################
+# Everything is ok, let's push
+
+print "Pushing the new tree at the remote repository specified at .hg/hgrc\n";
+$ret=system ("hg push");
+if ($ret) {
+ print "hg push failed. Don't forget to do the push later.\n";
+}
diff --git a/v4l/scripts/gentree.pl b/v4l/scripts/gentree.pl
index 1968bb334..b9053f464 100755..100644
--- a/v4l/scripts/gentree.pl
+++ b/v4l/scripts/gentree.pl
@@ -22,8 +22,8 @@
# If gentree knows the result of an expression, that directive will be
# "processed", otherwise it will be an "other". gentree knows the value
# of LINUX_VERSION_CODE, BTTV_VERSION_CODE, the KERNEL_VERSION(x,y,z)
-# macro, numeric constants like 0 and 1, and a few defines like MM_KERNEL
-# and STV0297_CS2.
+# macro, numeric constants like 0 and 1, and a few defines like
+# I2C_CLASS_TV_DIGITAL
#
# An exception is if the comment "/*KEEP*/" appears after the expression,
# in which case that directive will be considered an "other" and not
@@ -55,22 +55,10 @@ my %defs = (
'LINUX_VERSION_CODE' => $LINUXCODE,
'BTTV_VERSION_CODE' => $BTTVCODE,
'_COMPAT_H' => 0,
- 'MM_KERNEL' => ($extra =~ /-mm/)?1:0,
- 'BROKEN_XAWTV' => 0,
- 'STV0297_CS2' => 0,
- 'HAVE_VIDEO_BUF_DVB' => 1,
- 'I2C_PEC' => 1,
- 'I2C_DF_DUMMY' => 0,
- 'CONFIG_XC3028' => 0,
- 'HAVE_XC2028'=> 0,
- 'HAVE_XC3028' => 0,
'I2C_CLASS_TV_ANALOG' => 1,
'I2C_CLASS_TV_DIGITAL' => 1,
'OLD_XMIT_LOCK' => 0,
'COMPAT_SND_CTL_BOOLEAN_MONO' => 0,
- 'CONFIG_VIVI_SCATTER' => 0,
- 'CONFIG_BIGPHYS_AREA' => 0,
- 'BUZ_USE_HIMEM' => 1,
'NEED_SOUND_DRIVER_H' => 0,
'TTUSB_KERNEL' => 1,
'NO_PCM_LOCK' => 0,
diff --git a/v4l/scripts/make_config_compat.pl b/v4l/scripts/make_config_compat.pl
index 423dcff77..3c2b623ca 100755
--- a/v4l/scripts/make_config_compat.pl
+++ b/v4l/scripts/make_config_compat.pl
@@ -218,40 +218,86 @@ sub check_net_dev()
sub check_usb_endpoint_type()
{
- my $file = "$kdir/include/linux/usb.h";
+ my $nfiles = 0;
+ my @files = ( "$kdir/include/linux/usb.h", "$kdir/include/linux/usb/ch9.h" );
+
+ foreach my $file ( @files ) {
+ open IN, "<$file" or next;
+ $nfiles++;
+ while (<IN>) {
+ if (m/usb_endpoint_type/) {
+ close IN;
+ # definition found. No need for compat
+ return;
+ }
+ }
+ close IN;
+ }
+
+ die "Usb headers not found" if (!$nfiles);
+
+ # definition not found. This means that we need compat
+ $out.= "\n#define NEED_USB_ENDPOINT_TYPE 1\n";
+}
+
+sub check_pci_ioremap_bar()
+{
+ my $file = "$kdir/include/linux/pci.h";
my $need_compat = 1;
open INNET, "<$file" or die "File not found: $file";
while (<INNET>) {
- if (m/usb_endpoint_type/) {
+ if (m/pci_ioremap_bar/) {
$need_compat = 0;
last;
}
}
if ($need_compat) {
- $out.= "\n#define NEED_USB_ENDPOINT_TYPE 1\n";
+ $out.= "\n#define NEED_PCI_IOREMAP_BAR 1\n";
}
close INNET;
}
-sub check_pci_ioremap_bar()
+sub check_snd_card_create()
{
- my $file = "$kdir/include/linux/pci.h";
+ my $file = "$kdir/include/sound/core.h";
my $need_compat = 1;
- open INNET, "<$file" or die "File not found: $file";
- while (<INNET>) {
- if (m/pci_ioremap_bar/) {
+ open IN, "<$file" or die "File not found: $file";
+ while (<IN>) {
+ if (m/snd_card_create/) {
$need_compat = 0;
last;
}
}
if ($need_compat) {
- $out.= "\n#define NEED_PCI_IOREMAP_BAR 1\n";
+ $out.= "\n#define NEED_SND_CARD_CREATE\n";
}
- close INNET;
+ close IN;
+}
+
+sub check_poll_schedule()
+{
+
+
+ my @files = ( "$kdir//include/linux/poll.h" );
+
+ foreach my $file ( @files ) {
+ open IN, "<$file" or die "File not found: $file";
+ while (<IN>) {
+ if (m/poll_schedule/) {
+ close IN;
+ # definition found. No need for compat
+ return;
+ }
+ }
+ close IN;
+ }
+
+ # definition not found. This means that we need compat
+ $out.= "\n#define NEED_POLL_SCHEDULE 1\n";
}
sub check_other_dependencies()
@@ -269,6 +315,8 @@ sub check_other_dependencies()
check_net_dev();
check_usb_endpoint_type();
check_pci_ioremap_bar();
+ check_snd_card_create();
+ check_poll_schedule();
}
# Do the basic rules
diff --git a/v4l/scripts/make_kconfig.pl b/v4l/scripts/make_kconfig.pl
index 57c663c00..cfe53a636 100755
--- a/v4l/scripts/make_kconfig.pl
+++ b/v4l/scripts/make_kconfig.pl
@@ -277,11 +277,13 @@ sub open_kconfig($$) {
my $in_help = 0;
my $default_seen = 0;
my $if;
+ my $line;
print "Opening $file\n" if $debug;
open $in, '<', $file or die "File not found: $file";
push @kconfigfiles, $file;
while (<$in>) {
+ $line = $_;
# In our Kconfig files, the first non-help line after the
# help text always has no indention. Technically, the
# help text is ended by just by the indention decreasing,
@@ -303,7 +305,7 @@ sub open_kconfig($$) {
print OUT "\tdefault n\n";
}
print OUT "\tdepends on VIDEO_KERNEL_VERSION\n";
- $_ = sprintf($disabled_msg, $minver{$key});
+ $line = sprintf($disabled_msg, $minver{$key});
}
next;
}
@@ -319,10 +321,13 @@ sub open_kconfig($$) {
}
next if (/^\s*#/ || /^\s*$/); # skip comments and blank lines
+ # Erase any comments on this line
+ s/(?<!\\)#(.*)$//;
+
if (m|^\s*source\s+"([^"]+)"\s*$| ||
m|^\s*source\s+(\S+)\s*$|) {
open_kconfig($dir, "$dir/$1");
- $_ = ''; # don't print the source line itself
+ $line = ''; # don't print the source line itself
next;
}
@@ -453,13 +458,13 @@ sub open_kconfig($$) {
if ($disabled) {
$default_seen = 1;
- $_ = "\tdefault n\n";
+ $line = "\tdefault n\n";
}
} else {
print "Skipping $file:$. $_" if $debug;
}
} continue {
- print OUT $_;
+ print OUT $line;
}
close $in;
}
@@ -571,8 +576,8 @@ config VIDEO_KERNEL_VERSION
requiring a newer kernel is that no one has tested them with an
older one yet.
- If the driver works, please post a report at V4L mailing list:
- video4linux-list\@redhat.com.
+ If the driver works, please post a report to the V4L mailing list:
+ linux-media\@vger.kernel.org.
Unless you know what you are doing, you should answer N.