diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2006-11-07 09:04:22 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2006-11-07 09:04:22 +0000 |
commit | ed9f89c2efc8d5212291c25d9a23943984bbf2eb (patch) | |
tree | d2779d614468938f39dd746f893650b28b13427e | |
parent | 6d67fd7b5f62960b3a565e4f4c287f31aba4da62 (diff) | |
download | urpmi-ed9f89c2efc8d5212291c25d9a23943984bbf2eb.tar urpmi-ed9f89c2efc8d5212291c25d9a23943984bbf2eb.tar.gz urpmi-ed9f89c2efc8d5212291c25d9a23943984bbf2eb.tar.bz2 urpmi-ed9f89c2efc8d5212291c25d9a23943984bbf2eb.tar.xz urpmi-ed9f89c2efc8d5212291c25d9a23943984bbf2eb.zip |
factorize
-rwxr-xr-x | urpmf | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -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);", |