summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--urpm.pm54
-rw-r--r--urpmi.spec7
-rwxr-xr-xurpmq53
3 files changed, 66 insertions, 48 deletions
diff --git a/urpm.pm b/urpm.pm
index a8be6eb6..de890ae0 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -84,7 +84,7 @@ sub unquotespace { local $_ = $_[0]; s/\\(\s)/$1/g; $_ }
#- <name> <url>
#- <name> <ftp_url> with <relative_path_hdlist>
sub read_config {
- my ($urpm) = @_;
+ my ($urpm, %options) = @_;
#- keep in mind if it has been called before.
$urpm->{media} and return; $urpm->{media} ||= [];
@@ -108,15 +108,15 @@ sub read_config {
$_ eq '}' and last;
$_ and $urpm->{error}("syntax error at line $. in $urpm->{config}");
}
- $urpm->probe_medium($medium) and push @{$urpm->{media}}, $medium;
+ $urpm->probe_medium($medium, %options) and push @{$urpm->{media}}, $medium;
next; };
/^(.*?[^\\])\s+(.*?[^\\])\s+with\s+(.*)$/ and do { #- urpmi.cfg old format for ftp
my $medium = { name => unquotespace($1), clear_url => unquotespace($2), with_hdlist => unquotespace($3) };
- $urpm->probe_medium($medium) and push @{$urpm->{media}}, $medium;
+ $urpm->probe_medium($medium, %options) and push @{$urpm->{media}}, $medium;
next; };
/^(.*?[^\\])\s+(?:(.*?[^\\])\s*)?$/ and do { #- urpmi.cfg old format (assume hdlist.<name>.cz2?)
my $medium = { name => unquotespace($1), clear_url => unquotespace($2) };
- $urpm->probe_medium($medium) and push @{$urpm->{media}}, $medium;
+ $urpm->probe_medium($medium, %options) and push @{$urpm->{media}}, $medium;
next; };
$_ and $urpm->{error}("syntax error at line $. in [$urpm->{config}]");
}
@@ -154,7 +154,7 @@ sub read_config {
$medium and $urpm->{error}("unable to use name \"$2\" for unamed medium because it is already used"), next;
$medium = { name => $2, hdlist => "hdlist.$1", list => "list.$2" };
- $urpm->probe_medium($medium) and push @{$urpm->{media}}, $medium;
+ $urpm->probe_medium($medium, %options) and push @{$urpm->{media}}, $medium;
}
} else {
$urpm->{error}("unable to take medium \"$2\" into account as no list file [$urpm->{statedir}/list.$2] exists");
@@ -167,18 +167,20 @@ sub read_config {
#- check the presence of hdlist file and list file if necessary.
#- TODO?: degraded mode is possible with a list file but no hdlist, the medium
#- is no longer updatable nor removable TODO
- foreach (@{$urpm->{media}}) {
- $_->{ignore} and next;
- -r "$urpm->{statedir}/$_->{hdlist}" or
- $_->{ignore} = 1, $urpm->{error}("unable to access hdlist file of \"$_->{name}\", medium ignored");
- $_->{list} && -r "$urpm->{statedir}/$_->{list}" or
- $_->{ignore} = 1, $urpm->{error}("unable to access list file of \"$_->{name}\", medium ignored");
+ unless ($options{nocheck_access}) {
+ foreach (@{$urpm->{media}}) {
+ $_->{ignore} and next;
+ -r "$urpm->{statedir}/$_->{hdlist}" or
+ $_->{ignore} = 1, $urpm->{error}("unable to access hdlist file of \"$_->{name}\", medium ignored");
+ $_->{list} && -r "$urpm->{statedir}/$_->{list}" or
+ $_->{ignore} = 1, $urpm->{error}("unable to access list file of \"$_->{name}\", medium ignored");
+ }
}
}
#- probe medium to be used, take old medium into account too.
sub probe_medium {
- my ($urpm, $medium) = @_;
+ my ($urpm, $medium, %options) = @_;
local $_;
my $existing_medium;
@@ -217,9 +219,11 @@ sub probe_medium {
$medium->{url} = $_;
}
}
- $medium->{url} or
- $medium->{ignore} || $urpm->{error}("unable to inspect list file for \"$medium->{name}\", medium ignored"),
- $medium->{ignore} = 1; #, last; keeping it cause perl to exit caller loop ...
+ unless ($options{nocheck_access}) {
+ $medium->{url} or
+ $medium->{ignore} || $urpm->{error}("unable to inspect list file for \"$medium->{name}\", medium ignored"),
+ $medium->{ignore} = 1; #, last; keeping it cause perl to exit caller loop ...
+ }
}
$medium->{url} ||= $medium->{clear_url};
$medium;
@@ -825,10 +829,6 @@ sub compute_closure {
my ($urpm, $packages, $installed, $select_choices) = @_;
my ($id, @packages) = (undef, keys %$packages);
- #- select first level of packages, as in packages list will only be
- #- examined deps of each.
- @{$packages}{@packages} = ();
-
#- at this level, compute global closure of what is requested, regardless of
#- choices for which all package in the choices are taken and their dependancies.
#- allow iteration over a modifying list.
@@ -875,7 +875,7 @@ sub compute_closure {
if ($installed && $installed->{$_}) {
delete $packages->{$_};
} else {
- $packages->{$_} = $installed && ! exists $installed->{$_};
+ exists $packages->{$_} or $packages->{$_} = $installed && ! exists $installed->{$_};
}
}
}
@@ -949,9 +949,9 @@ sub filter_packages_to_upgrade {
#- need upgrade (0), requested (undef), already installed (not present) or
#- newly added (1).
#- choices if not chosen are present as ref.
- my @packages = keys %$packages;
- %$packages = %closures;
- @{$packages}{@packages} = ();
+ foreach (keys %closures) {
+ exists $packages->{$_} or $packages->{$_} = $closures{$_};
+ }
$packages;
}
@@ -992,10 +992,6 @@ sub filter_minimal_packages_to_upgrade {
my ($db, @packages) = (rpmtools::db_open(''), keys %$packages);
my ($id, %provides, %installed);
- #- select first level of packages, as in packages list will only be
- #- examined deps of each.
- @{$packages}{@packages} = ();
-
#- at this level, compute global closure of what is requested, regardless of
#- choices for which all package in the choices are taken and their dependancies.
#- allow iteration over a modifying list.
@@ -1129,7 +1125,7 @@ sub filter_minimal_packages_to_upgrade {
#- get out of package that should not be upgraded.
sub deselect_unwanted_packages {
- my ($urpm, $packages) = @_;
+ my ($urpm, $packages, %options) = @_;
my %skip;
local ($_, *F);
@@ -1137,7 +1133,7 @@ sub deselect_unwanted_packages {
while (<F>) {
chomp; s/#.*$//; s/^\s*//; s/\s*$//;
my $pkg = $urpm->{params}{info}{$_} or next;
- exists $packages->{$pkg->{id}} && defined $packages->{$pkg->{id}} and delete $packages->{$pkg->{id}};
+ $options{force} || (exists $packages->{$pkg->{id}} && defined $packages->{$pkg->{id}}) and delete $packages->{$pkg->{id}};
}
close F;
}
diff --git a/urpmi.spec b/urpmi.spec
index 6003651d..25ac7a66 100644
--- a/urpmi.spec
+++ b/urpmi.spec
@@ -2,7 +2,7 @@
Name: urpmi
Version: 1.5
-Release: 10mdk
+Release: 11mdk
License: GPL
Source0: %{name}.tar.bz2
Summary: User mode rpm install
@@ -113,6 +113,11 @@ autoirpm.uninstall
%changelog
+* Tue Feb 27 2001 François Pons <fpons@mandrakesoft.com> 1.5-11mdk
+- fixed cohabitation of --auto-select and skip list.
+- added -m mode for urpmq.
+- added --sources flag for urpmq.
+
* Mon Feb 26 2001 François Pons <fpons@mandrakesoft.com> 1.5-10mdk
- fixed auto-select flag to use dependancies resolver after.
diff --git a/urpmq b/urpmq
index 427b309e..b8370a59 100755
--- a/urpmq
+++ b/urpmq
@@ -50,6 +50,9 @@ usage:
-v - verbose mode.
-d - extend query to package dependancies.
-u - remove package if a better version is already installed.
+ -m - extend query to package dependancies, remove already
+ installed package that provide what is necessary, add
+ packages that may be block the upgrade.
-c - choose complete method for resolving requires closure.
-g - print groups too with name.
-r - print version and release too with name.
@@ -57,7 +60,8 @@ usage:
--auto-select - automatically select packages for upgrading the system.
--headers - extract headers for package listed from urpmi db to
stdout (root only).
- --force - force invocation even if some package does not exists.
+ --sources - give all source packages before downloading (root only).
+ --force - force invocation even if some package does not exists.
names or rpm files given on command line are queried.
", $urpm::VERSION)));
@@ -69,11 +73,13 @@ for (@ARGV) {
/^--help$/ and do { usage; next };
/^--auto-select$/ and do { $query->{auto_select} = 1; next };
/^--headers$/ and do { $query->{headers} = 1; next };
+ /^--sources$/ and do { $query->{sources} = 1; next };
/^--force$/ and do { $query->{force} = 1; next };
/^-(.*)$/ and do { foreach (split //, $1) {
/[\?h]/ and do { usage; next };
/d/ and do { $query->{deps} = 1; next };
/u/ and do { $query->{upgrade} = 1; next };
+ /m/ and do { $query->{minimal} = 1; next };
/c/ and do { $query->{complete} = 1; next };
/g/ and do { $query->{group} = 1; next };
/v/ and do { $query->{verbose} = 1; next };
@@ -124,13 +130,19 @@ if ($query->{auto_select}) {
}
#- filter to add in packages selected required packages.
-$query->{deps} && !$query->{upgrade} and $urpm->compute_closure(\%packages);
-$query->{upgrade} and $urpm->filter_packages_to_upgrade(\%packages, complete => $query->{complete});
+if ($query->{minimal}) {
+ $urpm->read_provides;
+ $urpm->read_config(nocheck_access => 1);
+ $urpm->filter_minimal_packages_to_upgrade(\%packages, undef);
+} else {
+ $query->{deps} && !$query->{upgrade} and $urpm->compute_closure(\%packages);
+ $query->{upgrade} and $urpm->filter_packages_to_upgrade(\%packages, undef, complete => $query->{complete});
+}
#- get out of package that should not be upgraded.
$urpm->deselect_unwanted_packages(\%packages);
-if ($query->{headers}) {
+if ($query->{headers} || $query->{sources}) {
$urpm->read_config();
my ($local_sources, $list) = $urpm->get_source_packages(\%packages);
@@ -139,20 +151,25 @@ if ($query->{headers}) {
exit 1;
}
- #- now examine source package to build headers list to extract.
- foreach (@$local_sources) {
- system 'rpm2header', @$local_sources;
- }
- foreach (0..$#{$urpm->{media} || []}) {
- my @headers = (grep { my $file = "$urpm->{cachedir}/headers/$_";
- -s $file and system 'cat', $file;
- ! -s $file }
- map { /(.*)\/([^\/]*)-([^-]*)-([^-]*)\.([^\.]*)\.rpm/ and "$2-$3-$4.$5" } @{$list->[$_]});
- @headers > 0 or next;
-
- require packdrake;
- my $packer = new packdrake("$urpm->{statedir}/$urpm->{media}[$_]{hdlist}");
- $packer->extract_archive(undef, @headers);
+ if ($query->{headers}) {
+ #- now examine source package to build headers list to extract.
+ @$local_sources and system 'rpm2header', @$local_sources;
+ foreach (0..$#{$urpm->{media} || []}) {
+ my @headers = (grep { my $file = "$urpm->{cachedir}/headers/$_";
+ -s $file and system 'cat', $file;
+ ! -s $file }
+ map { /(.*)\/([^\/]*)-([^-]*)-([^-]*)\.([^\.]*)\.rpm/ and "$2-$3-$4.$5" } @{$list->[$_]});
+ @headers > 0 or next;
+
+ require packdrake;
+ my $packer = new packdrake("$urpm->{statedir}/$urpm->{media}[$_]{hdlist}");
+ $packer->extract_archive(undef, @headers);
+ }
+ } else {
+ print join "\n", @$local_sources; @$local_sources and print "\n";
+ foreach (0..$#{$urpm->{media} || []}) {
+ print join "\n", @{$list->[$_]}; @{$list->[$_]} and print "\n";
+ }
}
exit 0;
}