summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--urpm.pm8
-rwxr-xr-xurpmi58
-rw-r--r--urpmi.spec13
3 files changed, 61 insertions, 18 deletions
diff --git a/urpm.pm b/urpm.pm
index 00608151..40853d54 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -2,7 +2,6 @@ package urpm;
use strict;
use vars qw($VERSION @ISA);
-use Fcntl ':flock';
$VERSION = '3.3';
@@ -642,13 +641,16 @@ sub build_synthesis_hdlist {
sub update_media {
my ($urpm, %options) = @_; #- do not trust existing hdlist and try to recompute them.
+ #- avoid putting a require on Fcntl ':flock' (which is perl and not perl-base).
+ my ($LOCK_EX, $LOCK_NB, $LOCK_UN) = (2, 4, 8);
+
#- avoid trashing existing configuration in this case.
$urpm->{media} or return;
#- lock urpmi database.
local (*LOCK_FILE);
open LOCK_FILE, $urpm->{statedir};
- flock LOCK_FILE, LOCK_EX|LOCK_NB or $urpm->{fatal}(7, _("urpmi database locked"));
+ flock LOCK_FILE, $LOCK_EX|$LOCK_NB or $urpm->{fatal}(7, _("urpmi database locked"));
#- examine each medium to see if one of them need to be updated.
#- if this is the case and if not forced, try to use a pre-calculated
@@ -1051,7 +1053,7 @@ sub update_media {
system("sync");
#- release lock on database.
- flock LOCK_FILE, LOCK_UN;
+ flock LOCK_FILE, $LOCK_UN;
close LOCK_FILE;
}
diff --git a/urpmi b/urpmi
index 5165cdcf..533902e7 100755
--- a/urpmi
+++ b/urpmi
@@ -143,7 +143,7 @@ for (@ARGV) {
my $urpm = new urpm;
my ($pid_out, $pid_err);
-if ($uid) {
+if ($uid > 0) {
#- only src files are installable using urpmi.
@names || @files and $urpm->{fatal}(1, _("Only superuser is allowed to install packages"));
@@ -284,13 +284,23 @@ my @to_install;
#- has not been given by the user.
my $ask_user = $auto_select && scalar(keys %packages);
my $sum = 0;
+my @root_only;
+
foreach (keys %packages) {
defined $packages{$_} and $ask_user = 1;
my $info = $urpm->{params}{depslist}[$_];
- $sum += $info->{size};
- push @to_install, "$info->{name}-$info->{version}-$info->{release}.$info->{arch}";
+ my $fullname = "$info->{name}-$info->{version}-$info->{release}.$info->{arch}";
+ if ($uid > 0 && $info->{arch} ne 'src') {
+ push @root_only, $fullname;
+ } elsif ($uid > 0 || $info->{arch} ne 'src') {
+ $sum += $info->{size};
+ push @to_install, $fullname;
+ }
}
-if (!$auto && $ask_user) {
+if (@root_only) {
+ print STDERR _("You need to be root to install the following dependencies:\n%s\n", join ' ', @root_only);
+ exit 1;
+} elsif (!$auto && $ask_user) {
my $msg = _("To satisfy dependencies, the following packages are going to be installed (%d MB)", toMb($sum));
my $msg2 = _("Is it OK?");
if ($X) {
@@ -302,7 +312,11 @@ if (!$auto && $ask_user) {
} else {
$noexpr = _("Nn");
$yesexpr = _("Yy");
- print SAVEOUT "$msg:\n@to_install\n$msg2" . _(" (Y/n) ");
+ if ($uid > 0) {
+ print STDOUT "$msg:\n@to_install\n$msg2" . _(" (Y/n) ");
+ } else {
+ print SAVEOUT "$msg:\n@to_install\n$msg2" . _(" (Y/n) ");
+ }
<STDIN> =~ /[$noexpr]/ and exit 0;
}
}
@@ -330,7 +344,11 @@ my %sources = $urpm->download_source_packages($local_sources, $list, ($X ? '' :
`gmessage -default $ok -buttons "$ok:0,$cancel:2" "$msg"`;
!$?;
} else {
- print SAVEOUT "$msg\n$msg2 ";
+ if ($uid > 0) {
+ print STDOUT "$msg\n$msg2 ";
+ } else {
+ print SAVEOUT "$msg\n$msg2 ";
+ }
<STDIN>; 1;
}
});
@@ -342,7 +360,11 @@ if ($uid == 0) {
}
if (@rpms_install || @rpms_upgrade) {
- printf SAVEOUT _("installing %s\n", join(' ', @rpms_install, @rpms_upgrade));
+ if ($uid > 0) {
+ printf STDOUT _("installing %s\n", join(' ', @rpms_install, @rpms_upgrade));
+ } else {
+ printf SAVEOUT _("installing %s\n", join(' ', @rpms_install, @rpms_upgrade));
+ }
log_it(scalar localtime, " @_\n");
#- check for local files.
foreach (@rpms_install, @rpms_upgrade) {
@@ -369,7 +391,11 @@ if (@rpms_install || @rpms_upgrade) {
$noexpr = _("Nn");
$yesexpr = _("Yy");
- print SAVEOUT _("Try installation even more strongly (--force)? (y/N) ");
+ if ($uid > 0) {
+ print STDOUT _("Try installation even more strongly (--force)? (y/N) ");
+ } else {
+ print SAVEOUT _("Try installation even more strongly (--force)? (y/N) ");
+ }
$force or <STDIN> =~ /[$yesexpr]/ or exit 1;
$urpm->{log}("starting force installing packages without deps");
system("rpm", "-i$rpm_opt", "--nodeps", "--force", @rpms_install);
@@ -385,14 +411,22 @@ if (@rpms_install || @rpms_upgrade) {
$noexpr = _("Nn");
$yesexpr = _("Yy");
- print SAVEOUT _("Try installation without checking dependencies? (y/N) ");
+ if ($uid > 0) {
+ print STDOUT _("Try installation without checking dependencies? (y/N) ");
+ } else {
+ print SAVEOUT _("Try installation without checking dependencies? (y/N) ");
+ }
$force or <STDIN> =~ /[$yesexpr]/ or exit 1;
$urpm->{log}("starting installing packages without deps");
system("rpm", "-U$rpm_opt", "--nodeps", @rpms_upgrade);
if ($?) {
message(_("Installation failed"));
- print SAVEOUT _("Try installation even more strongly (--force)? (y/N) ");
+ if ($uid > 0) {
+ print STDOUT _("Try installation even more strongly (--force)? (y/N) ");
+ } else {
+ print SAVEOUT _("Try installation even more strongly (--force)? (y/N) ");
+ }
$force or <STDIN> =~ /[$yesexpr]/ or exit 1;
$urpm->{log}("starting force installing packages without deps");
system("rpm", "-U$rpm_opt", "--nodeps", "--force", @rpms_upgrade);
@@ -417,9 +451,9 @@ sub toMb {
int $nb + 0.5;
}
-sub message { $X ? `gmessage -default Ok -buttons Ok "$_[0]"` : print SAVEOUT "$_[0]\n"; }
+sub message { $X ? `gmessage -default Ok -buttons Ok "$_[0]"` : $uid > 0 ? print STDOUT "$_[0]\n" : print SAVEOUT "$_[0]\n"; }
-sub message_auto { $auto ? print SAVEOUT "$_[0]\n" : message($_[0]); }
+sub message_auto { $auto ? ($uid > 0 ? print STDOUT "$_[0]\n" : print SAVEOUT "$_[0]\n") : message($_[0]); }
sub log_it {
#- if invoked as a simple user, nothing should be logged.
diff --git a/urpmi.spec b/urpmi.spec
index 2bb0ec52..1e194a3f 100644
--- a/urpmi.spec
+++ b/urpmi.spec
@@ -2,7 +2,7 @@
Name: urpmi
Version: 3.3
-Release: 14mdk
+Release: 15mdk
License: GPL
Source0: %{name}.tar.bz2
Source1: %{name}.logrotate
@@ -50,7 +50,6 @@ cat <<EOF >$RPM_BUILD_ROOT/etc/urpmi/inst.list
# Here you can specify packages that need to be installed instead
# of being upgraded (typically kernel packages).
kernel
-kernel-source
kernel-smp
kernel-secure
kernel-enterprise
@@ -145,7 +144,15 @@ fi
%changelog
-* Thu Feb 21 2002 François Pons <fpons@ackbar.mandrakesoft.com> 3.3-14mdk
+* Mon Feb 25 2002 François Pons <fpons@mandrakesoft.com> 3.3-15mdk
+- fixed not to require Fcntl module (in perl package).
+- fixed bad behaviour on src package as user (no message).
+- fixed src package listed on package to be installed (which is
+ wrong).
+- removed kernel-source in inst.list which may breaks on some
+ case (workaround).
+
+* Thu Feb 21 2002 François Pons <fpons@mandrakesoft.com> 3.3-14mdk
- build package as noarch as there is no more any binary inside.
- fixed urpme to avoid removing base package.