Currently, mtree_mutate wouldn't add new directories specified by package_dir, as it only appends it to existing lines.
However, if, e.g., package_dir is /opt/app, there will be no entries for opt or opt/app. As a result, in some cases, e.g., if the tar archive is used for a DEB package, the package installation would fail with an error like this:
error creating directory 'opt/app/app_data': No such file or directory
This is different from the behavior of pkg_tar from rules_pkg.
Describe the feature
I suggest to add an add_package_dirs option to mtree_mutate, which would add lines such as
What is the current behavior?
Currently,
mtree_mutate
wouldn't add new directories specified bypackage_dir
, as it only appends it to existing lines.However, if, e.g.,
package_dir
is/opt/app
, there will be no entries foropt
oropt/app
. As a result, in some cases, e.g., if the tar archive is used for a DEB package, the package installation would fail with an error like this:This is different from the behavior of
pkg_tar
fromrules_pkg
.Describe the feature
I suggest to add an
add_package_dirs
option tomtree_mutate
, which would add lines such asto the beginning of the mtree, using custom
mtree
,owner
, andownername
if specified.I can make a PR if there are no objections.