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 /urpm.pm | |
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
Diffstat (limited to 'urpm.pm')
-rw-r--r-- | urpm.pm | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -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) = @_; |