From 679031dee0cce1749851a71478a22ab8b3be939a Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 5 Feb 2008 17:08:50 +0000 Subject: - urpmi.update, urpmi.addmedia: o do not parse synthesis o drop /var/lib/urpmi/names. --- NEWS | 4 ++++ pod/urpmi.files.5.pod | 5 ----- urpm/media.pm | 55 ++++++--------------------------------------------- urpmi.bash-completion | 48 +++----------------------------------------- 4 files changed, 13 insertions(+), 99 deletions(-) diff --git a/NEWS b/NEWS index a6af2f46..c2293ea8 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +- urpmi.update, urpmi.addmedia: + o do not parse synthesis + o drop /var/lib/urpmi/names. + Version 5.4 - 5 February 2008, by Pascal "Pixel" Rigaux - bug fix release diff --git a/pod/urpmi.files.5.pod b/pod/urpmi.files.5.pod index 4f3d82eb..45baf3ba 100644 --- a/pod/urpmi.files.5.pod +++ b/pod/urpmi.files.5.pod @@ -16,11 +16,6 @@ media). This manual page documents them. Contains information about all known packages. -=item I<< /var/lib/urpmi/names. >> - -Contains the list of package names per media. This is generated by urpmi for external programs -(namely bash-completion) - =item I Contains media descriptions. See urpmi.cfg(5). diff --git a/urpm/media.pm b/urpm/media.pm index 0cf29f9c..c266eda7 100644 --- a/urpm/media.pm +++ b/urpm/media.pm @@ -929,27 +929,7 @@ sub _synthesis_suffix { $medium->{with_synthesis} =~ /synthesis\.hdlist(.*?)(?:\.src)?\.cz$/ ? $1 : ''; } -#- names. is used by external progs (namely for bash-completion) -sub generate_medium_names { - my ($urpm, $medium) = @_; - - unlink statedir_names($urpm, $medium); - - if (my $fh = urpm::sys::open_safe($urpm, ">", statedir_names($urpm, $medium))) { - foreach ($medium->{start} .. $medium->{end}) { - if (defined $urpm->{depslist}[$_]) { - print $fh $urpm->{depslist}[$_]->name . "\n"; - } else { - $urpm->{error}(N("Error generating names file: dependency %d not found", $_)); - } - } - } else { - $urpm->{error}(N("Error generating names file: Can't write to file (%s)", $!)); - } -} - - -sub _read_existing_synthesis { +sub _medium_is_up_to_date { my ($urpm, $medium) = @_; unlink cachedir_with_synthesis($urpm, $medium); @@ -958,12 +938,6 @@ sub _read_existing_synthesis { #- the medium is now considered not modified. $medium->{modified} = 0; - #- 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. - _parse_synthesis_or_ignore($urpm, $medium); - - 1; } sub _parse_synthesis { @@ -1191,9 +1165,7 @@ 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_synthesis has been found (but is mandatory). - _parse_synthesis_or_ignore($urpm, $medium); + #- syncing a virtual medium is very simple :) 1; } elsif ($options->{probe_with} eq 'rpms' || !_valid_synthesis_dir($medium)) { _call_genhdlist2($urpm, $medium) or return ''; @@ -1208,8 +1180,8 @@ this could happen if you mounted manually the directory when creating the medium if (!$options->{nomd5sum} && file_size($new_MD5SUM) > 32) { if (!$options->{force} && _is_statedir_MD5SUM_uptodate($urpm, $medium, $new_MD5SUM)) { - _read_existing_synthesis($urpm, $medium) - and return 'unmodified'; + _medium_is_up_to_date($urpm, $medium); + return 'unmodified'; } $urpm->{log}(N("copying MD5SUM file of \"%s\"...", $medium->{name})); @@ -1258,8 +1230,8 @@ sub _update_medium__parse_if_unmodified__remote { if (!$options->{nomd5sum} && _download_MD5SUM($urpm, $medium)) { my $new_MD5SUM = "$urpm->{cachedir}/partial/MD5SUM"; if ($options->{force} < 2 && _is_statedir_MD5SUM_uptodate($urpm, $medium, $new_MD5SUM)) { - _read_existing_synthesis($urpm, $medium) - and return 'unmodified'; + _medium_is_up_to_date($urpm, $medium); + return 'unmodified'; } } } @@ -1400,20 +1372,6 @@ sub _update_medium_ { return; } - $options{callback} and $options{callback}('parse', $medium->{name}); - - if (_parse_synthesis($urpm, $medium, cachedir_with_synthesis($urpm, $medium))) { - $options{callback} && $options{callback}('done', $medium->{name}); - } else { - $urpm->{error}(N("unable to parse synthesis file of \"%s\"", $medium->{name})); - $options{callback} and $options{callback}('failed', $medium->{name}); - - #- we have to read back the current synthesis file unmodified. - _parse_synthesis_or_ignore($urpm, $medium); - - return; - } - #- use new files unlink statedir_synthesis($urpm, $medium); @@ -1439,7 +1397,6 @@ sub _update_medium_ { _get_pubkey_and_descriptions($urpm, $medium, $options{nopubkey}); $medium->{'key-ids'} ||= _read_cachedir_pubkey($urpm, $medium, $options{wait_lock}); - generate_medium_names($urpm, $medium); $is_updating and $urpm->{info}(N("updated medium \"%s\"", $medium->{name})); diff --git a/urpmi.bash-completion b/urpmi.bash-completion index 84bd1072..2aec2e60 100644 --- a/urpmi.bash-completion +++ b/urpmi.bash-completion @@ -20,39 +20,6 @@ _urpmi_medias() COMPREPLY=( $( compgen -W '${medias[@]}' -- $cur ) ) } -_urpmi_packages() -{ - # return list of available packages - local medias i j IFS=$'\t\n,' - - # start with full media list - _urpmi_get_medias active - - # find media selection options - for (( i=1; i < COMP_CWORD; i++ )); do - if [[ "${COMP_WORDS[i]}" == --excludemedia ]]; then - for media in ${COMP_WORDS[i+1]}; do - for (( j=0; j < ${#medias[@]}; j++ )); do - [ "${medias[j]}" == "$media" ] && medias[j]='' - done - done - i=$(($i+1)) - fi - if [[ "${COMP_WORDS[i]}" == --media ]]; then - medias=( ${COMP_WORDS[i+1]} ) - i=$(($i+1)) - fi - if [[ "${COMP_WORDS[i]}" == --update ]]; then - _urpmi_get_medias update - fi - done - - # get matching packages - for media in ${medias[@]}; do - COMPREPLY=( ${COMPREPLY[@]:-} $( grep "^$cur" /var/lib/urpmi/names.${media//\\/} 2>/dev/null ) ) - done -} - _urpmi_aliases() { # return list of available aliases @@ -123,14 +90,8 @@ _urpmi() fi COMPREPLY=( $( compgen -W "$options" -- $cur ) ) else - # return available packages only - if [[ ${COMP_WORDS[0]} == *rurpmi ]]; then - _urpmi_packages - else - # return available packages (unless it is clearly a file) and rpm files - if [[ "$cur" != */* ]]; then - _urpmi_packages - fi + if [[ ${COMP_WORDS[0]} != *rurpmi ]]; then + # return rpm files (can't list available packages anymore) _filedir rpm fi fi @@ -182,10 +143,7 @@ _urpmq() --skip --prefer \ --use-distrib --searchmedia --ignorearch" -- $cur)) else - # return available packages (unless it is clearly a file) and rpm files - if [[ "$cur" != */* ]]; then - _urpmi_packages - fi + # return rpm files (can't list available packages anymore) _filedir rpm fi } -- cgit v1.2.1