summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--urpm/args.pm77
1 files changed, 53 insertions, 24 deletions
diff --git a/urpm/args.pm b/urpm/args.pm
index dc6d5b90..b354685e 100644
--- a/urpm/args.pm
+++ b/urpm/args.pm
@@ -31,6 +31,15 @@ sub import {
}
}
+# used by urpmf
+sub add_param_closure {
+ my (@tags) = @_;
+ return sub {
+ $::qf .= join ':', '', map "%$_", @tags;
+ $::params{$_} = 1 for @tags;
+ };
+}
+
# options specifications for Getopt::Long
my %options_spec = (
@@ -135,35 +144,29 @@ my %options_spec = (
a => \$::matches,
},
+ #- see also below, autogenerated callbacks
urpmf => {
- all => sub {
- foreach my $k (qw(filename group size summary description sourcerpm
- packager buildhost url provides requires files conflicts obsoletes))
- { $::params{$k} = 1 }
- },
- arch => \$::params{arch},
- buildhost => \$::params{buildhost},
- buildtime => \$::params{buildtime},
+ all => add_param_closure(qw(
+ buildhost
+ conflicts
+ description
+ filename
+ files
+ group
+ obsoletes
+ packager
+ provides
+ requires
+ size
+ sourcerpm
+ summary
+ url
+ )),
conffiles => \$::params{conf_files},
- conflicts => \$::params{conflicts},
debug => \$::debug,
- description => \$::params{description},
- distribution => \$::params{distribution},
- epoch => \$::params{epoch},
- files => \$::params{files},
- group => \$::params{group},
literal => \$::literal,
- name => \$::params{filename},
- obsoletes => \$::params{obsoletes},
- packager => \$::params{packager},
- provides => \$::params{provides},
- requires => \$::params{requires},
- size => \$::params{size},
- sourcerpm => \$::params{sourcerpm},
- summary => \$::params{summary},
+ qf => \$::qf,
'uniq|u' => \$::uniq,
- url => \$::params{url},
- vendor => \$::params{vendor},
'verbose|v' => \$::verbose,
m => \$::params{media},
i => sub { $::pattern = 'i' },
@@ -317,6 +320,32 @@ my %options_spec = (
);
+# generate urpmf options callbacks
+
+foreach my $k (qw(
+ arch
+ buildhost
+ buildtime
+ conflicts
+ description
+ distribution
+ epoch
+ files
+ group
+ filename
+ obsoletes
+ packager
+ provides
+ requires
+ size
+ sourcerpm
+ summary
+ url
+ vendor
+)) {
+ $options_spec{urpmf}{$k} = add_param_closure($k);
+}
+
# common options setup
foreach my $k ("help|h", "version", "no-locales", "test!", "force", "root=s", "use-distrib=s",