From 81b3d92b9f72ed5e66dc42049d474ebf2e8b4a92 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Fri, 16 Jan 2004 00:03:37 +0000 Subject: added urpm::get_updates_description, print updates description in urpmq -i when available, do "unable to get source packages" test only when printing headers --- urpm.pm | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'urpm.pm') diff --git a/urpm.pm b/urpm.pm index 98b64e4a..c577a674 100644 --- a/urpm.pm +++ b/urpm.pm @@ -2,6 +2,7 @@ package urpm; use strict; use vars qw($VERSION @ISA @EXPORT); +use MDK::Common; $VERSION = '4.4'; @ISA = qw(Exporter URPM); @@ -3394,6 +3395,34 @@ sub check_sources_signatures { sort keys %invalid_sources; } +#- get reason of update for packages to be updated +#- use all update medias if none given +sub get_updates_description { + my ($urpm, @update_medias) = @_; + my %update_descr; + my ($cur, $section); + + @update_medias or @update_medias = grep { !$_->{ignore} && $_->{update} } @{$urpm->{media}}; + + foreach (map { cat_("$urpm->{statedir}/descriptions.$_->{name}"), '%package dummy' } @update_medias) { + /^%package (.+)/ and do { + exists $cur->{importance} && !member($cur->{importance}, qw(security bugfix)) and $cur->{importance} = 'normal'; + $update_descr{$_} = $cur foreach @{$cur->{pkgs}}; + $cur = {}; + $cur->{pkgs} = [ split /\s/, $1 ]; + $section = 'pkg'; + next; + }; + /^Updated: (.+)/ && $section eq 'pkg' and $cur->{updated} = $1; + /^Importance: (.+)/ && $section eq 'pkg' and $cur->{importance} = $1; + /^%pre/ and do { $section = 'pre'; next }; + /^%description/ and do { $section = 'description'; next }; + $section eq 'pre' and $cur->{pre} .= $_; + $section eq 'description' and $cur->{description} .= $_; + } + \%update_descr; +} + 1; __END__ -- cgit v1.2.1