Skip to content

Commit

Permalink
Explicitly create group nodes instead of automatically creating them …
Browse files Browse the repository at this point in the history
…as needed (#565)

Group nodes will soon contain metadata, so we can't just create/delete them when it's convenient.
Also fixes a bug where empty groups get dropped when building a package from another package node.
  • Loading branch information
dimaryaz authored Apr 20, 2018
1 parent 22987b9 commit ac26632
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions compiler/quilt/tools/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ def _build_node(build_dir, package, node_path, node, checks_contents=None,
Child transform or kwargs override ancestor k:v pairs.
"""
if _is_internal_node(node):
if not dry_run:
package.save_group(node_path)

# Make a consumable copy. This is to cover a quirk introduced by accepting nodes named
# like RESERVED keys -- if a RESERVED key is actually matched, it should be removed from
# the node, or it gets treated like a subnode (or like a node with invalid content)
Expand Down
1 change: 1 addition & 0 deletions compiler/quilt/tools/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ def build_from_node(package, node):

def _process_node(node, path=[]):
if isinstance(node, nodes.GroupNode):
package_obj.save_group(path)
for key, child in node._items():
_process_node(child, path + [key])
elif isinstance(node, nodes.DataNode):
Expand Down
2 changes: 1 addition & 1 deletion compiler/quilt/tools/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ def _add_to_contents(self, node_path, hashes, ext, source_path, target):

ptr = contents
for node in node_path[:-1]:
ptr = ptr.children.setdefault(node, GroupNode(dict()))
ptr = ptr.children[node]

metadata = dict(
q_ext=ext,
Expand Down

0 comments on commit ac26632

Please sign in to comment.