summaryrefslogtreecommitdiff
path: root/Dh_Getopt.pm
diff options
context:
space:
mode:
authorjoey <joey>1999-08-17 05:01:21 +0000
committerjoey <joey>1999-08-17 05:01:21 +0000
commit19f377de13cb281cf19fe829e79a2498b7465002 (patch)
treebb29180d3306821c0c1f95d39b162742a1564583 /Dh_Getopt.pm
parent4e943112129121f04813e945eedded4c889ca65b (diff)
downloaddebhelper-19f377de13cb281cf19fe829e79a2498b7465002.tar.gz
r124: Initial Import
Diffstat (limited to 'Dh_Getopt.pm')
-rw-r--r--Dh_Getopt.pm23
1 files changed, 20 insertions, 3 deletions
diff --git a/Dh_Getopt.pm b/Dh_Getopt.pm
index 0f9dafdf..e9240893 100644
--- a/Dh_Getopt.pm
+++ b/Dh_Getopt.pm
@@ -49,7 +49,7 @@ sub AddExclude { my($option,$value)=@_;
# Parse options and return a hash of the values.
sub parseopts {
undef %options;
-
+
my $ret=GetOptions(
"v" => \$options{VERBOSE},
"verbose" => \$options{VERBOSE},
@@ -109,13 +109,25 @@ sub parseopts {
if (!$ret) {
error("unknown option; aborting");
}
-
+
# Check to see if -V was specified. If so, but no parameters were
# passed, the variable will be defined but empty.
if (defined($options{V_FLAG})) {
$options{V_FLAG_SET}=1;
}
+ # If we have not been given any packages to act on, assume they
+ # want us to act on them all. Note we have to do this before excluding
+ # packages out, below.
+ if (! defined $options{DOPACKAGES} || ! @{$options{DOPACKAGES}}) {
+ if ($options{DOINDEP} || $options{DOARCH}) {
+ # User specified that all arch (in)dep package be
+ # built, and there are none of that type.
+ error("I have no package to build");
+ }
+ push @{$options{DOPACKAGES}},GetPackages();
+ }
+
# Remove excluded packages from the list of packages to act on.
my @package_list;
my $package;
@@ -125,7 +137,12 @@ sub parseopts {
}
}
@{$options{DOPACKAGES}}=@package_list;
-
+
+ # If there are no packages to act on now, it's an error.
+ if (! defined $options{DOPACKAGES} || ! @{$options{DOPACKAGES}}) {
+ error("I have no package to build");
+ }
+
return %options;
}