summaryrefslogtreecommitdiffstats
path: root/urpm
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-02-14 14:09:39 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-02-14 14:09:39 +0000
commit7e171513d57516beea4e9bb92fc29f71a40555fb (patch)
tree8a05c786647c39b52a4d37e4978ac2d06df17d5c /urpm
parent5bd188a5c3383d12001df5ce32b636da9841acec (diff)
downloadurpmi-7e171513d57516beea4e9bb92fc29f71a40555fb.tar
urpmi-7e171513d57516beea4e9bb92fc29f71a40555fb.tar.gz
urpmi-7e171513d57516beea4e9bb92fc29f71a40555fb.tar.bz2
urpmi-7e171513d57516beea4e9bb92fc29f71a40555fb.tar.xz
urpmi-7e171513d57516beea4e9bb92fc29f71a40555fb.zip
Avoid using rpm because of locking
Diffstat (limited to 'urpm')
-rw-r--r--urpm/cfg.pm20
1 files changed, 14 insertions, 6 deletions
diff --git a/urpm/cfg.pm b/urpm/cfg.pm
index c952847a..815a992a 100644
--- a/urpm/cfg.pm
+++ b/urpm/cfg.pm
@@ -42,14 +42,22 @@ Returns 1 on success, 0 on failure.
#- implementations of the substitutions. arch and release are mdk-specific
-sub get_arch () { `/bin/rpm -q --qf '%{arch}' mandrakelinux-release` }
-
-sub get_release () {
- my ($v, $r) = split / /, `/bin/rpm -q --qf '%{version} %{release}' mandrakelinux-release`;
- $v = 'cooker' if $r =~ /^0\./;
- $v;
+my ($arch, $release);
+sub _init_arch_release () {
+ if (!$arch && !$release) {
+ open my $f, '/etc/mandrakelinux-release' or return undef;
+ my $l = <$f>;
+ close $f;
+ ($release, $arch) = $l =~ /release (\d+\.\d+).*for (\w+)/;
+ $release = 'cooker' if $l =~ /cooker/i;
+ }
+ 1;
}
+sub get_arch () { _init_arch_release(); $arch }
+
+sub get_release () { _init_arch_release(); $release }
+
sub get_host () {
my $h;
if (open my $f, '/proc/sys/kernel/hostname') {