diff options
author | Francois Pons <fpons@mandriva.com> | 2003-06-19 14:25:18 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2003-06-19 14:25:18 +0000 |
commit | 6ccf6ba7debe8f7761d37ae5b8e32bad5e46b6e0 (patch) | |
tree | e64e7b0bccaaa9d30d1d8925f433b1c6ac76d31f | |
parent | 5f7858e393290836dab05a68373ec00511a9bd3b (diff) | |
download | urpmi-6ccf6ba7debe8f7761d37ae5b8e32bad5e46b6e0.tar urpmi-6ccf6ba7debe8f7761d37ae5b8e32bad5e46b6e0.tar.gz urpmi-6ccf6ba7debe8f7761d37ae5b8e32bad5e46b6e0.tar.bz2 urpmi-6ccf6ba7debe8f7761d37ae5b8e32bad5e46b6e0.tar.xz urpmi-6ccf6ba7debe8f7761d37ae5b8e32bad5e46b6e0.zip |
4.4-5mdk
-rw-r--r-- | urpm.pm | 232 | ||||
-rwxr-xr-x | urpmi | 2 | ||||
-rwxr-xr-x | urpmi.addmedia | 10 | ||||
-rw-r--r-- | urpmi.spec | 9 |
4 files changed, 159 insertions, 94 deletions
@@ -441,8 +441,8 @@ sub read_config { while (<F>) { chomp; s/#.*$//; s/^\s*//; s/\s*$//; $_ eq '}' and last; - /^(hdlist|with_hdlist|list|removable|md5sum|key_ids)\s*:\s*(.*)$/ and $medium->{$1} = $2, next; - /^(update|ignore|synthesis)\s*$/ and $medium->{$1} = 1, next; + /^(hdlist|list|with_hdlist|removable|md5sum|key_ids)\s*:\s*(.*)$/ and $medium->{$1} = $2, next; + /^(update|ignore|synthesis|virtual)\s*$/ and $medium->{$1} = 1, next; /^modified\s*$/ and next; $_ and $urpm->{error}(N("syntax error in config file at line %s", $.)); } @@ -531,49 +531,66 @@ sub probe_medium { $medium->{url} ||= $medium->{clear_url}; - unless ($medium->{ignore} || $medium->{hdlist}) { - $medium->{hdlist} = "hdlist.$medium->{name}.cz"; - -e "$urpm->{statedir}/$medium->{hdlist}" or $medium->{hdlist} = "hdlist.$medium->{name}.cz2"; - -e "$urpm->{statedir}/$medium->{hdlist}" or - $medium->{ignore} = 1, $urpm->{error}(N("unable to find hdlist file for \"%s\", medium ignored", $medium->{name})); - } - unless ($medium->{ignore} || $medium->{list}) { - unless (defined $medium->{url}) { - $medium->{list} = "list.$medium->{name}"; - unless (-e "$urpm->{statedir}/$medium->{list}") { - $medium->{ignore} = 1, $urpm->{error}(N("unable to find list file for \"%s\", medium ignored", $medium->{name})); - } - } - } - - #- there is a little more to do at this point as url is not known, inspect directly list file for it. - unless ($medium->{url}) { - my %probe; - if (-r "$urpm->{statedir}/$medium->{list}") { - local *L; - open L, "$urpm->{statedir}/$medium->{list}"; - while (<L>) { - #- /./ is end of url marker in list file (typically generated by a - #- find . -name "*.rpm" > list - #- for exportable list file. - /^(.*)\/\.\// and $probe{$1} = undef; - /^(.*)\/[^\/]*$/ and $probe{$1} = undef; - } - close L; - } - foreach (sort { length($a) <=> length($b) } keys %probe) { - if ($medium->{url}) { - $medium->{url} eq substr($_, 0, length($medium->{url})) or - $medium->{ignore} || $urpm->{error}(N("incoherent list file for \"%s\", medium ignored", $medium->{name})), - $medium->{ignore} = 1, last; - } else { - $medium->{url} = $_; + if ($medium->{virtual}) { + #- a virtual medium need to have an url available without using a list file. + if ($medium->{hdlist} || $medium->{list}) { + $medium->{ignore} = 1; + $urpm->{error}(N("virtual medium \"%s\" should not have defined hdlist or list file, medium ignored", + $medium->{name})); + } + unless ($medium->{url}) { + $medium->{ignore} = 1; + $urpm->{error}(N("virtual medium \"%s\" should have a clear url, medium ignored", + $medium->{name})); + } + } else { + unless ($medium->{ignore} || $medium->{hdlist}) { + $medium->{hdlist} = "hdlist.$medium->{name}.cz"; + -e "$urpm->{statedir}/$medium->{hdlist}" or $medium->{hdlist} = "hdlist.$medium->{name}.cz2"; + -e "$urpm->{statedir}/$medium->{hdlist}" or + $medium->{ignore} = 1, + $urpm->{error}(N("unable to find hdlist file for \"%s\", medium ignored", $medium->{name})); + } + unless ($medium->{ignore} || $medium->{list}) { + unless (defined $medium->{url}) { + $medium->{list} = "list.$medium->{name}"; + unless (-e "$urpm->{statedir}/$medium->{list}") { + $medium->{ignore} = 1, + $urpm->{error}(N("unable to find list file for \"%s\", medium ignored", $medium->{name})); + } } } - unless ($options{nocheck_access}) { - $medium->{url} or - $medium->{ignore} || $urpm->{error}(N("unable to inspect list file for \"%s\", medium ignored", $medium->{name})), - $medium->{ignore} = 1; #, last; keeping it cause perl to exit caller loop ... + + #- there is a little more to do at this point as url is not known, inspect directly list file for it. + unless ($medium->{url}) { + my %probe; + if (-r "$urpm->{statedir}/$medium->{list}") { + local *L; + open L, "$urpm->{statedir}/$medium->{list}"; + while (<L>) { + #- /./ is end of url marker in list file (typically generated by a + #- find . -name "*.rpm" > list + #- for exportable list file. + /^(.*)\/\.\// and $probe{$1} = undef; + /^(.*)\/[^\/]*$/ and $probe{$1} = undef; + } + close L; + } + foreach (sort { length($a) <=> length($b) } keys %probe) { + if ($medium->{url}) { + $medium->{url} eq substr($_, 0, length($medium->{url})) or + $medium->{ignore} || $urpm->{error}(N("incoherent list file for \"%s\", medium ignored", $medium->{name})), + $medium->{ignore} = 1, last; + } else { + $medium->{url} = $_; + } + } + unless ($options{nocheck_access}) { + $medium->{url} or + $medium->{ignore} || $urpm->{error}(N("unable to inspect list file for \"%s\", medium ignored", + $medium->{name})), + $medium->{ignore} = 1; + } } } @@ -642,7 +659,7 @@ sub write_config { foreach (qw(hdlist with_hdlist list removable md5sum key_ids)) { $medium->{$_} and printf F " %s: %s\n", $_, $medium->{$_}; } - foreach (qw(update ignore synthesis modified)) { + foreach (qw(update ignore synthesis modified virtual)) { $medium->{$_} and printf F " %s\n", $_; } printf F "}\n\n"; @@ -746,7 +763,23 @@ sub configure { unless ($options{nodepslist}) { foreach (grep { !$_->{ignore} && (!$options{update} || $_->{update}) } @{$urpm->{media} || []}) { delete @{$_}{qw(start end)}; - if ($options{callback}) { + if ($_->{virtual}) { + my $path = $_->{url} =~ /^file:\/*(\/[^\/].*[^\/])\/*$/ && $1; + if ($path) { + if ($_->{synthesis}) { + $urpm->{log}(N("examining synthesis file [%s]", "$path/$_->{with_hdlist}")); + eval { ($_->{start}, $_->{end}) = $urpm->parse_synthesis("$path/$_->{with_hdlist}", + callback => $options{callback}) }; + } else { + $urpm->{log}(N("examining hdlist file [%s]", "$path/$_->{with_hdlist}")); + eval { ($_->{start}, $_->{end}) = $urpm->parse_hdlist("$path/$_->{with_hdlist}", + packing => 1, callback => $options{callback}) }; + } + } else { + $urpm->{error}(N("virtual medium \"%s\" is not local, medium ignored", $_->{name})); + $_->{ignore} = 1; + } + } else { if ($options{hdlist} && -s "$urpm->{statedir}/$_->{hdlist}" > 32) { $urpm->{log}(N("examining hdlist file [%s]", "$urpm->{statedir}/$_->{hdlist}")); eval { ($_->{start}, $_->{end}) = $urpm->parse_hdlist("$urpm->{statedir}/$_->{hdlist}", @@ -761,23 +794,12 @@ sub configure { packing => 1, callback => $options{callback}) }; } } + } + unless ($_->{ignore}) { unless (defined $_->{start} && defined $_->{end}) { - $urpm->{error}(N("problem reading hdlist file of medium \"%s\"", $_->{name})); + $urpm->{error}(N("problem reading hdlist or synthesis file of medium \"%s\"", $_->{name})); $_->{ignore} = 1; } - } else { - if (-s "$urpm->{statedir}/synthesis.$_->{hdlist}" > 32) { - $urpm->{log}(N("examining synthesis file [%s]", "$urpm->{statedir}/synthesis.$_->{hdlist}")); - eval { ($_->{start}, $_->{end}) = $urpm->parse_synthesis("$urpm->{statedir}/synthesis.$_->{hdlist}") }; - } - unless (defined $_->{start} && defined $_->{end}) { - $urpm->{log}(N("examining hdlist file [%s]", "$urpm->{statedir}/$_->{hdlist}")); - eval { ($_->{start}, $_->{end}) = $urpm->parse_hdlist("$urpm->{statedir}/$_->{hdlist}", packing => 1) }; - unless (defined $_->{start} && defined $_->{end}) { - $urpm->{error}(N("problem reading synthesis file of medium \"%s\"", $_->{name})); - $_->{ignore} = 1; - } - } } } } @@ -847,20 +869,30 @@ sub add_medium { $url =~ s|(.*?)/*$|$1|; #- creating the medium info. - $medium = { name => $name, - url => $url, - hdlist => "hdlist.$name.cz", - list => "list.$name", - update => $options{update}, - modified => 1, - }; + if ($options{virtual}) { + $url =~ m|^file:/*(/[^/].*)/| or $urpm->{fatal}(5, N("virtual medium need to local")); + + $medium = { name => $name, + url => $url, + update => $options{update}, + virtual => 1, + }; + } else { + $medium = { name => $name, + url => $url, + hdlist => "hdlist.$name.cz", + list => "list.$name", + update => $options{update}, + modified => 1, + }; + + #- check to see if the medium is using file protocol or removable medium. + $url =~ /^(removable[^:]*|file):\/(.*)/ and $urpm->probe_removable_device($medium); + } #- check if a password is visible, if not set clear_url. $url =~ m|([^:]*://[^/:\@]*:)[^/:\@]*(\@.*)| or $medium->{clear_url} = $url; - #- check to see if the medium is using file protocol or removable medium. - $url =~ /^(removable[^:]*|file):\/(.*)/ and $urpm->probe_removable_device($medium); - #- all flags once everything has been computed. $with_hdlist and $medium->{with_hdlist} = $with_hdlist; @@ -1077,14 +1109,34 @@ sub update_media { #- we still need to read it and all synthesis will be written if #- a unresolved provides is found. #- to speed up the process, we only read the synthesis at the begining. - $urpm->{log}(N("examining synthesis file [%s]", "$urpm->{statedir}/synthesis.$medium->{hdlist}")); - eval { ($medium->{start}, $medium->{end}) = $urpm->parse_synthesis("$urpm->{statedir}/synthesis.$medium->{hdlist}") }; - unless (defined $medium->{start} && defined $medium->{end}) { - $urpm->{log}(N("examining hdlist file [%s]", "$urpm->{statedir}/$medium->{hdlist}")); - eval { ($medium->{start}, $medium->{end}) = $urpm->parse_hdlist("$urpm->{statedir}/$medium->{hdlist}", packing => 1) }; + delete @{$medium}{qw(start end)}; + if ($medium->{virtual}) { + my $path = $medium->{url} =~ /^file:\/*(\/[^\/].*[^\/])\/*$/ && $1; + if ($path) { + if ($medium->{synthesis}) { + $urpm->{log}(N("examining synthesis file [%s]", "$path/$medium->{with_hdlist}")); + eval { ($medium->{start}, $medium->{end}) = $urpm->parse_synthesis("$path/$medium->{with_hdlist}") }; + } else { + $urpm->{log}(N("examining hdlist file [%s]", "$path/$medium->{with_hdlist}")); + eval { ($medium->{start}, $medium->{end}) = $urpm->parse_hdlist("$path/$medium->{with_hdlist}", + packing => 1) }; + } + } else { + $urpm->{error}(N("virtual medium \"%s\" is not local, medium ignored", $medium->{name})); + $_->{ignore} = 1; + } + } else { + $urpm->{log}(N("examining synthesis file [%s]", "$urpm->{statedir}/synthesis.$medium->{hdlist}")); + eval { ($medium->{start}, $medium->{end}) = $urpm->parse_synthesis("$urpm->{statedir}/synthesis.$medium->{hdlist}") }; + unless (defined $medium->{start} && defined $medium->{end}) { + $urpm->{log}(N("examining hdlist file [%s]", "$urpm->{statedir}/$medium->{hdlist}")); + eval { ($medium->{start}, $medium->{end}) = $urpm->parse_hdlist("$urpm->{statedir}/$medium->{hdlist}", packing => 1) }; + } + } + unless ($medium->{ignore}) { unless (defined $medium->{start} && defined $medium->{end}) { #- this is almost a fatal error, ignore it by default? - $urpm->{error}(N("problem reading synthesis file of medium \"%s\"", $medium->{name})); + $urpm->{error}(N("Aproblem reading synthesis file of medium \"%s\"", $medium->{name})); $medium->{ignore} = 1; } } @@ -1198,7 +1250,7 @@ sub update_media { eval { ($medium->{start}, $medium->{end}) = $urpm->parse_hdlist("$urpm->{statedir}/$medium->{hdlist}", packing => 1) }; unless (defined $medium->{start} && defined $medium->{end}) { - $urpm->{error}(N("problem reading synthesis file of medium \"%s\"", $medium->{name})); + $urpm->{error}(N("Bproblem reading synthesis file of medium \"%s\"", $medium->{name})); $medium->{ignore} = 1; } } @@ -1254,7 +1306,7 @@ sub update_media { eval { ($medium->{start}, $medium->{end}) = $urpm->parse_hdlist("$urpm->{statedir}/$medium->{hdlist}", packing => 1) }; unless (defined $medium->{start} && defined $medium->{end}) { - $urpm->{error}(N("problem reading synthesis file of medium \"%s\"", $medium->{name})); + $urpm->{error}(N("Cproblem reading synthesis file of medium \"%s\"", $medium->{name})); $medium->{ignore} = 1; } } @@ -1407,7 +1459,7 @@ sub update_media { eval { ($medium->{start}, $medium->{end}) = $urpm->parse_hdlist("$urpm->{statedir}/$medium->{hdlist}", packing => 1) }; unless (defined $medium->{start} && defined $medium->{end}) { - $urpm->{error}(N("problem reading synthesis file of medium \"%s\"", $medium->{name})); + $urpm->{error}(N("Cproblem reading synthesis file of medium \"%s\"", $medium->{name})); $medium->{ignore} = 1; } } @@ -1505,7 +1557,7 @@ sub update_media { eval { ($medium->{start}, $medium->{end}) = $urpm->parse_hdlist("$urpm->{statedir}/$medium->{hdlist}", packing => 1) }; unless (defined $medium->{start} && defined $medium->{end}) { - $urpm->{error}(N("problem reading synthesis file of medium \"%s\"", $medium->{name})); + $urpm->{error}(N("Dproblem reading synthesis file of medium \"%s\"", $medium->{name})); $medium->{ignore} = 1; } } @@ -1655,7 +1707,7 @@ sub update_media { $urpm->{log}(N("examining synthesis file [%s]", "$urpm->{statedir}/synthesis.$medium->{hdlist}")); eval { ($medium->{start}, $medium->{end}) = $urpm->parse_synthesis("$urpm->{statedir}/synthesis.$medium->{hdlist}") }; unless (defined $medium->{start} && defined $medium->{end}) { - $urpm->{error}(N("problem reading synthesis file of medium \"%s\"", $medium->{name})); + $urpm->{error}(N("Eproblem reading synthesis file of medium \"%s\"", $medium->{name})); $medium->{ignore} = 1; } } else { @@ -1736,11 +1788,13 @@ sub update_media { } #- check if synthesis file can be built. if (($urpm->{second_pass} || $medium->{modified_synthesis}) && !$medium->{modified}) { - $urpm->build_synthesis(start => $medium->{start}, - end => $medium->{end}, - synthesis => "$urpm->{statedir}/synthesis.$medium->{hdlist}", - ); - $urpm->{log}(N("built hdlist synthesis file for medium \"%s\"", $medium->{name})); + unless ($medium->{virtual}) { + $urpm->build_synthesis(start => $medium->{start}, + end => $medium->{end}, + synthesis => "$urpm->{statedir}/synthesis.$medium->{hdlist}", + ); + $urpm->{log}(N("built hdlist synthesis file for medium \"%s\"", $medium->{name})); + } #- keep in mind we have modified database, sure at this point. $urpm->{modified} = 1; } @@ -2870,10 +2924,12 @@ sub unselected_packages { sub translate_why_unselected { my ($urpm, $state, @l) = @_; - map { my @froms = keys %{$state->{rejected}{$_}{backtrack}{closure} || {}}; - my @unsatisfied = @{$state->{rejected}{$_}{backtrack}{unsatisfied} || []}; + map { my $rb = $state->{rejected}{$_}{backtrack}; + my @froms = keys %{$rb->{closure} || {}}; + my @unsatisfied = @{$rb->{unsatisfied} || []}; my $s = join ", ", ((map { N("due to missing %s", $_) } @froms), - (map { N("due to unsatisfied %s", $_) } @unsatisfied)); + (map { N("due to unsatisfied %s", $_) } @unsatisfied), + $rb->{promote} ? N("trying to promote %s by selection of %s", $rb->{promote}, $rb->{psel}) : @{[]}); $_ . ($s ? " ($s)" : ''); } @l; } @@ -732,7 +732,7 @@ if ($nok) { if ($test) { message(N("Installation is possible")); } else { - @{$state->{transaction} || []} == 1 && $verbose >= 0 and message(N("Everything already installed"), $auto); + @{$state->{transaction} || []} == 0 && $verbose >= 0 and message(N("Everything already installed"), $auto); } } diff --git a/urpmi.addmedia b/urpmi.addmedia index fe294a15..7239eb7d 100755 --- a/urpmi.addmedia +++ b/urpmi.addmedia @@ -72,6 +72,8 @@ and [options] are from installed mandrake-release package. ") . N(" --arch - use specified architecture, the default is arch of mandrake-release package installed. +") . N(" --virtual - create virtual media wich are always up-to-date, + only file:// protocol is allowed. ") . N(" -c - clean headers cache directory. ") . N(" -f - force generation of hdlist files. "); @@ -113,6 +115,7 @@ and [options] are from /^--version$/ and $options{version} = shift @_, next; /^--arch$/ and $options{arch} = shift @_, next; /^--update$/ and $options{update} = 1, next; + /^--virtual$/ and $options{virtual} = 1, next; /^-/ and die $usage . N("\nunknown options '%s'\n", $_); ($name, $url, $with, $relative_hdlist) = ($_, @_); last; @@ -180,13 +183,14 @@ and [options] are from } #- sort according to url or location if possible. !$url || $l && $l =~ /$url/i || $burl =~ /$url/i or next; - $urpm->add_medium($name, $burl, $relative_hdlist, update => $options{update}, index_name => 0); + $urpm->add_medium($name, $burl, $relative_hdlist, + virtual => $options{virtual}, update => $options{update}, index_name => 0); } close F; } else { $with || $relative_hdlist and die N("%s\nno need to give <relative path of hdlist> with --distrib", $usage); - $urpm->add_distrib_media($name, $url, update => $options{update}); + $urpm->add_distrib_media($name, $url, virtual => $options{virtual}, update => $options{update}); } $urpm->update_media(%options, callback => \&urpm::sync_logger); @@ -207,7 +211,7 @@ and [options] are from $options{probe_with} || $with eq "with" or die N("%s\n`with' missing for network media\n", $usage); } - $urpm->add_medium($name, $url, $relative_hdlist, update => $options{update}); + $urpm->add_medium($name, $url, $relative_hdlist, virtual => $options{virtual}, update => $options{update}); $urpm->update_media(%options, callback => \&urpm::sync_logger); #- check creation of media (during update has been successfull) @@ -2,14 +2,14 @@ Name: urpmi Version: 4.4 -Release: 4mdk +Release: 5mdk License: GPL Source0: %{name}.tar.bz2 Source1: %{name}.logrotate Summary: User mode rpm install URL: http://cvs.mandrakesoft.com/cgi-bin/cvsweb.cgi/soft/urpmi Requires: eject webfetch perl-DateManip >= 5.40 gnupg -PreReq: perl-Locale-gettext >= 1.01-7mdk rpmtools >= 4.3-6mdk perl-URPM >= 0.91-3mdk +PreReq: perl-Locale-gettext >= 1.01-7mdk rpmtools >= 4.3-6mdk perl-URPM >= 0.91-6mdk BuildRequires: bzip2-devel gettext rpm-devel >= 4.0.3 perl-MDK-Common-devel BuildRoot: %{_tmppath}/%{name}-buildroot BuildArch: noarch @@ -202,6 +202,11 @@ $urpm->update_media; %changelog +* Thu Jun 19 2003 François Pons <fpons@mandrakesoft.com> 4.4-5mdk +- fixed everything already installed annoying message. +- added --virtual to urpmi.addmedia to handle virtual media. +- added promotion message reason for backtrack. + * Wed Jun 18 2003 François Pons <fpons@mandrakesoft.com> 4.4-4mdk - added --env to urpmq and urpmf (simplest to examine now). - fixed --allow-nodeps and --allow-force no more taken into |