summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2008-09-09 17:20:19 +0000
committerThierry Vignaud <tv@mandriva.org>2008-09-09 17:20:19 +0000
commit66e5f23ab760cc334c1e8efc9aad9a72d7de1235 (patch)
treecf350d2f97bd83b5252f0228d3789befc9326d5d
parent349001f77115538579db7d1b2f7569f4da09b7ec (diff)
downloadurpmi-66e5f23ab760cc334c1e8efc9aad9a72d7de1235.tar
urpmi-66e5f23ab760cc334c1e8efc9aad9a72d7de1235.tar.gz
urpmi-66e5f23ab760cc334c1e8efc9aad9a72d7de1235.tar.bz2
urpmi-66e5f23ab760cc334c1e8efc9aad9a72d7de1235.tar.xz
urpmi-66e5f23ab760cc334c1e8efc9aad9a72d7de1235.zip
(set_env) extract it so that rpmdrake can support the --env option
-rw-r--r--NEWS2
-rw-r--r--urpm.pm18
-rwxr-xr-xurpmi15
3 files changed, 20 insertions, 15 deletions
diff --git a/NEWS b/NEWS
index 32470584..e3f418f4 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,5 @@
- library:
- o enable rpmdrake to support --debug, -q & -v options
+ o enable rpmdrake to support --debug, --env, -q & -v options
o fix urpm::download::sync() return value (used by rpmdrake) (#43639)
Version 6.9 - 9 September 2008, Pascal "Pixel" Rigaux
diff --git a/urpm.pm b/urpm.pm
index 8a1658cb..0b799ccc 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -134,6 +134,24 @@ sub is_temporary_file {
begins_with($f, $urpm->{cachedir});
}
+sub set_env {
+ my ($urpm, $env) = @_;
+ -d $env or $urpm->{fatal}(8, N("Environment directory %s does not exist", $env));
+ print N("using specific environment on %s\n", $env);
+ #- setting new environment.
+ $urpm->{config} = "$env/urpmi.cfg";
+ if (cat_($urpm->{config}) =~ /^\s*virtual\s*$/m) {
+ print "dropping virtual from $urpm->{config}\n";
+ system(q(perl -pi -e 's/^\s*virtual\s*$//' ) . $urpm->{config});
+ }
+ $urpm->{configs_dir} = "$env/media.d";
+ $urpm->{skiplist} = "$env/skip.list";
+ $urpm->{instlist} = "$env/inst.list";
+ $urpm->{prefer_list} = "$env/prefer.list";
+ $urpm->{prefer_vendor_list} = "$env/prefer.vendor.list";
+ $urpm->{statedir} = $env;
+}
+
sub set_files {
my ($urpm, $urpmi_root) = @_;
diff --git a/urpmi b/urpmi
index 200a3251..f6e34ff4 100755
--- a/urpmi
+++ b/urpmi
@@ -261,20 +261,7 @@ if ($bug) {
}
if ($env) {
- -d $env or $urpm->{fatal}(8, N("Environment directory %s does not exist", $env));
- print N("using specific environment on %s\n", $env);
- #- setting new environment.
- $urpm->{config} = "$env/urpmi.cfg";
- if (cat_($urpm->{config}) =~ /^\s*virtual\s*$/m) {
- print "dropping virtual from $urpm->{config}\n";
- system(q(perl -pi -e 's/^\s*virtual\s*$//' ) . $urpm->{config});
- }
- $urpm->{configs_dir} = "$env/media.d";
- $urpm->{skiplist} = "$env/skip.list";
- $urpm->{instlist} = "$env/inst.list";
- $urpm->{prefer_list} = "$env/prefer.list";
- $urpm->{prefer_vendor_list} = "$env/prefer.vendor.list";
- $urpm->{statedir} = $env;
+ urpm::set_env($urpm, $env);
} else {
if ($< != 0 && !$options{debug__do_not_install}) {
#- need to be root if binary rpms are to be installed