summaryrefslogtreecommitdiffstats
path: root/urpm.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-11-14 11:29:37 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-11-14 11:29:37 +0000
commit79b4dbe29da7619f21e8124b562c06b5628b94e1 (patch)
tree223c3db6850e9889ba0a7374f3673952f8ecb632 /urpm.pm
parentedabe9d4501ff5c70b18f85e15c4cd6fc0689cac (diff)
downloadurpmi-79b4dbe29da7619f21e8124b562c06b5628b94e1.tar
urpmi-79b4dbe29da7619f21e8124b562c06b5628b94e1.tar.gz
urpmi-79b4dbe29da7619f21e8124b562c06b5628b94e1.tar.bz2
urpmi-79b4dbe29da7619f21e8124b562c06b5628b94e1.tar.xz
urpmi-79b4dbe29da7619f21e8124b562c06b5628b94e1.zip
add undocumented & unstable --tune-rpm option
(allow to test nofsync and private db)
Diffstat (limited to 'urpm.pm')
-rw-r--r--urpm.pm34
1 files changed, 34 insertions, 0 deletions
diff --git a/urpm.pm b/urpm.pm
index 7c208505..2cbb3d2d 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -93,6 +93,40 @@ sub create_var_lib_rpm {
]);
}
+sub modify_rpm_macro {
+ my ($name, $to_remove, $to_add) = @_;
+
+ my $val = URPM::expand('%' . $name);
+ $val =~ s/$to_remove/$to_add/ or $val = join(' ', grep {$_} $val, $to_add);
+ URPM::add_macro("$name $val");
+}
+
+sub set_tune_rpm {
+ my ($urpm, $para) = @_;
+
+ my %h = map { $_ => 1 } map {
+ if ($_ eq 'all') {
+ ('nofsync', 'private');
+ } else {
+ $_;
+ }
+ } split(',', $para);
+
+ $urpm->{tune_rpm} = \%h;
+}
+
+sub tune_rpm {
+ my ($urpm) = @_;
+
+ if ($urpm->{tune_rpm}{nofsync}) {
+ modify_rpm_macro('__dbi_other', 'fsync', 'nofsync');
+ }
+ if ($urpm->{tune_rpm}{private}) {
+ urpm::sys::clean_rpmdb_shared_regions($urpm->{root});
+ modify_rpm_macro('__dbi_other', 'usedbenv', 'private');
+ }
+}
+
sub protocol_from_url {
my ($url) = @_;
$url =~ m!^(\w+)(_[^:]*)?:! && $1;