From 20f61d8756d85e6d65a64d183b5fea9f866fbc50 Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Thu, 13 May 2004 14:55:38 +0000 Subject: New helpful error messages in urpmq. Improve documentation and refactorization. --- urpm.pm | 79 ++++++++++----------- urpm/args.pm | 82 +++++++++++----------- urpmq | 220 +++++++++++++++++++++++++++++++++-------------------------- 3 files changed, 204 insertions(+), 177 deletions(-) diff --git a/urpm.pm b/urpm.pm index 6fd1750e..5f20a225 100644 --- a/urpm.pm +++ b/urpm.pm @@ -459,7 +459,7 @@ sub configure { $urpm->{media} = []; $urpm->add_distrib_media("Virtual", $options{usedistrib}, %options, 'virtual' => 1); } else { - $urpm->read_config(%options); + $urpm->read_config(%options); } if ($options{media}) { delete $_->{modified} foreach @{$urpm->{media} || []}; @@ -746,7 +746,7 @@ sub select_media { } } - #- check if some arguments does not correspond to medium name. + #- check if some arguments don't correspond to the medium name. #- in such case, try to find the unique medium (or list candidate #- media found). foreach (keys %media) { @@ -763,9 +763,9 @@ sub select_media { $foundi[0]{modified} = 1; } elsif (@found == 0 && @foundi == 0) { $urpm->{error}(N("trying to select nonexistent medium \"%s\"", $_)); - } else { #- multiple element in found or foundi list. + } else { #- several elements in found and/or foundi lists. $urpm->{log}(N("selecting multiple media: %s", join(", ", map { N("\"%s\"", $_->{name}) } (@found ? @found : @foundi)))); - #- changed behaviour to select all occurence by default. + #- changed behaviour to select all occurences by default. foreach (@found ? @found : @foundi) { $_->{modified} = 1; } @@ -838,62 +838,59 @@ sub _probe_with_try_list { @probe; } -#- update urpmi database regarding the current configuration. -#- take care of modification and try some trick to bypass -#- computational of base files. -#- allow options : -#- all -> all medium are rebuilded. +#- Update the urpmi database w.r.t. the current configuration. +#- Takes care of modifications, and tries some tricks to bypass +#- the recomputation of base files. +#- Recognized options : +#- all -> all medias are rebuilded. #- force -> try to force rebuilding base files (1) or hdlist from rpm files (2). -#- probe_with -> probe synthesis or hdlist. +#- probe_with -> probe synthesis or hdlist (or none). #- ratio -> use compression ratio (with gzip, default is 4) -#- noclean -> keep header directory cleaned. +#- noclean -> keep old files in the header cache directory. +#- nopubkey -> don't use rpm pubkeys +#- nolock -> don't lock the urpmi database +#- forcekey -> force retrieval of pubkey sub update_media { - my ($urpm, %options) = @_; #- do not trust existing hdlist and try to recompute them. - my ($cleaned_cache, $second_pass); - - #- take care of some options. - $cleaned_cache = !$options{noclean}; - - #- avoid trashing existing configuration in this case. - $urpm->{media} or return; + my ($urpm, %options) = @_; + my $clean_cache = !$options{noclean}; + my $second_pass; - #- now we need additional methods not defined by default in URPM. - require URPM::Build; - require URPM::Signature; + $urpm->{media} or return; # verify that configuration has been read #- get gpg-pubkey signature. - $options{nopubkey} or $urpm->exlock_rpm_db; - $options{nopubkey} or $urpm->{keys} or $urpm->parse_pubkeys(root => $urpm->{root}); - + if (!$options{nopubkey}) { + $urpm->exlock_rpm_db; + $urpm->{keys} or $urpm->parse_pubkeys(root => $urpm->{root}); + } #- lock database if allowed. $options{nolock} or $urpm->exlock_urpmi_db; - #- examine each medium to see if one of them need to be updated. + #- 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. + #- hdlist file, else build it from rpm files. $urpm->clean; foreach my $medium (@{$urpm->{media}}) { - #- take care of modified medium only or all if all have to be recomputed. $medium->{ignore} and next; $options{forcekey} and delete $medium->{'key-ids'}; - #- and create synthesis file associated if it does not already exists... + #- we should create the associated synthesis file if it does not already exist... -e "$urpm->{statedir}/synthesis.$medium->{hdlist}" && -s _ > 32 or $medium->{modified_synthesis} = 1; - #- but do not take care of removable media for all. + #- if we're rebuilding all media, mark them as modified (except removable ones) $medium->{modified} ||= $options{all} && $medium->{url} !~ m!^removable://!; + unless ($medium->{modified}) { #- the medium is not modified, but for computing dependencies, #- 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. + #- to speed up the process, we only read the synthesis at the beginning. delete @$medium{qw(start end)}; if ($medium->{virtual}) { my ($path) = $medium->{url} =~ m|^file:/*(/[^/].*[^/])/*$|; - my $with_hdlist_file = "$path/$medium->{with_hdlist}"; if ($path) { + my $with_hdlist_file = "$path/$medium->{with_hdlist}"; if ($medium->{synthesis}) { $urpm->{log}(N("examining synthesis file [%s]", $with_hdlist_file)); ($medium->{start}, $medium->{end}) = $urpm->parse_synthesis($with_hdlist_file); @@ -1182,7 +1179,7 @@ this could happen if you mounted manually the directory when creating the medium $medium->{headers} = [ $urpm->parse_rpms_build_headers( dir => "$urpm->{cachedir}/headers", rpms => \@files, - clean => $cleaned_cache, + clean => $clean_cache, ) ]; $medium->{end} = $#{$urpm->{depslist}}; if ($medium->{start} > $medium->{end}) { @@ -1192,7 +1189,7 @@ this could happen if you mounted manually the directory when creating the medium die "no rpms read\n"; } else { #- make sure the headers will not be removed for another media. - $cleaned_cache = 0; + $clean_cache = 0; my @unresolved = grep { ! defined $urpm->{provides}{$_}; } keys %{$urpm->{provides} || {}}; @@ -2103,7 +2100,11 @@ sub search_packages { $result; } -#- do the resolution of dependencies. +#- Resolves dependencies between requested packages (and auto selection if any). +#- handles parallel option if any. +#- The return value is true if program should be restarted (in order to take +#- care of important packages being upgraded (notably urpmi and perl-URPM, but +#- maybe rpm too, and glibc also ?). sub resolve_dependencies { my ($urpm, $state, $requested, %options) = @_; my $need_restart; @@ -2143,10 +2144,12 @@ sub resolve_dependencies { local $SIG{QUIT} = $sig_handler; #- auto select package for upgrading the distribution. - $options{auto_select} and $urpm->request_packages_to_upgrade($db, $state, $requested, requested => undef); + if ($options{auto_select}) { + $urpm->request_packages_to_upgrade($db, $state, $requested, requested => undef); + } - #- resolve dependencies which will be examined for packages needed to - #- updated with a restart needed. + #- resolve dependencies which will be examined for packages that need to + #- have urpmi restarted when they're updated. $urpm->resolve_requested($db, $state, $requested, %options); if ($options{priority_upgrade} && !$options{rpmdb}) { diff --git a/urpm/args.pm b/urpm/args.pm index a2fc93a2..97b1472c 100644 --- a/urpm/args.pm +++ b/urpm/args.pm @@ -166,52 +166,52 @@ my %options_spec = ( }, urpmq => { - update => \$::query->{update}, - 'media|mediums=s' => \$::query->{media}, - 'excludemedia|exclude-media=s' => \$::query->{excludemedia}, - 'sortmedia|sort-media=s' => \$::query->{sortmedia}, - 'synthesis=s' => \$::query->{sortmedia}, + update => \$options{update}, + 'media|mediums=s' => \$options{media}, + 'excludemedia|exclude-media=s' => \$options{excludemedia}, + 'sortmedia|sort-media=s' => \$options{sortmedia}, + 'synthesis=s' => \$options{sortmedia}, 'auto-select' => sub { - $::query->{deps} = $::query->{upgrade} = $::query->{auto_select} = 1; + $options{deps} = $options{upgrade} = $options{auto_select} = 1; }, fuzzy => sub { - $::query->{fuzzy} = $::query->{all} = 1; + $options{fuzzy} = $options{all} = 1; }, - keep => \$::query->{keep}, - list => \$::query->{list}, - changelog => \$::query->{changelog}, - 'list-media' => \$::query->{list_media}, - 'list-url' => \$::query->{list_url}, - 'list-nodes' => \$::query->{list_nodes}, - 'list-aliases' => \$::query->{list_aliases}, - 'dump-config' => \$::query->{dump_config}, - 'src|s' => \$::query->{src}, - headers => \$::query->{headers}, - sources => \$::query->{sources}, - force => \$::query->{force}, - 'skip=s' => \$::query->{skip}, - 'root=s' => \$::query->{root}, - 'use-distrib=s' => \$::query->{usedistrib}, - 'parallel=s' => \$::query->{parallel}, - 'env=s' => \$::query->{env}, - d => \$::query->{deps}, - u => \$::query->{upgrade}, - a => \$::query->{all}, - 'm|M' => sub { $::query->{deps} = $::query->{upgrade} = 1 }, - c => \$::query->{complete}, - g => \$::query->{group}, - p => \$::query->{use_provides}, - P => sub { $::query->{use_provides} = 0 }, - R => \$::query->{what_requires}, - y => sub { $::query->{fuzzy} = $::query->{all} = 1 }, - v => \$::query->{verbose}, - i => \$::query->{info}, - l => \$::query->{list_files}, + keep => \$options{keep}, + list => \$options{list}, + changelog => \$options{changelog}, + 'list-media' => \$options{list_media}, + 'list-url' => \$options{list_url}, + 'list-nodes' => \$options{list_nodes}, + 'list-aliases' => \$options{list_aliases}, + 'dump-config' => \$options{dump_config}, + 'src|s' => \$options{src}, + headers => \$options{headers}, + sources => \$options{sources}, + force => \$options{force}, + 'skip=s' => \$options{skip}, + 'root=s' => \$options{root}, + 'use-distrib=s' => \$options{usedistrib}, + 'parallel=s' => \$options{parallel}, + 'env=s' => \$options{env}, + d => \$options{deps}, + u => \$options{upgrade}, + a => \$options{all}, + 'm|M' => sub { $options{deps} = $options{upgrade} = 1 }, + c => \$options{complete}, + g => \$options{group}, + p => \$options{use_provides}, + P => sub { $options{use_provides} = 0 }, + R => \$options{what_requires}, + y => sub { $options{fuzzy} = $options{all} = 1 }, + v => \$options{verbose}, + i => \$options{info}, + l => \$options{list_files}, r => sub { - $::query->{version} = $::query->{release} = 1; + $options{version} = $options{release} = 1; }, f => sub { - $::query->{version} = $::query->{release} = $::query->{arch} = 1; + $options{version} = $options{release} = $options{arch} = 1; }, '<>' => sub { my $x = $_[0]; @@ -219,12 +219,12 @@ my %options_spec = ( if (-r $x) { push @::files, $x } else { print STDERR N("urpmq: cannot read rpm file \"%s\"\n", $x) } } else { - if ($::query->{src}) { + if ($options{src}) { push @::src_names, $x; } else { push @::names, $x; } - $::query->{src} = 0; #- reset switch for next package. + $options{src} = 0; #- reset switch for next package. } }, }, diff --git a/urpmq b/urpmq index 4db8f463..a276c517 100755 --- a/urpmq +++ b/urpmq @@ -2,7 +2,7 @@ # $Id$ -#- Copyright (C) 2000 MandrakeSoft (fpons@mandrakesoft.com) +#- Copyright (C) 2000-2004 MandrakeSoft (fpons@mandrakesoft.com) #- #- This program is free software; you can redistribute it and/or modify #- it under the terms of the GNU General Public License as published by @@ -22,23 +22,21 @@ use strict; -#- default options. -#- this needs to be set earlier than the loading of urpm::args. -our $query; -BEGIN { $query = { use_provides => 1, } } - use urpm; use urpm::args; use urpm::msg; use MDK::Common; +#- default options. +$urpm::args::options = { use_provides => 1 }; + our @files; our @names; our @src_names; sub usage { print STDERR N("urpmq version %s -Copyright (C) 2000, 2001, 2002 MandrakeSoft. +Copyright (C) 2000-2004 MandrakeSoft. This is free software and may be redistributed under the terms of the GNU GPL. usage: @@ -94,67 +92,72 @@ usage: exit(0); } -#- params contains informations to parse installed system. -my $urpm = new urpm; - #- parse arguments list. @ARGV or usage; +my $urpm = new urpm; urpm::args::parse_cmdline(urpm => $urpm); #- remove verbose if not asked. -$query->{verbose} or $urpm->{log} = sub {}; +$urpm::args::options{verbose} or $urpm->{log} = sub {}; #- improve speed if using any list_... options. -$query->{nodepslist} = $query->{list_aliases} || $query->{list_nodes} || $query->{list_media} || $query->{dump_config} || $query->{list_url}; +$urpm::args::options{nodepslist} = $urpm::args::options{list_aliases} + || $urpm::args::options{list_nodes} + || $urpm::args::options{list_media} + || $urpm::args::options{dump_config} + || $urpm::args::options{list_url}; -if ($query->{env}) { - print STDERR N("using specific environment on %s\n", $query->{env}); +if ($urpm::args::options{env}) { + print STDERR N("using specific environment on %s\n", $urpm::args::options{env}); #- setting new environment. - $urpm->{config} = "$query->{env}/urpmi.cfg"; - $urpm->{skiplist} = "$query->{env}/skip.list"; - $urpm->{instlist} = "$query->{env}/inst.list"; - $urpm->{statedir} = $query->{env}; + $urpm->{config} = "$urpm::args::options{env}/urpmi.cfg"; + $urpm->{skiplist} = "$urpm::args::options{env}/skip.list"; + $urpm->{instlist} = "$urpm::args::options{env}/inst.list"; + $urpm->{statedir} = $urpm::args::options{env}; } -$query->{upgrade} && !$query->{env} and $urpm->shlock_rpm_db; +$urpm::args::options{upgrade} && !$urpm::args::options{env} and $urpm->shlock_rpm_db; $urpm->shlock_urpmi_db; -$urpm->configure(nocheck_access => 1, - noskipping => $query->{nodepslist}, noinstalling => $query->{nodepslist}, nodepslist => $query->{nodepslist}, - media => $query->{media}, - excludemedia => $query->{excludemedia}, - sortmedia => $query->{sortmedia}, - synthesis => $query->{synthesis}, - update => $query->{update}, - skip => $query->{skip}, - root => $query->{root}, - parallel => $query->{parallel}, - usedistrib => $query->{usedistrib}, - ); +$urpm->configure( + nocheck_access => 1, + noskipping => $urpm::args::options{nodepslist}, + noinstalling => $urpm::args::options{nodepslist}, + nodepslist => $urpm::args::options{nodepslist}, + media => $urpm::args::options{media}, + excludemedia => $urpm::args::options{excludemedia}, + sortmedia => $urpm::args::options{sortmedia}, + synthesis => $urpm::args::options{synthesis}, + update => $urpm::args::options{update}, + skip => $urpm::args::options{skip}, + root => $urpm::args::options{root}, + parallel => $urpm::args::options{parallel}, + usedistrib => $urpm::args::options{usedistrib}, +); my $state = {}; my %requested; -if ($query->{list_aliases}) { - local ($_, *PARALLEL); - open PARALLEL, "/etc/urpmi/parallel.cfg"; - while () { +if ($urpm::args::options{list_aliases}) { + local $_; + open my $parallelfh, "/etc/urpmi/parallel.cfg"; + while (<$parallelfh>) { chomp; s/#.*$//; s/^\s*//; s/\s*$//; - /\s*([^:]*):/ or next; - print "$1\n"; + /\s*([^:]*):/ + and print "$1\n"; } - close PARALLEL; -} elsif ($query->{list_nodes}) { - $query->{parallel} or $urpm->{fatal}(1, N("--list-nodes can only be used with --parallel")); + close $parallelfh; +} elsif ($urpm::args::options{list_nodes}) { + $urpm::args::options{parallel} or $urpm->{fatal}(1, N("--list-nodes can only be used with --parallel")); foreach (keys %{$urpm->{parallel_handler}{nodes} || {}}) { print "$_\n"; } exit 0; -} elsif ($query->{list_media} || $query->{list_url}) { +} elsif ($urpm::args::options{list_media} || $urpm::args::options{list_url}) { foreach (@{$urpm->{media}}) { - print $_->{name} . ($query->{list_url} ? " $_->{url}" : "") . "\n"; + print $_->{name} . ($urpm::args::options{list_url} ? " $_->{url}" : "") . "\n"; } exit 0; -} elsif ($query->{dump_config}) { +} elsif ($urpm::args::options{dump_config}) { foreach (@{$urpm->{media}}) { $_->{update} and print "--update "; $_->{virtual} and print "--virtual "; @@ -165,39 +168,43 @@ if ($query->{list_aliases}) { print "\n"; } exit 0; -} elsif ($query->{list}) { - #- if list has been activated, select all... +} elsif ($urpm::args::options{list}) { + # --list lists all available packages: select them all @{$state->{selected}}{0 .. $#{$urpm->{depslist}}} = (); } else { %requested = $urpm->register_rpms(@files); - #- search the packages according the selection given by the user, - #- basesystem is added to the list so if it need to be upgraded, all its dependency - #- will be updated too. + #- search the packages according to the selection given by the user. if (@names) { - $urpm->search_packages(\%requested, [ @names ], - use_provides => $query->{use_provides}, - fuzzy => $query->{fuzzy}, - all => $query->{all}) - or $query->{force} or exit 1; + $urpm->search_packages( + \%requested, + [ @names ], + use_provides => $urpm::args::options{use_provides}, + fuzzy => $urpm::args::options{fuzzy}, + all => $urpm::args::options{all}, + ) or $urpm::args::options{force} + or exit 1; } if (@src_names) { - $urpm->search_packages(\%requested, [ @src_names ], - use_provides => $query->{use_provides}, - fuzzy => $query->{fuzzy}, - src => 1) - or $query->{force} or exit 1; + $urpm->search_packages( + \%requested, + [ @src_names ], + use_provides => $urpm::args::options{use_provides}, + fuzzy => $urpm::args::options{fuzzy}, + src => 1, + ) or $urpm::args::options{force} + or exit 1; } - #- keep track of choices, do no propagate but mark them in selected. + #- keep track of choices, don't propagate but mark them selected. my $stop_on_choices = sub { - my ($urpm, $db, $state, $choices) = @_; - $state->{selected}{join '|', sort { $a <=> $b } map { $_ ? $_->id : () } @$choices} = 0; + my (undef, undef, $state_, $choices) = @_; + $state_->{selected}{join '|', sort { $a <=> $b } map { $_ ? $_->id : () } @$choices} = 0; }; #- open/close of database should be moved here, in order to allow testing #- some bogus case and check for integrity. (note auto_select implies upgrade). - if ($query->{what_requires}) { - #- search for packages that requires on of the package proposed. + if ($urpm::args::options{what_requires}) { + #- search for packages that require one of the proposed packages. my (@properties, %requires, %properties, $dep); #- keep in mind the requested id (if given) in order to prefer these packages @@ -237,12 +244,12 @@ if ($query->{list_aliases}) { } } - #- examine all choice proposed. + #- examine all proposed choices. my $pkg = $best_requested || $best or next; exists $state->{selected}{$pkg->id} and next; $state->{selected}{$pkg->id} = undef; - #- for all provides of package, look of what is requiring them. + #- for all provides of package, look up what is requiring them. foreach ($pkg->provides) { if (my ($n, $s) = /^([^\s\[]*)(?:\[\*\])?\[?([^\s\]]*\s*[^\s\]]*)/) { foreach (map { $urpm->{depslist}[$_] } @@ -258,15 +265,15 @@ if ($query->{list_aliases}) { } } } - } elsif ($query->{auto_select} || $query->{upgrade}) { + } elsif ($urpm::args::options{auto_select} || $urpm::args::options{upgrade}) { $urpm->resolve_dependencies($state, \%requested, - keep => $query->{keep}, - rpmdb => $query->{env} && "$query->{env}/rpmdb.cz", - auto_select => $query->{auto_select}, + keep => $urpm::args::options{keep}, + rpmdb => $urpm::args::options{env} && "$urpm::args::options{env}/rpmdb.cz", + auto_select => $urpm::args::options{auto_select}, callback_choices => $stop_on_choices); - $query->{deps} or delete @{$state->{selected}}{grep { exists $state->{selected}{$_} && + $urpm::args::options{deps} or delete @{$state->{selected}}{grep { exists $state->{selected}{$_} && ! defined $state->{selected}{$_} } keys %{$state->{selected}}}; - } elsif ($query->{deps}) { + } elsif ($urpm::args::options{deps}) { #- only deps required. my $empty_db = new URPM; #- URPM has same methods as URPM::DB and empty URPM will be seen as empty URPM::DB. require URPM::Resolve; @@ -275,10 +282,15 @@ if ($query->{list_aliases}) { $state->{selected} = \%requested; } - if ($query->{headers} || $query->{sources} || $query->{info} || $query->{list_files} || $query->{changelog}) { + if ($urpm::args::options{headers} + || $urpm::args::options{sources} + || $urpm::args::options{info} + || $urpm::args::options{list_files} + || $urpm::args::options{changelog}) + { my ($local_sources, $list) = $urpm->get_source_packages($state->{selected}); - if ($query->{headers}) { + if ($urpm::args::options{headers}) { #- now examine source package to build headers list to extract. unless ($local_sources || $list) { $urpm->{fatal}(1, N("unable to get source packages, aborting")); @@ -304,18 +316,21 @@ if ($query->{list_aliases}) { system "rpm2header", values %downloads; } } - } elsif ($query->{info} || $query->{list_files} || $query->{changelog}) { + } elsif ($urpm::args::options{info} || $urpm::args::options{list_files} || $urpm::args::options{changelog}) { my %downloads; # get descriptions of update sources my $updates_descr = $urpm->urpm::get_updates_description; # if not root, use a temporary directory to store headers $< != 0 and my $tmp_header_dir = chomp_(`mktemp -d /tmp/urpmq.XXXXXX`); foreach (0..$#{$urpm->{media} || []}) { - $urpm->{media}[$_]{synthesis} and next; - if (my @headers = (grep { my $file = "$urpm->{cachedir}/headers/$_"; ! -s $file } - map { my $pkg = $urpm->{depslist}[$_]; - $pkg && $pkg->header_filename } keys %{$list->[$_]})) { - #map { /(.*)\/([^\/]*)-([^-]*)-([^-]*)\.([^\.]*)\.rpm/ and "$2-$3-$4.$5" } values %{$list->[$_]})) { + if ($urpm->{media}[$_]{synthesis}) { + $urpm->{log}->(N("skipping media %s: no hdlist\n", $urpm->{media}[$_]{name})); + next; + } + if (my @headers = (grep { ! -s "$urpm->{cachedir}/headers/$_" } + map { my $pkg = $urpm->{depslist}[$_]; + $pkg && $pkg->header_filename } keys %{$list->[$_]})) + { if (-s "$urpm->{statedir}/$urpm->{media}[$_]{hdlist}") { require packdrake; my $packer = new packdrake( @@ -339,7 +354,7 @@ if ($query->{list_aliases}) { $pkg->update_header("$tmp_header_dir/".$pkg->header_filename, keep_all_tags => 1); unlink "$tmp_header_dir/".$pkg->header_filename; } - if ($query->{info}) { + if ($urpm::args::options{info}) { printf "%-12s: %s\n", "Name", $pkg->name; printf "%-12s: %s\n", "Version", $pkg->version; printf "%-12s: %s\n", "Release", $pkg->release; @@ -366,18 +381,27 @@ if ($query->{list_aliases}) { $updesc->{pre} and printf "%-20s:\n%s\n", "Reason for update", $updesc->{pre}; } } - if ($query->{list_files}) { - $pkg->files and print join("\n", $pkg->files)."\n"; + if ($urpm::args::options{list_files}) { + if ($pkg->files) { + print join("\n", $pkg->files)."\n"; + } else { + print STDERR N("No filelist found\n"); + } } - if ($query->{changelog} && $pkg->changelog_time && $pkg->changelog_name && $pkg->changelog_text) { - print join("\n", mapn { - "* ".urpm::msg::localtime2changelog($_[0])." $_[1]\n\n$_[2]\n" - } [ $pkg->changelog_time ], [ $pkg->changelog_name ] , [ $pkg->changelog_text ]); + if ($urpm::args::options{changelog}) { + if ($pkg->changelog_time && $pkg->changelog_name && $pkg->changelog_text) { + print join("\n", mapn { + "* ".urpm::msg::localtime2changelog($_[0])." $_[1]\n\n$_[2]\n" + } [ $pkg->changelog_time ], [ $pkg->changelog_name ], [ $pkg->changelog_text ] + ); + } else { + print STDERR N("No changelog found\n"); + } } } } -d $tmp_header_dir and rmdir $tmp_header_dir; - } elsif ($query->{sources}) { + } elsif ($urpm::args::options{sources}) { print join "\n", values %$local_sources; values %$local_sources and print "\n"; foreach (0..$#{$urpm->{media} || []}) { print join "\n", values %{$list->[$_]}; values %{$list->[$_]} and print "\n"; @@ -387,23 +411,23 @@ if ($query->{list_aliases}) { } } $urpm->unlock_urpmi_db; -$query->{upgrade} && !$query->{env} and $urpm->unlock_rpm_db; +$urpm::args::options{upgrade} && !$urpm::args::options{env} and $urpm->unlock_rpm_db; #- print sub for query. my $query_sub = sub { - my ($id) = @_; - my $pkg = $urpm->{depslist}[$id]; - my $str = ''; - $query->{group} and $str .= $pkg->group . '/'; - $str .= $pkg->name; - $query->{version} and $str .= '-' . $pkg->version; - $query->{release} and $str .= '-' . $pkg->release; - $query->{arch} and $str .= '.' . $pkg->arch; - $str; + my ($id) = @_; + my $pkg = $urpm->{depslist}[$id]; + my $str = ''; + $urpm::args::options{group} and $str .= $pkg->group . '/'; + $str .= $pkg->name; + $urpm::args::options{version} and $str .= '-' . $pkg->version; + $urpm::args::options{release} and $str .= '-' . $pkg->release; + $urpm::args::options{arch} and $str .= '.' . $pkg->arch; + $str; }; my %hack_only_one; -if ($query->{complete}) { +if ($urpm::args::options{complete}) { foreach my $removal (grep { $state->{rejected}{$_}{removed} && !$state->{rejected}{$_}{obsoleted} } keys %{$state->{rejected} || {}}) { print '@removing@' . $removal . "\n"; -- cgit v1.2.1