diff options
author | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2004-05-21 08:05:33 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2004-05-21 08:05:33 +0000 |
commit | ee6a16bc54d40e474f24d3f7eceba6f0480954aa (patch) | |
tree | 84e2fb13e5794c8fb67f1dd95fb03d183e60c4f8 | |
parent | e227e7173027b99d6761241872e7459eaf691ac5 (diff) | |
download | urpmi-ee6a16bc54d40e474f24d3f7eceba6f0480954aa.tar urpmi-ee6a16bc54d40e474f24d3f7eceba6f0480954aa.tar.gz urpmi-ee6a16bc54d40e474f24d3f7eceba6f0480954aa.tar.bz2 urpmi-ee6a16bc54d40e474f24d3f7eceba6f0480954aa.tar.xz urpmi-ee6a16bc54d40e474f24d3f7eceba6f0480954aa.zip |
Minor documentation and refactorization
-rw-r--r-- | urpm.pm | 54 |
1 files changed, 29 insertions, 25 deletions
@@ -556,21 +556,29 @@ sub configure { #- determine package to withdraw (from skip.list file) only if something should be withdrawn. unless ($options{noskipping}) { my %uniq; - $urpm->compute_flags($urpm->get_packages_list($urpm->{skiplist}, $options{skip}), skip => 1, callback => sub { - my ($urpm, $pkg) = @_; - $pkg->is_arch_compat && ! exists $uniq{$pkg->fullname} or return; - $uniq{$pkg->fullname} = undef; - $urpm->{log}(N("skipping package %s", scalar($pkg->fullname))); - }); + $urpm->compute_flags( + $urpm->get_packages_list($urpm->{skiplist}, $options{skip}), + skip => 1, + callback => sub { + my ($urpm, $pkg) = @_; + $pkg->is_arch_compat && ! exists $uniq{$pkg->fullname} or return; + $uniq{$pkg->fullname} = undef; + $urpm->{log}(N("skipping package %s", scalar($pkg->fullname))); + }, + ); } unless ($options{noinstalling}) { my %uniq; - $urpm->compute_flags($urpm->get_packages_list($urpm->{instlist}, $options{inst}), disable_obsolete => 1, callback => sub { - my ($urpm, $pkg) = @_; - $pkg->is_arch_compat && ! exists $uniq{$pkg->fullname} or return; - $uniq{$pkg->fullname} = undef; - $urpm->{log}(N("would install instead of upgrade package %s", scalar($pkg->fullname))); - }); + $urpm->compute_flags( + $urpm->get_packages_list($urpm->{instlist}, $options{inst}), + disable_obsolete => 1, + callback => sub { + my ($urpm, $pkg) = @_; + $pkg->is_arch_compat && ! exists $uniq{$pkg->fullname} or return; + $uniq{$pkg->fullname} = undef; + $urpm->{log}(N("would install instead of upgrade package %s", scalar($pkg->fullname))); + }, + ); } if ($options{bug}) { #- and a dump of rpmdb itself as synthesis file. @@ -2211,30 +2219,26 @@ sub create_transaction { } } -#- get list of package that should not be upgraded. +#- get the list of packages that should not be upgraded or installed, +#- typically from the inst.list or skip.list files. +#- This file contains lines with the following format : +#- 0. everything after a '#' is ignored +#- 1. name of package or regular expression between slashes +#- 2. optional string "[*]", or optional "[" +#- 3. version specification (a comparison operator and a version number) +#- 4. the rest of the line is ignored sub get_packages_list { my ($urpm, $file, $extra) = @_; my %val; - local $_; open my $f, $file or return {}; - while (<$f>) { + for (<$f>, split /,/, $extra) { chomp; s/#.*$//; s/^\s*//; s/\s*$//; if (my ($n, $s) = /^([^\s\[]+)(?:\[\*\])?\[?\s*([^\s\]]*\s*[^\s\]]*)/) { $val{$n}{$s} = undef; } } close $f; - - #- additional skipping from given parameter. - if ($extra) { - foreach (split ',', $extra) { - if (my ($n, $s) = /^([^\s\[]+)(?:\[\*\])?\[?\s*([^\s\]]*\s*[^\s\]]*)/) { - $val{$n}{$s} = undef; - } - } - } - \%val; } #- for compability... |