travitch / build-bom

Dynamically discover the commands used to create a piece of software
Apache License 2.0
45 stars 8 forks source link

Use abstraction to handle chained subprocess operations. #48

Closed kquick closed 4 months ago

kquick commented 1 year ago

The build-bom functionality largely consists of issuing a sequence of commands as sub-processes at key points in the processing. When running the sequence of operations, the output of one operation is usually the input of the subsequent operation; sometimes temporary files are needed for these interspersed outputs.

This extracts the functionality of managing subprocess execution, temporary file creation, and input-to-output chaining into the chainops module. This simplifies the mainline code and should facilitate future modifications of the chained sequence of operations.

There are some small changes in the locations that various files are generated in; it is possible that this might need adjustment in the future to address the impact of these changes, but at present all tests pass and all functionality appears to be operating as desired.

This PR is an internal refactoring, so feel free to request changes or even reject it if you do not think it is the right approach; I'm working on some changes that will add more operations to the chains, and this will make it easier for me to do so, but it's certainly not required to effect those changes.

travitch commented 1 year ago

Interesting - thanks. Reading through. This is something that I wanted to address so yeah lets definitely work through it.

kquick commented 1 year ago

I think I've made all the appropriate changes. There are some places in the code I could change x::from(v) to v.into(), but I'm not sure it makes a difference?

Please take a look again, @travitch .