Blob Blame History Raw
From e4b5443604b603a9ea0c17a831a08eba6a3eb463 Mon Sep 17 00:00:00 2001
From: Alexander Bokovoy <abokovoy@redhat.com>
Date: Fri, 27 Mar 2020 19:33:11 +0200
Subject: [PATCH] Use GIT_VERSION instead of GIT_BRANCH for reseting
 translations

We shouldn't try to reset translations if building a release tarball,
otherwise msgattrib is confused by a resulted .po file and fails with a
fatal error, preventing build process.

The issue is not easily reproducible, so far I have encountered it on
i686 on Fedora 32 mock environment and on x86_64 on Fedora 31 mock
environment while submitting builds to Fedora. It is reproduced once in
a scratch build and once in a real build with now exact reason.

Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
---
 freeipa.spec.in     | 1 +
 po/Makefile.hack.in | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/freeipa.spec.in b/freeipa.spec.in
index 7beed1ebc..53e17b1fa 100755
--- a/freeipa.spec.in
+++ b/freeipa.spec.in
@@ -155,6 +155,7 @@ URL:            http://www.freeipa.org/
 Source0:        freeipa-%{version}.tar.gz
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
+BuildRequires:  git-core
 BuildRequires:  openldap-devel
 # For KDB DAL version, make explicit dependency so that increase of version
 # will cause the build to fail due to unsatisfied dependencies.
diff --git a/po/Makefile.hack.in b/po/Makefile.hack.in
index 08aad6c28..1096daa25 100644
--- a/po/Makefile.hack.in
+++ b/po/Makefile.hack.in
@@ -7,7 +7,7 @@ DISTFILES.common.extra3 = Makefile.hack.in
 IPA_TEST_I18N = @top_srcdir@/ipatests/i18n.py
 MSGATTRIB = @MSGATTRIB@
 PYTHON = @PYTHON@
-GIT_BRANCH = @GIT_BRANCH@
+GIT_VERSION = @GIT_VERSION@
 
 .PHONY: strip-po
 strip-po:
@@ -16,7 +16,7 @@ strip-po:
 	for po_file in $(POFILES); do \
 		$(MSGATTRIB) --translated --no-fuzzy --no-location -s $$po_file > $$po_file.tmp || exit 1; \
 		mv $$po_file.tmp $$po_file || exit 1; \
-		if [ "$(GIT_BRANCH)" != "" ]; then \
+		if [ "$(GIT_VERSION)" != "" ]; then \
 			export GIT_DIFF_PO_FILE=`git diff --numstat $$po_file | cut -f1,2 | tr '\t' ,` || :; \
 			if [ "$$GIT_DIFF_PO_FILE" = "2,2" -o "$$GIT_DIFF_PO_FILE" = "1,1" ]; then \
 				echo "No translation changes in $$po_file, restore the original"; \
@@ -24,7 +24,7 @@ strip-po:
 			fi; \
 		fi; \
 	done
-	if [ "$(GIT_BRANCH)" != "" ]; then \
+	if [ "$(GIT_VERSION)" != "" ]; then \
 		export GIT_DIFF_IPA_POT=`git diff --numstat $(DOMAIN).pot | cut -f1,2 | tr '\t' ,` || :; \
 		if [ "$$GIT_DIFF_IPA_POT" = "2,2" -o "$$GIT_DIFF_IPA_POT" = "1,1" ]; then \
 			echo "No changes in $(DOMAIN).pot, restore the original"; \
-- 
2.25.1