in pkg/private/tar/build_tar.py [0:0]
def add_manifest_entry(self, entry_list, file_attributes):
entry = manifest.ManifestEntry(*entry_list)
# Use the pkg_tar mode/owner remaping as a fallback
non_abs_path = entry.dest.strip('/')
if file_attributes:
attrs = file_attributes(non_abs_path)
else:
attrs = {}
# But any attributes from the manifest have higher precedence
if entry.mode is not None and entry.mode != '':
attrs['mode'] = int(entry.mode, 8)
if entry.user:
if entry.group:
attrs['names'] = (entry.user, entry.group)
else:
# Use group that legacy tar process would assign
attrs['names'] = (entry.user, attrs.get('names')[1])
if entry.entry_type == manifest.ENTRY_IS_LINK:
self.add_link(entry.dest, entry.src, **attrs)
elif entry.entry_type == manifest.ENTRY_IS_DIR:
self.add_empty_dir(entry.dest, **attrs)
elif entry.entry_type == manifest.ENTRY_IS_TREE:
self.add_tree(entry.src, entry.dest, **attrs)
elif entry.entry_type == manifest.ENTRY_IS_EMPTY_FILE:
self.add_empty_file(entry.dest, **attrs)
else:
self.add_file(entry.src, entry.dest, **attrs)