summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-09-07 02:44:33 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-09-07 02:44:33 +0000
commited5a529684417fc440305c9fb76e58dedbd26b71 (patch)
tree102b3155fec4fa10b6382590f4e161c5775af0a3
parente2a592278c6518ed865f3f5c8aa73becae986330 (diff)
downloaddrakx-ed5a529684417fc440305c9fb76e58dedbd26b71.tar
drakx-ed5a529684417fc440305c9fb76e58dedbd26b71.tar.gz
drakx-ed5a529684417fc440305c9fb76e58dedbd26b71.tar.bz2
drakx-ed5a529684417fc440305c9fb76e58dedbd26b71.tar.xz
drakx-ed5a529684417fc440305c9fb76e58dedbd26b71.zip
Code factorization
-rw-r--r--perl-install/pkgs.pm37
1 files changed, 12 insertions, 25 deletions
diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm
index f17c4cfd3..848a21a76 100644
--- a/perl-install/pkgs.pm
+++ b/perl-install/pkgs.pm
@@ -488,35 +488,22 @@ sub psUsingHdlist {
if ($m->{ignored}) {
log::l("ignoring packages in $hdlist");
} else {
- our %uniq_pkg_seen;
+ my $callback = sub {
+ my (undef, $p) = @_;
+ our %uniq_pkg_seen;
+ if ($uniq_pkg_seen{$p->fullname}++) {
+ log::l("skipping " . scalar $p->fullname);
+ return 0;
+ } else {
+ return 1;
+ }
+ };
if (-s $newsf) {
log::l("parse_synthesis");
- ($m->{start}, $m->{end}) = $packages->parse_synthesis(
- $newsf,
- callback => sub {
- my (undef, $p) = @_;
- if ($uniq_pkg_seen{$p->fullname}++) {
- log::l("skipping " . scalar $p->fullname);
- return 0;
- } else {
- return 1;
- }
- },
- );
+ ($m->{start}, $m->{end}) = $packages->parse_synthesis($newsf, callback => $callback);
} elsif (-s $newf) {
log::l("parse_hdlist");
- ($m->{start}, $m->{end}) = $packages->parse_hdlist(
- $newf,
- callback => sub {
- my (undef, $p) = @_;
- if ($uniq_pkg_seen{$p->fullname}++) {
- log::l("skipping " . scalar $p->fullname);
- return 0;
- } else {
- return 1;
- }
- },
- );
+ ($m->{start}, $m->{end}) = $packages->parse_hdlist($newf, callback => $callback);
} else {
delete $packages->{mediums}{$medium_name};
unlink $newf;