diff options
-rw-r--r-- | urpm.pm | 20 | ||||
-rw-r--r-- | urpmi.spec | 10 |
2 files changed, 20 insertions, 10 deletions
@@ -78,7 +78,7 @@ sub new { media => undef, params => new rpmtools, - sync => \&sync_curl, #- first argument is directory, others are url to fetch. + sync => \&sync_webfetch, #- first argument is directory, others are url to fetch. fatal => sub { printf STDERR "%s\n", $_[1]; exit($_[0]) }, error => sub { printf STDERR "%s\n", $_[0] }, @@ -90,17 +90,23 @@ sub new { sub quotespace { local $_ = $_[0]; s/(\s)/\\$1/g; $_ } sub unquotespace { local $_ = $_[0]; s/\\(\s)/$1/g; $_ } -#- syncing algorithms, currently is implemented wget and curl methods. +#- syncing algorithms, currently is implemented wget and curl methods, +#- webfetch is trying to find the best (and one which will work :-) +sub sync_webfetch { + -x "/usr/bin/curl" and return &sync_curl; + -x "/usr/bin/wget" and return &sync_wget; + die _("no webfetch (curl or wget for example) found\n"); +} sub sync_wget { -x "/usr/bin/wget" or die _("wget is missing\n"); system "/usr/bin/wget", "-NP", @_; - $? == 0 or die _("wget failed\n"); + $? == 0 or die _("wget failed: exited with %d or signal %d\n", $? >> 8, $? & 127); } sub sync_curl { -x "/usr/bin/curl" or die _("curl is missing\n"); chdir shift @_; system "/usr/bin/curl", "-R", map { ("-O", $_ ) } @_; - $? == 0 or die _("curl failed\n"); + $? == 0 or die _("curl failed: exited with %d or signal %d\n", $? >> 8, $? & 127); } #- read /etc/urpmi/urpmi.cfg as config file, keep compability with older @@ -549,7 +555,7 @@ sub update_media { $urpm->{sync}("$urpm->{cachedir}/partial", "$medium->{url}/../descriptions"); $urpm->{log}(_("...retrieving done")); }; - $@ and $urpm->{log}(_("...retrieving failed")); + $@ and $urpm->{log}(_("...retrieving failed: %s", $@)); if (-e "$urpm->{cachedir}/partial/descriptions") { rename("$urpm->{cachedir}/partial/descriptions", "$urpm->{statedir}/descriptions.$medium->{name}") or @@ -572,7 +578,7 @@ sub update_media { $urpm->{sync}("$urpm->{cachedir}/partial", "$medium->{url}/$medium->{with_hdlist}"); $urpm->{log}(_("...retrieving done")); }; - $@ and $urpm->{log}(_("...retrieving failed")); + $@ and $urpm->{log}(_("...retrieving failed: %s", $@)); -s "$urpm->{cachedir}/partial/$basename" or $error = 1, $urpm->{error}(_("retrieve of [%s] failed", "<source_url>/$medium->{with_hdlist}")); unless ($error) { @@ -1699,7 +1705,7 @@ sub upload_source_packages { $urpm->{sync}("$urpm->{cachedir}/rpms", @distant_sources); $urpm->{log}(_("...retrieving done")); }; - $@ and $urpm->{log}(_("...retrieving failed")); + $@ and $urpm->{log}(_("...retrieving failed: %s", $@)); #- return the hash of rpm file that have to be installed, they are all local now. %$local_sources, %sources; @@ -2,13 +2,13 @@ Name: urpmi Version: 2.1 -Release: 5mdk +Release: 6mdk License: GPL Source0: %{name}.tar.bz2 Source1: %{name}.logrotate Summary: User mode rpm install -Requires: eject, wget -PreReq: perl-gettext, rpmtools >= 3.1-5mdk +Requires: eject, webfetch +PreReq: perl-gettext, rpmtools >= 3.1-9mdk BuildRequires: libbzip2-devel rpm-devel BuildRoot: %{_tmppath}/%{name}-buildroot @@ -129,6 +129,10 @@ rm -f /var/lib/urpmi/depslist %changelog +* Wed Nov 28 2001 François Pons <fpons@mandrakesoft.com> 2.1-6mdk +- updated requires to webfetch. +- updated requires to last rpmtools needed. + * Wed Nov 28 2001 François Pons <fpons@mandrakesoft.com> 2.1-5mdk - fixed URL with trailing slashes. - added download log. |