Commit 722bc55d authored by Jérome Perrin's avatar Jérome Perrin Committed by Xavier Thompson

[fixup] Ignore _profile_base_location_ when computing signatures

We want two identical sections at different URL to be able to produce
same signature. This feature is useful for slapos.recipe.cmmi's
shared parts.

This commit may fixup "Support ${:_profile_base_location_}." but is
purposefuly kept separate because it concerns parts signatures which
are an orthogonal feature.
parent 4a018546
...@@ -1680,9 +1680,16 @@ class Options(DictMixin): ...@@ -1680,9 +1680,16 @@ class Options(DictMixin):
self.buildout._parts.append(name) self.buildout._parts.append(name)
m = md5() m = md5()
# _profile_base_location_ is ignored in signatures, so that two sections
# at different URLs can have same signature
_profile_base_location_ = self.get('_profile_base_location_')
# access values through .get() instead of .items() to detect unused keys # access values through .get() instead of .items() to detect unused keys
for key in sorted(self.keys()): for key in sorted(self.keys()):
if key == '_profile_base_location_':
continue
value = self._data.get(key, self._cooked.get(key, self._raw.get(key))) value = self._data.get(key, self._cooked.get(key, self._raw.get(key)))
if _profile_base_location_:
value = value.replace(_profile_base_location_, '${:_profile_base_location_}')
m.update(('%r\0%r\0' % (key, value)).encode()) m.update(('%r\0%r\0' % (key, value)).encode())
self.items_signature = '%s:%s' % (name, m.hexdigest()) self.items_signature = '%s:%s' % (name, m.hexdigest())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment