aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.am1
-rw-r--r--NEWS1
-rw-r--r--build.macros.in2
-rwxr-xr-xfind-lang.pl128
-rwxr-xr-xtests/findlang.pl44
-rwxr-xr-xtests/findlang.sh12
6 files changed, 1 insertions, 187 deletions
diff --git a/Makefile.am b/Makefile.am
index f96323f..2411bc1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,7 +26,6 @@ pkg_scripts = \
devel.prov \
devel.req \
drop-ld-no-undefined-for-shared-lib-modules-in-libtool \
- find-lang.pl \
fix-dlsearch-path-in-libtool-for-multilib \
fix-libtool-from-moving-options-after-libs \
fix-libtool-ltmain-from-overlinking \
diff --git a/NEWS b/NEWS
index 809635a..adf1791 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,4 @@
+- Remove find-lang.pl in favor of using upstream find-lang.sh
- Unify %configure macros into a single %configure macro
Version 2.21 - 26 July 2017, by Thierry Vignaud
diff --git a/build.macros.in b/build.macros.in
index fdd6f29..fd16d79 100644
--- a/build.macros.in
+++ b/build.macros.in
@@ -72,8 +72,6 @@
# Note: Disable (by commenting out) for legacy compatibility.
#%__check_multiarch_files @RPMLIBDIR@/check-multiarch-files %{buildroot}
-%find_lang @RPMVENDORDIR@/find-lang.pl %{buildroot}
-
# stuff below has been deprecated by rpm filetriggers [June 2008]
%update_menus %{nil}
%clean_menus %{nil}
diff --git a/find-lang.pl b/find-lang.pl
deleted file mode 100755
index ba35ff9..0000000
--- a/find-lang.pl
+++ /dev/null
@@ -1,128 +0,0 @@
-#!/usr/bin/perl
-
-# $Id: find-lang.pl 243013 2008-06-23 13:01:50Z pixel $
-
-use strict;
-use warnings;
-use File::Find;
-use Getopt::Long;
-use Pod::Usage;
-
-GetOptions(
- 'all-name' => \my $allname,
- 'with-gnome' => \my $withgnome,
- 'with-help' => \my $withhelp,
- 'with-kde' => \my $withkde,
- 'with-html' => \my $withhtml,
- 'without-mo' => \my $withoutmo,
- 'with-man' => \my $withman,
- 'debug' => \my $debug,
-) or pod2usage();
-
-my ($buildroot, @searchname) = @ARGV;
-$buildroot or die "No buildroot given\n";
-$buildroot =~ s!/+$!!; # removing trailing /
-my ($pkgname) = @searchname or die "Main name to find missing\n";
-
-sub debug {
- $debug or return;
- my ($msg, @val) = @_;
- printf("DEBUG: $msg\n", @val);
-}
-
-my %finallist; # filename => attr, easy way to perform uniq
-
-File::Find::find(
- sub {
- my $file = substr($File::Find::name, length($buildroot));
- -f $File::Find::name or -l $File::Find::name or return;
- debug("next file is %s", $file);
- if ($file =~ m!^((.*/share/locale)/([^/@]+)[^/]*).*/([^/]+)\.mo!) {
- return if $withoutmo;
- my ($pkg, $lang) = ($4, $3);
- own_file($file, $lang) if pkg_match($pkg);
- } elsif ($file =~ m!^((.*/gnome/help)/([^/]+)/([^/]+))!) {
- return if !$withgnome;
- my ($pkg, $lang, $langfile) = ($3, $4, $1);
- parent_to_own($langfile, $file, $lang) if pkg_match($pkg);
- } elsif ($file =~ m!^((.*/share/help)/([^/]+)/([^/]+))/([^/]+)!) {
- return if !$withhelp;
- my ($pkg, $lang, $langfile) = ($4, $3, $1);
- parent_to_own($langfile, $file, $lang) if pkg_match($pkg);
- } elsif ($file =~ m!^((.*/doc/kde)/HTML/([^/@]+)[^/]*)/([^/]+)/!) {
- return if !$withkde;
- my ($pkg, $lang, $langfile) = ($4, $3, $1);
- parent_to_own($langfile, $file, $lang) if pkg_match($pkg);
- } elsif ($file =~ m!^((.*/doc)/HTML/([^/@]+)[^/]*)/([^/_]+)!) {
- return if !$withhtml;
- my ($pkg, $lang, $langfile) = ($4, $3, $1);
- parent_to_own($langfile, $file, $lang) if pkg_match($pkg);
- } elsif ($file =~ m!^((/+usr/share/man)/([^/@.]+)[^/]*)/man[^/]+/([^/]+)\.\d[^/]*!) {
- return if !$withman;
- my ($pkg, $lang, $langfile) = ($4, $3, $1);
- $file =~ s/\.[^\.]+$/.*/;
- own_file($file, $lang) if pkg_match($pkg);
- } else {
- return;
- }
- },
- $buildroot || '/'
-);
-
-open(my $hlang, '>', "$pkgname.lang") or die "cannot open $pkgname.lang\n";
-
-foreach my $f (sort keys %finallist) {
- my ($lang, @otherlang) = keys %{ $finallist{$f}{lang} || {} };
- my $l = sprintf("%s%s%s",
- $finallist{$f}{dir} ? '%dir ' : '',
- @otherlang == 0 && $lang && $lang ne 'C'
- ? "%lang($lang) "
- : '', # skip if multiple lang, 'C' or dir
- $f
- );
- debug('OUT: %s', $l);
- print $hlang "$l\n";
-
-}
-
-close($hlang);
-
-exit(0);
-
-sub pkg_match {
- my ($pkg) = @_;
- return 1 if $allname;
- return 1 if grep { $_ eq $pkg } @searchname;
- return;
-}
-
-sub own_file {
- my ($file, $lang) = @_;
- $finallist{$file}{lang}{$lang} = 1;
-}
-
-sub parent_to_own {
- my ($parent, $file, $lang) = @_;
- debug("parent_to_own: $parent, $file, $lang");
- if ($allname) {
- #my @subdir = grep { $_ } split('/', substr($file, length($parent)));
- #$parent .= '/' . shift @subdir;
- $finallist{$parent}{lang}{$lang} = 1;
- debug("Parent %s will be %s", $parent, $lang);
- } else {
- my @subdir = grep { $_ } split('/', substr($file, length($parent)));
- pop @subdir;
- $finallist{$parent}{dir} = 1;
- $finallist{$parent}{lang}{$lang} = 1;
- debug("Parent %s will be %s", $parent, $lang);
- while (my $part = shift @subdir) {
- $parent .= "/$part";
- $finallist{$parent}{dir} = 1;
- $finallist{$parent}{lang}{$lang} = 1;
- debug("Parent %s will be %s", $parent, $lang);
- }
- own_file($file, $lang);
- debug("Parent %s will be %s", $file, $lang);
-
- }
-}
diff --git a/tests/findlang.pl b/tests/findlang.pl
deleted file mode 100755
index d601728..0000000
--- a/tests/findlang.pl
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-use Test::More qw(no_plan);
-
-my $pwd = `pwd`;
-chomp($pwd);
-my $testarbo = "$pwd/find-lang-root";
-
-
-my %files = (
- # file => [ lang, is_%dir ]
- '/usr/share/man/fr' => [ 'fr', 1 ],
- '/usr/share/man/fr/man1' => [ 'fr', 1 ],
- '/usr/share/man/fr/man1/lang.1.*' => [ 'fr', 0 ],
- '/usr/share/locale/pt_BR' => [ 'pt_BR', 1 ],
- '/usr/share/gnome/help/lang/pt_BR' => [ 'pt_BR', 1 ],
- '/usr/share/gnome/help/lang/pt_BR/any.html' => [ 'pt_BR', 0 ],
- '/usr/share/gnome/help/lang/en_GB' => [ 'en_GB', 1 ],
- '/usr/share/gnome/help/lang/en_GB/any.html' => [ 'en_GB', 0 ],
- '/usr/share/gnome/help/lang' => [ '', 1 ],
- '/usr/share/locale/pt_BR/LC_MESSAGES' => [ 'pt_BR', 1 ],
- '/usr/share/locale/pt_BR/LC_MESSAGES/lang.mo' => [ 'pt_BR', 0 ],
-);
-
-system("/usr/bin/perl find-lang.pl $testarbo lang --with-man --with-gnome") and die "can't run find-lang $@";
-
-open(my $h, '<', 'lang.lang') or die "can't open lang.lang";
-
-while (my $line = <$h>) {
- chomp($line);
- $line =~ /svn/ and next;
- my ($file) = $line =~ / ([^ ]+)$/;
- my ($lang) = $line =~ /%lang\(([^\)]+)\)/;
- $lang ||= '';
- my $dir = $line =~ /%dir/;
- $dir ||= 0;
- print STDERR "$file\n";
- is($lang, $files{$file}[0], "lang is find");
- is($dir, $files{$file}[1], "%dir is properly set if need");
-}
-
diff --git a/tests/findlang.sh b/tests/findlang.sh
deleted file mode 100755
index fb7110a..0000000
--- a/tests/findlang.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-rm -fr find-lang-root
-for file in \
- find-lang-root/usr/share/man/fr/man1/lang.1.lzma \
- find-lang-root/usr/share/locale/pt_BR/LC_MESSAGES/lang.mo \
- find-lang-root/usr/share/gnome/help/lang/pt_BR/any.html \
- find-lang-root/usr/share/gnome/help/lang/en_GB/any.html
-do install -D Makefile $file
-done
-
-exec perl tests/findlang.pl