aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-09-21 16:16:00 +0000
committerThierry Vignaud <tv@mageia.org>2012-09-21 16:16:00 +0000
commit066e87f60a7bc056a84c89739f4093b081b76dd7 (patch)
tree092398ff834469e1a324857b7a02940f4f5d5435
parent2292feb7bc25dafe8794b2cde71c733b28ab07a2 (diff)
downloadrpmdrake-066e87f60a7bc056a84c89739f4093b081b76dd7.tar
rpmdrake-066e87f60a7bc056a84c89739f4093b081b76dd7.tar.gz
rpmdrake-066e87f60a7bc056a84c89739f4093b081b76dd7.tar.bz2
rpmdrake-066e87f60a7bc056a84c89739f4093b081b76dd7.tar.xz
rpmdrake-066e87f60a7bc056a84c89739f4093b081b76dd7.zip
(version_release) factorize some code
also needed for next commit (backported from trunk)
-rw-r--r--Rpmdrake/formatting.pm9
-rw-r--r--Rpmdrake/gui.pm3
-rw-r--r--Rpmdrake/pkg.pm2
3 files changed, 10 insertions, 4 deletions
diff --git a/Rpmdrake/formatting.pm b/Rpmdrake/formatting.pm
index 6f581b9e..7b4c0917 100644
--- a/Rpmdrake/formatting.pm
+++ b/Rpmdrake/formatting.pm
@@ -49,7 +49,9 @@ our @EXPORT = qw(
pkg2medium
rpm_description
split_fullname
- urpm_name);
+ urpm_name
+ version_release
+ );
# from rpmtools, #37482:
@@ -90,6 +92,11 @@ sub my_fullname {
"$name-$version-$release";
}
+sub version_release {
+ my (undef, $version, $release) = $_[0]->fullname;
+ "$version-$release";
+}
+
sub urpm_name {
return '?-?-?.?' unless ref $_[0];
scalar $_[0]->fullname;
diff --git a/Rpmdrake/gui.pm b/Rpmdrake/gui.pm
index f1ac09f3..72428dea 100644
--- a/Rpmdrake/gui.pm
+++ b/Rpmdrake/gui.pm
@@ -204,10 +204,9 @@ sub get_main_text {
sub get_details {
my ($key, $pkg, $upkg, $installed_version, $raw_medium) = @_;
- my (undef, $version, $release) = split_fullname($key);
my $a = ugtk2::markup_to_TextView_format(
$spacing . join("\n$spacing",
- format_field(N("Version: ")) . $version . '-' . $release,
+ format_field(N("Version: ")) . version_release($upkg),
($upkg->flag_installed ?
format_field(N("Currently installed version: ")) . $installed_version : ()
),
diff --git a/Rpmdrake/pkg.pm b/Rpmdrake/pkg.pm
index 11c97b1e..9d273a06 100644
--- a/Rpmdrake/pkg.pm
+++ b/Rpmdrake/pkg.pm
@@ -195,7 +195,7 @@ sub find_installed_version {
# FIXME: make it faster
# 1) reuse $db if set
# 2) s/traverse_tag/traverse_tag_find/ and time it
- open_rpm_db()->traverse_tag('name', [ $p->name ], sub { push @version, $_[0]->version . '-' . $_[0]->release });
+ open_rpm_db()->traverse_tag('name', [ $p->name ], sub { push @version, version_release($_[0])});
@version ? join(',', sort @version) : N("(none)");
}