aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2006-09-18 08:39:13 +0000
committerThierry Vignaud <tv@mandriva.org>2006-09-18 08:39:13 +0000
commit59b3bcd34fece84f1a43f6d4b2ffc0e6a30c0498 (patch)
tree318c7e341d3d235579a3a9ea9825af8fb2a09558
parent61afa2f03718f0b95ab2905981cfa41ab458c8a9 (diff)
downloadrpmdrake-59b3bcd34fece84f1a43f6d4b2ffc0e6a30c0498.tar
rpmdrake-59b3bcd34fece84f1a43f6d4b2ffc0e6a30c0498.tar.gz
rpmdrake-59b3bcd34fece84f1a43f6d4b2ffc0e6a30c0498.tar.bz2
rpmdrake-59b3bcd34fece84f1a43f6d4b2ffc0e6a30c0498.tar.xz
rpmdrake-59b3bcd34fece84f1a43f6d4b2ffc0e6a30c0498.zip
(run_rpm) introduce it in order to always run rpm in an unicode locale (#25716)
-rwxr-xr-xrpmdrake16
1 files changed, 12 insertions, 4 deletions
diff --git a/rpmdrake b/rpmdrake
index 52f8c6bc..d25ab8f9 100755
--- a/rpmdrake
+++ b/rpmdrake
@@ -402,6 +402,14 @@ sub pkg2medium {
#- encodings; but if a user has a so broken setup we can't do much anyway
sub localtime2changelog { to_utf8(strftime("%c", localtime($_[0]))) }
+sub run_rpm {
+ foreach (qw(LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION LC_ALL)) {
+ local $ENV{$_} = $ENV{$_} . '.UTF-8' if !/UTF-8/;
+ }
+ `@_`
+}
+
+
sub extract_header {
my ($pkg, $urpm) = @_;
my $chg_prepro = sub {
@@ -410,8 +418,8 @@ sub extract_header {
};
my $name = my_fullname($pkg->{pkg});
if ($pkg->{pkg}->flag_installed) {
- add2hash($pkg, { files => [ split /\n/, chomp_(scalar(`rpm -ql $name`)) || N("(none)") ],
- changelog => $chg_prepro->(to_utf8(scalar(`rpm -q --changelog $name`))) });
+ add2hash($pkg, { files => [ split /\n/, chomp_(scalar(run_rpm("rpm -ql $name"))) || N("(none)") ],
+ changelog => $chg_prepro->(to_utf8(scalar(run_rpm("rpm -q --changelog $name")))) });
} else {
my ($p, $medium) = ($pkg->{pkg}, pkg2medium($pkg->{pkg}, $urpm));
my $hdlist = $medium->{virtual} ? "$medium->{url}/$medium->{with_hdlist}" : "$urpm->{statedir}/$medium->{hdlist}";
@@ -814,7 +822,7 @@ or you already installed all of them."));
|| uc($a->[0]) cmp uc($b->[0]) } @_ },
by_leaves => sub {
my $pkgs_times = 'rpm -q --qf "%{name}-%{version}-%{release} %{installtime}\n" `urpmi_rpm-find-leaves`';
- sort { $b->[1] <=> $a->[1] } grep { exists $pkgs->{$_->[0]} } map { [ split ] } `$pkgs_times`;
+ sort { $b->[1] <=> $a->[1] } grep { exists $pkgs->{$_->[0]} } map { [ split ] } run_rpm($pkgs_times);
},
flat => sub { no locale; sort { uc($a->[0]) cmp uc($b->[0]) } @_ },
by_medium => sub { sort { $a->[2] <=> $b->[2] || uc($a->[0]) cmp uc($b->[0]) } @_ },
@@ -1894,7 +1902,7 @@ Is it ok to continue?", join("\n\n", $r, if_($to_install, $to_install))) : $to_i
foreach my $u (@rpms_upgrade) {
$u =~ m|/([^/]+-[^-]+-[^-]+)\.[^\./]+\.rpm$|
and $pkg2rpmnew{$1} = [ grep { m|^/etc| && (-r "$_.rpmnew" || -r "$_.rpmsave") }
- map { chomp_($_) } `rpm -ql $1` ];
+ map { chomp_($_) } run_rpm("rpm -ql $1") ];
}
dialog_rpmnew(N("The installation is finished; everything was installed correctly.