Run hooks in sorted order (Closes: #745839).
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Fri, 25 Apr 2014 16:08:20 +0000 (17:08 +0100)
committerDaniel Baumann <mail@daniel-baumann.ch>
Sat, 26 Apr 2014 06:05:32 +0000 (08:05 +0200)
glob.glob() returns files in filesystem order, which is unpredictable
on many modern filesystems.

components/binary-hooks
components/bootstrap-hooks
components/chroot-hooks
components/source-hooks

index 3e9cf07..d7bb4d7 100755 (executable)
@@ -80,7 +80,7 @@ def main():
 
        hooks = glob.glob('config/hooks/*.hook') + glob.glob('config/hooks/*.hook.binary')
 
-       for hook in hooks:
+       for hook in sorted(hooks):
                if verbose:
                        print('I: Copying config/hooks/*.hook.binary to binary/live-build')
 
index e27f1ad..9eaa5ea 100755 (executable)
@@ -80,7 +80,7 @@ def main():
 
        hooks = glob.glob('config/hooks/*.hook') + glob.glob('config/hooks/*.hook.bootstrap')
 
-       for hook in hooks:
+       for hook in sorted(hooks):
                if verbose:
                        print('I: Copying config/hooks/*.hook.bootstrap to chroot/live-build')
 
index ab7bb25..a7a2481 100755 (executable)
@@ -80,7 +80,7 @@ def main():
 
        hooks = glob.glob('config/hooks/*.hook') + glob.glob('config/hooks/*.hook.chroot')
 
-       for hook in hooks:
+       for hook in sorted(hooks):
                if verbose:
                        print('I: Copying config/hooks/*.hook.chroot to chroot/live-build')
 
index 32be58b..672b53f 100755 (executable)
@@ -80,7 +80,7 @@ def main():
 
        hooks = glob.glob('config/hooks/*.hook') + glob.glob('config/hooks/*.hook.source')
 
-       for hook in hooks:
+       for hook in sorted(hooks):
                if verbose:
                        print('I: Copying config/hooks/*.hook.source to source/live-build')