[packages/gitlab-ce] use find lang to package locales
glen
glen at pld-linux.org
Sat Nov 11 16:26:02 CET 2017
commit ebc6ea09f503c161e773db4dd51b7be7689bdb3a
Author: Elan Ruusamäe <glen at pld-linux.org>
Date: Tue Nov 7 09:23:46 2017 +0200
use find lang to package locales
clean-vendor.sh | 1 +
find-lang.sh | 34 ++++++++++++++++++++++++++++++++++
gitlab-ce.spec | 9 +++++++--
3 files changed, 42 insertions(+), 2 deletions(-)
---
diff --git a/gitlab-ce.spec b/gitlab-ce.spec
index bc5068f..ddcf1c4 100644
--- a/gitlab-ce.spec
+++ b/gitlab-ce.spec
@@ -21,7 +21,7 @@
Summary: A Web interface to create projects and repositories, manage access and do code reviews
Name: gitlab-ce
Version: 10.1.1
-Release: 0.104
+Release: 0.105
License: MIT
Group: Applications/WWW
# md5 deliberately omitted until this package is useful
@@ -40,6 +40,7 @@ Source11: gitlab-ctl.sh
Source12: clean-vendor.sh
Source13: nginx.conf
Source14: gitconfig
+Source15: find-lang.sh
Patch1: pld.patch
URL: https://www.gitlab.com/gitlab-ce/
BuildRequires: cmake
@@ -72,6 +73,8 @@ Suggests: redis-server
Obsoletes: gitlab <= 8.1.4
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+%define find_lang sh %{SOURCE15} %{buildroot}
+
%define _noautoreqfiles redcloth_scan.jar primitives.jar
%define uname git
@@ -191,6 +194,8 @@ cp -a$l . $RPM_BUILD_ROOT%{appdir}
# cleanup unneccessary cruft (gem build files, etc)
sh -x %{SOURCE12} $RPM_BUILD_ROOT%{appdir}
+%find_lang %{name}.lang
+
# rpm cruft from repackaging
rm -f $RPM_BUILD_ROOT%{appdir}/debug*.list
@@ -298,7 +303,7 @@ fi
%triggerun -- apache < 2.2.0, apache-base
%webapp_unregister httpd %{_webapp}
-%files
+%files -f %{name}.lang
%defattr(644,root,root,755)
%doc LICENSE
%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/gitlab/database.yml
diff --git a/clean-vendor.sh b/clean-vendor.sh
index f1cd3d1..092d40b 100755
--- a/clean-vendor.sh
+++ b/clean-vendor.sh
@@ -115,6 +115,7 @@ clean_log() {
clean_locale() {
cd $root
+ rm locale/gitlab.pot
rm locale/*/gitlab.po.time_stamp
}
diff --git a/find-lang.sh b/find-lang.sh
new file mode 100755
index 0000000..824d1d3
--- /dev/null
+++ b/find-lang.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+PROG=${0##*/}
+if [ $# = 2 ]; then
+ # for using same syntax as rpm own find-lang
+ RPM_BUILD_ROOT=$1
+ shift
+fi
+dir=$RPM_BUILD_ROOT/usr/lib/gitlab/locale
+langfile=$1
+tmp=$(mktemp) || exit 1
+rc=0
+
+find $dir -name '*.po' > $tmp
+
+echo '%defattr(644,root,root,755)' > $langfile
+while read file; do
+ lang=${file##*/}
+ lang=${lang%.po}
+ case "$lang" in
+ *-*)
+ echo >&2 "ERROR: Need mapping for $lang!"
+ rc=1
+ ;;
+ esac
+ echo "%lang($lang) ${file#$RPM_BUILD_ROOT}" >> $langfile
+done < $tmp
+
+if [ "$(grep -Ev '(^%defattr|^$)' $langfile | wc -l)" -le 0 ]; then
+ echo >&2 "$PROG: Error: international files not found!"
+ rc=1
+fi
+
+rm -f $tmp
+exit $rc
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/gitlab-ce.git/commitdiff/c4fb95eb8b3c5bf51c349d62f48521ccaff20788
More information about the pld-cvs-commit
mailing list