summaryrefslogtreecommitdiffstats
path: root/perl-install/modules/any_conf.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-08-10 02:00:45 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-08-10 02:00:45 +0000
commitff2191b0d6fe81de6447fe1d453f8640f1a19b42 (patch)
tree3436062bace3fe45eb9d345ec6b443f28c48d554 /perl-install/modules/any_conf.pm
parentec3d78cf088439fbf9f9c71f75565417ccad831b (diff)
downloaddrakx-backup-do-not-use-ff2191b0d6fe81de6447fe1d453f8640f1a19b42.tar
drakx-backup-do-not-use-ff2191b0d6fe81de6447fe1d453f8640f1a19b42.tar.gz
drakx-backup-do-not-use-ff2191b0d6fe81de6447fe1d453f8640f1a19b42.tar.bz2
drakx-backup-do-not-use-ff2191b0d6fe81de6447fe1d453f8640f1a19b42.tar.xz
drakx-backup-do-not-use-ff2191b0d6fe81de6447fe1d453f8640f1a19b42.zip
internally keep module names according to what we configure (and our kernel, 2.4 or 2.6)
Diffstat (limited to 'perl-install/modules/any_conf.pm')
-rw-r--r--perl-install/modules/any_conf.pm40
1 files changed, 25 insertions, 15 deletions
diff --git a/perl-install/modules/any_conf.pm b/perl-install/modules/any_conf.pm
index b2655dba0..0af11a461 100644
--- a/perl-install/modules/any_conf.pm
+++ b/perl-install/modules/any_conf.pm
@@ -30,42 +30,48 @@ sub get_alias {
$conf->{$alias}{alias};
}
sub get_options {
- my ($conf, $name) = @_;
- $conf->{$name}{options};
+ my ($conf, $module) = @_;
+ $module = $conf->mapping($module);
+ $conf->{$module}{options};
}
sub set_options {
- my ($conf, $name, $new_option) = @_;
- log::l(qq(set option "$new_option" for module "$name"));
- $conf->{$name}{options} = $new_option;
+ my ($conf, $module, $new_option) = @_;
+ $module = $conf->mapping($module);
+ log::l(qq(set option "$new_option" for module "$module"));
+ $conf->{$module}{options} = $new_option;
}
sub get_parameters {
- my ($conf, $name) = @_;
- map { if_(/(.*)=(.*)/, $1 => $2) } split(' ', $conf->get_options($name));
+ my ($conf, $module) = @_;
+ $module = $conf->mapping($module);
+ map { if_(/(.*)=(.*)/, $1 => $2) } split(' ', $conf->get_options($module));
}
sub get_probeall {
my ($conf, $alias) = @_;
$conf->{$alias}{probeall};
}
-sub set_probeall {
+sub _set_probeall {
my ($conf, $alias, $modules) = @_;
$conf->{$alias}{probeall} = $modules;
log::l("setting probeall $alias to $modules");
}
sub add_probeall {
my ($conf, $alias, $module) = @_;
+ $module = $conf->mapping($module);
my $modules = join(' ', uniq(split(' ', $conf->{$alias}{probeall}), $module));
- set_probeall($conf, $alias, $modules);
+ _set_probeall($conf, $alias, $modules);
}
sub remove_probeall {
my ($conf, $alias, $module) = @_;
+ $module = $conf->mapping($module);
my $modules = join(' ', grep { $_ ne $module } split(' ', $conf->{$alias}{probeall}));
- set_probeall($conf, $alias, $modules);
+ _set_probeall($conf, $alias, $modules);
}
sub set_alias {
my ($conf, $alias, $module) = @_;
$module =~ /ignore/ and return;
+ $module = $conf->mapping($module);
/\Q$alias/ && $conf->{$_}{alias} && $conf->{$_}{alias} eq $module and return $_ foreach keys %$conf;
log::l("adding alias $alias to $module");
$conf->{$alias}{alias} = $module;
@@ -96,15 +102,17 @@ sub remove_alias_regexp_byname {
}
sub remove_module {
- my ($conf, $name) = @_;
- $conf->remove_alias($name);
- log::l("removing module $name");
- delete $conf->{$name};
+ my ($conf, $module) = @_;
+ $module = $conf->mapping($module);
+ $conf->remove_alias($module);
+ log::l("removing module $module");
+ delete $conf->{$module};
0;
}
sub set_sound_slot {
my ($conf, $alias, $module) = @_;
+ $module = $conf->mapping($module);
if (my $old = $conf->get_alias($alias)) {
$conf->set_above($old, undef);
}
@@ -156,7 +164,9 @@ sub write {
my $to_add;
while (my ($module, $h) = each %$conf) {
while (my ($type, $v) = each %$h) {
- $to_add .= "$type $module $v\n" if $v && !$written{$module}{$type};
+ if ($v && !$written{$module}{$type}) {
+ $to_add .= "$type $module $v\n";
+ }
}
}
append_to_file($file, $to_add);