Author: schoenfeld
Date: 2008-11-06 12:31:39 +0000 (Thu, 06 Nov 2008)
New Revision: 1711

Modified:
   trunk/debian/changelog
   trunk/scripts/build-rdeps.pl
Log:
mk-build-deps: Add a --exclude-components paramater which can be specified
multiple times to exclude certain components (e.g. main, contrib,
non-free).

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2008-11-06 11:52:51 UTC (rev 1710)
+++ trunk/debian/changelog      2008-11-06 12:31:39 UTC (rev 1711)
@@ -6,8 +6,11 @@
   [ Patrick Schoenfeld ]
   * mk-build-deps: Make default pattern for source files match on codename
     aswell as suite (unstable, sid)
+  * mk-build-deps: Add a --exclude-components paramater which can be specified
+    multiple times to exclude certain components (e.g. main, contrib,
+    non-free).
 
- -- Patrick Schoenfeld <[EMAIL PROTECTED]>  Thu, 06 Nov 2008 12:51:51 +0100
+ -- Patrick Schoenfeld <[EMAIL PROTECTED]>  Thu, 06 Nov 2008 13:30:40 +0100
 
 devscripts (2.10.40) unstable; urgency=low
 

Modified: trunk/scripts/build-rdeps.pl
===================================================================
--- trunk/scripts/build-rdeps.pl        2008-11-06 11:52:51 UTC (rev 1710)
+++ trunk/scripts/build-rdeps.pl        2008-11-06 12:31:39 UTC (rev 1711)
@@ -83,6 +83,7 @@
 my $opt_maintainer;
 my $opt_mainonly;
 my $opt_distribution;
+my @opt_exclude_components;
 
 if (!(-x $dctrl)) {
        die "$progname: Fatal error. grep-dctrl is not available.\nPlease 
install the 'dctrl-tools' package.\n";
@@ -107,27 +108,43 @@
 Searches for all packages that build-depend on the specified package.
 
 Options:
-   -u, --update                  Run apt-get update before searching for 
build-depends.
-                                 (needs root privileges)
-   -s, --sudo                    Use sudo when running apt-get update
-                                 (has no effect when -u is ommitted)
-   -d, --debug                   Enable the debug mode
-   -m, --print-maintainer        Print the maintainer information 
(experimental)
-   --distribution distribution   Select a distribution to search for 
build-depends
-                                 (Default: unstable)
-   --only-main                   Ignore contrib and non-free
+   -u, --update                   Run apt-get update before searching for 
build-depends.
+                                  (needs root privileges)
+   -s, --sudo                     Use sudo when running apt-get update
+                                  (has no effect when -u is ommitted)
+   -d, --debug                    Enable the debug mode
+   -m, --print-maintainer         Print the maintainer information 
(experimental)
+   --distribution distribution    Select a distribution to search for 
build-depends
+                                  (Default: unstable)
+   --only-main                    Ignore contrib and non-free
+   --exclude-component=COMPONENT  Ignore the specified component (can be given 
multiple times)
 
 EOT
 version;
 }
 
+# Sub to test if a given section shall be included in the result
+sub test_for_valid_component {
+    if ($opt_mainonly and /(contrib|non-free)/) {
+       return -1;
+    }
+    foreach my $component (@opt_exclude_components) {
+           if ($_ =~ /$component/) {
+               return -1;
+           }
+    }
+
+    print STDERR "DEBUG: Component ($_) may not be excluded." if ($opt_debug);
+    return 0;
+}
+
 sub findsources {
        if (/$source_pattern/ and $sources_count <= 3) {
-               unless ($opt_mainonly and /(contrib|non-free)/) {
-                       push(@source_files, $_);
-                       $sources_count+=1;
-                       print STDERR "DEBUG: Added source file: $_ 
(#$sources_count)\n" if ($opt_debug);
-               }
+           if (test_for_valid_component($_) eq 0) {
+               push(@source_files, $_);
+               $sources_count+=1;
+               print STDERR "DEBUG: Added source file: $_ (#$sources_count)\n" 
if ($opt_debug);
+           }
        }
 }
 
@@ -197,6 +214,7 @@
        "m|print-maintainer" => \$opt_maintainer,
        "distribution=s" => \$opt_distribution,
        "only-main" => \$opt_mainonly,
+       "exclude-component=s" => [EMAIL PROTECTED],
        "d|debug" => \$opt_debug,
        "h|help" => sub { usage; },
        "v|version" => sub { version; }



-- 
To unsubscribe, send mail to [EMAIL PROTECTED]

Reply via email to