summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2006-11-07 09:06:11 +0000
committerPascal Rigaux <pixel@mandriva.com>2006-11-07 09:06:11 +0000
commit0ebedbbeec33581b997708dc46cb5f60ffcb4c9a (patch)
tree9dbb925a373f86b054fced898da9c4662cb1296f
parented9f89c2efc8d5212291c25d9a23943984bbf2eb (diff)
downloadurpmi-0ebedbbeec33581b997708dc46cb5f60ffcb4c9a.tar
urpmi-0ebedbbeec33581b997708dc46cb5f60ffcb4c9a.tar.gz
urpmi-0ebedbbeec33581b997708dc46cb5f60ffcb4c9a.tar.bz2
urpmi-0ebedbbeec33581b997708dc46cb5f60ffcb4c9a.tar.xz
urpmi-0ebedbbeec33581b997708dc46cb5f60ffcb4c9a.zip
simplify: drop $multi, $multitag is enough
-rwxr-xr-xurpmf13
1 files changed, 4 insertions, 9 deletions
diff --git a/urpmf b/urpmf
index e4cacaee..5aa94159 100755
--- a/urpmf
+++ b/urpmf
@@ -118,9 +118,6 @@ if ($full) { $qf =~ s/%name\b/%fullname/ }
my $urpm = new urpm;
$verbose or $urpm->{log} = sub {};
-#- build the callback matching the expression.
-#- count multi-valued tags
-my $multi = 0;
my $multitag = '';
my %multitags = map { $_ => 1 } qw(conffiles conflicts files obsoletes provides requires);
my %usedtags;
@@ -133,7 +130,7 @@ my $sprintfargs = join(', ', map {
} elsif ($_ eq 'fullname') {
'scalar($pkg->fullname)';
} elsif ($multitags{$_}) {
- $multi++;
+ $multitag and $urpm->{fatal}->(1, N("Incorrect format: you may use only one multi-valued tag"));
$multitag = $_;
'$mt';
} else {
@@ -141,10 +138,7 @@ my $sprintfargs = join(', ', map {
}
} $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 $next_st = $multitag ? 'next' : 'return 1';
my @inner = (
"my \$s = sprintf(qq{$proto}, $sprintfargs);",
"\$s =~ $expr or $next_st;",
@@ -152,7 +146,7 @@ my @inner = (
'print $s, "\n";',
);
-if ($multi) {
+if ($multitag) {
@inner = (
"for my \$mt (\$pkg->$multitag) {",
(map { " $_" } @inner),
@@ -160,6 +154,7 @@ if ($multi) {
);
}
+#- build the callback matching the expression.
my $callback = join("\n",
"sub {",
(map { " $_" }