diff options
author | Francois Pons <fpons@mandriva.com> | 2002-11-29 12:31:24 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2002-11-29 12:31:24 +0000 |
commit | 5443ef24e434a6635f086d491c9c0e86dfec68bd (patch) | |
tree | 6bb1ab47df25fe77455243e6d34450d3f6b1cfdb | |
parent | 535f899cc9098478cc5459fc35b6a9355ab68236 (diff) | |
download | urpmi-5443ef24e434a6635f086d491c9c0e86dfec68bd.tar urpmi-5443ef24e434a6635f086d491c9c0e86dfec68bd.tar.gz urpmi-5443ef24e434a6635f086d491c9c0e86dfec68bd.tar.bz2 urpmi-5443ef24e434a6635f086d491c9c0e86dfec68bd.tar.xz urpmi-5443ef24e434a6635f086d491c9c0e86dfec68bd.zip |
4.1-4mdk
-rw-r--r-- | urpm.pm | 51 | ||||
-rwxr-xr-x | urpmi.addmedia | 2 | ||||
-rw-r--r-- | urpmi.spec | 11 |
3 files changed, 51 insertions, 13 deletions
@@ -206,13 +206,17 @@ sub sync_webfetch { } delete @files{qw(ftp http)}; } - if ($files{rsync} || $files{ssh}) { - my @rsync_files = @{$files{rsync} || []}; + if ($files{rsync}) { + sync_rsync($options, @{$files{rsync} || []}); + delete $files{rsync}; + } + if ($files{ssh}) { + my @ssh_files; foreach (@{$files{ssh} || []}) { - /^ssh:\/\/([^\/]*)(.*)/ and push @rsync_files, "$1:$2"; + /^ssh:\/\/([^\/]*)(.*)/ and push @ssh_files, "$1:$2"; } - sync_rsync($options, @rsync_files); - delete @files{qw(rsync ssh)}; + sync_ssh($options, @ssh_files); + delete $files{ssh}; } %files and die _("unable to handle protocol: %s", join ', ', keys %files); } @@ -294,6 +298,20 @@ sub sync_rsync { my $count = 10; #- retry count on error (if file exists). my $basename = (/^.*\/([^\/]*)$/ && $1) || $_; do { + system "/usr/bin/rsync", (ref $options && $options->{quiet} ? ("-q") : ("--progress", "-v")), "--partial", + $_, (ref $options ? $options->{dir} : $options); + } while ($? != 0 && --$count > 0 && (-e (ref $options ? $options->{dir} : $options) . "/$basename")); + } + $? == 0 or die _("rsync failed: exited with %d or signal %d\n", $? >> 8, $? & 127); +} +sub sync_ssh { + -x "/usr/bin/rsync" or die _("rsync is missing\n"); + -x "/usr/bin/ssh" or die _("ssh is missing\n"); + my $options = shift @_; + foreach (@_) { + my $count = 10; #- retry count on error (if file exists). + my $basename = (/^.*\/([^\/]*)$/ && $1) || $_; + do { system "/usr/bin/rsync", (ref $options && $options->{quiet} ? ("-q") : ("--progress", "-v")), "--partial", "-e", "ssh", $_, (ref $options ? $options->{dir} : $options); } while ($? != 0 && --$count > 0 && (-e (ref $options ? $options->{dir} : $options) . "/$basename")); @@ -1220,7 +1238,7 @@ sub update_media { } else { #- if url is clear and no relative list file has been downloaded, #- there is no need for a list file. - if ($medium->{url} eq $medium->{clear_url}) { + if ($medium->{url} ne $medium->{clear_url}) { foreach ($medium->{start} .. $medium->{end}) { my $filename = $urpm->{depslist}[$_]->filename; $list{$filename} = "$medium->{url}/$filename\n"; @@ -1569,13 +1587,26 @@ sub register_rpms { #- depslist and provides environment. $start = @{$urpm->{depslist}}; foreach (@files) { - /(.*\/)?[^\/]*\.rpm$/ or $error = 1, $urpm->{error}(_("invalid rpm file name [%s]", $_)), next; - -r $_ or $error = 1, $urpm->{error}(_("unable to access rpm file [%s]", $_)), next; + /\.rpm$/ or $error = 1, $urpm->{error}(_("invalid rpm file name [%s]", $_)), next; + + #- allow url to be given. + if (my ($basename) = /^[^:]*:\/.*\/([^\/]*\.rpm)$/) { + unlink "$urpm->{cachedir}/partial/$basename"; + eval { + $urpm->{log}(_("retrieving rpm file [%s] ...", $_)); + $urpm->{sync}({dir => "$urpm->{cachedir}/partial", quiet => 0, proxy => $urpm->{proxy}}, $_); + $urpm->{log}(_("...retrieving done")); + $_ = "$urpm->{cachedir}/partial/$basename"; + }; + $@ and $urpm->{log}(_("...retrieving failed: %s", $@)); + } else { + -r $_ or $error = 1, $urpm->{error}(_("unable to access rpm file [%s]", $_)), next; + } ($id, undef) = $urpm->parse_rpm($_); - my $pkg = $urpm->{depslist}[$id]; + my $pkg = defined $id && $urpm->{depslist}[$id]; $pkg or $urpm->{error}(_("unable to register rpm file")), next; - $urpm->{source}{$id} = $1 ? $_ : "./$_"; + $urpm->{source}{$id} = $_; } $error and $urpm->{fatal}(1, _("error registering local packages")); $start <= $id and @requested{($start .. $id)} = (1) x ($id-$start+1); diff --git a/urpmi.addmedia b/urpmi.addmedia index 72d4d043..edbc5a46 100755 --- a/urpmi.addmedia +++ b/urpmi.addmedia @@ -150,7 +150,7 @@ and [options] are from $urpm->add_medium("$name$i", $options{distrib} eq 'updates' ? "$burl/$options{version}/RPMS" : $options{distrib} eq 'contrib' ? $burl."2" : $burl, - $options{distrib} ne 'contrib' && $relative_hdlist, + ($options{distrib} ne 'contrib' || $options{version} ne 'cooker') && $relative_hdlist, update => $options{update}); ++$i; } @@ -2,7 +2,7 @@ Name: urpmi Version: 4.1 -Release: 3mdk +Release: 4mdk License: GPL Source0: %{name}.tar.bz2 Source1: %{name}.logrotate @@ -204,13 +204,20 @@ fi %changelog +* Fri Nov 29 2002 François Pons <fpons@mandrakesoft.com> 4.1-4mdk +- allow urpmi <url> to work with rpm filename with all supported + protocols (ftp, http, ssh, rsync). +- fixed rsync:// protocol not to use rsync with -e along with + an rsync server. +- fixed missing list creation update. + * Thu Nov 28 2002 François Pons <fpons@mandrakesoft.com> 4.1-3mdk - added mirrors management for urpmi.addmedia, so added --distrib-XXX, --from, --version, --arch options. <url> is now just a regex for choosing a mirror, and <name> will have an numeric index appended to it. anyway for more info, look in the code or guess with - --help ;-) + --help ;-) too late here in Paris ... - urpmi.addmedia now delete failing media to create. - added --update option to urpmi.update, guess for what ? |