packages: pootle/pootle.spec - %lang tagging via script

glen glen at pld-linux.org
Tue May 11 11:16:03 CEST 2010


Author: glen                         Date: Tue May 11 09:16:03 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- %lang tagging via script

---- Files affected:
packages/pootle:
   pootle.spec (1.5 -> 1.6) 

---- Diffs:

================================================================
Index: packages/pootle/pootle.spec
diff -u packages/pootle/pootle.spec:1.5 packages/pootle/pootle.spec:1.6
--- packages/pootle/pootle.spec:1.5	Tue May 11 10:26:04 2010
+++ packages/pootle/pootle.spec	Tue May 11 11:15:58 2010
@@ -7,7 +7,7 @@
 Summary:	Localization and translation management web application
 Name:		pootle
 Version:	2.0.3
-Release:	0.9
+Release:	0.11
 License:	GPL v2+
 Group:		Development/Tools
 URL:		http://translate.sourceforge.net/wiki/pootle/index
@@ -92,6 +92,44 @@
 	esac
 done
 
+> %{name}.lang
+# application language
+for a in $RPM_BUILD_ROOT%{_datadir}/pootle/mo/[a-z]*; do
+	# path file and lang
+	p=${a#$RPM_BUILD_ROOT} l=${a##*/}
+	echo "%lang($l) $p" >> %{name}.lang
+done
+
+# such recursive magic is because we need to have different permissions for
+# directories and files and we want to language tag both of them
+scan_mo() {
+	for obj in "$@"; do
+		# skip bad globs (happens when we recurse)
+		[ -e "$obj" ] || continue
+		# path file and lang
+		path=${obj#$RPM_BUILD_ROOT} lang=${MO_LANG:-${obj##*/}}
+
+		if [ -d $obj ]; then
+			attr='%dir %attr(770,root,http)'
+		else
+			attr='%attr(660,root,http)'
+		fi
+		case $lang in
+		templates)
+			echo "$attr $path" >> %{name}.lang
+			;;
+		*)
+			echo "%lang($lang) $attr $path" >> %{name}.lang
+			;;
+		esac
+		if [ -d $obj ]; then
+			MO_LANG=$lang scan_mo $obj/*
+			unset MO_LANG
+		fi
+	done
+}
+scan_mo $RPM_BUILD_ROOT%{_sharedstatedir}/pootle/po/{pootle,terminology}/* >> %{name}.lang
+
 # don't clobber user $PATH
 mv $RPM_BUILD_ROOT{%{_bindir},%{_sbindir}}/PootleServer
 install -p wsgi.py $RPM_BUILD_ROOT%{_datadir}/pootle
@@ -114,7 +152,7 @@
 %triggerun -- apache < 2.2.0, apache-base
 %webapp_unregister httpd %{_webapp}
 
-%files
+%files -f %{name}.lang
 %defattr(644,root,root,755)
 %doc ChangeLog README
 %dir %attr(750,root,http) %{_sysconfdir}
@@ -131,8 +169,6 @@
 %{_datadir}/pootle/html
 %{_datadir}/pootle/templates
 %dir %{_datadir}/pootle/mo
-# TODO: %lang
-%{_datadir}/pootle/mo/[a-z]*
 
 %{py_sitescriptdir}/pootle
 %{py_sitescriptdir}/pootle_app
@@ -149,38 +185,27 @@
 %dir %{_sharedstatedir}/pootle
 %dir %attr(770,root,http) %{_sharedstatedir}/pootle/dbs
 %dir %attr(770,root,http) %{_sharedstatedir}/pootle/po
-
 # setup a tempdir inside the PODIRECTORY heirarchy, this way we have
 # reasonable guarantee that temp files will be created on the same
 # filesystem as translation files (required for save operations).
 %dir %attr(770,root,http) %{_sharedstatedir}/pootle/po/.tmp
 
+# base translations from pootle itself
 %dir %attr(770,root,http) %{_sharedstatedir}/pootle/po/pootle
-%dir %attr(770,root,http) %{_sharedstatedir}/pootle/po/pootle/templates
-%attr(660,root,http) %{_sharedstatedir}/pootle/po/pootle/templates/pootle.pot
-
 %dir %attr(770,root,http) %{_sharedstatedir}/pootle/po/terminology
 %dir %attr(770,root,http) %{_sharedstatedir}/pootle/po/tutorial
 %dir %attr(770,root,http) %{_sharedstatedir}/pootle/po/tutorial/templates
 %attr(660,root,http) %{_sharedstatedir}/pootle/po/tutorial/templates/tutorial.pot
 
-# TODO %lang
-%dir %attr(770,root,http) %{_sharedstatedir}/pootle/po/pootle/[a-z][a-z]
-%dir %attr(770,root,http) %{_sharedstatedir}/pootle/po/pootle/[a-z][a-z][a-z]
-%dir %attr(770,root,http) %{_sharedstatedir}/pootle/po/pootle/*[@_]*
-
-%attr(660,root,http) %{_sharedstatedir}/pootle/po/pootle/*/*.po
-
-%dir %attr(770,root,http) %{_sharedstatedir}/pootle/po/terminology/*
-%dir %attr(770,root,http) %{_sharedstatedir}/pootle/po/terminology/*/gnome
-%attr(660,root,http) %{_sharedstatedir}/pootle/po/terminology/*/gnome/*.po
-
 %define date	%(echo `LC_ALL="C" date +"%a %b %d %Y"`)
 %changelog
 * %{date} PLD Team <feedback at pld-linux.org>
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.6  2010/05/11 09:15:58  glen
+- %lang tagging via script
+
 Revision 1.5  2010/05/11 08:26:04  glen
 - require mod_mime, otherwise firefox and chrome will not use css file due wrong content-type. sigh
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/pootle/pootle.spec?r1=1.5&r2=1.6&f=u



More information about the pld-cvs-commit mailing list