019e173
From e4b5443604b603a9ea0c17a831a08eba6a3eb463 Mon Sep 17 00:00:00 2001
019e173
From: Alexander Bokovoy <abokovoy@redhat.com>
019e173
Date: Fri, 27 Mar 2020 19:33:11 +0200
019e173
Subject: [PATCH] Use GIT_VERSION instead of GIT_BRANCH for reseting
019e173
 translations
019e173
019e173
We shouldn't try to reset translations if building a release tarball,
019e173
otherwise msgattrib is confused by a resulted .po file and fails with a
019e173
fatal error, preventing build process.
019e173
019e173
The issue is not easily reproducible, so far I have encountered it on
019e173
i686 on Fedora 32 mock environment and on x86_64 on Fedora 31 mock
019e173
environment while submitting builds to Fedora. It is reproduced once in
019e173
a scratch build and once in a real build with now exact reason.
019e173
019e173
Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
019e173
---
019e173
 freeipa.spec.in     | 1 +
019e173
 po/Makefile.hack.in | 6 +++---
019e173
 2 files changed, 4 insertions(+), 3 deletions(-)
019e173
019e173
diff --git a/freeipa.spec.in b/freeipa.spec.in
019e173
index 7beed1ebc..53e17b1fa 100755
019e173
--- a/freeipa.spec.in
019e173
+++ b/freeipa.spec.in
019e173
@@ -155,6 +155,7 @@ URL:            http://www.freeipa.org/
019e173
 Source0:        freeipa-%{version}.tar.gz
019e173
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
019e173
 
019e173
+BuildRequires:  git-core
019e173
 BuildRequires:  openldap-devel
019e173
 # For KDB DAL version, make explicit dependency so that increase of version
019e173
 # will cause the build to fail due to unsatisfied dependencies.
019e173
diff --git a/po/Makefile.hack.in b/po/Makefile.hack.in
019e173
index 08aad6c28..1096daa25 100644
019e173
--- a/po/Makefile.hack.in
019e173
+++ b/po/Makefile.hack.in
019e173
@@ -7,7 +7,7 @@ DISTFILES.common.extra3 = Makefile.hack.in
019e173
 IPA_TEST_I18N = @top_srcdir@/ipatests/i18n.py
019e173
 MSGATTRIB = @MSGATTRIB@
019e173
 PYTHON = @PYTHON@
019e173
-GIT_BRANCH = @GIT_BRANCH@
019e173
+GIT_VERSION = @GIT_VERSION@
019e173
 
019e173
 .PHONY: strip-po
019e173
 strip-po:
019e173
@@ -16,7 +16,7 @@ strip-po:
019e173
 	for po_file in $(POFILES); do \
019e173
 		$(MSGATTRIB) --translated --no-fuzzy --no-location -s $$po_file > $$po_file.tmp || exit 1; \
019e173
 		mv $$po_file.tmp $$po_file || exit 1; \
019e173
-		if [ "$(GIT_BRANCH)" != "" ]; then \
019e173
+		if [ "$(GIT_VERSION)" != "" ]; then \
019e173
 			export GIT_DIFF_PO_FILE=`git diff --numstat $$po_file | cut -f1,2 | tr '\t' ,` || :; \
019e173
 			if [ "$$GIT_DIFF_PO_FILE" = "2,2" -o "$$GIT_DIFF_PO_FILE" = "1,1" ]; then \
019e173
 				echo "No translation changes in $$po_file, restore the original"; \
019e173
@@ -24,7 +24,7 @@ strip-po:
019e173
 			fi; \
019e173
 		fi; \
019e173
 	done
019e173
-	if [ "$(GIT_BRANCH)" != "" ]; then \
019e173
+	if [ "$(GIT_VERSION)" != "" ]; then \
019e173
 		export GIT_DIFF_IPA_POT=`git diff --numstat $(DOMAIN).pot | cut -f1,2 | tr '\t' ,` || :; \
019e173
 		if [ "$$GIT_DIFF_IPA_POT" = "2,2" -o "$$GIT_DIFF_IPA_POT" = "1,1" ]; then \
019e173
 			echo "No changes in $(DOMAIN).pot, restore the original"; \
019e173
-- 
019e173
2.25.1
019e173