Use a sorted list of files in kickstarter to avoid unnecessary rebuilds. 82/85882/1 accepted/tizen/common/20160901.143249 submit/tizen/20160831.230944
authorJunghyun Kim <jh0822.kim@samsung.com>
Mon, 29 Aug 2016 10:46:59 +0000 (19:46 +0900)
committerJunghyun Kim <jh0822.kim@samsung.com>
Mon, 29 Aug 2016 10:46:59 +0000 (19:46 +0900)
commit0c30cba6cfa94bacd70fb8b94225cd5063df29d8
tree1c4efd7c09ddc37944011f2ff557a01c5828e15c
parente9403a6c80ccafe3066558fbbac73e8b64d03278
Use a sorted list of files in kickstarter to avoid unnecessary rebuilds.

- 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 kickstarter.
tools/kickstarter uses os.listdir() which returns an unordered list of files.

- SOLUTION
Use sorted(os.listdir()).
We can obtain a sorted list of files when using sorted().

Change-Id: I9047ca08f748a938557ced46e350c24c378d439d
Signed-off-by: Junghyun Kim <jh0822.kim@samsung.com>
tools/kickstarter