aboutsummaryrefslogtreecommitdiffstats
path: root/translate_menu
diff options
context:
space:
mode:
authorGuillaume Rousse <guillomovitch@mandriva.org>2008-01-29 22:08:04 +0000
committerGuillaume Rousse <guillomovitch@mandriva.org>2008-01-29 22:08:04 +0000
commitccaa8550a6c27a96ba420b5bf426ae181d315934 (patch)
tree392472239d7529c85abe732ba275bd5dc71c5ddd /translate_menu
parent3fc0d1eafae7643111ec6a1a01e2f1a90b4c3701 (diff)
downloadspec-helper-ccaa8550a6c27a96ba420b5bf426ae181d315934.tar
spec-helper-ccaa8550a6c27a96ba420b5bf426ae181d315934.tar.gz
spec-helper-ccaa8550a6c27a96ba420b5bf426ae181d315934.tar.bz2
spec-helper-ccaa8550a6c27a96ba420b5bf426ae181d315934.tar.xz
spec-helper-ccaa8550a6c27a96ba420b5bf426ae181d315934.zip
cosmetics
Diffstat (limited to 'translate_menu')
-rwxr-xr-xtranslate_menu48
1 files changed, 21 insertions, 27 deletions
diff --git a/translate_menu b/translate_menu
index 4128f8b..db37640 100755
--- a/translate_menu
+++ b/translate_menu
@@ -21,28 +21,23 @@ chomp($menudir);
! -d "$buildroot/$menudir/" || exit(0);
-my @nested = (["Configuration", "System/Configuration"],
-
- ["Applications/Monitoring", "System/Monitoring"],
- ["Applications/Publishing", "Office/Publishing"],
- ["Applications/File tools", "System/File Tools"],
- ["Applications/Text tools", "System/Text Tools"],
- ["Applications/Archiving", "System/Archiving"],
- ["Applications", "More Applications"],
-
- ["Terminals", "System/Terminals"],
-
- ["Documentation", "More Applications/Documentation"],
-
- ["Office/PDA", "Office/Communications/PDA"],
-
- ["Networking/IRC", "Internet/Chat"],
- ["Networking/WWW", "Internet/Web Browsers"],
- ["^Networking", "Internet"],
-
- ["Amusement", "More Applications/Games"],
- ["Session/Windowmanagers", "System/Session/Windowmanagers"],
- );
+my @nested = (
+ ["Configuration", "System/Configuration"],
+ ["Applications/Monitoring", "System/Monitoring"],
+ ["Applications/Publishing", "Office/Publishing"],
+ ["Applications/File tools", "System/File Tools"],
+ ["Applications/Text tools", "System/Text Tools"],
+ ["Applications/Archiving", "System/Archiving"],
+ ["Applications", "More Applications"],
+ ["Terminals", "System/Terminals"],
+ ["Documentation", "More Applications/Documentation"],
+ ["Office/PDA", "Office/Communications/PDA"],
+ ["Networking/IRC", "Internet/Chat"],
+ ["Networking/WWW", "Internet/Web Browsers"],
+ ["^Networking", "Internet"],
+ ["Amusement", "More Applications/Games"],
+ ["Session/Windowmanagers", "System/Session/Windowmanagers"],
+);
sub translate {
my ($str) = @_;
@@ -51,21 +46,22 @@ sub translate {
if ($str =~ /(.*)$t->[0](.*)/ && $str !~ /$t->[1]/) {
print "$str => $1$t->[1]$2\n";
return "$1$t->[1]$2";
- }
+ }
}
return $str;
}
# process each file passed on cli:
-foreach my $file (glob("$ENV{RPM_BUILD_ROOT}/$menudir/*")) {
+foreach my $file (glob("$buildroot/$menudir/*")) {
open(my $FILE, "<$file") or die $!;
my @lines = <$FILE>;
close($FILE);
open($FILE, ">$file") or die $!;
foreach my $l (@lines) {
chomp($l);
- if ($l =~ /(.*section=)"([^"]+)"(\s*.*)/ || $l =~ /(.*section=)([^"].+?)((\s|\\)+.*)/) {
+ if ($l =~ /(.*section=)"([^"]+)"(\s*.*)/ ||
+ $l =~ /(.*section=)([^"].+?)((\s|\\)+.*)/) {
my ($beg, $section, $end) = ($1, $2, $3);
$section = translate($section);
$l = qq($beg"$section"$end);
@@ -74,5 +70,3 @@ foreach my $file (glob("$ENV{RPM_BUILD_ROOT}/$menudir/*")) {
}
close($FILE);
}
-
-# translate_menu.pl ends here