summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2001-12-20 14:08:22 +0000
committerFrancois Pons <fpons@mandriva.com>2001-12-20 14:08:22 +0000
commit99444655133917f839a3534421eafd15e2bb3418 (patch)
tree7f444845f26ed5ecd9948529964c3f92a4abc6b9
parent4d94c8bbdb19eebc62cf4e36dcaff3c639f9f045 (diff)
downloadurpmi-99444655133917f839a3534421eafd15e2bb3418.tar
urpmi-99444655133917f839a3534421eafd15e2bb3418.tar.gz
urpmi-99444655133917f839a3534421eafd15e2bb3418.tar.bz2
urpmi-99444655133917f839a3534421eafd15e2bb3418.tar.xz
urpmi-99444655133917f839a3534421eafd15e2bb3418.zip
pre-noel version.
-rw-r--r--urpm.pm77
-rwxr-xr-xurpmi2
-rw-r--r--urpmi.spec13
-rwxr-xr-xurpmq3
4 files changed, 73 insertions, 22 deletions
diff --git a/urpm.pm b/urpm.pm
index ac5b99fb..2b73a96b 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -146,7 +146,8 @@ sub sync_curl {
#- options for ftp files, -R (-O <file>)*
#- options for http files, -R (-z file -O <file>)*
if (my @all_files = ((map { ("-O", $_ ) } @ftp_files), (map { /\/([^\/]*)$/ ? ("-z", $1, "-O", $_) : () } @other_files))) {
- system "/usr/bin/curl", "-R", @all_files;
+ print STDERR join " ", "/usr/bin/curl", "-R", "-f", @all_files;
+ system "/usr/bin/curl", "-R", "-f", @all_files;
$? == 0 or die _("curl failed: exited with %d or signal %d\n", $? >> 8, $? & 127);
}
}
@@ -634,6 +635,8 @@ sub update_media {
$medium->{with_hdlist} = "./synthesis.hdlist$suffix.cz";
} elsif (defined $suffix && !$suffix && -s "$dir/synthesis.hdlist1.cz" > 32) {
$medium->{with_hdlist} = "./synthesis.hdlist1.cz";
+ } elsif (defined $suffix && !$suffix && -s "$dir/synthesis.hdlist2.cz" > 32) {
+ $medium->{with_hdlist} = "./synthesis.hdlist2.cz";
} elsif (-s "$dir/../synthesis.hdlist$suffix.cz" > 32) {
$medium->{with_hdlist} = "../synthesis.hdlist$suffix.cz";
} elsif (defined $suffix && !$suffix && -s "$dir/../synthesis.hdlist1.cz" > 32) {
@@ -700,7 +703,7 @@ sub update_media {
}
}
} else {
- my $basename = ($medium->{with_hdlist} =~ /^.*\/([^\/]*)$/ && $1) || $medium->{with_hdlist};
+ my $basename;
#- try to get the description if it has been found.
unlink "$urpm->{cachedir}/partial/descriptions";
@@ -718,24 +721,52 @@ sub update_media {
system("mv", "$urpm->{cachedir}/partial/descriptions", "$urpm->{statedir}/descriptions.$medium->{name}");
}
- #- try to sync (copy if needed) local copy after restored the previous one.
- unlink "$urpm->{cachedir}/partial/$basename";
- if ($medium->{synthesis}) {
- $options{force} || ! -e "$urpm->{statedir}/synthesis.$medium->{hdlist}" or
- system("cp", "-a", "$urpm->{statedir}/synthesis.$medium->{hdlist}", "$urpm->{cachedir}/partial/$basename");
+ #- try to probe for possible with_hdlist parameter, unless
+ #- it is already defined (and valid).
+ $urpm->{log}(_("retrieving source hdlist (or synthesis) of \"%s\"...", $medium->{name}));
+ if ($options{probe_with_hdlist}) {
+ my ($suffix) = $dir =~ /RPMS([^\/]*)\/*$/;
+
+ foreach ($medium->{with_hdlist} ? ($medium->{with_hdlist}) : (),
+ "synthesis.hdlist.cz", "synthesis.hdlist$suffix.cz",
+ !$suffix ? ("synthesis.hdlist1.cz", "synthesis.hdlist2.cz") : (),
+ "../synthesis.hdlist$suffix.cz", !$suffix ? ("../synthesis.hdlist1.cz") : (),
+ "../base/hdlist$suffix.cz", !$suffix ? ("../base/hdlist1.cz") : (),
+ ) {
+ $basename = (/^.*\/([^\/]*)$/ && $1) || $_;
+
+ unlink "$urpm->{cachedir}/partial/$basename";
+ eval {
+ $urpm->{sync}("$urpm->{cachedir}/partial", "$medium->{url}/$_");
+ };
+ if (!$@ && -s "$urpm->{cachedir}/partial/$basename" > 32) {
+ $medium->{with_hdlist} = $_;
+ last; #- found a suitable with_hdlist in the list above.
+ }
+ }
} else {
- $options{force} || ! -e "$urpm->{statedir}/$medium->{hdlist}" or
- system("cp", "-a", "$urpm->{statedir}/$medium->{hdlist}", "$urpm->{cachedir}/partial/$basename");
+ $basename = ($medium->{with_hdlist} =~ /^.*\/([^\/]*)$/ && $1) || $medium->{with_hdlist};
+
+ #- try to sync (copy if needed) local copy after restored the previous one.
+ unlink "$urpm->{cachedir}/partial/$basename";
+ if ($medium->{synthesis}) {
+ $options{force} || ! -e "$urpm->{statedir}/synthesis.$medium->{hdlist}" or
+ system("cp", "-a", "$urpm->{statedir}/synthesis.$medium->{hdlist}", "$urpm->{cachedir}/partial/$basename");
+ } else {
+ $options{force} || ! -e "$urpm->{statedir}/$medium->{hdlist}" or
+ system("cp", "-a", "$urpm->{statedir}/$medium->{hdlist}", "$urpm->{cachedir}/partial/$basename");
+ }
+ eval {
+ $urpm->{sync}("$urpm->{cachedir}/partial", "$medium->{url}/$medium->{with_hdlist}");
+ };
+ if ($@) {
+ $urpm->{log}(_("...retrieving failed: %s", $@));
+ unlink "$urpm->{cachedir}/partial/$basename";
+ }
}
- eval {
- $urpm->{log}(_("retrieving source hdlist (or synthesis) of \"%s\"...", $medium->{name}));
- $urpm->{sync}("$urpm->{cachedir}/partial", "$medium->{url}/$medium->{with_hdlist}");
+ if (-s "$urpm->{cachedir}/partial/$basename" > 32) {
$urpm->{log}(_("...retrieving done"));
- };
- $@ and $urpm->{log}(_("...retrieving failed: %s", $@));
- -s "$urpm->{cachedir}/partial/$basename" > 32 or
- $error = 1, $urpm->{error}(_("retrieve of [%s] failed", "<source_url>/$medium->{with_hdlist}"));
- unless ($error) {
+
unless ($options{force}) {
my @sstat = stat "$urpm->{cachedir}/partial/$basename";
my @lstat = stat "$urpm->{statedir}/$medium->{hdlist}";
@@ -748,8 +779,10 @@ sub update_media {
}
#- the file are different, update local copy.
- rename("$urpm->{cachedir}/partial/$basename", "$urpm->{cachedir}/partial/$medium->{hdlist}") or
- system("mv", "$urpm->{cachedir}/partial/$basename", "$urpm->{cachedir}/partial/$medium->{hdlist}");
+ rename("$urpm->{cachedir}/partial/$basename", "$urpm->{cachedir}/partial/$medium->{hdlist}");
+ } else {
+ $error = 1;
+ $urpm->{error}(_("retrieve of source hdlist (or synthesis) failed"));
}
}
@@ -1326,6 +1359,9 @@ sub filter_packages_to_upgrade {
my ($urpm, $packages, $select_choices, %options) = @_;
my ($db, @packages) = (rpmtools::db_open(''), keys %$packages);
my ($id, %installed, %selected);
+ my $sig_handler = sub { rpmtools::db_close($db) };
+ local $SIG{INT} = $sig_handler;
+ local $SIG{QUIT} = $sig_handler;
#- at this level, compute global closure of what is requested, regardless of
#- choices for which all package in the choices are taken and their dependencies.
@@ -1770,6 +1806,9 @@ sub extract_packages_to_install {
sub select_packages_to_upgrade {
my ($urpm, $prefix, $packages, $remove_packages, $keep_files, %options) = @_;
my $db = rpmtools::db_open($prefix);
+ my $sig_handler = sub { rpmtools::db_close($db) };
+ local $SIG{INT} = $sig_handler;
+ local $SIG{QUIT} = $sig_handler;
#- used for package that are not correctly updated.
#- should only be used when nothing else can be done correctly.
diff --git a/urpmi b/urpmi
index d7afc1ee..4ddf791a 100755
--- a/urpmi
+++ b/urpmi
@@ -34,7 +34,7 @@ my $X = 0;
my $WID = 0;
my $all = 0;
my $rpm_opt = "vh";
-my $use_provides = 0;
+my $use_provides = 1;
my $verbose = 0;
my $uid;
diff --git a/urpmi.spec b/urpmi.spec
index 52496cc5..018f7283 100644
--- a/urpmi.spec
+++ b/urpmi.spec
@@ -2,7 +2,7 @@
Name: urpmi
Version: 3.1
-Release: 3mdk
+Release: 4mdk
License: GPL
Source0: %{name}.tar.bz2
Source1: %{name}.logrotate
@@ -142,6 +142,17 @@ fi
%changelog
+* Thu Dec 20 2001 François Pons <fpons@mandrakesoft.com> 3.1-4mdk
+- make sure curl fail if http url does not exists.
+- added probe for http or ftp hdlist or synthesis when adding
+ a medium (-h).
+- added probe for synthesis.hdlist2.cz (contrib medium).
+- added signal handler when opening rpm database to make sure
+ it will be closed on SIGINT or SIGQUIT.
+- urpmi use -p by default.
+- allow urpmq to download rpm with http or ftp protocol when
+ invoked with --headers (fix rpminst behaviour).
+
* Mon Dec 17 2001 François Pons <fpons@mandrakesoft.com> 3.1-3mdk
- fixed choice listing.
- somewhat fixed -p kernel.
diff --git a/urpmq b/urpmq
index b5d3c814..fcedeb53 100755
--- a/urpmq
+++ b/urpmq
@@ -150,7 +150,8 @@ if ($query->{headers} || $query->{sources}) {
$packer->extract_archive(undef, @headers);
} else {
#- fallback to retrieve rpm package before, so that --headers will be ok.
- my %uploads = $urpm->upload_source_packages({}, $list, '', undef);
+ my %uploads = $urpm->upload_source_packages({}, $list, 'local', undef);
+ print STDERR join " ", "rpm2header", values %uploads;
system "rpm2header", values %uploads;
}
}