... |
... |
@@ -80,6 +80,7 @@ from collections import Mapping, OrderedDict |
80
|
80
|
from contextlib import contextmanager
|
81
|
81
|
import tempfile
|
82
|
82
|
import shutil
|
|
83
|
+import functools
|
83
|
84
|
|
84
|
85
|
from . import _yaml
|
85
|
86
|
from ._variables import Variables
|
... |
... |
@@ -1137,21 +1138,33 @@ class Element(Plugin): |
1137
|
1138
|
self.__build_result = None
|
1138
|
1139
|
return
|
1139
|
1140
|
|
|
1141
|
+ def cmp_dep(a, b):
|
|
1142
|
+ sysroot_a, key_a = a
|
|
1143
|
+ sysroot_b, key_b = b
|
|
1144
|
+ if key_a is None:
|
|
1145
|
+ key_a = ''
|
|
1146
|
+ if key_b is None:
|
|
1147
|
+ key_b = ''
|
|
1148
|
+ if (sysroot_a, key_a) < (sysroot_b, key_b):
|
|
1149
|
+ return -1
|
|
1150
|
+ elif (sysroot_a, key_a) > (sysroot_b, key_b):
|
|
1151
|
+ return 1
|
|
1152
|
+ else:
|
|
1153
|
+ return 0
|
|
1154
|
+
|
1140
|
1155
|
if self.__weak_cache_key is None:
|
1141
|
1156
|
# Calculate weak cache key
|
1142
|
1157
|
# Weak cache key includes names of direct build dependencies
|
1143
|
1158
|
# but does not include keys of dependencies.
|
1144
|
1159
|
dependencies = []
|
1145
|
1160
|
if self.BST_STRICT_REBUILD:
|
1146
|
|
- for sysroot, e in self.dependencies(Scope.BUILD, with_sysroot=True):
|
1147
|
|
- dependencies = [(sysroot, e._get_cache_key(strength=_KeyStrength.WEAK))
|
1148
|
|
- for sysroot, e in self.dependencies(Scope.BUILD, with_sysroot=True)]
|
|
1161
|
+ dependencies = [(sysroot, e._get_cache_key(strength=_KeyStrength.WEAK))
|
|
1162
|
+ for sysroot, e in self.dependencies(Scope.BUILD, with_sysroot=True)]
|
1149
|
1163
|
else:
|
1150
|
|
- for sysroot, e in self.dependencies(Scope.BUILD, with_sysroot=True):
|
1151
|
|
- dependencies = [(sysroot, e.name)
|
1152
|
|
- for sysroot, e in self.dependencies(Scope.BUILD, with_sysroot=True)]
|
|
1164
|
+ dependencies = [(sysroot, e.name)
|
|
1165
|
+ for sysroot, e in self.dependencies(Scope.BUILD, with_sysroot=True)]
|
1153
|
1166
|
|
1154
|
|
- self.__weak_cache_key = self.__calculate_cache_key(sorted(dependencies))
|
|
1167
|
+ self.__weak_cache_key = self.__calculate_cache_key(sorted(dependencies, key=functools.cmp_to_key(cmp_dep)))
|
1155
|
1168
|
|
1156
|
1169
|
if self.__weak_cache_key is None:
|
1157
|
1170
|
# Weak cache key could not be calculated yet
|
... |
... |
@@ -1179,7 +1192,7 @@ class Element(Plugin): |
1179
|
1192
|
if self.__strict_cache_key is None:
|
1180
|
1193
|
dependencies = [(sysroot, e.__strict_cache_key)
|
1181
|
1194
|
for sysroot, e in self.dependencies(Scope.BUILD, with_sysroot=True)]
|
1182
|
|
- self.__strict_cache_key = self.__calculate_cache_key(sorted(dependencies))
|
|
1195
|
+ self.__strict_cache_key = self.__calculate_cache_key(sorted(dependencies, key=functools.cmp_to_key(cmp_dep)))
|
1183
|
1196
|
|
1184
|
1197
|
if self.__strict_cache_key is None:
|
1185
|
1198
|
# Strict cache key could not be calculated yet
|
... |
... |
@@ -1220,7 +1233,7 @@ class Element(Plugin): |
1220
|
1233
|
elif self.__assemble_scheduled or self.__assemble_done:
|
1221
|
1234
|
dependencies = [(sysroot, e._get_cache_key())
|
1222
|
1235
|
for sysroot, e in self.dependencies(Scope.BUILD, with_sysroot=True)]
|
1223
|
|
- self.__cache_key = self.__calculate_cache_key(sorted(dependencies))
|
|
1236
|
+ self.__cache_key = self.__calculate_cache_key(sorted(dependencies, key=functools.cmp_to_key(cmp_dep)))
|
1224
|
1237
|
|
1225
|
1238
|
if self.__cache_key is None:
|
1226
|
1239
|
# Strong cache key could not be calculated yet
|