rpms/filesystem/devel iso_3166.sed, NONE, 1.1 iso_639.sed, NONE, 1.1 filesystem.spec, 1.62, 1.63

Ondrej Vasik ovasik at fedoraproject.org
Mon Aug 10 13:55:46 UTC 2009


Author: ovasik

Update of /cvs/extras/rpms/filesystem/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv12986

Modified Files:
	filesystem.spec 
Added Files:
	iso_3166.sed iso_639.sed 
Log Message:
iso_codes package no longer provides tab files, do generate them on fly with sed (thanks D. Tardon)


--- NEW FILE iso_3166.sed ---
1,/<iso_3166_entries/b

# on each new iso-code process the current one
\!\(<iso_3166_entry\|</iso_3166_entries>\)!{
    x
    s/^$//
    # we are on the first iso-code--nothing to process here
    t
    # process and write to output
    s/\s\+/ /g
    s/<iso_3166_entry//
    s!/\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


--- NEW FILE iso_639.sed ---
1,/<iso_639_entries/b

# on each new iso-code process the current one
\!\(<iso_639_entry\|</iso_639_entries>\)!{
    x
    s/^$//
    # we are on the first iso-code--nothing to process here
    t
    # process and write to output
    s/\s\+/ /g
    s/<iso_639_entry//
    s!/\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


Index: filesystem.spec
===================================================================
RCS file: /cvs/extras/rpms/filesystem/devel/filesystem.spec,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -p -r1.62 -r1.63
--- filesystem.spec	5 Aug 2009 10:12:20 -0000	1.62
+++ filesystem.spec	10 Aug 2009 13:55:46 -0000	1.63
@@ -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 
 
     # 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 <ovasik at redhat.com> 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 <ovasik at redhat.com> 2.4.28-1
 - Provide/obsolete pm-utils-filesystem, own dirs for pm-utils
   hooks(#515362)




More information about the fedora-extras-commits mailing list