summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--urpme56
-rwxr-xr-xurpmf2
-rwxr-xr-xurpmi2
-rw-r--r--urpmi.spec11
-rwxr-xr-xurpmq2
5 files changed, 45 insertions, 28 deletions
diff --git a/urpme b/urpme
index 085e2075..20c58a49 100644
--- a/urpme
+++ b/urpme
@@ -20,12 +20,13 @@
use strict;
#use strict qw(subs vars refs);
+use rpmtools;
use urpm;
#- get I18N translation method.
import urpm _;
-my ($auto, $matches, $maymatch, %provides, @l, @m, @toremove);
+my ($auto, $matches, $maymatch, @l, @m, @toremove);
my $askok = _("Is it OK?");
my $askrm = _("Remove them all?");
# Translator: Add here the keys which might be pressed in the "No"-case.
@@ -43,8 +44,6 @@ if ( / --?h/ || @ARGV == 0 ) {
$matches = / -a /;
$auto = / --?auto /;
-my $DIR = "/var/lib/urpmi";
-
@l = grep { !/^-/ } @ARGV;
if (!$matches) {
@m = map { chop; $_ } `rpm -q @l 2>&1`;
@@ -65,10 +64,7 @@ if ($matches || $maymatch) {
}
}
-load_provides();
-my %toremove;
-@toremove{$_, @{$provides{$_} || []}} = () foreach @m;
-
+my %toremove; @toremove{@m} = ();
my $changed = 1;
while ($changed) {
$changed = 0;
@@ -87,6 +83,37 @@ if ( ! (@toremove = keys %toremove) ) {
print _("Nothing to remove.\n");
exit(0);
}
+
+#- check if a package to be removed is a part of basesystem requires.
+my %base;
+my @base = qw(basesystem);
+my %basepackages;
+my $db = rpmtools::db_open('');
+while (defined($_ = shift @base)) {
+ exists $basepackages{$_} and next;
+ rpmtools::db_traverse_tag($db, /^\// ? 'path' : 'whatprovides', [ $_ ], [ qw(name version release requires) ], sub {
+ my ($p) = @_;
+ push @{$basepackages{$_} ||= []}, "$p->{name}-$p->{version}-$p->{release}";
+ push @base, @{$p->{requires} || []};
+ });
+}
+rpmtools::db_close($db);
+foreach (values %basepackages) {
+ my $n = @$_;
+ foreach (@$_) {
+ $base{$_} = \$n;
+ }
+}
+my $base_str = '';
+foreach (@toremove) {
+ my $rn = $base{$_};
+ if ($rn) {
+ $$rn == 1 and $base_str .= _("removing package %s will break your system\n", $_);
+ --$$rn;
+ }
+}
+$base_str and die $base_str;
+
if (@toremove > @l && !$auto) {
my $sum = 0;
map { $sum += $_ } `rpm -q --queryformat "%{SIZE}\n" @toremove`;
@@ -97,21 +124,6 @@ if (@toremove > @l && !$auto) {
system("rpm", "-e", @toremove);
-sub load_provides {
- local *F;
- open F, "$DIR/depslist.ordered" or return;
- my @packages_id;
- my %provides_id;
- foreach (<F>) {
- my ($p, $size, @l) = split;
- #$size{$p} = $size;
- push @packages_id, $p;
- push @{$provides_id{$_}}, $p foreach @l;
- }
- foreach (keys %provides_id) {
- $provides{$packages_id[$_]} = $provides_id{$_};
- }
-}
sub toMb {
my $nb = $_[0] / 1024 / 1024;
int $nb + 0.5;
diff --git a/urpmf b/urpmf
index 6ca2e6e9..06820092 100755
--- a/urpmf
+++ b/urpmf
@@ -18,7 +18,7 @@ do
-h|--help)
TMPDATA=`$ECHO "urpmf version %s"`
printf "$TMPDATA" `rpm -q rpmtools --qf '%{VERSION}'` ; echo
- $ECHO "Copyright (C) 1999,2000,2001 MandrakeSoft."
+ $ECHO "Copyright (C) 1999, 2000, 2001, 2002 MandrakeSoft."
$ECHO "This is free software and may be redistributed under the terms of the GNU GPL."
echo
$ECHO "usage: urpmf [options] <file>"
diff --git a/urpmi b/urpmi
index 5ed11d31..5165cdcf 100755
--- a/urpmi
+++ b/urpmi
@@ -55,7 +55,7 @@ delete @ENV{qw(ENV BASH_ENV IFS CDPATH)};
sub usage {
print STDERR _("urpmi version %s
-Copyright (C) 1999, 2000, 2001 MandrakeSoft.
+Copyright (C) 1999, 2000, 2001, 2002 MandrakeSoft.
This is free software and may be redistributed under the terms of the GNU GPL.
usage:
diff --git a/urpmi.spec b/urpmi.spec
index 0c0cca58..2bb0ec52 100644
--- a/urpmi.spec
+++ b/urpmi.spec
@@ -2,7 +2,7 @@
Name: urpmi
Version: 3.3
-Release: 13mdk
+Release: 14mdk
License: GPL
Source0: %{name}.tar.bz2
Source1: %{name}.logrotate
@@ -11,6 +11,7 @@ Requires: eject, webfetch, perl-DateManip >= 5.40
PreReq: perl-gettext, rpmtools >= 4.2-4mdk
BuildRequires: bzip2-devel gcc-c++ gettext rpm-devel rpmtools
BuildRoot: %{_tmppath}/%{name}-buildroot
+BuildArch: noarch
Group: %{group}
%description
@@ -62,7 +63,7 @@ hackkernel
EOF
mkdir -p $RPM_BUILD_ROOT%{perl_sitearch}
-install -m 644 urpm.pm $RPM_BUILD_ROOT%{perl_sitearch}
+install -m 644 urpm.pm $RPM_BUILD_ROOT%{perl_sitearch}/../urpm.pm
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man3
pod2man urpm.pm >$RPM_BUILD_ROOT%{_mandir}/man3/urpm.3
@@ -125,7 +126,7 @@ fi
%{_mandir}/man?/urpm*
# find_lang isn't able to find man pages yet...
%lang(fr) %{_mandir}/fr/man?/urpm*
-%{perl_sitearch}/urpm.pm
+%{_libdir}/perl5/site_perl/*/urpm.pm
%files -n gurpmi
%defattr(-,root,root)
@@ -144,6 +145,10 @@ fi
%changelog
+* Thu Feb 21 2002 François Pons <fpons@ackbar.mandrakesoft.com> 3.3-14mdk
+- build package as noarch as there is no more any binary inside.
+- fixed urpme to avoid removing base package.
+
* Thu Feb 21 2002 François Pons <fpons@mandrakesoft.com> 3.3-13mdk
- removed staling debug log.
- try to mount a removable device before examining if an available
diff --git a/urpmq b/urpmq
index 0c796f4b..c493d06d 100755
--- a/urpmq
+++ b/urpmq
@@ -33,7 +33,7 @@ my @src_names;
sub usage {
print STDERR _("urpmq version %s
-Copyright (C) 2000, 2001 MandrakeSoft.
+Copyright (C) 2000, 2001, 2002 MandrakeSoft.
This is free software and may be redistributed under the terms of the GNU GPL.
usage: