diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2007-12-19 12:16:49 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2007-12-19 12:16:49 +0000 |
commit | 3880463a92142896704deca4d341af93be762b84 (patch) | |
tree | 083ddaa4280c8f7bd74b0619ebe5d40fd4a9d038 | |
parent | fa957b2abb16441c131d8242b22579ca63d70c01 (diff) | |
download | urpmi-3880463a92142896704deca4d341af93be762b84.tar urpmi-3880463a92142896704deca4d341af93be762b84.tar.gz urpmi-3880463a92142896704deca4d341af93be762b84.tar.bz2 urpmi-3880463a92142896704deca4d341af93be762b84.tar.xz urpmi-3880463a92142896704deca4d341af93be762b84.zip |
- all tools:
o drop hdlist support (will be replaced with xml media_info)
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | pod/urpme.8.pod | 8 | ||||
-rw-r--r-- | pod/urpmf.8.pod | 2 | ||||
-rw-r--r-- | pod/urpmi.8.pod | 8 | ||||
-rw-r--r-- | pod/urpmi.addmedia.8.pod | 9 | ||||
-rw-r--r-- | pod/urpmi.cfg.5.pod | 2 | ||||
-rw-r--r-- | pod/urpmi.files.5.pod | 11 | ||||
-rw-r--r-- | pod/urpmi.update.8.pod | 6 | ||||
-rw-r--r-- | pod/urpmq.8.pod | 8 | ||||
-rw-r--r-- | t/cfg.t | 4 | ||||
-rw-r--r-- | t/superuser--addmedia.t | 58 | ||||
-rw-r--r-- | urpm.pm | 5 | ||||
-rw-r--r-- | urpm/args.pm | 4 | ||||
-rw-r--r-- | urpm/bug_report.pm | 7 | ||||
-rw-r--r-- | urpm/cfg.pm | 7 | ||||
-rw-r--r-- | urpm/md5sum.pm | 4 | ||||
-rw-r--r-- | urpm/media.pm | 773 | ||||
-rw-r--r-- | urpme | 2 | ||||
-rwxr-xr-x | urpmf | 12 | ||||
-rwxr-xr-x | urpmi | 2 | ||||
-rwxr-xr-x | urpmi.addmedia | 15 | ||||
-rw-r--r-- | urpmi.bash-completion | 5 | ||||
-rwxr-xr-x | urpmi.update | 6 | ||||
-rwxr-xr-x | urpmq | 8 |
24 files changed, 274 insertions, 694 deletions
@@ -1,3 +1,5 @@ +- all tools: + o drop hdlist support (will be replaced with xml media_info) - urpmi: o do remove __db* on priority-upgrade (fix regression introduced in 4.10.15) diff --git a/pod/urpme.8.pod b/pod/urpme.8.pod index 0fa32dcc..77d441c2 100644 --- a/pod/urpme.8.pod +++ b/pod/urpme.8.pod @@ -86,14 +86,6 @@ to B<--root>, the urpmi configuration comes from the rooted tree. Configure urpme on the fly from a distribution tree. -=item B<--probe-synthesis> - -Use synthesis file (to use with --use-distrib). - -=item B<--probe-hdlist> - -Use hdlist file (to use with --use-distrib). - =item B<--wait-lock> If the urpmi or rpm db is busy, wait until it is available diff --git a/pod/urpmf.8.pod b/pod/urpmf.8.pod index f69d375d..77759aa9 100644 --- a/pod/urpmf.8.pod +++ b/pod/urpmf.8.pod @@ -85,7 +85,7 @@ to B<--root>, the urpmi configuration comes from the rooted tree. =item B<--verbose> Verbose mode. urpmf will emit various messages related to the parsing of -hdlist files for your media. +media_info files for your media. =item B<--wait-lock> diff --git a/pod/urpmi.8.pod b/pod/urpmi.8.pod index 9743700d..5acc4190 100644 --- a/pod/urpmi.8.pod +++ b/pod/urpmi.8.pod @@ -243,14 +243,6 @@ Configure urpmi on the fly from a distrib tree, useful to install a chroot with the B<--root> option. See the description of the B<--distrib> option in the C<urpmi.addmedia> manpage. -=item B<--probe-synthesis> - -Use synthesis file (to use with --use-distrib). - -=item B<--probe-hdlist> - -Use hdlist file (to use with --use-distrib). - =item B<--wget> Use wget for downloading distant files via http or ftp. By default curl is diff --git a/pod/urpmi.addmedia.8.pod b/pod/urpmi.addmedia.8.pod index 8b551efb..c23867d1 100644 --- a/pod/urpmi.addmedia.8.pod +++ b/pod/urpmi.addmedia.8.pod @@ -21,8 +21,7 @@ must be chosen: where <I<name>> is a human-readable name for the new media (e.g. "updates"). <I<name>> is optional if B<--distrib> is given in the options list. <I<host>>/<I<path>> is the location of the media directory on the -net (e.g. C<media/main>). <I<relative path of hdlist>> is the pathname -where to find the hdlist of the rpms. The location is given relative to +net (e.g. C<media/main>). The location is given relative to <I<path>>. B<curl> is used by default to download files, B<wget> may be used if B<curl> is not installed or if or B<--wget> is given in I<options>. Example: @@ -122,13 +121,9 @@ C<urpmi --update> when looking for updates. Use synthesis file. -=item B<--probe-hdlist> - -Use hdlist file. - =item B<--probe-rpms> -Use rpm files (instead of synthesis/hdlist). +Use rpm files (instead of synthesis). =item B<--distrib> diff --git a/pod/urpmi.cfg.5.pod b/pod/urpmi.cfg.5.pod index 8bb5dad6..14a40874 100644 --- a/pod/urpmi.cfg.5.pod +++ b/pod/urpmi.cfg.5.pod @@ -184,7 +184,7 @@ A medium is described as follows : where B<name> is the medium name (space characters must be prefixed by a backslash) and where B<url> is the medium URL. -Most other options like B<list>, B<with_hdlist>, B<media_info_dir>, +Most other options like B<list>, B<media_info_dir>, B<synthesis>, B<removable>, B<virtual> are for internal use and should be changed only by experienced users. diff --git a/pod/urpmi.files.5.pod b/pod/urpmi.files.5.pod index 502c2703..7b08730d 100644 --- a/pod/urpmi.files.5.pod +++ b/pod/urpmi.files.5.pod @@ -19,18 +19,9 @@ file is used when a password is used to access a distant location (using a network protocol) or when various directories are used to store the packages. That's why it's not world-readable. -=item I<< /var/lib/urpmi/hdlist.<media_name>.cz >> - -Contains information about all known packages; it's a summary of rpm -headers. If an hdlist file is used for a medium, C<urpmf> can operate -completely without accessing this medium (this is almost always the case). - =item I<< /var/lib/urpmi/synthesis.hdlist.<media_name>.cz >> -Contains synthesis information about all known packages built from hdlist -files that can be used by minimal closure algorithm. If these files are -not present, hdlist files will be used instead to resolve dependencies -(but this is much slower). +Contains information about all known packages. =item I<< /var/lib/urpmi/names.<media_name> >> diff --git a/pod/urpmi.update.8.pod b/pod/urpmi.update.8.pod index 578ce317..5adfde88 100644 --- a/pod/urpmi.update.8.pod +++ b/pod/urpmi.update.8.pod @@ -88,15 +88,15 @@ Clean F</var/cache/urpmi/headers> directory on exit. =item B<-f> -Force updating synthesis/hdlist +Force updating synthesis =item B<-ff> -Really force updating synthesis/hdlist +Really force updating synthesis =item B<--probe-rpms> -Do not use synthesis/hdlist, use rpm files directly +Do not use synthesis, use rpm files directly =item B<-q> diff --git a/pod/urpmq.8.pod b/pod/urpmq.8.pod index 866af32e..a297b3c2 100644 --- a/pod/urpmq.8.pod +++ b/pod/urpmq.8.pod @@ -173,14 +173,6 @@ and a password. Configure urpmq on the fly from a distribution tree. -=item B<--probe-synthesis> - -Use synthesis file (to use with --use-distrib). - -=item B<--probe-hdlist> - -Use hdlist file (to use with --use-distrib). - =item B<--env> I<directory> Use a different environment directly from a bug report to replay a bug. @@ -27,12 +27,10 @@ update\ 1 http://foo/bar/$RELEASE { } update_2 ftp://foo/bar/ { - hdlist: hdlist.update2.cz ignore key_ids: 456 789 priority-upgrade: 'kernel' - synthesis - with_hdlist: hdlist.update2.cz + with_synthesis: synthesis.hdlist.update2.cz } URPMICFG close $f; diff --git a/t/superuser--addmedia.t b/t/superuser--addmedia.t index 87941c35..aa192a0a 100644 --- a/t/superuser--addmedia.t +++ b/t/superuser--addmedia.t @@ -12,61 +12,61 @@ my $name = 'various'; my $name2 = 'various2'; my $name3 = 'various3'; -my @fields = qw(hdlist synthesis with_hdlist media_info_dir list virtual ignore); +my @fields = qw(hdlist synthesis with_synthesis media_info_dir list virtual ignore); try_medium({ media_info_dir => 'media_info' }, ''); -try_medium_({ list => 'list.various' }, { list => 'list.various2' }, +try_medium_({}, {}, '--probe-rpms', '--probe-rpms'); -try_medium({ hdlist => 1, media_info_dir => 'media_info' }, +try_medium({ media_info_dir => 'media_info' }, '--probe-hdlist'); -try_medium({ hdlist => 1, media_info_dir => 'media_info' }, +try_medium({ media_info_dir => 'media_info' }, 'with media_info/hdlist.cz'); -try_medium({ hdlist => 1, - with_hdlist => "../media_info/hdlist_$name.cz", - with_hdlist2 => "../media_info/hdlist_$name2.cz" }, +try_medium({ + with_synthesis => "../media_info/synthesis.hdlist_$name.cz", + with_synthesis2 => "../media_info/synthesis.hdlist_$name2.cz" }, "with ../media_info/hdlist_$name.cz", "with ../media_info/hdlist_$name2.cz", ); -try_medium({ synthesis => 1, media_info_dir => 'media_info' }, +try_medium({ media_info_dir => 'media_info' }, '--probe-synthesis'); -try_medium({ synthesis => 1, media_info_dir => 'media_info' }, +try_medium({ media_info_dir => 'media_info' }, 'with media_info/synthesis.hdlist.cz'); -try_medium({ synthesis => 1, - with_hdlist => "../media_info/synthesis.hdlist_$name.cz", - with_hdlist2 => "../media_info/synthesis.hdlist_$name2.cz" }, +try_medium({ + with_synthesis => "../media_info/synthesis.hdlist_$name.cz", + with_synthesis2 => "../media_info/synthesis.hdlist_$name2.cz" }, "with ../media_info/synthesis.hdlist_$name.cz", "with ../media_info/synthesis.hdlist_$name2.cz"); try_distrib({ media_info_dir => 'media_info' }, ''); -try_distrib({ hdlist => 1, media_info_dir => 'media_info' }, +try_distrib({ media_info_dir => 'media_info' }, '--probe-hdlist'); -try_distrib({ synthesis => 1, media_info_dir => 'media_info' }, +try_distrib({ media_info_dir => 'media_info' }, '--probe-synthesis'); -try_distrib_removable({ hdlist => 1, - with_hdlist => "../..//media/media_info/hdlist_$name.cz", - with_hdlist2 => "../..//media/media_info/hdlist_$name2.cz", - with_hdlist3 => "../..//media/media_info/hdlist_$name3.cz" }, +try_distrib_removable({ + with_synthesis => "../..//media/media_info/synthesis.hdlist_$name.cz", + with_synthesis2 => "../..//media/media_info/synthesis.hdlist_$name2.cz", + with_synthesis3 => "../..//media/media_info/synthesis.hdlist_$name3.cz" }, ''); -try_distrib_removable({ hdlist => 1, - with_hdlist => "../..//media/media_info/hdlist_$name.cz", - with_hdlist2 => "../..//media/media_info/hdlist_$name2.cz", - with_hdlist3 => "../..//media/media_info/hdlist_$name3.cz" }, +try_distrib_removable({ + with_synthesis => "../..//media/media_info/synthesis.hdlist_$name.cz", + with_synthesis2 => "../..//media/media_info/synthesis.hdlist_$name2.cz", + with_synthesis3 => "../..//media/media_info/synthesis.hdlist_$name3.cz" }, '--probe-hdlist'); -try_distrib_removable({ synthesis => 1, - with_hdlist => "../..//media/media_info/synthesis.hdlist_$name.cz", - with_hdlist2 => "../..//media/media_info/synthesis.hdlist_$name2.cz", - with_hdlist3 => "../..//media/media_info/synthesis.hdlist_$name3.cz" }, +try_distrib_removable({ + with_synthesis => "../..//media/media_info/synthesis.hdlist_$name.cz", + with_synthesis2 => "../..//media/media_info/synthesis.hdlist_$name2.cz", + with_synthesis3 => "../..//media/media_info/synthesis.hdlist_$name3.cz" }, '--probe-synthesis'); sub try_medium { my ($want, $options, $o_options2) = @_; - my $want2 = { %$want, with_hdlist => $want->{with_hdlist2} || $want->{with_hdlist} }; + my $want2 = { %$want, with_synthesis => $want->{with_synthesis2} || $want->{with_synthesis} }; try_medium_($want, $want2, $options, ($o_options2 || $options)); @@ -86,8 +86,8 @@ sub try_distrib { sub try_distrib_removable { my ($want, $options) = @_; - my $want2 = { %$want, with_hdlist => $want->{with_hdlist2} || $want->{with_hdlist} }; - my $want3 = { %$want, with_hdlist => $want->{with_hdlist3} || $want->{with_hdlist}, ignore => 1 }; + my $want2 = { %$want, with_synthesis => $want->{with_synthesis2} || $want->{with_synthesis} }; + my $want3 = { %$want, with_synthesis => $want->{with_synthesis3} || $want->{with_synthesis}, ignore => 1 }; try_distrib_removable_($want, $want2, $want3, $options); @@ -375,8 +375,7 @@ B<source>: { id => src_rpm_file|spec_file } B<media>: [ { start => int, end => int, name => string, url => string, - virtual => bool, media_info_dir => string, with_hdlist => string, - hdlist => bool|string, synthesis => bool, + virtual => bool, media_info_dir => string, with_synthesis => string, removable => string, downloader => string, ignore => bool, update => bool, modified => bool, really_modified => bool, } ], @@ -385,7 +384,7 @@ B<media>: [ { =head1 SEE ALSO -The C<URPM> package is used to manipulate at a lower level hdlist and rpm +The C<URPM> package is used to manipulate at a lower level synthesis and rpm files. =head1 COPYRIGHT diff --git a/urpm/args.pm b/urpm/args.pm index 14ebaf57..5b5f9920 100644 --- a/urpm/args.pm +++ b/urpm/args.pm @@ -146,7 +146,7 @@ my %options_spec = ( 'root=s' => sub { set_root($urpm, $_[1]) }, 'use-distrib=s' => \$options{usedistrib}, 'probe-synthesis' => sub { $options{probe_with} = 'synthesis' }, - 'probe-hdlist' => sub { $options{probe_with} = 'hdlist' }, + 'probe-hdlist' => sub { $options{probe_with} = 'synthesis' }, #- ignored, kept for compatibility 'excludepath|exclude-path=s' => sub { $urpm->{options}{excludepath} = $_[1] }, 'excludedocs|exclude-docs' => sub { $urpm->{options}{excludedocs} = 1 }, 'ignoresize' => sub { $urpm->{options}{ignoresize} = 1 }, @@ -394,7 +394,7 @@ foreach my $k ("y") { $options_spec{'urpmi.removemedia'}{$k} = $options_spec{urpmi}{$k}; } -foreach my $k ("probe-synthesis", "probe-hdlist") +foreach my $k ("probe-synthesis", "probe-hdlist") # probe-hdlist is obsolete { $options_spec{'urpmi.addmedia'}{$k} = $options_spec{urpme}{$k} = diff --git a/urpm/bug_report.pm b/urpm/bug_report.pm index f4265870..d6aeb492 100644 --- a/urpm/bug_report.pm +++ b/urpm/bug_report.pm @@ -27,13 +27,10 @@ sub rpmdb_to_synthesis { sub write_urpmdb { my ($urpm, $bug_report_dir) = @_; - require URPM::Build; foreach (@{$urpm->{media}}) { - #- take care of virtual medium this way. - #- now build directly synthesis file, this is by far the simplest method. if (urpm::media::is_valid_medium($_)) { - $urpm->build_synthesis(start => $_->{start}, end => $_->{end}, synthesis => "$bug_report_dir/synthesis." . urpm::media::_hdlist($_)); - $urpm->{log}(N("built hdlist synthesis file for medium \"%s\"", $_->{name})); + system('cp', urpm::media::any_synthesis($urpm, $_), + "$bug_report_dir/" . urpm::media::_synthesis($_)) == 0 or $urpm->{fatal}(1, "failed to copy $_->{name} synthesis"); } } #- fake configuration written to convert virtual media on the fly. diff --git a/urpm/cfg.pm b/urpm/cfg.pm index 0c3b63a4..68421910 100644 --- a/urpm/cfg.pm +++ b/urpm/cfg.pm @@ -144,6 +144,7 @@ sub load_config_raw { } elsif (/^(hdlist |list |with_hdlist + |with_synthesis |media_info_dir |removable |md5sum @@ -161,7 +162,9 @@ sub load_config_raw { $block->{$1} = $2; } elsif (/^key[-_]ids\s*:\s*['"]?(.*?)['"]?$/) { $block->{'key-ids'} = $1; - } elsif (/^(hdlist|$no_para_option_regexp)$/) { + } elsif (/^(hdlist|synthesis)$/) { + # ignored, kept for compatibility + } elsif (/^($no_para_option_regexp)$/) { #- positive flags $block->{$1} = 1; } elsif (my ($no, $k, $v) = @@ -229,8 +232,6 @@ sub dump_config_raw { my @l = map { if (/^($no_para_option_regexp)$/) { $_; - } elsif ($_ eq 'hdlist' && $m->{$_} eq '1') { - $_; } elsif ($_ ne 'priority') { "$_: " . $substitute_back->($m, $_); } diff --git a/urpm/md5sum.pm b/urpm/md5sum.pm index 71ccc5b5..05176086 100644 --- a/urpm/md5sum.pm +++ b/urpm/md5sum.pm @@ -41,8 +41,8 @@ sub compute_on_local_medium { my ($urpm, $medium) = @_; require urpm::media; #- help perl_checker - my $f = urpm::media::statedir_hdlist_or_synthesis($urpm, $medium, 's'); - $urpm->{log}(N("computing md5sum of existing source hdlist (or synthesis) [%s]", $f)); + my $f = urpm::media::statedir_synthesis($urpm, $medium); + $urpm->{log}(N("computing md5sum of existing source synthesis [%s]", $f)); -e $f && compute($f); } diff --git a/urpm/media.pm b/urpm/media.pm index ac9aeb91..73d769c8 100644 --- a/urpm/media.pm +++ b/urpm/media.pm @@ -28,6 +28,7 @@ our @PER_MEDIA_OPT = qw( verify-rpm virtual with_hdlist + with_synthesis ); sub only_media_opts { @@ -96,22 +97,26 @@ sub remove_passwords_and_write_private_netrc { sub recover_url_from_list { my ($urpm, $medium) = @_; + my $list = delete $medium->{list} or return; + my $statedir_list = "$urpm->{statedir}/$list"; + #- /./ is end of url marker in list file (typically generated by a #- find . -name "*.rpm" > list #- for exportable list file. - if (my @probe = map { m!^(.*)/\./! || m!^(.*)/[^/]*$! } cat_(statedir_list($urpm, $medium))) { - $urpm->{log}("recovering url from " . statedir_list($urpm, $medium)); + if (my @probe = map { m!^(.*)/\./! || m!^(.*)/[^/]*$! } cat_($statedir_list)) { + $urpm->{log}("recovering url from $statedir_list"); ($medium->{url}) = sort { length($a) <=> length($b) } @probe; $urpm->{modified} = 1; #- ensure urpmi.cfg is handled using only partially hidden url + netrc, since file list won't be generated anymore + unlink $statedir_list; } } #- Loads /etc/urpmi/urpmi.cfg and performs basic checks. #- Does not handle old format: <name> <url> [with <path_hdlist>] #- options : -#- - nocheck_access : don't check presence of hdlist and other files +#- - nocheck_access : don't check presence of synthesis and other files sub read_config { - my ($urpm, $b_nocheck_access, $b_auto_correct) = @_; + my ($urpm, $b_nocheck_access) = @_; return if $urpm->{media}; #- media already loaded $urpm->{media} = []; my $config = urpm::cfg::load_config($urpm->{config}) @@ -130,14 +135,14 @@ sub read_config { $medium->{url} or $urpm->{error}("unable to find url in list file $medium->{name}, medium ignored"); } - add_existing_medium($urpm, $medium, $b_nocheck_access, $b_auto_correct); + add_existing_medium($urpm, $medium, $b_nocheck_access); } eval { require urpm::ldap; urpm::ldap::load_ldap_media($urpm) }; #- read MD5 sums (not in urpmi.cfg but in a separate file) foreach (@{$urpm->{media}}) { - if (my $md5sum = urpm::md5sum::from_MD5SUM("$urpm->{statedir}/MD5SUM", statedir_hdlist_or_synthesis($urpm, $_, 's'))) { + if (my $md5sum = urpm::md5sum::from_MD5SUM("$urpm->{statedir}/MD5SUM", statedir_synthesis($urpm, $_))) { $_->{md5sum} = $md5sum; } } @@ -145,105 +150,52 @@ sub read_config { #- if invalid, set {ignore} sub check_existing_medium { - my ($urpm, $medium, $b_nocheck_access, $b_auto_correct) = @_; - - if ($medium->{virtual}) { - #- a virtual medium needs to have an url available without using a list file. - if ($medium->{list}) { - $medium->{ignore} = 1; - $urpm->{error}(N("virtual medium \"%s\" should not have defined hdlist or list file, medium ignored", - $medium->{name})); - } elsif (!$medium->{url}) { - $medium->{ignore} = 1; - $urpm->{error}(N("virtual medium \"%s\" should have a clear url, medium ignored", - $medium->{name})); - } - } else { - if ($medium->{hdlist}) { - #- is this check really needed? keeping just in case - $medium->{hdlist} ne 'list' && $medium->{hdlist} ne 'pubkey' or - $medium->{ignore} = 1, - $urpm->{error}(N("invalid hdlist name")); - } - if (!$medium->{ignore} && !$medium->{list}) { - unless (defined $medium->{url}) { - $medium->{list} = "list.$medium->{name}"; - unless (-e statedir_list($urpm, $medium)) { - $medium->{ignore} = 1, - $urpm->{error}(N("unable to find list file for \"%s\", medium ignored", $medium->{name})); - } - } - } - } - - - #- check the presence of hdlist and list files if necessary. - if (!$b_nocheck_access && !$medium->{ignore}) { - if ($medium->{virtual} && -r hdlist_or_synthesis_for_virtual_medium($medium, 's')) {} - elsif (-r statedir_hdlist_or_synthesis($urpm, $medium, 's')) {} - elsif (-r statedir_hdlist($urpm, $medium)) { - $b_auto_correct and delete $urpm->{synthesis}; - $urpm->{error}(N("\"synthesis\" should not be set (medium \"%s\")", $medium->{name})); - } elsif (-r statedir_synthesis($urpm, $medium)) { - $medium->{synthesis} = 1; - $urpm->{error}(N("\"synthesis\" should be set (medium \"%s\")", $medium->{name})); - } else { - $medium->{ignore} = 1; - $urpm->{error}(N("unable to access hdlist file of \"%s\", medium ignored", $medium->{name})); - } - if ($medium->{list} && -r statedir_list($urpm, $medium)) {} - elsif ($medium->{url}) { - if ($medium->{list}) { - $b_auto_correct and delete $medium->{list}; #- remove buggy list - $urpm->{error}(N("unable to access list file of \"%s\"", $medium->{name})); - } - } else { - $medium->{ignore} = 1; - $urpm->{error}(N("unable to access list file of \"%s\", medium ignored", $medium->{name})); - } - } - - foreach my $field ('hdlist', 'list') { - $medium->{$field} && $medium->{$field} ne '1' or next; - if (grep { $_->{$field} eq $medium->{$field} } @{$urpm->{media}}) { - $medium->{ignore} = 1; - $urpm->{error}( - $field eq 'hdlist' - ? N("medium \"%s\" trying to use an already used hdlist, medium ignored", $medium->{name}) - : N("medium \"%s\" trying to use an already used list, medium ignored", $medium->{name})); - } + my ($urpm, $medium, $b_nocheck_access) = @_; + + my $err; + if (!$medium->{url}) { + $err = $medium->{virtual} ? + N("virtual medium \"%s\" should have a clear url, medium ignored", + $medium->{name}) : + N("unable to access list file of \"%s\", medium ignored", $medium->{name}); + } elsif (!$b_nocheck_access && !$medium->{ignore} + && !-r any_synthesis($urpm, $medium)) { + $err = N("unable to access synthesis file of \"%s\", medium ignored", $medium->{name}); + } + if ($err) { + $medium->{ignore} = 1; + $urpm->{error}($err); } } -sub _migrate__with_hdlist { - my ($medium) = @_; - - grep { $_ eq '..' } split('/', $medium->{with_hdlist}) and return; +sub _migrate__with_synthesis { + my ($medium, $with_synthesis) = @_; #- try to migrate to media_info_dir - my $b = basename($medium->{with_hdlist}); - if ($b eq ($medium->{synthesis} ? 'synthesis.hdlist.cz' : 'hdlist.cz')) { - $medium->{media_info_dir} = dirname(delete $medium->{with_hdlist}); - 1; + my $b = basename($with_synthesis); + if ($b eq 'synthesis.hdlist.cz' || $b eq 'hdlist.cz') { + $medium->{media_info_dir} = dirname($with_synthesis); } else { - 0; + $with_synthesis =~ s/(synthesis\.)?(hdlist.*\.cz)$/synthesis.$2/; + $medium->{with_synthesis} = $with_synthesis; } } #- probe medium to be used, take old medium into account too. sub add_existing_medium { - my ($urpm, $medium, $b_nocheck_access, $b_auto_correct) = @_; + my ($urpm, $medium, $b_nocheck_access) = @_; if (name2medium($urpm, $medium->{name})) { $urpm->{error}(N("trying to override existing medium \"%s\", skipping", $medium->{name})); return; } - if ($medium->{with_hdlist} && _migrate__with_hdlist($medium)) { + if ($medium->{with_hdlist}) { + _migrate__with_synthesis($medium, delete $medium->{with_hdlist}); $urpm->{modified} = 1; } - check_existing_medium($urpm, $medium, $b_nocheck_access, $b_auto_correct); + check_existing_medium($urpm, $medium, $b_nocheck_access); #- probe removable device. probe_removable_device($urpm, $medium); @@ -254,71 +206,47 @@ sub add_existing_medium { push @{$urpm->{media}}, $medium; } -sub _set_synthesis_or_hdlist { - my ($medium, $want_synthesis) = @_; - - $medium->{$want_synthesis ? 'synthesis' : 'hdlist'} = 1; -} - sub file_from_file_url { my ($url) = @_; $url =~ m!^(?:file:/)?(/.*)! && $1; } -sub _synthesis_or_not { - my ($medium, $prefer_synthesis) = @_; - $medium->{synthesis} || !$medium->{hdlist} && $prefer_synthesis; -} -sub _url_with_hdlist_basename { - my ($medium, $prefer_synthesis) = @_; +sub _url_with_synthesis_basename { + my ($medium) = @_; - $medium->{with_hdlist} - ? basename($medium->{with_hdlist}) - : _synthesis_or_not($medium, $prefer_synthesis) ? 'synthesis.hdlist.cz' : 'hdlist.cz'; + $medium->{with_synthesis} + ? basename($medium->{with_synthesis}) + : 'synthesis.hdlist.cz'; } -sub _hdlist_dir { +sub _synthesis_dir { my ($medium) = @_; my $base = file_from_local_url($medium->{url}) || $medium->{url}; - $medium->{with_hdlist} - ? reduce_pathname("$base/$medium->{with_hdlist}/..") + $medium->{with_synthesis} + ? reduce_pathname("$base/$medium->{with_synthesis}/..") : $medium->{media_info_dir} && reduce_pathname("$base/$medium->{media_info_dir}"); } -sub _url_with_hdlist { - my ($medium, $prefer_synthesis) = @_; +sub _url_with_synthesis { + my ($medium) = @_; my $base = file_from_local_url($medium->{url}) || $medium->{url}; - $medium->{with_hdlist} - ? reduce_pathname("$base/$medium->{with_hdlist}") - : _hdlist_dir($medium) . "/" . _url_with_hdlist_basename($medium, $prefer_synthesis); + $medium->{with_synthesis} + ? reduce_pathname("$base/$medium->{with_synthesis}") + : _synthesis_dir($medium) . "/" . _url_with_synthesis_basename($medium); } -sub hdlist_or_synthesis_for_virtual_medium { - my ($medium, $prefer_synthesis) = @_; - file_from_file_url($medium->{url}) && _url_with_hdlist($medium, $prefer_synthesis); +sub synthesis_for_virtual_medium { + my ($medium) = @_; + file_from_file_url($medium->{url}) && _url_with_synthesis($medium); } -sub _hdlist { +sub _synthesis { my ($medium) = @_; - $medium->{hdlist} && $medium->{hdlist} ne '1' - ? $medium->{hdlist} - : $medium->{name} && "hdlist.$medium->{name}.cz"; + $medium->{name} && "synthesis.hdlist.$medium->{name}.cz"; } -sub statedir_hdlist_or_synthesis { - my ($urpm, $medium, $prefer_synthesis) = @_; - "$urpm->{statedir}/" . (_synthesis_or_not($medium, $prefer_synthesis) ? 'synthesis.' : '') . _hdlist($medium); -} -sub statedir_hdlist { - my ($urpm, $medium) = @_; - "$urpm->{statedir}/" . _hdlist($medium); -} sub statedir_synthesis { my ($urpm, $medium) = @_; - "$urpm->{statedir}/synthesis." . _hdlist($medium); -} -sub statedir_list { - my ($urpm, $medium) = @_; - $medium->{list} && "$urpm->{statedir}/$medium->{list}"; + "$urpm->{statedir}/" . _synthesis($medium); } sub statedir_descriptions { my ($urpm, $medium) = @_; @@ -328,27 +256,13 @@ sub statedir_names { my ($urpm, $medium) = @_; $medium->{name} && "$urpm->{statedir}/names.$medium->{name}"; } -sub cachedir_with_hdlist { - my ($urpm, $medium, $prefer_synthesis) = @_; - _url_with_hdlist($medium, $prefer_synthesis) && "$urpm->{cachedir}/partial/" . _url_with_hdlist_basename($medium, $prefer_synthesis); -} -sub cachedir_list { +sub cachedir_with_synthesis { my ($urpm, $medium) = @_; - $medium->{list} && "$urpm->{cachedir}/partial/$medium->{list}"; -} -sub any_hdlist { - my ($urpm, $medium) = @_; - my $f = statedir_hdlist($urpm, $medium); - if ($medium->{virtual} && !$medium->{synthesis} - || !-e $f && file_from_local_url($medium->{url}) && !$medium->{synthesis} && !$medium->{hdlist}) { - $f = _url_with_hdlist($medium, ''); - } - -e $f && $f; + _url_with_synthesis($medium) && "$urpm->{cachedir}/partial/" . _url_with_synthesis_basename($medium); } sub any_synthesis { my ($urpm, $medium) = @_; - my $f = $medium->{virtual} && !$medium->{hdlist} - ? _url_with_hdlist($medium, 's') + my $f = $medium->{virtual} ? _url_with_synthesis($medium) : statedir_synthesis($urpm, $medium); -e $f && $f; } @@ -404,7 +318,7 @@ sub write_MD5SUM { #- write MD5SUM file my $fh = urpm::sys::open_safe($urpm, '>', "$urpm->{statedir}/MD5SUM") or return 0; foreach my $medium (grep { $_->{md5sum} } @{$urpm->{media}}) { - my $s = basename(statedir_hdlist_or_synthesis($urpm, $medium, 's')); + my $s = basename(statedir_synthesis($urpm, $medium)); print $fh "$medium->{md5sum} $s\n"; } @@ -456,8 +370,8 @@ sub _tempignore { #- nocheck_access (used by read_config) #- #- callback (urpmf) -#- need_hdlist (for urpmf: to be able to have info not available in synthesis) -#- nodepslist (for urpmq: we don't need the hdlist/synthesis) +#- need_xml (for urpmf: to be able to have info not available in synthesis) +#- nodepslist (for urpmq: we don't need the synthesis) #- no_skiplist (urpmf) #- no_second_pass (urpmf) #- @@ -510,7 +424,7 @@ sub configure { $urpm->{media} = []; add_distrib_media($urpm, "Virtual", $options{usedistrib}, %options, 'virtual' => 1); } else { - read_config($urpm, $options{nocheck_access}, 1); + read_config($urpm, $options{nocheck_access}); if (!$options{media} && $urpm->{options}{'default-media'}) { $options{media} = $urpm->{options}{'default-media'}; } @@ -543,7 +457,7 @@ sub configure { my @remaining = difference2($urpm->{media}, \@sorted_media); $urpm->{media} = [ @sorted_media, @remaining ]; } - _parse_media($urpm, 0, \%options) if !$options{nodepslist}; + _parse_media($urpm, \%options) if !$options{nodepslist}; } #- determine package to withdraw (from skip.list file) only if something should be withdrawn. if (!$options{nodepslist}) { @@ -553,39 +467,22 @@ sub configure { } sub _parse_media { - my ($urpm, $is_second_pass, $options) = @_; + my ($urpm, $options) = @_; - my $need_second_pass; foreach (grep { !$_->{ignore} && (!$options->{update} || $_->{update}) } @{$urpm->{media} || []}) { our $currentmedia = $_; #- hack for urpmf delete @$_{qw(start end)}; - my $want_hdlist = $options->{need_hdlist} || $is_second_pass; - if (!$want_hdlist && - _parse_synthesis($urpm, $_, any_synthesis($urpm, $_), $options->{callback})) { - #- cool - } elsif (_parse_hdlist($urpm, $_, any_hdlist($urpm, $_), $options->{callback})) { - $need_second_pass = 1 if !$is_second_pass && !$options->{no_second_pass}; - } else { - $options->{need_hdlist} - and $urpm->{error}(N("Note: no hdlist for medium \"%s\", unable to return any result for it", $_->{name})); + _parse_synthesis_or_ignore($urpm, $_, $options->{callback}); - _parse_synthesis($urpm, $_, any_synthesis($urpm, $_), $options->{callback}); - } - unless ($_->{ignore}) { - _check_after_reading_hdlist_or_synthesis($urpm, $_); + if ($options->{need_xml}) { + # TODO + # _parse_xml_($urpm, $_, any_xml($urpm, $_), $options->{callback}); } if ($_->{searchmedia}) { $urpm->{searchmedia} = 1; $urpm->{log}(N("Search start: %s end: %s", $_->{start}, $_->{end})); } } - - if ($need_second_pass) { - require URPM::Build; - $urpm->{log}(N("performing second pass to compute dependencies\n")); - $urpm->unresolved_provides_clean; - _parse_media($urpm, 1, $options); - } } sub _compute_flags_for_skiplist { @@ -623,9 +520,9 @@ sub _compute_flags_for_instlist { #- add a new medium, sync the config file accordingly. #- returns the new medium's name. (might be different from the requested #- name if index_name was specified) -#- options: ignore, index_name, nolock, hdlist, synthesis, update, virtual, media_info_dir +#- options: ignore, index_name, nolock, update, virtual, media_info_dir sub add_medium { - my ($urpm, $name, $url, $with_hdlist, %options) = @_; + my ($urpm, $name, $url, $with_synthesis, %options) = @_; #- make sure configuration has been read. $urpm->{media} or die "caller should have used ->read_config or ->configure first"; @@ -649,7 +546,7 @@ sub add_medium { url => $url, modified => !$options{ignore}, }; - foreach (qw(downloader update ignore hdlist synthesis media_info_dir)) { + foreach (qw(downloader update ignore media_info_dir)) { $medium->{$_} = $options{$_} if exists $options{$_}; } @@ -660,10 +557,8 @@ sub add_medium { probe_removable_device($urpm, $medium); } - if ($with_hdlist) { - _set_synthesis_or_hdlist($medium, $with_hdlist =~ m!(?:^|/)synthesis\.!); - $medium->{with_hdlist} = $with_hdlist; - _migrate__with_hdlist($medium); + if ($with_synthesis) { + _migrate__with_synthesis($medium, $with_synthesis); } #- local media have priority, other are added at the end. @@ -693,7 +588,7 @@ sub add_medium { #- returns the list of names of added media. #- options : #- - initial_number : when adding several numbered media, start with this number -#- - probe_with : force use of synthesis/hdlist/rpms instead of using both synthesis&hdlist +#- - probe_with : force use of rpms instead of using synthesis #- - ask_media : callback to know whether each media should be added #- - only_updates : only add "update" media (used by rpmdrake) #- other options are passed to add_medium(): ignore, nolock, virtual @@ -762,18 +657,18 @@ sub add_distrib_media { $is_update_media or next; } - my $use_copied_hdlist = $urpm->{options}{use_copied_hdlist} || $distribconf->getvalue($media, 'use_copied_hdlist'); - my $with_hdlist = $use_copied_hdlist && offset_pathname( + my $use_copied_synthesis = $urpm->{options}{use_copied_hdlist} || $distribconf->getvalue($media, 'use_copied_hdlist'); + my $with_synthesis = $use_copied_synthesis && offset_pathname( $url, $distribconf->getpath($media, 'path'), - ) . '/' . $distribconf->getpath($media, $options{probe_with} eq 'synthesis' ? 'synthesis' : 'hdlist'); + ) . '/' . $distribconf->getpath($media, 'synthesis'); push @newnames, add_medium($urpm, $name ? "$media_name ($name$medium_index)" : $media_name, reduce_pathname($distribconf->getfullpath($media, 'path')), - $with_hdlist, - !$use_copied_hdlist ? (media_info_dir => 'media_info') : (), - !$use_copied_hdlist && $options{probe_with} ? ($options{probe_with} => 1) : (), + $with_synthesis, + !$use_copied_synthesis ? (media_info_dir => 'media_info') : (), + !$use_copied_synthesis && $options{probe_with} ? ($options{probe_with} => 1) : (), index_name => $name ? undef : 0, $add_by_default ? () : (ignore => 1), %options, @@ -848,7 +743,7 @@ sub remove_media { $urpm->{modified} = 1; #- remove files associated with this medium. - unlink grep { $_ } map { $_->($urpm, $medium) } \&statedir_hdlist, \&statedir_list, \&statedir_synthesis, \&statedir_descriptions, \&statedir_names; + unlink grep { $_ } map { $_->($urpm, $medium) } \&statedir_synthesis, \&statedir_descriptions, \&statedir_names; #- remove proxy settings for this media urpm::download::remove_proxy_media($medium->{name}); @@ -858,49 +753,21 @@ sub remove_media { } sub _probe_with_try_list { - my ($urpm, $medium, $probe_with, $f) = @_; - - my $probe = sub { - my ($synthesis, $media_info_dir) = @_; - - my $base = file_from_local_url($medium->{url}) || $medium->{url}; - my $url = reduce_pathname("$base/$media_info_dir") . '/' . ($synthesis ? 'synthesis.hdlist.cz' : 'hdlist.cz'); - $f->($url) or return; - - $urpm->{debug} and $urpm->{debug}("found hdlist/synthesis: $url"); - - $medium->{media_info_dir} = $media_info_dir; - if ($probe_with) { - _set_synthesis_or_hdlist($medium, $synthesis); - } - 1; - }; + my ($urpm, $medium, $f) = @_; - - my $want_synthesis = !$probe_with || $probe_with eq 'synthesis'; my @media_info_dirs = ('media_info', '.'); + my $base = file_from_local_url($medium->{url}) || $medium->{url}; + foreach my $media_info_dir (@media_info_dirs) { - if ($probe->($want_synthesis, $media_info_dir)) { - return 1 if $probe_with; - last; - } - } - if ($medium->{media_info_dir}) { - #- try to have both synthesis and hdlist :-) - if (file_from_file_url($medium->{url}) && - !$probe->(!$want_synthesis, $medium->{media_info_dir})) { - #- sad, only one available. - _set_synthesis_or_hdlist($medium, $want_synthesis); + my $url = reduce_pathname("$base/$media_info_dir") . '/synthesis.hdlist.cz'; + if ($f->($url)) { + $urpm->{debug} and $urpm->{debug}("found synthesis: $url"); + $medium->{media_info_dir} = $media_info_dir; + return 1; } - 1; - } else { - foreach my $media_info_dir (@media_info_dirs) { - $probe->(!$want_synthesis, $media_info_dir) - and return 1; - } - ''; } + undef; } sub may_reconfig_urpmi { @@ -949,7 +816,7 @@ sub reconfig_urpmi { } my $reconfigured = 0; - my @reconfigurable = qw(url with_hdlist media_info_dir); + my @reconfigurable = qw(url with_synthesis media_info_dir); my %orig = %$medium; @@ -983,35 +850,24 @@ sub reconfig_urpmi { $reconfigured; } -sub _guess_hdlist_suffix { +sub _guess_synthesis_suffix { my ($url) = @_; $url =~ m!\bmedia/(\w+)/*\Z! && $1; } -sub _hdlist_suffix { +sub _synthesis_suffix { my ($medium) = @_; - $medium->{with_hdlist} =~ /hdlist(.*?)(?:\.src)?\.cz$/ ? $1 : ''; + $medium->{with_synthesis} =~ /synthesis\.hdlist(.*?)(?:\.src)?\.cz$/ ? $1 : ''; } -sub _parse_hdlist_or_synthesis__when_not_modified { - my ($urpm, $medium) = @_; - - delete @$medium{qw(start end)}; - - _parse_synthesis($urpm, $medium, any_synthesis($urpm, $medium)) or - _parse_hdlist($urpm, $medium, any_hdlist($urpm, $medium)); - - _check_after_reading_hdlist_or_synthesis($urpm, $medium); -} - -sub _parse_hdlist_or_synthesis__virtual { +sub _parse_synthesis__virtual { my ($urpm, $medium) = @_; delete $medium->{modified}; $medium->{really_modified} = 1; $urpm->{md5sum_modified} = 1; - _parse_hdlist_or_synthesis__when_not_modified($urpm, $medium); + _parse_synthesis_or_ignore($urpm, $medium); } #- names.<media_name> is used by external progs (namely for bash-completion) @@ -1034,61 +890,48 @@ sub generate_medium_names { } -sub _read_existing_synthesis_and_hdlist_if_same_time_and_msize { +sub _read_existing_synthesis_if_same_time_and_msize { my ($urpm, $medium) = @_; - same_size_and_mtime(cachedir_with_hdlist($urpm, $medium, 's'), - statedir_hdlist_or_synthesis($urpm, $medium, 's')) or return; + same_size_and_mtime(cachedir_with_synthesis($urpm, $medium), + statedir_synthesis($urpm, $medium)) or return; - _read_existing_synthesis_and_hdlist($urpm, $medium); + _read_existing_synthesis($urpm, $medium); 1; } -sub _read_existing_synthesis_and_hdlist_if_same_md5sum { +sub _read_existing_synthesis_if_same_md5sum { my ($urpm, $medium, $retrieved_md5sum) = @_; - #- if an existing hdlist or synthesis file has the same md5sum, we assume the + #- if an existing synthesis file has the same md5sum, we assume the #- files are the same. #- if local md5sum is the same as distant md5sum, this means there is no need to - #- download hdlist or synthesis file again. + #- download synthesis file again. $retrieved_md5sum && $medium->{md5sum} eq $retrieved_md5sum or return; - _read_existing_synthesis_and_hdlist($urpm, $medium); + _read_existing_synthesis($urpm, $medium); 1; } -sub _read_existing_synthesis_and_hdlist { +sub _read_existing_synthesis { my ($urpm, $medium) = @_; - unlink cachedir_with_hdlist($urpm, $medium, 's'); + unlink cachedir_with_synthesis($urpm, $medium); $urpm->{info}(N("medium \"%s\" is up-to-date", $medium->{name})); #- the medium is now considered not modified. $medium->{modified} = 0; - #- XXX we could link the new hdlist to the old one. + #- XXX we could link the new synthesis to the old one. #- (However links need to be managed. see bug #12391.) #- as previously done, just read synthesis file here, this is enough. - if (!_parse_synthesis($urpm, $medium, statedir_synthesis($urpm, $medium))) { - _parse_hdlist($urpm, $medium, statedir_hdlist($urpm, $medium)); - _check_after_reading_hdlist_or_synthesis($urpm, $medium); - } + _parse_synthesis_or_ignore($urpm, $medium); 1; } -sub _parse_hdlist { - my ($urpm, $medium, $hdlist_file, $o_callback) = @_; - - -e $hdlist_file or return; - - $urpm->{log}(N("examining hdlist file [%s]", $hdlist_file)); - ($medium->{start}, $medium->{end}) = - $urpm->parse_hdlist($hdlist_file, packing => 1, $o_callback ? (callback => $o_callback) : @{[]}); -} - sub _parse_synthesis { my ($urpm, $medium, $synthesis_file, $o_callback) = @_; @@ -1098,46 +941,12 @@ sub _parse_synthesis { ($medium->{start}, $medium->{end}) = $urpm->parse_synthesis($synthesis_file, $o_callback ? (callback => $o_callback) : @{[]}); } -sub _parse_hdlist_or_synthesis { - my ($urpm, $medium, $hdlist_or, $prefer_synthesis) = @_; - - if (_synthesis_or_not($medium, $prefer_synthesis)) { - _parse_synthesis($urpm, $medium, $hdlist_or); - } else { - _parse_hdlist($urpm, $medium, $hdlist_or); - } -} -sub _build_hdlist_using_rpm_headers { - my ($urpm, $medium) = @_; - - $urpm->{log}(N("building hdlist [%s]", statedir_hdlist($urpm, $medium))); - #- finish building operation of hdlist. - $urpm->build_hdlist(start => $medium->{start}, - end => $medium->{end}, - dir => "$urpm->{cachedir}/headers", - hdlist => statedir_hdlist($urpm, $medium), - ); -} - -sub _build_synthesis { - my ($urpm, $medium) = @_; +sub _parse_synthesis_or_ignore { + my ($urpm, $medium, $o_callback) = @_; - eval { $urpm->build_synthesis( - start => $medium->{start}, - end => $medium->{end}, - synthesis => statedir_synthesis($urpm, $medium), - ) }; - if (my $err = $@) { - chomp($err); - $urpm->{error}(N("Unable to build synthesis file for medium \"%s\". Your hdlist file may be corrupted.", $medium->{name})); - $urpm->{error}($err); - unlink statedir_synthesis($urpm, $medium); - } else { - $urpm->{log}(N("built hdlist synthesis file for medium \"%s\"", $medium->{name})); - } - #- keep in mind we have a modified database, sure at this point. - $urpm->{md5sum_modified} = 1; + _parse_synthesis($urpm, $medium, any_synthesis($urpm, $medium), $o_callback) or + _ignore_medium_on_parse_error($urpm, $medium); } sub is_valid_medium { @@ -1145,19 +954,17 @@ sub is_valid_medium { defined $medium->{start} && defined $medium->{end}; } -sub _check_after_reading_hdlist_or_synthesis { +sub _ignore_medium_on_parse_error { my ($urpm, $medium) = @_; - if (!is_valid_medium($medium)) { - $urpm->{error}(N("problem reading hdlist or synthesis file of medium \"%s\"", $medium->{name})); - $medium->{ignore} = 1; - } + $urpm->{error}(N("problem reading synthesis file of medium \"%s\"", $medium->{name})); + $medium->{ignore} = 1; } sub _get_list_or_pubkey__local { my ($urpm, $medium, $name) = @_; - my $path = _hdlist_dir($medium) . "/$name" . _hdlist_suffix($medium); + my $path = _synthesis_dir($medium) . "/$name" . _synthesis_suffix($medium); -e $path or $path = file_from_local_url($medium->{url}) . "/media_info/$name"; if (-e $path) { $urpm->{log}(N("copying [%s] for medium \"%s\"...", $path, $medium->{name})); @@ -1171,17 +978,17 @@ sub _get_list_or_pubkey__remote { my ($urpm, $medium, $name) = @_; my $found; - if (_hdlist_suffix($medium)) { - my $local_name = $name . _hdlist_suffix($medium); + if (_synthesis_suffix($medium)) { + my $local_name = $name . _synthesis_suffix($medium); - if (urpm::download::sync($urpm, $medium, [_hdlist_dir($medium) . "/$local_name"], + if (urpm::download::sync($urpm, $medium, [_synthesis_dir($medium) . "/$local_name"], quiet => 1)) { rename("$urpm->{cachedir}/partial/$local_name", "$urpm->{cachedir}/partial/$name"); $found = 1; } } if (!$found) { - urpm::download::sync($urpm, $medium, [_hdlist_dir($medium) . "/$name"], quiet => 1) + urpm::download::sync($urpm, $medium, [_synthesis_dir($medium) . "/$name"], quiet => 1) or unlink "$urpm->{cachedir}/partial/$name"; } } @@ -1220,14 +1027,14 @@ sub get_descriptions_remote { urpm::util::move("$urpm->{cachedir}/partial/descriptions", statedir_descriptions($urpm, $medium)); } } -sub get_hdlist_or_synthesis__local { +sub get_synthesis__local { my ($urpm, $medium, $callback) = @_; - my $f = cachedir_with_hdlist($urpm, $medium, 's'); + my $f = cachedir_with_synthesis($urpm, $medium); unlink $f; - $urpm->{log}(N("copying [%s] for medium \"%s\"...", _url_with_hdlist($medium, 's'), $medium->{name})); + $urpm->{log}(N("copying [%s] for medium \"%s\"...", _url_with_synthesis($medium), $medium->{name})); $callback and $callback->('copy', $medium->{name}); - if (copy_and_own(_url_with_hdlist($medium, 's'), $f)) { + if (copy_and_own(_url_with_synthesis($medium), $f)) { $callback and $callback->('done', $medium->{name}); $urpm->{log}(N("...copying done")); if (file_size($f) < 20) { @@ -1243,12 +1050,12 @@ sub get_hdlist_or_synthesis__local { 0; } } -sub get_hdlist_or_synthesis__remote { +sub get_synthesis__remote { my ($urpm, $medium, $callback, $quiet) = @_; - if (urpm::download::sync($urpm, $medium, [ _url_with_hdlist($medium, 's') ], + if (urpm::download::sync($urpm, $medium, [ _url_with_synthesis($medium) ], quiet => $quiet, callback => $callback) && - file_size(cachedir_with_hdlist($urpm, $medium, 's')) >= 20) { + file_size(cachedir_with_synthesis($urpm, $medium)) >= 20) { 1; } else { chomp(my $err = $@); @@ -1257,94 +1064,52 @@ sub get_hdlist_or_synthesis__remote { } } -sub get_hdlist_or_synthesis_and_check_md5sum__local { +sub get_synthesis_and_check_md5sum__local { my ($urpm, $medium, $retrieved_md5sum, $callback) = @_; - get_hdlist_or_synthesis__local($urpm, $medium, $callback) or return; + get_synthesis__local($urpm, $medium, $callback) or return; #- keep checking md5sum of file just copied ! (especially on nfs or removable device). if ($retrieved_md5sum) { - $urpm->{log}(N("computing md5sum of copied source hdlist (or synthesis)")); - urpm::md5sum::compute(cachedir_with_hdlist($urpm, $medium, 's')) eq $retrieved_md5sum or - $urpm->{error}(N("copy of [%s] failed (md5sum mismatch)", _url_with_hdlist($medium, 's'))), return; + $urpm->{log}(N("computing md5sum of copied source synthesis")); + urpm::md5sum::compute(cachedir_with_synthesis($urpm, $medium)) eq $retrieved_md5sum or + $urpm->{error}(N("copy of [%s] failed (md5sum mismatch)", _url_with_synthesis($medium))), return; } 1; } -sub get_hdlist_or_synthesis_and_check_md5sum__remote { +sub get_synthesis_and_check_md5sum__remote { my ($urpm, $medium, $retrieved_md5sum, $callback, $quiet) = @_; - get_hdlist_or_synthesis__remote($urpm, $medium, $callback, $quiet) or return; + get_synthesis__remote($urpm, $medium, $callback, $quiet) or return; #- check downloaded file has right signature. if ($retrieved_md5sum) { - $urpm->{log}(N("computing md5sum of retrieved source hdlist (or synthesis)")); - urpm::md5sum::compute(cachedir_with_hdlist($urpm, $medium, 's')) eq $retrieved_md5sum or + $urpm->{log}(N("computing md5sum of retrieved source synthesis")); + urpm::md5sum::compute(cachedir_with_synthesis($urpm, $medium)) eq $retrieved_md5sum or $urpm->{error}(N("...retrieving failed: md5sum mismatch")), return; } 1; } -sub _read_rpms_from_dir { - my ($urpm, $medium, $clean_cache) = @_; - - my $dir = file_from_local_url($medium->{url}); - - require File::Glob; - $medium->{rpm_files} = [ File::Glob::glob("$dir/*.rpm") ]; - - #- check files contains something good! - if (!@{$medium->{rpm_files}}) { - $urpm->{error}(N("no rpm files found from [%s]", $dir)); - $medium->{ignore} = 1; - return; - } - - #- we need to rebuild from rpm files the hdlist. - - $urpm->{log}(N("reading rpm files from [%s]", $dir)); - my @unresolved_before = grep { - ! defined $urpm->{provides}{$_}; - } keys %{$urpm->{provides} || {}}; - $medium->{start} = @{$urpm->{depslist}}; +sub _call_genhdlist2 { + my ($urpm, $medium) = @_; - eval { - $medium->{headers} = [ $urpm->parse_rpms_build_headers( - dir => "$urpm->{cachedir}/headers", - rpms => $medium->{rpm_files}, - clean => $$clean_cache, - packing => 1, - ) ]; - }; - if ($@) { - $urpm->{error}(N("unable to read rpm files from [%s]: %s", $dir, $@)); - delete $medium->{headers}; #- do not propagate these. - return; - } + !$medium->{with_synthesis} or $urpm->{fatal}(1, 'with_synthesis not handled with --probe-rpms'); - $medium->{end} = $#{$urpm->{depslist}}; - if ($medium->{start} > $medium->{end}) { - #- an error occured (provided there are files in input.) - delete $medium->{start}; - delete $medium->{end}; - $urpm->{fatal}(9, N("no rpms read")); - } - - #- make sure the headers will not be removed for another media. - $$clean_cache = 0; + my $dir = file_from_local_url($medium->{url}); - my @unresolved = grep { - ! defined $urpm->{provides}{$_}; - } keys %{$urpm->{provides} || {}}; - @unresolved_before == @unresolved or $medium->{need_second_pass} = 1; + system('genhdlist2', + $urpm->{debug} ? '--verbose' : (), '--no-hdlist', + '--media_info-dir', "$urpm->{cachedir}/partial", $dir) == 0 + or $urpm->{error}(N("genhdlist2 failed on %s", $dir)), return; - delete $medium->{synthesis}; #- when building hdlist by ourself, drop synthesis property. 1; } #- options: callback, force, nomd5sum, nopubkey, probe_with sub _update_medium__parse_if_unmodified__local { - my ($urpm, $medium, $clean_cache, $options) = @_; + my ($urpm, $medium, $options) = @_; my $dir = file_from_local_url($medium->{url}); @@ -1353,18 +1118,18 @@ sub _update_medium__parse_if_unmodified__local { #- by mounting some other directory. Try to figure it out and mount #- everything that might be necessary. urpm::removable::try_mounting($urpm, - $options->{probe_with} ne 'rpms' && _hdlist_dir($medium) - ? _hdlist_dir($medium) : $dir, + $options->{probe_with} ne 'rpms' && _synthesis_dir($medium) + ? _synthesis_dir($medium) : $dir, #- in case of an iso image, pass its name urpm::removable::is_iso($medium->{removable}) && $medium->{removable}, ) or $urpm->{error}(N("unable to access medium \"%s\", this could happen if you mounted manually the directory when creating the medium.", $medium->{name})), return; } - #- try to probe for possible with_hdlist parameter, unless + #- try to probe for possible with_synthesis parameter, unless #- it is already defined (and valid). - if (!_hdlist_dir($medium) && $options->{probe_with} ne 'rpms') { - _probe_with_try_list($urpm, $medium, $options->{probe_with}, sub { + if (!_synthesis_dir($medium) && $options->{probe_with} ne 'rpms') { + _probe_with_try_list($urpm, $medium, sub { my ($url) = @_; -e $url or return; if (file_size($url) >= 20) { @@ -1378,41 +1143,42 @@ this could happen if you mounted manually the directory when creating the medium if ($medium->{virtual}) { #- syncing a virtual medium is very simple, just try to read the file in order to - #- determine its type, once a with_hdlist has been found (but is mandatory). - _parse_hdlist_or_synthesis__virtual($urpm, $medium); + #- determine its type, once a with_synthesis has been found (but is mandatory). + _parse_synthesis__virtual($urpm, $medium); 1; - } elsif ($options->{probe_with} eq 'rpms' || !_hdlist_dir($medium)) { - #- build hdlist/synthesis from rpms - _read_rpms_from_dir($urpm, $medium, $clean_cache); - } elsif (_hdlist_dir($medium)) { + } elsif ($options->{probe_with} eq 'rpms' || !_synthesis_dir($medium)) { + _call_genhdlist2($urpm, $medium) or return ''; + 1; + } elsif (_synthesis_dir($medium)) { my ($retrieved_md5sum); - if (!$options->{nomd5sum} && file_size(_hdlist_dir($medium) . '/MD5SUM') > 32) { - $retrieved_md5sum = urpm::md5sum::from_MD5SUM__or_warn($urpm, _hdlist_dir($medium) . '/MD5SUM', - _url_with_hdlist_basename($medium, 's')); + if (!$options->{nomd5sum} && file_size(_synthesis_dir($medium) . '/MD5SUM') > 32) { + $retrieved_md5sum = urpm::md5sum::from_MD5SUM__or_warn($urpm, _synthesis_dir($medium) . '/MD5SUM', + _url_with_synthesis_basename($medium)); if (urpm::md5sum::on_local_medium($urpm, $medium, $options->{force})) { - _read_existing_synthesis_and_hdlist_if_same_md5sum($urpm, $medium, $retrieved_md5sum) + _read_existing_synthesis_if_same_md5sum($urpm, $medium, $retrieved_md5sum) and return 'unmodified'; } } - if (get_hdlist_or_synthesis_and_check_md5sum__local($urpm, $medium, $retrieved_md5sum, $options->{callback})) { + if (get_synthesis_and_check_md5sum__local($urpm, $medium, $retrieved_md5sum, $options->{callback})) { $medium->{md5sum} = $retrieved_md5sum if $retrieved_md5sum; #- check if the files are equal... and no force copy... if (!$options->{force}) { - _read_existing_synthesis_and_hdlist_if_same_time_and_msize($urpm, $medium) + _read_existing_synthesis_if_same_time_and_msize($urpm, $medium) and return 'unmodified'; } 1; } else { - #- if copying hdlist has failed, try to build it directly. + #- if copying synthesis has failed, try to build it directly. if ($urpm->{options}{'build-hdlist-on-error'}) { - #- no available hdlist/synthesis, try to build it from rpms - _read_rpms_from_dir($urpm, $medium, $clean_cache); + #- no available synthesis, try to build it from rpms + _call_genhdlist2($urpm, $medium) or return ''; + 1; } else { - $urpm->{error}(N("unable to access hdlist file of \"%s\", medium ignored", $medium->{name})); + $urpm->{error}(N("unable to access synthesis file of \"%s\", medium ignored", $medium->{name})); $medium->{ignore} = 1; ''; } @@ -1426,10 +1192,10 @@ sub _update_medium__parse_if_unmodified__remote { my ($retrieved_md5sum); #- examine if a distant MD5SUM file is available. - #- this will only be done if $with_hdlist is not empty in order to use - #- an existing hdlist or synthesis file, and to check if download was good. + #- this will only be done if $with_synthesis is not empty in order to use + #- an existing synthesis file, and to check if download was good. #- if no MD5SUM is available, do it as before... - if (_hdlist_dir($medium)) { + if (_synthesis_dir($medium)) { #- we can assume at this point a basename is existing, but it needs #- to be checked for being valid, nothing can be deduced if no MD5SUM #- file is present. @@ -1437,70 +1203,70 @@ sub _update_medium__parse_if_unmodified__remote { unlink "$urpm->{cachedir}/partial/MD5SUM"; if (!$options->{nomd5sum} && urpm::download::sync($urpm, $medium, - [ reduce_pathname(_hdlist_dir($medium) . '/MD5SUM') ], + [ reduce_pathname(_synthesis_dir($medium) . '/MD5SUM') ], quiet => 1) && file_size("$urpm->{cachedir}/partial/MD5SUM") > 32) { if (urpm::md5sum::on_local_medium($urpm, $medium, $options->{force} >= 2)) { $retrieved_md5sum = urpm::md5sum::from_MD5SUM__or_warn($urpm, "$urpm->{cachedir}/partial/MD5SUM", - _url_with_hdlist_basename($medium, 's')); - _read_existing_synthesis_and_hdlist_if_same_md5sum($urpm, $medium, $retrieved_md5sum) + _url_with_synthesis_basename($medium)); + _read_existing_synthesis_if_same_md5sum($urpm, $medium, $retrieved_md5sum) and return 'unmodified'; } } } - #- try to probe for possible with_hdlist parameter, unless + #- try to probe for possible with_synthesis parameter, unless #- it is already defined (and valid). - $urpm->{log}(N("retrieving source hdlist (or synthesis) of \"%s\"...", $medium->{name})); + $urpm->{log}(N("retrieving source synthesis of \"%s\"...", $medium->{name})); $options->{callback} and $options->{callback}('retrieve', $medium->{name}); my $error = sub { my ($msg) = @_; $urpm->{error}($msg); - unlink cachedir_with_hdlist($urpm, $medium, 's'); + unlink cachedir_with_synthesis($urpm, $medium); $options->{callback} and $options->{callback}('failed', $medium->{name}); }; - if (!_hdlist_dir($medium)) { + if (!_synthesis_dir($medium)) { my $err; - _probe_with_try_list($urpm, $medium, $options->{probe_with}, sub { + _probe_with_try_list($urpm, $medium, sub { my ($url) = @_; my $f = "$urpm->{cachedir}/partial/" . basename($url); $options->{force} and unlink $f; if (urpm::download::sync($urpm, $medium, [ $url ], quiet => $options->{quiet}, callback => $options->{callback}) && file_size($f) >= 20) { - $urpm->{log}(N("found probed hdlist (or synthesis) as %s", $url)); + $urpm->{log}(N("found probed synthesis as %s", $url)); 1; } else { chomp($err = $@); 0; } }) or do { - $error->(N("no hdlist file found for medium \"%s\"", $medium->{name})); + $error->(N("no synthesis file found for medium \"%s\"", $medium->{name})); $urpm->{error}(N("...retrieving failed: %s", $err)); return; }; } else { if ($options->{force}) { - unlink cachedir_with_hdlist($urpm, $medium, 's'); + unlink cachedir_with_synthesis($urpm, $medium); } else { #- for rsync, try to sync (copy if needed) local copy after restored the previous one. - my $previous_hdlist = statedir_hdlist_or_synthesis($urpm, $medium, 's'); - if (-e $previous_hdlist && urpm::protocol_from_url($medium->{url}) eq 'rsync') { + my $previous_synthesis = statedir_synthesis($urpm, $medium); + if (-e $previous_synthesis && urpm::protocol_from_url($medium->{url}) eq 'rsync') { copy_and_own( - $previous_hdlist, - cachedir_with_hdlist($urpm, $medium, 's'), + $previous_synthesis, + cachedir_with_synthesis($urpm, $medium), ) or $error->(N("...copying failed")), return; } } - if (get_hdlist_or_synthesis_and_check_md5sum__remote($urpm, $medium, $retrieved_md5sum, $options->{callback}, $options->{quiet})) { + if (get_synthesis_and_check_md5sum__remote($urpm, $medium, $retrieved_md5sum, $options->{callback}, $options->{quiet})) { $options->{callback} and $options->{callback}('done', $medium->{name}); $medium->{md5sum} = $retrieved_md5sum if $retrieved_md5sum; if (!$options->{force}) { - _read_existing_synthesis_and_hdlist_if_same_time_and_msize($urpm, $medium) + _read_existing_synthesis_if_same_time_and_msize($urpm, $medium) and return 'unmodified'; } } else { - $error->(N("unable to access hdlist file of \"%s\", medium ignored", $medium->{name})); + $error->(N("unable to access synthesis file of \"%s\", medium ignored", $medium->{name})); $medium->{ignore} = 1; return; } @@ -1551,38 +1317,13 @@ sub _read_cachedir_pubkey { unlink "$urpm->{cachedir}/partial/pubkey"; } -sub _write_rpm_list { - my ($urpm, $medium) = @_; - - @{$medium->{rpm_files} || []} or return; - - $medium->{list} ||= "list.$medium->{name}"; - - #- write list file. - $urpm->{log}(N("writing list file for medium \"%s\"", $medium->{name})); - my $listfh = urpm::sys::open_safe($urpm, '>', cachedir_list($urpm, $medium)) or return; - print $listfh basename($_), "\n" foreach @{$medium->{rpm_files}}; - 1; -} - #- options: callback, force, nomd5sum, probe_with, quiet #- (from _update_medium__parse_if_unmodified__local and _update_medium__parse_if_unmodified__remote) sub _update_medium_first_pass { - my ($urpm, $medium, $clean_cache, %options) = @_; - - #- we should create the associated synthesis file if it does not already exist... - file_size(statedir_synthesis($urpm, $medium)) >= 20 - or $medium->{must_build_synthesis} = 1; - - my @unresolved_before = grep { ! defined $urpm->{provides}{$_} } keys %{$urpm->{provides} || {}}; + my ($urpm, $medium, %options) = @_; unless ($medium->{modified}) { - #- the medium is not modified, but to compute dependencies, - #- we still need to read it and all synthesis will be written if - #- an unresolved provides is found. - #- to speed up the process, we only read the synthesis at the beginning. - _parse_hdlist_or_synthesis__when_not_modified($urpm, $medium); - compute_need_second_pass($urpm, $medium, \@unresolved_before); + _parse_synthesis_or_ignore($urpm, $medium); return 'unmodified'; } @@ -1599,7 +1340,7 @@ sub _update_medium_first_pass { { my $rc = file_from_local_url($medium->{url}) - ? _update_medium__parse_if_unmodified__local($urpm, $medium, $clean_cache, \%options) + ? _update_medium__parse_if_unmodified__local($urpm, $medium, \%options) : _update_medium__parse_if_unmodified__remote($urpm, $medium, \%options); if (!$rc || $rc eq 'unmodified') { @@ -1607,89 +1348,46 @@ sub _update_medium_first_pass { } } - #- build list file according to hdlist. - if (!$medium->{headers} && !$medium->{virtual} && file_size(cachedir_with_hdlist($urpm, $medium, 's')) < 20) { - $urpm->{error}(N("no hdlist file found for medium \"%s\"", $medium->{name})); + if (!$medium->{virtual} && file_size(cachedir_with_synthesis($urpm, $medium)) < 20) { + $urpm->{error}(N("no synthesis file found for medium \"%s\"", $medium->{name})); return; } if (!$medium->{virtual}) { - if ($medium->{headers}) { - _write_rpm_list($urpm, $medium) or return; - - if (-e statedir_list($urpm, $medium)) { - $urpm->{info}(N("updated medium \"%s\"", $medium->{name})); - } - unlink statedir_hdlist($urpm, $medium); - unlink statedir_synthesis($urpm, $medium); - unlink statedir_list($urpm, $medium); - urpm::util::move(cachedir_list($urpm, $medium), statedir_list($urpm, $medium)); - } else { - #- read first pass hdlist or synthesis, try to open as synthesis, if file - #- is larger than 1MB, this is probably an hdlist else a synthesis. - #- anyway, if one tries fails, try another mode. $options{callback} and $options{callback}('parse', $medium->{name}); - _parse_hdlist_or_synthesis($urpm, $medium, cachedir_with_hdlist($urpm, $medium, 's'), 's'); - - if (is_valid_medium($medium)) { + if (_parse_synthesis($urpm, $medium, cachedir_with_synthesis($urpm, $medium))) { $options{callback} && $options{callback}('done', $medium->{name}); } else { - $urpm->{error}(N("unable to parse hdlist file of \"%s\"", $medium->{name})); + $urpm->{error}(N("unable to parse synthesis file of \"%s\"", $medium->{name})); $options{callback} and $options{callback}('failed', $medium->{name}); delete $medium->{md5sum}; #- we have to read back the current synthesis file unmodified. - if (!_parse_synthesis($urpm, $medium, statedir_synthesis($urpm, $medium))) { - $urpm->{error}(N("problem reading synthesis file of medium \"%s\"", $medium->{name})); - $medium->{ignore} = 1; - } + _parse_synthesis_or_ignore($urpm, $medium); + return; } - if (-e statedir_hdlist_or_synthesis($urpm, $medium, 's')) { + if (-e statedir_synthesis($urpm, $medium)) { $urpm->{info}(N("updated medium \"%s\"", $medium->{name})); } - unlink statedir_list($urpm, $medium); - unlink statedir_hdlist($urpm, $medium); unlink statedir_synthesis($urpm, $medium); #- use newly created file. - urpm::util::move(cachedir_with_hdlist($urpm, $medium, 's'), - statedir_hdlist_or_synthesis($urpm, $medium, 's')); - - if ($medium->{list}) { - delete $medium->{list}; - $urpm->{modified} = 1; - } - } + urpm::util::move(cachedir_with_synthesis($urpm, $medium), + statedir_synthesis($urpm, $medium)); #- make sure to rebuild base files and clear medium modified state. $medium->{modified} = 0; $medium->{really_modified} = 1; - $urpm->{md5sum_modified} = 1; - - #- and create synthesis file associated. - $medium->{must_build_synthesis} = !_synthesis_or_not($medium, 's'); + $urpm->{md5sum_modified} = 1; } - compute_need_second_pass($urpm, $medium, \@unresolved_before); 1; } -sub compute_need_second_pass { - my ($urpm, $medium, $unresolved_before) = @_; - - my @unresolved_after = grep { ! defined $urpm->{provides}{$_} } keys %{$urpm->{provides} || {}}; - if (@$unresolved_before != @unresolved_after) { - $medium->{need_second_pass} = 1; - $urpm->{debug} and $urpm->{debug}(sprintf qq(medium "%s" has unresolved dependencies: %s), - $medium->{name}, - join(' ', difference2(\@unresolved_after, $unresolved_before))); - } -} - sub _update_medium_first_pass_failed { my ($urpm, $medium) = @_; @@ -1699,45 +1397,6 @@ sub _update_medium_first_pass_failed { unlink(glob("$urpm->{cachedir}/partial/*")); } -#- take care of modified medium only, or all if all have to be recomputed. -sub _update_medium_second_pass { - my ($urpm, $medium, $callback) = @_; - - $callback and $callback->('parse', $medium->{name}); - - #- a modified medium is an invalid medium, we have to read back the previous hdlist - #- or synthesis which has not been modified by first pass above. - - if ($medium->{headers} && !$medium->{modified}) { - $urpm->{log}(N("reading headers from medium \"%s\"", $medium->{name})); - ($medium->{start}, $medium->{end}) = $urpm->parse_headers(dir => "$urpm->{cachedir}/headers", - headers => $medium->{headers}, - ); - } elsif (_parse_hdlist($urpm, $medium, any_hdlist($urpm, $medium))) { - $medium->{must_build_synthesis} = 1; - } else { - _parse_synthesis($urpm, $medium, any_synthesis($urpm, $medium)); - } - - $callback && $callback->('done', $medium->{name}); -} - -sub _build_hdlist_synthesis { - my ($urpm, $medium) = @_; - - if ($medium->{headers} && !$medium->{modified}) { - _build_hdlist_using_rpm_headers($urpm, $medium); - #- synthesis needs to be created, since the medium has been built from rpm files. - _build_synthesis($urpm, $medium); - } elsif ($medium->{synthesis}) { - } else { - #- check if the synthesis file can be built. - if ($medium->{must_build_synthesis} && !$medium->{modified} && !$medium->{virtual}) { - _build_synthesis($urpm, $medium); - } - } -} - sub _update_media__handle_some_flags { my ($urpm, $forcekey, $all) = @_; @@ -1765,8 +1424,8 @@ sub _update_media__handle_some_flags { #- noclean : keep old files in the header cache directory #- nomd5sum : don't verify MD5SUM of retrieved files #- nopubkey : don't use rpm pubkeys -#- probe_with : probe synthesis or hdlist (or none) -#- quiet : download hdlists quietly +#- probe_with : probe synthesis or rpms +#- quiet : download synthesis quietly #- wait_lock : block until lock can be acquired sub update_media { my ($urpm, %options) = @_; @@ -1777,15 +1436,14 @@ sub update_media { #- examine each medium to see if one of them needs to be updated. #- if this is the case and if not forced, try to use a pre-calculated - #- hdlist file, else build it from rpm files. + #- synthesis file, else build it from rpm files. clean($urpm); _update_media__handle_some_flags($urpm, $options{forcekey}, $options{all}); - my $clean_cache = !$options{noclean}; my %updates_result; foreach my $medium (grep { !$_->{ignore} } @{$urpm->{media}}) { - my $rc = _update_medium_first_pass($urpm, $medium, \$clean_cache, %options); + my $rc = _update_medium_first_pass($urpm, $medium, %options); $updates_result{$rc || 'error'}++; $rc or _update_medium_first_pass_failed($urpm, $medium); } @@ -1798,26 +1456,7 @@ sub update_media { return $updates_result{error} == 0; } - #- some unresolved provides may force to rebuild all synthesis, - #- a second pass will be necessary. - my $need_second_pass = - (grep { $_->{need_second_pass} } @{$urpm->{media}}) - #- second pass not useful if not a single media allowed to build a synthesis - && (grep { !$_->{virtual} } @{$urpm->{media}}) - #- second pass not useful if only synthesis available - && (grep { !$_->{synthesis} } @{$urpm->{media}}); - if ($need_second_pass) { - $urpm->{log}(N("performing second pass to compute dependencies\n")); - $urpm->unresolved_provides_clean; - } - foreach my $medium (grep { !$_->{ignore} } @{$urpm->{media}}) { - if ($need_second_pass) { - #- second pass consists in reading again synthesis or hdlists. - _update_medium_second_pass($urpm, $medium, $options{callback}); - } - _build_hdlist_synthesis($urpm, $medium); - if ($medium->{really_modified}) { _get_pubkey_and_descriptions($urpm, $medium, $options{nopubkey}); _read_cachedir_pubkey($urpm, $medium, $options{wait_lock}); @@ -53,8 +53,6 @@ usage: ") . N(" --noscripts - do not execute package scriptlet(s). ") . N(" --use-distrib - configure urpme on the fly from a distrib tree, useful to (un)install a chroot with --root option. -") . N(" --probe-synthesis - use synthesis file. -") . N(" --probe-hdlist - use hdlist file. ") . N(" --verbose, -v - verbose mode. ") . N(" -a - select all packages matching expression. "); @@ -196,7 +196,7 @@ if ($env) { } my $_lock = urpm::lock::urpmi_db($urpm, '', nofatal => 1, wait => $options{wait_lock}); -my $need_hdlist = grep { $usedtags{$_} } qw( +my $need_xml = grep { $usedtags{$_} } qw( buildhost buildtime conf_files @@ -220,13 +220,9 @@ urpm::media::configure($urpm, usedistrib => $urpm::args::options{usedistrib}, update => $update, callback => $callback, - need_hdlist => $need_hdlist, + need_xml => $need_xml, ); -if ($need_hdlist) { - my @hdlist_media = grep { !$_->{ignore} && -e urpm::media::any_hdlist($urpm, $_) } @{$urpm->{media}}; - if (!@hdlist_media) { - print N("Note: since no media searched uses hdlists, urpmf was unable to return any result\n"); - print N("You may want to use --name to search for package names.\n") if !$usedtags{name}; - } +if ($need_xml) { + # TODO } @@ -111,8 +111,6 @@ usage: ") . N(" --urpmi-root - use another root for urpmi db & rpm installation. ") . N(" --use-distrib - configure urpmi on the fly from a distrib tree, useful to install a chroot with --root option. -") . N(" --probe-synthesis - use synthesis file. -") . N(" --probe-hdlist - use hdlist file. ") . N(" --wget - use wget to retrieve distant files. ") . N(" --curl - use curl to retrieve distant files. ") . N(" --prozilla - use prozilla to retrieve distant files. diff --git a/urpmi.addmedia b/urpmi.addmedia index 6b057e2d..fc46d9da 100755 --- a/urpmi.addmedia +++ b/urpmi.addmedia @@ -52,9 +52,8 @@ and [options] are from authentication (format is <user:password>). ") . N(" --update - create an update medium. ") . N(" --probe-synthesis - use synthesis file. -") . N(" --probe-hdlist - use hdlist file. -") . N(" --probe-rpms - use rpm files (instead of synthesis/hdlist). -") . N(" --no-probe - do not try to find any synthesis or hdlist file. +") . N(" --probe-rpms - use rpm files (instead of synthesis). +") . N(" --no-probe - do not try to find any synthesis file. ") . N(" --urpmi-root - use another root for urpmi db & rpm installation. ") . N(" --distrib - automatically create all media from an installation medium. @@ -88,7 +87,7 @@ if ($options{mirrors_url}) { $options{force} = 0; $options{noclean} = 1; my $urpm = urpm->new_parse_cmdline or usage(); -our ($name, $url, $with, $relative_hdlist) = our @cmdline; +our ($name, $url, $with, $relative_synthesis) = our @cmdline; $options{quiet} = 1 if $options{verbose} < 0; @@ -107,8 +106,8 @@ urpm::media::read_config($urpm); my $ok = 1; if ($options{distrib}) { - $with || $relative_hdlist - and usage N("no need to give <relative path of hdlist> with --distrib"); + $with || $relative_synthesis + and usage N("no need to give <relative path of synthesis> with --distrib"); my $add_media_callback = $options{interactive} ? sub { @@ -140,14 +139,14 @@ if ($options{distrib}) { $name or usage(); if ($with eq "with") { - $relative_hdlist or usage N("<relative path of hdlist> missing\n"); + $relative_synthesis or usage N("<relative path of synthesis> missing\n"); } if ($options{probe_with} && $options{probe_with} eq 'rpms' && !urpm::file_from_local_url($url)) { die N("Can't use %s with remote medium", "--probe-rpms"); } urpm::media::add_medium($urpm, - $name, $url, $relative_hdlist, + $name, $url, $relative_synthesis, virtual => $options{virtual}, update => $options{update}, ignore => $options{raw}, diff --git a/urpmi.bash-completion b/urpmi.bash-completion index 5748b4dc..667a9637 100644 --- a/urpmi.bash-completion +++ b/urpmi.bash-completion @@ -114,11 +114,6 @@ _urpmi() --verify-rpm" for (( i=1; i < COMP_CWORD; i++ )); do case ${COMP_WORDS[i]} in - --use-distrib) - options="$options \ - --probe-synthesis \ - --probe-hdlist" - ;; ----auto-update) options="$options --no-md5sum \ --force-key" diff --git a/urpmi.update b/urpmi.update index 2e3f3aa8..29beade8 100755 --- a/urpmi.update +++ b/urpmi.update @@ -44,11 +44,11 @@ where <name> is a medium name to update. ") . N(" --ignore - don't update, mark the media as ignored. ") . N(" --no-ignore - don't update, mark the media as enabled. ") . N(" --urpmi-root - use another root for urpmi db & rpm installation. -") . N(" --probe-rpms - do not use synthesis/hdlist, use rpm files directly +") . N(" --probe-rpms - do not use synthesis, use rpm files directly ") . N(" -a - select all non-removable media. ") . N(" -c - clean headers cache directory. -") . N(" -f - force updating synthesis/hdlist -") . N(" -ff - really force updating synthesis/hdlist +") . N(" -f - force updating synthesis +") . N(" -ff - really force updating synthesis ") . N(" -q - quiet mode. ") . N(" -v - verbose mode. "); @@ -68,8 +68,6 @@ usage: ") . N(" --urpmi-root - use another root for urpmi db & rpm installation. ") . N(" --use-distrib - configure urpmi on the fly from a distrib tree. This permit to querying a distro. -") . N(" --probe-synthesis - use synthesis file. -") . N(" --probe-hdlist - use hdlist file. ") . N(" --wget - use wget to retrieve distant files. ") . N(" --curl - use curl to retrieve distant files. ") . N(" --prozilla - use prozilla to retrieve distant files. @@ -194,13 +192,10 @@ if ($options{list_aliases}) { $_->{update} and print "--update "; $_->{virtual} and print "--virtual "; print escape_shell($_->{name}), " ", escape_shell($_->{url}), " "; - $_->{with_hdlist} and print "with " . escape_shell($_->{with_hdlist}); + $_->{with_synthesis} and print "with " . escape_shell($_->{with_synthesis}); print "\n"; } exit 0; -} elsif ($options{list}) { - # --list lists all available packages: select them all - @{$state->{selected}}{0 .. $#{$urpm->{depslist}}} = (); } else { %requested = $urpm->register_rpms(@files); @@ -336,6 +331,7 @@ if ($options{list_aliases}) { my @l = grep { $medium->{start} <= $_ && $_ <= $medium->{end} } @selected or next; my @pkgs = map { $urpm->{depslist}[$_] } @l or next; + # TODO my $hdlist_path = urpm::media::any_hdlist($urpm, $medium); if (-s $hdlist_path) { require MDV::Packdrakeng; |