Use a sorted list of files in Makefile to avoid unnecessary rebuilds. 12/85112/1
authorJunghyun Kim <jh0822.kim@samsung.com>
Wed, 24 Aug 2016 00:45:36 +0000 (09:45 +0900)
committerJunghyun Kim <jh0822.kim@samsung.com>
Wed, 24 Aug 2016 00:49:36 +0000 (09:49 +0900)
- PROBLEM
We use OBS to build packages in Tizen.
There is a mechanism not to rebuild when the result binary is the same.
For example, there is a dependency graph: A->B->C.
If A is modified, B would be built.
If the result RPM of B is not changed, OBS does not trigger a build of C.
To effectively use this mechanism, each packages make sure that
the result binary should be the same if the input source is the same.

There is a reason we found is that the file list given by
python(os.walk(), os.listdir()), widely used executable(find),
and system call(readdir()) is unordered.
In this case, different OBS workers can make different results
because of the file list in different order.

The same thing happens in vconf-internal-keys.
This package uses find in Makefile.
"find" returns an unordered list of files.

- SOLUTION
I suggest to sort this list of files using sort.
I tested this in my test OBS server, and I found that
the result RPMs are the same after this patch.

Change-Id: I0d7514663a601470edc07c9e3c84302bb79c33af
Signed-off-by: Junghyun Kim <jh0822.kim@samsung.com>
Makefile

index b793db5..1438e42 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -5,10 +5,10 @@
 #all:init allcmd postproc allhtml allheader vconf-internal-keys.h endproc
 all:init allcmd allhtml allheader vconf-internal-keys.h endproc
 
-allcmd: $(shell find . -name "*.xml" | sed 's/xml/sh/')
+allcmd: $(shell find . -name "*.xml" | sort | sed 's/xml/sh/')
 #allcmd2: $(shell find . -name "*.xml" | sed 's/xml/sh2/')
-allheader: $(shell find . -name "*.xml" | sed 's/xml/h/')
-allhtml: $(shell find . -name "*.xml" | sed 's/xml/html/')
+allheader: $(shell find . -name "*.xml" | sort | sed 's/xml/h/')
+allhtml: $(shell find . -name "*.xml" | sort | sed 's/xml/html/')
 #allwrapper: $(shell find . -name "*.xml" | sed 's/.xml/_wrapper.h/')
 #allwrapper_impl: $(shell find . -name "*.xml" | sed 's/.xml/_wrapper.c/')