diff options
Diffstat (limited to 'bitbake/lib/bb/cache.py')
-rw-r--r-- | bitbake/lib/bb/cache.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py index ee924b2d2b..8db4e47674 100644 --- a/bitbake/lib/bb/cache.py +++ b/bitbake/lib/bb/cache.py | |||
@@ -873,6 +873,10 @@ class MultiProcessCache(object): | |||
873 | if not self.cachefile: | 873 | if not self.cachefile: |
874 | return | 874 | return |
875 | 875 | ||
876 | have_data = any(self.cachedata_extras) | ||
877 | if not have_data: | ||
878 | return | ||
879 | |||
876 | glf = bb.utils.lockfile(self.cachefile + ".lock", shared=True) | 880 | glf = bb.utils.lockfile(self.cachefile + ".lock", shared=True) |
877 | 881 | ||
878 | i = os.getpid() | 882 | i = os.getpid() |
@@ -907,6 +911,8 @@ class MultiProcessCache(object): | |||
907 | 911 | ||
908 | data = self.cachedata | 912 | data = self.cachedata |
909 | 913 | ||
914 | have_data = False | ||
915 | |||
910 | for f in [y for y in os.listdir(os.path.dirname(self.cachefile)) if y.startswith(os.path.basename(self.cachefile) + '-')]: | 916 | for f in [y for y in os.listdir(os.path.dirname(self.cachefile)) if y.startswith(os.path.basename(self.cachefile) + '-')]: |
911 | f = os.path.join(os.path.dirname(self.cachefile), f) | 917 | f = os.path.join(os.path.dirname(self.cachefile), f) |
912 | try: | 918 | try: |
@@ -921,12 +927,14 @@ class MultiProcessCache(object): | |||
921 | os.unlink(f) | 927 | os.unlink(f) |
922 | continue | 928 | continue |
923 | 929 | ||
930 | have_data = True | ||
924 | self.merge_data(extradata, data) | 931 | self.merge_data(extradata, data) |
925 | os.unlink(f) | 932 | os.unlink(f) |
926 | 933 | ||
927 | with open(self.cachefile, "wb") as f: | 934 | if have_data: |
928 | p = pickle.Pickler(f, -1) | 935 | with open(self.cachefile, "wb") as f: |
929 | p.dump([data, self.__class__.CACHE_VERSION]) | 936 | p = pickle.Pickler(f, -1) |
937 | p.dump([data, self.__class__.CACHE_VERSION]) | ||
930 | 938 | ||
931 | bb.utils.unlockfile(glf) | 939 | bb.utils.unlockfile(glf) |
932 | 940 | ||