From 0c30cba6cfa94bacd70fb8b94225cd5063df29d8 Mon Sep 17 00:00:00 2001 From: Junghyun Kim Date: Mon, 29 Aug 2016 19:46:59 +0900 Subject: [PATCH] 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 --- tools/kickstarter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/kickstarter b/tools/kickstarter index 7acc485..2739c78 100755 --- a/tools/kickstarter +++ b/tools/kickstarter @@ -69,7 +69,7 @@ def create_xml(image_meta, external_configs=[]): if image_meta.has_key('ExternalConfigs') and image_meta['ExternalConfigs']: external = external + image_meta['ExternalConfigs'] for path in external: - for f in os.listdir(path): + for f in sorted(os.listdir(path)): if f.endswith('.yaml'): local = yamlload_safe('%s/%s' %(path, f)) conf = ks.parse(local) -- 2.7.4