summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--rpm-find-leaves36
-rw-r--r--urpm.pm31
-rwxr-xr-xurpmi8
-rw-r--r--urpmi.spec14
-rwxr-xr-xurpmq9
5 files changed, 55 insertions, 43 deletions
diff --git a/rpm-find-leaves b/rpm-find-leaves
index 781422b7..32d9668c 100644
--- a/rpm-find-leaves
+++ b/rpm-find-leaves
@@ -1,32 +1,22 @@
#!/usr/bin/perl
-use lib "../rpmtools";
-
-local $_ = join '', @ARGV;
-
-/-h/ and die "usage: rpm-find-leaves [--show-unknown]\n";
-
-$show_unknown = /-show-unknown/;
+@ARGV and die "usage: rpm-find-leaves\n";
use rpmtools;
-$f = "/var/lib/urpmi/depslist.ordered";
-open F, $f or die "read_depslist: can't open file $f\n";
-$o = new rpmtools;
-$o->read_depslist(\*F);
-
-chop, $l{$_} = 1 foreach `rpm -qa --queryformat "%{name}\n"`;
+$db = rpmtools::db_open('');
+rpmtools::db_traverse($db, [ qw(name version release provides requires) ], sub {
+ push @packages, $_[0];
+});
+rpmtools::db_close($db);
-%m = %l;
-
-foreach (@{$o->{depslist}}) {
- delete $m{$_->{name}} or next;
- delete $l{$o->{depslist}[$_]{name}} foreach split ' ', $_->{deps};
+foreach my $pkg (@packages) {
+ $l{$pkg->{name}} = 1;
+ push @{$provides{$_}}, $pkg->{name} foreach @{$pkg->{provides} || []};
}
-!$m{$_} and print "$_\n" foreach sort keys %l;
-
-if ($show_unknown) {
- print "\n";
- print "$_\n" foreach sort keys %m;
+foreach my $pkg (@packages) {
+ delete @l{grep { $_ ne $pkg->{name} } @{$provides{$_} || []}} foreach @{$pkg->{requires} || []};
}
+
+print "$_\n" foreach sort keys %l;
diff --git a/urpm.pm b/urpm.pm
index 073d51a0..b2323f75 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -4,7 +4,7 @@ use strict;
use vars qw($VERSION @ISA);
use Fcntl ':flock';
-$VERSION = '3.1';
+$VERSION = '3.2';
=head1 NAME
@@ -554,14 +554,7 @@ sub build_synthesis_hdlist {
my ($urpm, $medium, $use_parsehdlist) = @_;
unlink "$urpm->{statedir}/synthesis.$medium->{hdlist}";
- if ($use_parsehdlist) {
- #- building synthesis file using parsehdlist output, need 4.0-1mdk or above.
- if (system "parsehdlist --compact --info --provides --requires '$urpm->{statedir}/$medium->{hdlist}' | gzip >'$urpm->{statedir}/synthesis.$medium->{hdlist}'") {
- unlink "$urpm->{statedir}/synthesis.$medium->{hdlist}";
- $urpm->{error}(_("unable to build synthesis file for medium \"%s\"", $medium->{name}));
- return;
- }
- } else {
+ unless ($use_parsehdlist) {
#- building synthesis file using internal params.
local *F;
open F, "| gzip >'$urpm->{statedir}/synthesis.$medium->{hdlist}'";
@@ -573,7 +566,12 @@ sub build_synthesis_hdlist {
$p->{name}, 'info', "$p->{name}-$p->{version}-$p->{release}.$p->{arch}",
$p->{serial} || 0, $p->{size} || 0, $p->{group}, $p->{file} ? ($p->{file}) : ()). "\n";
}
- unless (close F) {
+ close F or unlink "$urpm->{statedir}/synthesis.$medium->{hdlist}";
+ }
+ if (-s "$urpm->{statedir}/synthesis.$medium->{hdlist}" <= 32) {
+ #- building synthesis file using parsehdlist output, need 4.0-1mdk or above.
+ $use_parsehdlist or $urpm->{error}(_("unable to build hdlist synthesis, using parsehdlist method"));
+ if (system "parsehdlist --synthesis '$urpm->{statedir}/$medium->{hdlist}' | gzip >'$urpm->{statedir}/synthesis.$medium->{hdlist}'") {
unlink "$urpm->{statedir}/synthesis.$medium->{hdlist}";
$urpm->{error}(_("unable to build synthesis file for medium \"%s\"", $medium->{name}));
return;
@@ -918,16 +916,17 @@ sub update_media {
#- build synthesis files once requires/files have been matched by rpmtools::read_hdlists.
if (my @rebuild_synthesis = grep { $_->{modified_synthesis} && !$_->{modified} } @{$urpm->{media}}) {
#- cleaning whole data structures (params and per media).
+ $urpm->{log}(_("examining whole urpmi database"));
$urpm->clean;
foreach my $medium (@{$urpm->{media} || []}) {
$medium->{ignore} || $medium->{modified} and next;
if ($medium->{synthesis}) {
#- reading the synthesis allow to propagate requires to files, so that if an hdlist can have them...
- $urpm->{log}(_("reading synthesis file [%s]", "$urpm->{statedir}/synthesis.$medium->{hdlist}"));
+ $urpm->{log}(_("examining synthesis file [%s]", "$urpm->{statedir}/synthesis.$medium->{hdlist}"));
$urpm->parse_synthesis($medium, examine_requires => 1);
} else {
- $urpm->{log}(_("reading hdlist file [%s]", "$urpm->{statedir}/$medium->{hdlist}"));
+ $urpm->{log}(_("examining hdlist file [%s]", "$urpm->{statedir}/$medium->{hdlist}"));
$urpm->{params}->read_hdlists("$urpm->{statedir}/$medium->{hdlist}");
}
}
@@ -937,8 +936,12 @@ sub update_media {
foreach my $medium (@{$urpm->{media} || []}) {
$medium->{ignore} || $medium->{modified} and next;
unless ($medium->{synthesis}) {
- $urpm->{log}(_("reading hdlist file [%s]", "$urpm->{statedir}/$medium->{hdlist}"));
+ $urpm->{log}(_("examining hdlist file [%s]", "$urpm->{statedir}/$medium->{hdlist}"));
my @fullnames = $urpm->{params}->read_hdlists("$urpm->{statedir}/$medium->{hdlist}");
+ while (!@fullnames) {
+ $urpm->{error}(_("problem reading hdlist file, trying again"));
+ @fullnames = $urpm->{params}->read_hdlists("$urpm->{statedir}/$medium->{hdlist}");
+ }
$medium->{depslist} = [];
push @{$medium->{depslist}}, $urpm->{params}{info}{$_} foreach @fullnames;
}
@@ -1237,7 +1240,7 @@ sub search_packages {
foreach my $id (0 .. $#{$urpm->{params}{depslist}}) {
my $info = $urpm->{params}{depslist}[$id];
- rpmtools::compat_arch($info->{arch}) && (!$options{use_active} || $info->{active}) or next;
+ rpmtools::compat_arch($info->{arch}) or next;
my $pack_ra = "$info->{name}-$info->{version}";
my $pack_a = "$pack_ra-$info->{release}";
diff --git a/urpmi b/urpmi
index 4ddf791a..f8e87004 100755
--- a/urpmi
+++ b/urpmi
@@ -24,6 +24,7 @@ import urpm _;
#- default options.
my $update = 0;
+my $mediums = 0;
my $auto = 0;
my $allow_medium_change = 0;
my $complete = 0;
@@ -53,6 +54,7 @@ This is free software and may be redistributed under the terms of the GNU GPL.
usage:
") . _(" --help - print this help message.
") . _(" --update - use only update media.
+") . _(" --mediums - use only the medium listed by comma.
") . _(" --auto - automatically select a good package in choices.
") . _(" --auto-select - automatically select packages for upgrading the system.
") . _(" --complete - use parsehdlist server to complete selection.
@@ -76,6 +78,7 @@ my @nextargv;
for (@ARGV) {
/^--help$/ and do { usage; next };
/^--update$/ and do { $update = 1; next };
+ /^--mediums$/ and do { push @nextargv, \$mediums; next };
/^--auto$/ and do { $auto = 1; next };
/^--allow-medium-change$/ and do { $allow_medium_change = 1; next };
/^--auto-select$/ and do { $auto_select = 1; next };
@@ -149,7 +152,10 @@ $sync and $urpm->{sync} = $sync;
$verbose or $urpm->{log} = sub {};
$urpm->read_config;
-$urpm->parse_synthesis($_) foreach grep { !$_->{ignore} && (!$update || $_->{active}) } @{$urpm->{media} || []};
+$mediums and $urpm->select_media(split ',', $mediums);
+foreach (grep { !$_->{ignore} && (!$update || $_->{update}) && (!$mediums || $_->{modified}) } @{$urpm->{media} || []}) {
+ $urpm->parse_synthesis($_);
+}
if (@files) {
$uid == 0 or $urpm->fatal(1, _("Only superuser is allowed to install local packages"));
diff --git a/urpmi.spec b/urpmi.spec
index 3b42732b..58299cf6 100644
--- a/urpmi.spec
+++ b/urpmi.spec
@@ -1,14 +1,14 @@
%define group System/Configuration/Packaging
Name: urpmi
-Version: 3.1
-Release: 8mdk
+Version: 3.2
+Release: 1mdk
License: GPL
Source0: %{name}.tar.bz2
Source1: %{name}.logrotate
Summary: User mode rpm install
Requires: eject, webfetch, perl-DateManip >= 5.40
-PreReq: perl-gettext, rpmtools >= 4.0
+PreReq: perl-gettext, rpmtools >= 4.0-5mdk
BuildRequires: libbzip2-devel rpm-devel
BuildRoot: %{_tmppath}/%{name}-buildroot
@@ -142,6 +142,14 @@ fi
%changelog
+* Wed Jan 16 2002 François Pons <fpons@mandrakesoft.com> 3.2-1mdk
+- fixed bad use of update flag.
+- fixed urpmi_rpm-find-leaves to use rpm db directly.
+- added --mediums to urpmi/urpmq to select medium explicitely.
+- added workaround to make sure synthesis file are built,
+ using specific rpmtools-4.0-4mdk and above parsehdlist.
+- release 3.2 (urpmi_rpm-find-leaves changes, --mediums flag).
+
* Wed Jan 16 2002 François Pons <fpons@mandrakesoft.com> 3.1-8mdk
- improved dependencies resolution (typically XFree86 newer
packages).
diff --git a/urpmq b/urpmq
index fcedeb53..4c03f641 100755
--- a/urpmq
+++ b/urpmq
@@ -46,6 +46,7 @@ usage:
") . _(" -r - print version and release too with name.
") . _(" -f - print version, release and arch with name.
") . "\n" . _(" --update - use only update media.
+") . _(" --mediums - use only the medium listed by comma.
") . _(" --auto-select - automatically select packages for upgrading the system.
") . _(" --headers - extract headers for package listed from urpmi db to
stdout (root only).
@@ -61,6 +62,7 @@ my @nextargv;
for (@ARGV) {
/^--help$/ and do { usage; next };
/^--update$/ and do { $query->{update} = 1; next };
+ /^--mediums$/ and do { push @nextargv, \$query->{mediums}; next };
/^--auto-select$/ and do { $query->{auto_select} = 1; next };
/^--headers$/ and do { $query->{headers} = 1; next };
/^--sources$/ and do { $query->{sources} = 1; next };
@@ -92,7 +94,10 @@ my $urpm = new urpm;
$query->{verbose} or $urpm->{log} = sub {};
$urpm->read_config(nocheck_access => 1);
-$urpm->parse_synthesis($_) foreach grep { !$_->{ignore} && (!$update || $_->{active}) } @{$urpm->{media} || []};
+$query->{mediums} and $urpm->select_media(split ',', $query->{mediums});
+foreach (grep { !$_->{ignore} && (!$query->{update} || $_->{update}) && (!$query->{mediums} || $_->{modified}) } @{$urpm->{media} || []}) {
+ $urpm->parse_synthesis($_);
+}
if (@files) {
#- build closure with local package and return list of names.
@@ -100,7 +105,7 @@ if (@files) {
}
#- relocate depslist.
-$urpm->relocate_depslist_provides(use_active => $query->{update});
+$urpm->relocate_depslist_provides();
#- search the packages according the selection given by the user,
#- basesystem is added to the list so if it need to be upgraded, all its dependency