File 0001-Use-sort-on-finds-to-improve-deterministic-build.patch of Package libreoffice.12309

From b264e2f18c08ad9184ff8fa005c090ba2b4f8038 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= <tchvatal@suse.com>
Date: Thu, 4 Apr 2019 13:33:26 +0200
Subject: [PATCH] Use sort on finds to improve deterministic build

This should sort out all outputs prior processing them further resulting
in equal output among multiple builds.

Change-Id: Iaf24bbb94eb7b8960177bcf2c3e08d31d2fb7210
---
 postprocess/CustomTarget_images.mk   | 4 ++--
 postprocess/CustomTarget_registry.mk | 2 ++
 solenv/gbuild/GeneratedPackage.mk    | 2 +-
 solenv/gbuild/Module.mk              | 2 +-
 4 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/postprocess/CustomTarget_images.mk b/postprocess/CustomTarget_images.mk
index 5ad55799e1e1..f1e32f0b28ff 100644
--- a/postprocess/CustomTarget_images.mk
+++ b/postprocess/CustomTarget_images.mk
@@ -96,9 +96,9 @@ $(packimages_DIR)/commandimagelist.ilst :
 	$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),PRL,1)
 	$(call gb_Helper_abbreviate_dirs, \
 		$(FIND) $(SRCDIR)/icon-themes -name "*.png" -o -name "*.svg" | \
-			grep -e '/cmd/' | sed 's#^.*/icon-themes/[^/]*##' | $(SORT) | uniq | \
+			grep -e '/cmd/' | sed 's#^.*/icon-themes/[^/]*##' | \
 			sed "s#^#%MODULE%#" | \
-			LC_ALL=C $(SORT) > $@.tmp && \
+			LC_ALL=C $(SORT) -u > $@.tmp && \
 		$(call gb_Helper_replace_if_different_and_touch,$@.tmp,$@))
 
 $(packimages_DIR)/sorted.lst : \
diff --git a/postprocess/CustomTarget_registry.mk b/postprocess/CustomTarget_registry.mk
index e84c35eec7e5..a2560f2e2d74 100644
--- a/postprocess/CustomTarget_registry.mk
+++ b/postprocess/CustomTarget_registry.mk
@@ -597,6 +597,7 @@ $(call gb_CustomTarget_get_workdir,postprocess/registry)/fcfg_langpack_%.list :
 	$(call gb_Helper_abbreviate_dirs,\
 	    $(FIND) $(call gb_XcuResTarget_get_target,fcfg_langpack/$*/) \
 	         -name *.xcu -size +0c \
+		| LC_ALL=C $(SORT) \
 	        | $(gb_AWK) 'BEGIN{print "<list>"} \
 	                    {print "<filename>"$$0"</filename>"} \
 	               END  {print "</list>"}' > $@ \
@@ -612,6 +613,7 @@ $(call gb_CustomTarget_get_workdir,postprocess/registry)/registry_%.list :
 	         $(if $(filter TRUE,$(ENABLE_ONLINE_UPDATE)),\
 	             $(call gb_XcuResTarget_get_target,updchk/$*/))\
 	         -name *.xcu \
+		| LC_ALL=C $(SORT) \
 	        | $(gb_AWK) 'BEGIN{print "<list>"} \
 	                    {print "<filename>"$$0"</filename>"} \
 	               END  {print "</list>"}' > $@ \
diff --git a/solenv/gbuild/GeneratedPackage.mk b/solenv/gbuild/GeneratedPackage.mk
index 25af209b857e..05bbcf43a93e 100644
--- a/solenv/gbuild/GeneratedPackage.mk
+++ b/solenv/gbuild/GeneratedPackage.mk
@@ -42,7 +42,7 @@ $(call gb_GeneratedPackage_get_target,%) :
 		$(foreach pair,$(PACKAGE_DIRS),&& cp -R $(PACKAGE_SOURCEDIR)/$(call gb_GeneratedPackage__get_srcdir,$(pair)) $(call gb_GeneratedPackage__get_destdir,$(pair))) \
 	)
 	$(call gb_Helper_abbreviate_dirs,\
-		$(FIND) $(foreach pair,$(PACKAGE_DIRS),$(call gb_GeneratedPackage__get_destdir,$(pair))) \( -type f -o -type l \) -print > $@ \
+		$(FIND) $(foreach pair,$(PACKAGE_DIRS),$(call gb_GeneratedPackage__get_destdir,$(pair))) \( -type f -o -type l \) -print | LC_ALL=C $(SORT) > $@ \
 	)
 
 .PHONY : $(call gb_GeneratedPackage_get_clean_target,%)
diff --git a/solenv/gbuild/Module.mk b/solenv/gbuild/Module.mk
index 8b74a425bb2e..52798fd40731 100644
--- a/solenv/gbuild/Module.mk
+++ b/solenv/gbuild/Module.mk
@@ -235,7 +235,7 @@ $(WORKDIR)/pot.done : $(foreach exec,cfgex helpex localize propex ulfex xrmex tr
 	$(call gb_Output_announce,$(subst .pot,,$(subst $(WORKDIR)/,,$@)),$(true),POT,1)
 	$(call gb_Helper_abbreviate_dirs,\
 		mkdir -p $(dir $@) && $(call gb_Helper_execute,localize) $(SRCDIR) $(dir $@)/pot \
-		&& $(FIND) $(dir $@)/pot -type f -printf "%P\n" | sed -e "s/\.pot/.po/" > $(dir $@)/LIST \
+		&& $(FIND) $(dir $@)/pot -type f -printf "%P\n" | sed -e "s/\.pot/.po/" | LC_ALL=C $(SORT) > $(dir $@)/LIST \
 		&& touch $@)
 
 # enable if: no "-MODULE/" defined AND ["all" defined OR "MODULE/" defined]
-- 
2.21.0

openSUSE Build Service is sponsored by