diff options
author | Thierry Vignaud <tv@mandriva.org> | 2008-09-09 17:20:19 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2008-09-09 17:20:19 +0000 |
commit | 66e5f23ab760cc334c1e8efc9aad9a72d7de1235 (patch) | |
tree | cf350d2f97bd83b5252f0228d3789befc9326d5d | |
parent | 349001f77115538579db7d1b2f7569f4da09b7ec (diff) | |
download | urpmi-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-- | NEWS | 2 | ||||
-rw-r--r-- | urpm.pm | 18 | ||||
-rwxr-xr-x | urpmi | 15 |
3 files changed, 20 insertions, 15 deletions
@@ -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 @@ -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) = @_; @@ -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 |