summaryrefslogtreecommitdiffstats
path: root/urpmf
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2006-11-07 09:04:22 +0000
committerPascal Rigaux <pixel@mandriva.com>2006-11-07 09:04:22 +0000
commited9f89c2efc8d5212291c25d9a23943984bbf2eb (patch)
treed2779d614468938f39dd746f893650b28b13427e /urpmf
parent6d67fd7b5f62960b3a565e4f4c287f31aba4da62 (diff)
downloadurpmi-ed9f89c2efc8d5212291c25d9a23943984bbf2eb.tar
urpmi-ed9f89c2efc8d5212291c25d9a23943984bbf2eb.tar.gz
urpmi-ed9f89c2efc8d5212291c25d9a23943984bbf2eb.tar.bz2
urpmi-ed9f89c2efc8d5212291c25d9a23943984bbf2eb.tar.xz
urpmi-ed9f89c2efc8d5212291c25d9a23943984bbf2eb.zip
factorize
Diffstat (limited to 'urpmf')
-rwxr-xr-xurpmf14
1 files changed, 7 insertions, 7 deletions
diff --git a/urpmf b/urpmf
index 6ab2cced..e4cacaee 100755
--- a/urpmf
+++ b/urpmf
@@ -124,26 +124,26 @@ my $multi = 0;
my $multitag = '';
my %multitags = map { $_ => 1 } qw(conffiles conflicts files obsoletes provides requires);
my %usedtags;
-while ($qf =~ /%[-\d]*(\w+)/g) {
- ++$multi, $multitag = $1 if $multitags{$1};
- $usedtags{$1} = 1;
-}
-$multi > 1
- and $urpm->{fatal}->(1, N("Incorrect format: you may use only one multi-valued tag"));
(my $proto = $qf) =~ s/%([-\d]*)(\w+)/%${1}s/g;
my $sprintfargs = join(', ', map {
+ $usedtags{$1} = 1;
if ($_ eq 'media') {
'$urpm::currentmedia->{name}';
} elsif ($_ eq 'fullname') {
'scalar($pkg->fullname)';
- } elsif ($_ eq $multitag) {
+ } elsif ($multitags{$_}) {
+ $multi++;
+ $multitag = $_;
'$mt';
} else {
'$pkg->' . $_;
}
} $qf =~ /%[-\d]*(\w+)/g);
+$multi > 1
+ and $urpm->{fatal}->(1, N("Incorrect format: you may use only one multi-valued tag"));
+
my $next_st = $multi ? 'next' : 'return 1';
my @inner = (
"my \$s = sprintf(qq{$proto}, $sprintfargs);",