diff options
-rwxr-xr-x | strip_files | 29 | ||||
-rwxr-xr-x | translate_menu | 48 |
2 files changed, 39 insertions, 38 deletions
diff --git a/strip_files b/strip_files index d03de2b..af81327 100755 --- a/strip_files +++ b/strip_files @@ -37,7 +37,7 @@ sub testfile() { # See if we were asked to exclude this file. # Note that we have to test on the full filename, including directory. foreach my $f (@exclude_files) { - return if $fn =~ m/\Q$f\E/; + return if $fn =~ m/\Q$f\E/; } # Does its filename look like a shared library? @@ -46,7 +46,7 @@ sub testfile() { if (expensive_test($_) =~ m/ELF.*shared/) { push @executables, $fn; return; - } + } } # Is it executable? -x isn't good enough, so we need to use stat. @@ -56,13 +56,13 @@ sub testfile() { if (expensive_test($_) =~ m/ELF.*executable/) { push @executables, $fn; return; - } + } } # Is it a static library, and not a debug library? if (m/lib.*\.a/ && ! m/_g\.a/) { - push @static_libs, $fn; - return; + push @static_libs, $fn; + return; } } @@ -75,10 +75,17 @@ chdir($buildroot) or die "Can't cd to $buildroot: $!"; @shared_libs = @executables = @static_libs = (); find(\&testfile, $buildroot); -# Note that all calls to strip on shared libs *must* include the --strip-unneeded. -system("strip", "--remove-section=.comment", "--remove-section=.note", "--strip-unneeded",$_) foreach @shared_libs; +# Note that all calls to strip on shared libs *must* include the +# --strip-unneeded. +system( + "strip", + "--remove-section=.comment", + "--remove-section=.note", + "--strip-unneeded", + $_) foreach @shared_libs; -system("strip", "--remove-section=.comment", "--remove-section=.note",$_) foreach @executables; - - -# strip_files ends here +system( + "strip", + "--remove-section=.comment", + "--remove-section=.note", + $_) foreach @executables; 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 |