summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MDK/Common.pm.pl2
-rw-r--r--MDK/Common/System.pm23
-rw-r--r--perl-MDK-Common.spec5
3 files changed, 26 insertions, 4 deletions
diff --git a/MDK/Common.pm.pl b/MDK/Common.pm.pl
index cb5152d..d60dabe 100644
--- a/MDK/Common.pm.pl
+++ b/MDK/Common.pm.pl
@@ -71,7 +71,7 @@ use vars qw(@ISA @EXPORT $VERSION); #);
# perl_checker: RE-EXPORT-ALL
@EXPORT = map { @$_ } map { values %{'MDK::Common::' . $_ . 'EXPORT_TAGS'} } grep { /::$/ } keys %MDK::Common::;
-$VERSION = "1.1.4";
+$VERSION = "1.1.5";
1;
EOF
diff --git a/MDK/Common/System.pm b/MDK/Common/System.pm
index 686fcbe..a1ee80c 100644
--- a/MDK/Common/System.pm
+++ b/MDK/Common/System.pm
@@ -120,6 +120,13 @@ file
read in a template file, replace keys @@@key@@@ with value, save it in every homes.
If BOOL is true, overwrite existing files. FILENAME_OUT must be a relative filename
+=item read_gnomekderc(FILENAME, STRING)
+
+reads GNOME-like and KDE-like config files (aka windows-like).
+You must give a category. eg:
+
+ read_gnomekderc("/etc/skels/.kderc", 'KDE')
+
=item update_gnomekderc(FILENAME, STRING, HASH)
modifies GNOME-like and KDE-like config files (aka windows-like).
@@ -168,7 +175,7 @@ use MDK::Common::File;
use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK %compat_arch $printable_chars $sizeof_int $bitof_int); #);
@ISA = qw(Exporter);
-@EXPORT_OK = qw(%compat_arch $printable_chars $sizeof_int $bitof_int arch typeFromMagic list_passwd list_home list_skels list_users syscall_ psizeof availableMemory availableRamMB gettimeofday unix2dos getVarsFromSh setVarsInSh setVarsInShMode setExportedVarsInSh setExportedVarsInCsh template2file template2userfile update_gnomekderc fuzzy_pidofs); #);
+@EXPORT_OK = qw(%compat_arch $printable_chars $sizeof_int $bitof_int arch typeFromMagic list_passwd list_home list_skels list_users syscall_ psizeof availableMemory availableRamMB gettimeofday unix2dos getVarsFromSh setVarsInSh setVarsInShMode setExportedVarsInSh setExportedVarsInCsh template2file template2userfile read_gnomekderc update_gnomekderc fuzzy_pidofs); #);
%EXPORT_TAGS = (all => [ @EXPORT_OK ]);
@@ -345,6 +352,18 @@ sub template2userfile {
m|/home/(.+?)/| and chown(getpwnam($1), getgrnam($1), $_);
}
}
+
+sub read_gnomekderc {
+ my ($file, $category) = @_;
+ my %h;
+ foreach (MDK::Common::File::cat_($file), "[NOCATEGORY]\n") {
+ if (/^\s*\[\Q$category\E\]/i ... /^\[/) {
+ $h{$1} = $2 if /^\s*(\w*?)=(.*)/;
+ }
+ }
+ %h;
+}
+
sub update_gnomekderc {
my ($file, $category, %subst_) = @_;
@@ -352,7 +371,7 @@ sub update_gnomekderc {
my $s;
foreach (MDK::Common::File::cat_($file), "[NOCATEGORY]\n") {
- if (my $i = /^\s*\[$category\]/i ... /^\[/) {
+ if (my $i = /^\s*\[\Q$category\E\]/i ... /^\[/) {
if ($i =~ /E/) { #- for last line of category
chomp $s; $s .= "\n";
$s .= "$_->[0]=$_->[1]\n" foreach values %subst;
diff --git a/perl-MDK-Common.spec b/perl-MDK-Common.spec
index fcd61c4..d2c92cc 100644
--- a/perl-MDK-Common.spec
+++ b/perl-MDK-Common.spec
@@ -2,7 +2,7 @@
# do not change the version here, change in MDK/Common.pm.pl
%define version THEVERSION
-%define release 2mdk
+%define release 1mdk
%ifarch x86_64
%define build_option PERL_CHECKER_TARGET='debug-code BCSUFFIX=""'
@@ -72,6 +72,9 @@ rm -rf $RPM_BUILD_ROOT
# MODIFY IN THE CVS: cvs.mandrakesoft.com:/cooker soft/perl-MDK-Common
%changelog
+* Wed Jul 30 2003 Pixel <pixel@mandrakesoft.com> 1.1.5-1mdk
+- add read_gnomekderc() (and make update_gnomekderc() a little more robust when the category is plain weird)
+
* Mon Jun 16 2003 Pixel <pixel@mandrakesoft.com> 1.1.4-2mdk
- no native perl_checker for x86_64, only bytecode
- build require ocaml >= 3.06 (thanks to Per Øyvind Karlsen)