aboutsummaryrefslogtreecommitdiffstats
path: root/translate_menu.pl
diff options
context:
space:
mode:
authorGuillaume Rousse <guillomovitch@mandriva.org>2008-01-29 21:13:16 +0000
committerGuillaume Rousse <guillomovitch@mandriva.org>2008-01-29 21:13:16 +0000
commitcfd087f5ce8e31cc42747a35a6248265123383e7 (patch)
tree5f73d4c3012d234fdaf265a6c5973e1280e44c67 /translate_menu.pl
parenta92aaad9c59ad9843503033f03fb9bc87b251c0b (diff)
downloadspec-helper-cfd087f5ce8e31cc42747a35a6248265123383e7.tar
spec-helper-cfd087f5ce8e31cc42747a35a6248265123383e7.tar.gz
spec-helper-cfd087f5ce8e31cc42747a35a6248265123383e7.tar.bz2
spec-helper-cfd087f5ce8e31cc42747a35a6248265123383e7.tar.xz
spec-helper-cfd087f5ce8e31cc42747a35a6248265123383e7.zip
rename translate_menu.pl to translate_menu, for consistency
Diffstat (limited to 'translate_menu.pl')
-rwxr-xr-xtranslate_menu.pl72
1 files changed, 0 insertions, 72 deletions
diff --git a/translate_menu.pl b/translate_menu.pl
deleted file mode 100755
index 2d661c6..0000000
--- a/translate_menu.pl
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/perl -w
-#---------------------------------------------------------------
-# Project : Mandrake Linux
-# Module : spec-helper
-# File : translate_menu.pl
-# Version : $Id$
-# Author : Frederic Lepied
-# Created On : Mon Jan 26 13:37:49 2004
-# Purpose : change the menu sections
-#---------------------------------------------------------------
-
-my $menudir = `rpm --eval %_menudir`;
-chomp($menudir);
-
-$ENV{RPM_BUILD_ROOT} or exit(0);
-! -d "$ENV{RPM_BUILD_ROOT}/$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"],
- );
-
-sub translate {
- my ($str) = @_;
-
- foreach my $t (@nested) {
- 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/*")) {
- 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|\\)+.*)/) {
- my ($beg, $section, $end) = ($1, $2, $3);
- $section = translate($section);
- $l = qq($beg"$section"$end);
- }
- print $FILE "$l\n";
- }
- close($FILE);
-}
-
-# translate_menu.pl ends here