go-mtree icon indicating copy to clipboard operation
go-mtree copied to clipboard

feat: implement mutate command

Open thesayyn opened this issue 8 months ago • 11 comments

thesayyn avatar Oct 24 '23 16:10 thesayyn

@vbatts This is a pretty gross version of implementing the update command. Looking for feedback. I wish there was an API that would allow me to mutate the tree and understand the semantics of a mtree more.

thesayyn avatar Oct 24 '23 16:10 thesayyn

@vbatts I'm interested in getting this released so Bazel users have a strip_prefix feature, have any time to give some feedback on this one? 🙇🏻

alexeagle avatar Nov 01 '23 15:11 alexeagle

@vbatts This is a pretty gross version of implementing the update command. Looking for feedback. I wish there was an API that would allow me to mutate the tree and understand the semantics of a mtree more.

understood. I'm trying to understand if the output of the --strip-prefix is acting as expected. As a first feedback on the experience, perhaps if you would update this OP message to describe the expected behaviour. Additionally, in likeness to the validate command, can we default to output the mutated hierarchy to os.Stdout, and maybe add a flag to write to a file if provided? (it's a bit unexpected that it just in-place modifies the file provided.

vbatts avatar Nov 04 '23 19:11 vbatts

And I'm brainstorming about your comment on how to help understand the semantics of the mtree better.

vbatts avatar Nov 04 '23 19:11 vbatts

Ping! @thesayyn I think it's your turn here :)

alexeagle avatar Dec 12 '23 18:12 alexeagle

Sorry this slipped away.

thesayyn avatar Dec 12 '23 23:12 thesayyn

I think @thesayyn is too underwater to get back to this at any point. Also the maintainer of bazel's rules_pkg found a new spot at Google so it's not going away. That means the urgency here got lower.

I've tried to sell @rickvanprim on the idea of picking up the PR, but I know it's an obscure hobby project.

Maybe we should just close this and open an issue or discussion to suggest the feature without "licking the cookie" of attempting an implementation.

alexeagle avatar Mar 08 '24 00:03 alexeagle

ah sorry. things have been so busy on my side as well, else I would've taken this over

vbatts avatar Mar 08 '24 18:03 vbatts

Sahin suggested that maybe on the Bazel side we can just hook up a fixture to run hermetic awk interpreter, then write the mtree mutations in awk scripts

alexeagle avatar Mar 12 '24 04:03 alexeagle

doing things with awk sounds involved... looking again, and this branch builds fine locally, and all the checks pass with act. I'm not see a way to rerun the checks on GH. I may carry this to a new PR to check again.

vbatts avatar Mar 14 '24 17:03 vbatts

If you imagine an engineer is equally comfortable coding in AWK and Go, then I think the former is the more expressive language that's purpose-built for basic manipulation of lines in a file. The problem for us is simply that we want to be hermetic in Bazel, and don't already have a toolchain to get a specific release of awk we can rely on everywhere.

alexeagle avatar Mar 14 '24 17:03 alexeagle