summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2004-01-16 00:03:37 +0000
committerOlivier Blin <oblin@mandriva.org>2004-01-16 00:03:37 +0000
commit81b3d92b9f72ed5e66dc42049d474ebf2e8b4a92 (patch)
treec5f9d7afeac6211dc693772151b61127b4525f9e
parent144b2ddb191ce4ac7f76950dd9bda65402d474c2 (diff)
downloadurpmi-81b3d92b9f72ed5e66dc42049d474ebf2e8b4a92.tar
urpmi-81b3d92b9f72ed5e66dc42049d474ebf2e8b4a92.tar.gz
urpmi-81b3d92b9f72ed5e66dc42049d474ebf2e8b4a92.tar.bz2
urpmi-81b3d92b9f72ed5e66dc42049d474ebf2e8b4a92.tar.xz
urpmi-81b3d92b9f72ed5e66dc42049d474ebf2e8b4a92.zip
added urpm::get_updates_description, print updates description in urpmq -i when available, do "unable to get source packages" test only when printing headers
-rw-r--r--urpm.pm29
-rw-r--r--urpmi.spec1
-rwxr-xr-xurpmq20
3 files changed, 44 insertions, 6 deletions
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__
diff --git a/urpmi.spec b/urpmi.spec
index dc4f9cc8..18062749 100644
--- a/urpmi.spec
+++ b/urpmi.spec
@@ -237,6 +237,7 @@ $urpm->update_media(nolock => 1, nopubkey => 1);
%changelog
* Thu Jan 15 2004 Olivier Blin <blino@mandrake.org> 4.4.2-1mdk
+- print updates description in urpmq -i when available
- add auto and keep options in global config section
- urpmq -l (list files), urpmq --changelog
- lock rpm db even in chroot for urpmq
diff --git a/urpmq b/urpmq
index 745e2e72..98c3111a 100755
--- a/urpmq
+++ b/urpmq
@@ -19,9 +19,8 @@
#- this program is based upon urpmi.
use strict;
-use lib qw(/usr/lib/libDrakX);
-use common;
use urpm;
+use MDK::Common;
#- default options.
my $query = { use_provides => 1, };
@@ -348,12 +347,12 @@ if ($query->{list_aliases}) {
if ($query->{headers} || $query->{sources} || $query->{info} || $query->{list_files} || $query->{changelog}) {
my ($local_sources, $list) = $urpm->get_source_packages($state->{selected});
- unless ($local_sources || $list) {
- $urpm->{fatal}(1, N("unable to get source packages, aborting"));
- }
if ($query->{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"));
+ }
values %$local_sources and system 'rpm2header', values %$local_sources;
foreach (0..$#{$urpm->{media} || []}) {
my @headers = (grep { my $file = "$urpm->{cachedir}/headers/$_";
@@ -377,6 +376,8 @@ if ($query->{list_aliases}) {
}
} elsif ($query->{info} || $query->{list_files} || $query->{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
my $tmp_header_dir = ($< != 0 and chomp_(`mktemp -d /tmp/urpmq.XXXXXX`));
foreach (0..$#{$urpm->{media} || []}) {
@@ -425,7 +426,14 @@ if ($query->{list_aliases}) {
$pkg->packager and printf "%-12s: %s\n", "Packager", $pkg->packager;
$pkg->url and printf "%-12s: %s\n", "URL", $pkg->url;
$pkg->summary and printf "%-12s: %s\n", "Summary", $pkg->summary;
- $pkg->description and printf "%-12s:\n%s\n", "Description", $pkg->description;
+ my $updesc = $updates_descr->{$pkg->name};
+ $pkg->description && !$updesc->{description} and printf "%-12s:\n%s\n", "Description", $pkg->description;
+ if ($updesc) {
+ $updesc->{description} and printf "%-12s:\n%s\n", "Description", $updesc->{description};
+ $updesc->{updated} and printf "%-20s: %s\n", "Last updated", $updesc->{updated};
+ $updesc->{importance} and printf "%-20s: %s\n", "Update importance", $updesc->{importance};
+ $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";