Skip to content

Commit

Permalink
input: do not merge identical steps with different sandboxes
Browse files Browse the repository at this point in the history
When the sandboxInvariant policy is enabled the sandbox is considered
an invariant of the build. Given an identical package that is
referenced with different sandboxes in the recipes we previously
treated them as fully identical packages. But this might have prevented
the user from selecting between the desired instance with a concrete
sandbox. Instead the user could experience that he chose a path that
should have used a particular sandbox but when building actually
another sandbox was used. While the *result* should be identical we
must still honor the users choice which sandbox to use.
  • Loading branch information
jkloetzke committed Jun 13, 2020
1 parent 26ef3fa commit 739096c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pym/bob/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,17 @@ def getResultId(self):
h.update(struct.pack("<I", len(args)))
for arg in args:
h.update(arg.getResultId())
# Include used sandbox in case sandboxInvariant policy is active.
# Prevents merging of identical packages that are defined under
# different sandboxes.
sandbox = self.corePackage.recipe.getRecipeSet().sandboxInvariant and \
self.getSandbox()
if sandbox:
h.update(sandbox.coreStep.variantId)
h.update(struct.pack("<I", len(sandbox.paths)))
for p in sandbox.paths:
h.update(struct.pack("<I", len(p)))
h.update(p.encode('utf8'))
# providedEnv
h.update(struct.pack("<I", len(self.providedEnv)))
for (key, val) in sorted(self.providedEnv.items()):
Expand Down

0 comments on commit 739096c

Please sign in to comment.