Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: Ability to manipulate mtrees #191

Open
thesayyn opened this issue Oct 20, 2023 · 5 comments
Open

FR: Ability to manipulate mtrees #191

thesayyn opened this issue Oct 20, 2023 · 5 comments

Comments

@thesayyn
Copy link
Contributor

Hey @vbatts, thank you for the great tool for the great mtree format.

I am a maintainer of the bsdtar toolchain for bazel in https://github.com/aspect-build/bazel-lib/blob/main/docs/tar.md. We are in a need of a commandline tool that understands mtree and can transform them.

Would you be warm to the idea of having a subcommand gomtree that can perform general tasks like path rewriting, hierarchy flattening etc?

We'd like to contribute this feature.

@vbatts
Copy link
Owner

vbatts commented Oct 20, 2023

hey @thesayyn!
Neat idea. I've expected the gomtree tool would eventually depart from the pure cli alignment with the classic BSD mtree experience. Very likely through different sub-commands, so, I am definitely warm to the idea.

I would like to hear more of your expectations or requirements.

One of the behaviours I've mulled on, which sounds similar, would be to union more than one mtree hierarchy (i.e. generating a hierarchy per layer on a container image, and then produce a single hierarchy of what the resulting filesystem ought to appear as). Might this be what you're calling hierarchy flattening?

@thesayyn
Copy link
Contributor Author

thesayyn commented Oct 20, 2023

Great to hear!!!!

What I mean by flattening is that given this mtree,

./lib type=dir
./lib/dir type=dir
./lib/dir/file.txt type=file

I was imagining we could implement something like gomtree apply --strip-prefix ./lib/dir/ would make this mtree become

./file.txt type=file

There are multiple variants of manipulations like this I want but can't think of all of them yet! It would even better to implement a generic solution using some combination of https://github.com/google/cel-go with something else to implement a generic manipulation command.

@thesayyn
Copy link
Contributor Author

Maybe I could make a draft PR just to see what it might look like.

@vbatts
Copy link
Owner

vbatts commented Oct 20, 2023

that would be welcome. Since it would be a first for this cli, it would seem easy to either over or under design that experience. Better to just iterate on it.

@thesayyn
Copy link
Contributor Author

Awesome. I just made a prefactor PR that prepares the cli surface for subcommands.
#192

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants