diff options
-rw-r--r-- | urpm.pm | 27 | ||||
-rwxr-xr-x | urpmi | 50 | ||||
-rwxr-xr-x | urpmi.addmedia | 1 | ||||
-rw-r--r-- | urpmi.spec | 13 | ||||
-rwxr-xr-x | urpmi.update | 4 |
5 files changed, 74 insertions, 21 deletions
@@ -329,7 +329,8 @@ sub sync_rsync { open RSYNC, join(" ", map { "'$_'" } "/usr/bin/rsync", ($limit_rate ? "--bwlimit=$limit_rate" : ()), (ref($options) && $options->{quiet} ? qw(-q) : qw(--progress -v)), - qw(--partial -z --no-whole-file), $file, (ref($options) ? $options->{dir} : $options)) . " |"; + (ref($options) && $options->{compress} ? qw(-z) : ()), + qw(--partial --no-whole-file), $file, (ref($options) ? $options->{dir} : $options)) . " |"; local $/ = \1; #- read input by only one char, this is slow but very nice (and it works!). while (<RSYNC>) { $buf .= $_; @@ -375,6 +376,7 @@ sub sync_ssh { open RSYNC, join(" ", map { "'$_'" } "/usr/bin/rsync", ($limit_rate ? "--bwlimit=$limit_rate" : ()), (ref($options) && $options->{quiet} ? qw(-q) : qw(--progress -v)), + (ref($options) && $options->{compress} ? qw(-z) : ()), qw(--partial -e ssh), $file, (ref($options) ? $options->{dir} : $options)) . " |"; local $/ = \1; #- read input by only one char, this is slow but very nice (and it works!). while (<RSYNC>) { @@ -441,7 +443,7 @@ sub read_config { $_ eq '}' and last; #- check for boolean variables first, and after that valued variables. my ($no, $k, $v); - if (($no, $k, $v) = /^(no-)?(verify-rpm|fuzzy|allow-(?:force|nodeps)|(?:pre|post)-clean|excludedocs)(?:\s*:\s*(.*))?$/) { + if (($no, $k, $v) = /^(no-)?(verify-rpm|fuzzy|allow-(?:force|nodeps)|(?:pre|post)-clean|excludedocs|compress)(?:\s*:\s*(.*))?$/) { unless (exists($urpm->{options}{$k})) { $urpm->{options}{$k} = $v eq '' || $v =~ /^(yes|on|1)$/i || 0; $no and $urpm->{options}{$k} = ! $urpm->{options}{$k} || 0; @@ -978,6 +980,7 @@ sub add_distrib_media { $urpm->{sync}({ dir => "$urpm->{cachedir}/partial", quiet => 1, limit_rate => $options{limit_rate}, + compress => $options{compress}, proxy => $urpm->{proxy} }, reduce_pathname("$url/Mandrake/base/hdlists")); $urpm->{log}(N("...retrieving done")); @@ -1485,6 +1488,7 @@ this could happen if you mounted manually the directory when creating the medium $urpm->{sync}({ dir => "$urpm->{cachedir}/partial", quiet => 1, limit_rate => $options{limit_rate}, + compress => $options{compress}, proxy => $urpm->{proxy} }, reduce_pathname("$medium->{url}/../descriptions")); }; @@ -1509,6 +1513,7 @@ this could happen if you mounted manually the directory when creating the medium $urpm->{sync}({ dir => "$urpm->{cachedir}/partial", quiet => 1, limit_rate => $options{limit_rate}, + compress => $options{compress}, proxy => $urpm->{proxy} }, reduce_pathname("$medium->{url}/$medium->{with_hdlist}/../MD5SUM")); } @@ -1598,6 +1603,7 @@ this could happen if you mounted manually the directory when creating the medium $urpm->{sync}({ dir => "$urpm->{cachedir}/partial", quiet => 0, limit_rate => $options{limit_rate}, + compress => $options{compress}, callback => $options{callback}, proxy => $urpm->{proxy} }, reduce_pathname("$medium->{url}/$with_hdlist")); }; @@ -1627,6 +1633,7 @@ this could happen if you mounted manually the directory when creating the medium $urpm->{sync}({ dir => "$urpm->{cachedir}/partial", quiet => 0, limit_rate => $options{limit_rate}, + compress => $options{compress}, callback => $options{callback}, proxy => $urpm->{proxy} }, reduce_pathname("$medium->{url}/$medium->{with_hdlist}")); }; @@ -1687,6 +1694,7 @@ this could happen if you mounted manually the directory when creating the medium $urpm->{sync}({ dir => "$urpm->{cachedir}/partial", quiet => 1, limit_rate => $options{limit_rate}, + compress => $options{compress}, proxy => $urpm->{proxy} }, $_); $local_list ne 'list' && -s "$urpm->{cachedir}/partial/$local_list" and @@ -1707,6 +1715,7 @@ this could happen if you mounted manually the directory when creating the medium $urpm->{sync}({ dir => "$urpm->{cachedir}/partial", quiet => 1, limit_rate => $options{limit_rate}, + compress => $options{compress}, proxy => $urpm->{proxy} }, $_); $local_pubkey ne 'pubkey' && -s "$urpm->{cachedir}/partial/$local_pubkey" and @@ -1931,8 +1940,17 @@ this could happen if you mounted manually the directory when creating the medium $urpm->{modified} = 1; } elsif ($medium->{synthesis}) { if ($urpm->{second_pass}) { - $urpm->{log}(N("examining synthesis file [%s]", "$urpm->{statedir}/synthesis.$medium->{hdlist}")); - ($medium->{start}, $medium->{end}) = $urpm->parse_synthesis("$urpm->{statedir}/synthesis.$medium->{hdlist}"); + if ($medium->{virtual}) { + my ($path) = $medium->{url} =~ /^file:\/*(\/[^\/].*[^\/])\/*$/; + my $with_hdlist_file = "$path/$medium->{with_hdlist}"; + if ($path) { + $urpm->{log}(N("examining synthesis file [%s]", $with_hdlist_file)); + eval { ($medium->{start}, $medium->{end}) = $urpm->parse_synthesis($with_hdlist_file) }; + } + } else { + $urpm->{log}(N("examining synthesis file [%s]", "$urpm->{statedir}/synthesis.$medium->{hdlist}")); + ($medium->{start}, $medium->{end}) = $urpm->parse_synthesis("$urpm->{statedir}/synthesis.$medium->{hdlist}"); + } } } else { if ($urpm->{second_pass}) { @@ -2808,6 +2826,7 @@ sub download_packages_of_distant_media { quiet => 0, verbose => $options{verbose}, limit_rate => $options{limit_rate}, + compress => $options{compress}, callback => $options{callback}, proxy => $urpm->{proxy} }, values %distant_sources); @@ -216,6 +216,7 @@ while (defined($_ = shift @ARGV)) { /y/ and do { $urpm->{options}{fuzzy} = 1; next }; /s/ and do { $src = 1; next }; /v/ and do { ++$verbose; $rpm_opt = "vh"; next }; + /z/ and do { $urpm->{options}{compress} = 1; next }; die N("urpmi: unknown option \"-%s\", check usage with --help\n", $1) } next }; @nextargv and do { my $r = shift @nextargv; $r and $$r = $_; next }; if (/\.rpm$/) { @@ -244,13 +245,7 @@ if ($install_src) { if ($bug) { mkdir $bug or $urpm->{fatal}(8, N("Unable to create directory [%s] for bug report", $bug)); #- copy all synthesis file used, along with configuration of urpmi - system("cp", "-af", $urpm->{config}, $urpm->{skiplist}, $urpm->{instlist}, $bug); - local *DIR; - opendir DIR, $urpm->{statedir}; - while (defined ($_ = readdir DIR)) { - /synthesis\./ and system "cp", "-af", "$urpm->{statedir}/$_", $bug; - } - closedir DIR; + system("cp", "-af", $urpm->{skiplist}, $urpm->{instlist}, $bug); #- allow log file. $log = "$bug/urpmi.log"; } @@ -323,8 +318,10 @@ unless ($bug) { } $verbose > 0 or $urpm->{log} = sub {}; -$urpm->exlock_rpm_db; -$urpm->shlock_urpmi_db; +unless ($env) { + $urpm->exlock_rpm_db; + $urpm->shlock_urpmi_db; +} $urpm->configure(nocheck_access => $env || $uid > 0, media => $media, excludemedia => $excludemedia, @@ -337,7 +334,7 @@ $urpm->configure(nocheck_access => $env || $uid > 0, parallel => $parallel, ); #- get back activated default values of boolean options. -foreach (qw(post-clean use-provides verify-rpm)) { +foreach (qw(post-clean verify-rpm)) { exists $urpm->{options}{$_} or $urpm->{options}{$_} = 1; } exists $urpm->{options}{'split-level'} or $urpm->{options}{'split-level'} = $split_level; @@ -346,6 +343,28 @@ exists $urpm->{options}{'split-length'} or $urpm->{options}{'split-length'} = $s my $state = {}; my %requested = $urpm->register_rpms(@files, @src_files); +#- finish bug environment creation. +if ($bug) { + require URPM::Build; + foreach (@{$urpm->{media}}) { + #- take care of virtual medium this way. + $_->{hdlist} ||= "hdlist.$_->{name}.cz"; + delete $_->{virtual}; + #- now build directly synthesis file, this is by far the simplest method. + if (defined $_->{start} && defined $_->{end}) { + $urpm->build_synthesis(start => $_->{start}, end => $_->{end}, synthesis => "$bug/synthesis.$_->{hdlist}"); + $urpm->{log}(N("built hdlist synthesis file for medium \"%s\"", $_->{name})); + } + } + #- fake configuration written to convert virtual media on the fly. + $urpm->{config} = "$bug/urpmi.cfg"; + $urpm->write_config; + #- handle local packages, copy them directly in bug environment. + foreach (keys %requested) { + $urpm->{source}{$_} and system "cp", "-af", $urpm->{source}{$_}, $bug; + } +} + #- search the packages according the selection given by the user, #- basesystem is added to the list so if it need to be upgraded, #- all its dependency will be updated too. @@ -549,6 +568,7 @@ foreach my $set (@{$state->{transaction} || []}) { $urpm->download_packages_of_distant_media(\@transaction_list, \%transaction_sources, \%error_sources, verbose => $verbose > 0, limit_rate => $urpm->{options}{'limit-rate'}, + compress => $urpm->{options}{compress}, force_local => 1, callback => sub { my ($mode, $file, $percent, $total, $eta, $speed) = @_; @@ -749,11 +769,13 @@ if ($nok) { } } -$urpm->unlock_urpmi_db; -$urpm->unlock_rpm_db; +unless ($env) { + $urpm->unlock_urpmi_db; + $urpm->unlock_rpm_db; -#- try to umount removable device which may have been mounted. -$urpm->try_umounting_removables; + #- try to umount removable device which may have been mounted. + $urpm->try_umounting_removables; +} #- this help flushing correctly by closing this file before (piped on tee). #- but killing them is generally better. diff --git a/urpmi.addmedia b/urpmi.addmedia index 6a697582..dcfa0f3b 100755 --- a/urpmi.addmedia +++ b/urpmi.addmedia @@ -86,6 +86,7 @@ and [options] are from /^--?c/ and $options{noclean} = 0, next; /^--?h/ and next; /^--?f/ and ++$options{force}, next; + /^-z$/ and ++$options{compress}, next; /^--wget/ and $urpm->{sync} = sub { my $options = shift @_; if (ref $options) { $options->{prefer} = 'wget' } else { $options = { dir => $options, prefer => 'wget' } } @@ -2,7 +2,7 @@ Name: urpmi Version: 4.4 -Release: 30mdk +Release: 31mdk License: GPL Source0: %{name}.tar.bz2 Source1: %{name}.logrotate @@ -202,6 +202,17 @@ $urpm->update_media(nolock => 1, nopubkey => 1); %changelog +* Thu Sep 4 2003 François Pons <fpons@mandrakesoft.com> 4.4-31mdk +- removed obsoleted and no more used -d of urpmi.update. +- fixed --bug to handle local pakcages and virtual media. +- added -z option to urpmi, urpmi.addmedia and urpmi.update for + handling on the fly compression if possible, only handled for + rsync:// and ssh:// protocol currently. +- removed -z option by default for rsync:// protocol. +- avoid trying locking rpmdb when using --env. +- fixed media updating on second pass when a synthesis + virtual medium is used. + * Tue Sep 2 2003 François Pons <fpons@mandrakesoft.com> 4.4-30mdk - improved checking to be safer and smarter. - added urpm::check_sources_signatures. diff --git a/urpmi.update b/urpmi.update index 962a431b..c2f008fb 100755 --- a/urpmi.update +++ b/urpmi.update @@ -30,8 +30,8 @@ sub main { while ($_ = shift @_) { /^--?a/ and $options{all} = 1, next; /^--?c/ and $options{noclean} = 0, next; - /^--?d/ and $options{depslist} = 1, next; /^--?f/ and ++$options{force}, next; + /^-z$/ and ++$options{compress}, next; /^--update$/ and $options{update} = 1, next; /^--wget$/ and $urpm->{sync} = sub { my $options = shift @_; if (ref $options) { $options->{prefer} = 'wget' } @@ -55,6 +55,7 @@ sub main { }; /^--no-md5sum/ and $options{nomd5sum} = 1, next; /^--?noa/ and next; #- default, keeped for compability. + /^--?d/ and next; #- default, keeped for compability. /^-/ and die N("usage: urpmi.update [options] <name> ... where <name> is a medium name to update. ") . N(" --help - print this help message. @@ -68,7 +69,6 @@ where <name> is a medium name to update. ") . N(" --update - update only update media. ") . N(" -a - select all non-removable media. ") . N(" -c - clean headers cache directory. -") . N(" -d - force complete computation of depslist.ordered file. ") . N(" -f - force generation of hdlist files. ") . (/^--?h(?:elp)$/ ? '' : N("\nunknown options '%s'\n", $_)); push @toupdates, $_; |