]> git.donarmstrong.com Git - debhelper.git/blobdiff - Debian/Debhelper/Dh_Getopt.pm
r2033: * Add --ignore option. This is intended to ease dealing with upstream
[debhelper.git] / Debian / Debhelper / Dh_Getopt.pm
index 16851a04902999cd2cb929e184e07080ba77f783..d1e052affba85501c5ca5fc72189f76f432c05b4 100644 (file)
@@ -19,7 +19,7 @@ my (%options, %exclude_package);
 sub showhelp {
        my $prog=basename($0);
        print "Usage: $prog [options]\n\n";
-       print "  $prog is a part of debhelper. See debhelper(1)\n";
+       print "  $prog is a part of debhelper. See debhelper(7)\n";
        print "  and $prog(1) for complete usage instructions.\n"; 
        exit(1);
 }
@@ -29,18 +29,18 @@ sub showhelp {
 # order.
 sub AddPackage { my($option,$value)=@_;
        if ($option eq 'i' or $option eq 'indep') {
-               push @{$options{DOPACKAGES}}, GetPackages('indep');
+               push @{$options{DOPACKAGES}}, getpackages('indep');
                $options{DOINDEP}=1;
        }
        elsif ($option eq 'a' or $option eq 'arch') {
-               push @{$options{DOPACKAGES}}, GetPackages('arch');
+               push @{$options{DOPACKAGES}}, getpackages('arch');
                $options{DOARCH}=1;
        }
        elsif ($option eq 'p' or $option eq 'package') {
                push @{$options{DOPACKAGES}}, $value;
        }
        elsif ($option eq 's' or $option eq 'same-arch') {
-               push @{$options{DOPACKAGES}}, GetPackages('same');
+               push @{$options{DOPACKAGES}}, getpackages('same');
                $options{DOSAME}=1;
        }
        else {
@@ -48,6 +48,11 @@ sub AddPackage { my($option,$value)=@_;
        }
 }
 
+# Adds packages to the list of debug packages.
+sub AddDebugPackage { my($option,$value)=@_;
+       push @{$options{DEBUGPACKAGES}}, $value;
+}
+
 # Add a package to a list of packages that should not be acted on.
 sub ExcludePackage { my($option,$value)=@_;
        $exclude_package{$value}=1;
@@ -58,6 +63,11 @@ sub AddExclude { my($option,$value)=@_;
        push @{$options{EXCLUDE}},$value;
 }
 
+# Add a file to the ignore list.
+sub AddIgnore { my($option,$file)=@_;
+       $options{IGNORE}->{$file}=1;
+}
+
 # This collects non-options values.
 sub NonOption {
        push @{$options{ARGV}}, @_;
@@ -80,6 +90,8 @@ sub parseopts {
                "p=s" => \&AddPackage,
                "package=s" => \&AddPackage,
        
+               "dbg-package=s" => \&AddDebugPackage,
+               
                "s" => \&AddPackage,
                "same-arch" => \&AddPackage,
        
@@ -88,12 +100,16 @@ sub parseopts {
        
                "n" => \$options{NOSCRIPTS},
                "noscripts" => \$options{NOSCRIPTS},
+               "o" => \$options{ONLYSCRIPTS},
+               "onlyscripts" => \$options{ONLYSCRIPTS},
 
                "x" => \$options{INCLUDE_CONFFILES}, # is -x for some unknown historical reason..
                "include-conffiles" => \$options{INCLUDE_CONFFILES},
        
                "X=s" => \&AddExclude,
                "exclude=s" => \&AddExclude,
+               
+               "ignore=s" => \&AddIgnore,
        
                "d" => \$options{D_FLAG},
                "remove-d" => \$options{D_FLAG},
@@ -101,6 +117,7 @@ sub parseopts {
        
                "r" => \$options{R_FLAG},
                "no-restart-on-upgrade" => \$options{R_FLAG},
+               "no-start" => \$options{NO_START},
        
                "k" => \$options{K_FLAG},
                "keep" => \$options{K_FLAG},
@@ -134,14 +151,32 @@ sub parseopts {
 
                "filename=s" => \$options{FILENAME},
                
-               "priority=i" => \$options{PRIORITY},
+               "priority=s" => \$options{PRIORITY},
                
                "flavor=s" => \$options{FLAVOR},
 
                "autodest" => \$options{AUTODEST},
 
                "h|help" => \&showhelp,
+
+               "mainpackage=s" => \$options{MAINPACKAGE},
+
+               "list-missing" => \$options{LIST_MISSING},
+
+               "fail-missing" => \$options{FAIL_MISSING},
                
+               "L|libpackage=s" => \$options{LIBPACKAGE},
+               
+               "name=s" => \$options{NAME},
+               
+               "keep-debug" => \$options{KEEP_DEBUG},
+               
+               "error-handler=s" => \$options{ERROR_HANDLER},
+               
+               "add-udeb=s" => \$options{SHLIBS_UDEB},
+               
+               "language=s" => \$options{LANGUAGE},
+
                "<>" => \&NonOption,
        );
 
@@ -162,17 +197,24 @@ sub parseopts {
                if ($options{DOINDEP} || $options{DOARCH} || $options{DOSAME}) {
                        # User specified that all arch (in)dep package be
                        # built, and there are none of that type.
-                       error("I have no package to build");
+                       warning("I have no package to build");
+                       exit(0);
                }
-               push @{$options{DOPACKAGES}},GetPackages();
+               push @{$options{DOPACKAGES}},getpackages();
        }
-       
+
        # Remove excluded packages from the list of packages to act on.
+       # Also unique the list, in case some options were specified that
+       # added a package to it twice.
        my @package_list;
        my $package;
+       my %packages_seen;
        foreach $package (@{$options{DOPACKAGES}}) {
                if (! $exclude_package{$package}) {
-                       push @package_list, $package;   
+                       if (! exists $packages_seen{$package}) {
+                               $packages_seen{$package}=1;
+                               push @package_list, $package;   
+                       }
                }
        }
        @{$options{DOPACKAGES}}=@package_list;