From 0548eab3254f7e8ae84f02a61fa0f13bac405e41 Mon Sep 17 00:00:00 2001 From: Ondrej Vasik Date: Aug 10 2009 13:55:46 +0000 Subject: iso_codes package no longer provides tab files, do generate them on fly with sed (thanks D. Tardon) --- diff --git a/filesystem.spec b/filesystem.spec index 661eef3..e33144d 100644 --- a/filesystem.spec +++ b/filesystem.spec @@ -1,6 +1,6 @@ Summary: The basic directory layout for a Linux system Name: filesystem -Version: 2.4.28 +Version: 2.4.29 Release: 1%{?dist} License: Public Domain URL: https://fedorahosted.org/filesystem @@ -8,6 +8,8 @@ Group: System Environment/Base Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) # Raw source1 URL: https://fedorahosted.org/filesystem/browser/lang-exceptions?format=raw Source1: https://fedorahosted.org/filesystem/browser/lang-exceptions +Source2: iso_639.sed +Source3: iso_3166.sed Requires(Pre): setup >= 2.5.4-1 BuildRequires: iso-codes @@ -31,6 +33,8 @@ rm -f $RPM_BUILD_DIR/filelist %install rm -rf %{buildroot} mkdir %{buildroot} +install -p -c -m755 %SOURCE2 %{buildroot}/iso_639.sed +install -p -c -m755 %SOURCE3 %{buildroot}/iso_3166.sed cd %{buildroot} @@ -44,7 +48,12 @@ mkdir -p mnt/{floppy,cdrom} \ ln -snf ../var/tmp usr/tmp ln -snf spool/mail var/mail -grep -v "^$" /usr/share/iso-codes/iso_639.tab | grep -v "^#" | while read a b c d ; do +sed -n -f %{buildroot}/iso_639.sed /usr/share/xml/iso-codes/iso_639.xml \ + >%{buildroot}/iso_639.tab +sed -n -f %{buildroot}/iso_3166.sed /usr/share/xml/iso-codes/iso_3166.xml \ + >%{buildroot}/iso_3166.tab + +grep -v "^$" %{buildroot}/iso_639.tab | grep -v "^#" | while read a b c d ; do [[ "$d" =~ "^Reserved" ]] && continue [[ "$d" =~ "^No linguistic" ]] && continue @@ -66,17 +75,21 @@ cat %{SOURCE1} | grep -v "^#" | grep -v "^$" | while read loc ; do # If the locality is not official, skip it if [ -n "$locality" ]; then - grep -q "^$locality" /usr/share/iso-codes/iso_3166.tab || continue + grep -q "^$locality" %{buildroot}/iso_3166.tab || continue fi # If the locale is not official and not special, skip it if [ -z "$special" ]; then egrep -q "[[:space:]]${locale%_*}[[:space:]]" \ - /usr/share/iso-codes/iso_639.tab || continue + %{buildroot}/iso_639.tab || continue fi echo "%lang(${locale}) /usr/share/locale/${loc}" >> $RPM_BUILD_DIR/filelist echo "%lang(${locale}) %ghost %config(missingok) /usr/share/man/${loc}" >> $RPM_BUILD_DIR/filelist done +rm -f %{buildroot}/iso_639.tab +rm -f %{buildroot}/iso_639.sed +rm -f %{buildroot}/iso_3166.tab +rm -f %{buildroot}/iso_3166.sed cat $RPM_BUILD_DIR/filelist | grep "locale" | while read a b ; do mkdir -p -m 755 %{buildroot}/$b/LC_MESSAGES @@ -167,6 +180,10 @@ rm -rf %{buildroot} /var/yp %changelog +* Mon Aug 10 2009 Ondrej Vasik 2.4.29-1 +- iso_codes package no longer provides tab files, do generate + them on fly with sed (thanks D. Tardon) + * Wed Aug 05 2009 Ondrej Vasik 2.4.28-1 - Provide/obsolete pm-utils-filesystem, own dirs for pm-utils hooks(#515362) diff --git a/iso_3166.sed b/iso_3166.sed new file mode 100644 index 0000000..705dbdb --- /dev/null +++ b/iso_3166.sed @@ -0,0 +1,31 @@ +1,/\)!{ + x + s/^$// + # we are on the first iso-code--nothing to process here + t + # process and write to output + s/\s\+/ /g + s/!! + # use '%' as a separator of parsed and unparsed input + s/\(.*\)alpha_2_code="\([^"]\+\)"\(.*\)/\2 % \1 \3/ + s/\([^%]\+\)%\(.*\)alpha_3_code="\([^"]\+\)"\(.*\)/\1% \2 \4/ + # clear subst. memory for the next t + t clear + :clear + s/\([^%]\+\)%\(.*\)numeric_code="\([^"]\+\)"\(.*\)/\1% \2 \4/ + t name + # no 3166 code--write xx + s/%/\tXX %/ + :name + s/\([^%]\+\)%\(.*\)name="\([^"]\+\)"\(.*\)/\1\t\3/ + s/ \t/\t/g + p + b + :noout +} + +H diff --git a/iso_639.sed b/iso_639.sed new file mode 100644 index 0000000..e7e4d05 --- /dev/null +++ b/iso_639.sed @@ -0,0 +1,31 @@ +1,/\)!{ + x + s/^$// + # we are on the first iso-code--nothing to process here + t + # process and write to output + s/\s\+/ /g + s/!! + # use '%' as a separator of parsed and unparsed input + s/\(.*\)iso_639_2T_code="\([^"]\+\)"\(.*\)/\2 % \1 \3/ + s/\([^%]\+\)%\(.*\)iso_639_2B_code="\([^"]\+\)"\(.*\)/\1\t\3 % \2 \4/ + # clear subst. memory for the next t + t clear + :clear + s/\([^%]\+\)%\(.*\)iso_639_1_code="\([^"]\+\)"\(.*\)/\1\t\3 % \2 \4/ + t name + # no 639-1 code--write xx + s/%/\tXX %/ + :name + s/\([^%]\+\)%\(.*\)name="\([^"]\+\)"\(.*\)/\1\t\3/ + s/ \t/\t/g + p + b + :noout +} + +H