From 68d80bdfa06aa4ff0764e64c3b940b705fe5b606 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jani=20V=C3=A4limaa?= Date: Fri, 1 May 2020 15:07:51 +0300 Subject: Drop unneeded translate_menu script (mga#26519) Nothing uses /usr/lib/menu anymore. --- Makefile | 3 +-- NEWS | 2 ++ README | 4 ---- spec-helper.macros.in | 1 - t/run.t | 1 - translate_menu | 64 --------------------------------------------------- 6 files changed, 3 insertions(+), 72 deletions(-) delete mode 100755 translate_menu diff --git a/Makefile b/Makefile index 5c28653..df861ef 100644 --- a/Makefile +++ b/Makefile @@ -13,8 +13,7 @@ SCRIPT_FILES = check_desktop_files \ lib_symlinks \ relink_symlinks \ remove_info_dir \ - restrict_to_cpu0 \ - translate_menu + restrict_to_cpu0 BIN_FILES = macroszification MACROS_FILES = spec-helper.macros TEST_FILES = t/*.t diff --git a/NEWS b/NEWS index a5af6e6..17d914a 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ + * remove unneeded translate_menu script (mga#26519) + 2018-10-21 Jani Välimaa 0.31.22 * move binary and library stripping to __os_install_post in rpm-setup if __debug_package isn't defined diff --git a/README b/README index c3fcf4c..eef5b6d 100644 --- a/README +++ b/README @@ -41,10 +41,6 @@ fix-mo Fix bad translations. Set DONT_FIX_MO to disable. -translate_menu -Change the menu sections. -Set DONT_TRANSLATE_MENU to disable. - fixpamd Fix pam.d config files. Set DONT_FIX_PAMD_CONFIGS to disable. diff --git a/spec-helper.macros.in b/spec-helper.macros.in index db8ed2e..bc3b947 100644 --- a/spec-helper.macros.in +++ b/spec-helper.macros.in @@ -8,7 +8,6 @@ %{?!dont_symlinks_libs: [ -n "$DONT_SYMLINK_LIBS" ] || %_spec_helper_dir/lib_symlinks} \ %{?!dont_gprintify: [ -n "$DONT_GPRINTIFY" ] || %_spec_helper_dir/gprintify} \ %{?!dont_fix_mo: [ -n "$DONT_FIX_MO" ] || %_spec_helper_dir/fix_mo} \ - %{?!dont_translate_menu: [ -n "$DONT_TRANSLATE_MENU" ] || %_spec_helper_dir/translate_menu} \ %{?!dont_fix_pamd: [ -n "$DONT_FIX_PAMD_CONFIGS" ] || %_spec_helper_dir/fix_pamd} \ %{?!dont_remove_info_dir: [ -n "$DONT_REMOVE_INFO_DIR" ] || %_spec_helper_dir/remove_info_dir} \ %{?!dont_fix_eol: [ -n "$DONT_FIX_EOL" ] || %_spec_helper_dir/fix_eol} \ diff --git a/t/run.t b/t/run.t index 7f0b24b..17f8b6a 100755 --- a/t/run.t +++ b/t/run.t @@ -14,7 +14,6 @@ my @programs = qw/ compress_files relink_symlinks gprintify - translate_menu remove_info_dir fix_pamd fix_eol diff --git a/translate_menu b/translate_menu deleted file mode 100755 index 56c90e8..0000000 --- a/translate_menu +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/perl -# change the menu sections - -use strict; -use warnings; - -my $buildroot = $ENV{RPM_BUILD_ROOT}; -die "No build root defined" unless $buildroot; -die "Invalid build root" unless -d $buildroot; - -my $menudir = `rpm --eval %_menudir`; -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"], -); - -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("$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|\\)+.*)/) { - my ($beg, $section, $end) = ($1, $2, $3); - $section = translate($section); - $l = qq($beg"$section"$end); - } - print $FILE "$l\n"; - } - close($FILE); -} -- cgit v1.2.1