Replies: 7 comments 16 replies
-
Related to this: we now have My concerns (and related) wrt packager/distro control over packaging still stand, that sort of interaction and plan for compatibility needs to be in the design I think. |
Beta Was this translation helpful? Give feedback.
-
One use-case is also to add new Requires/Provides/... to subpackages or the main package during build, sometimes that's not (easily) possible with dependency generators. |
Beta Was this translation helpful? Give feedback.
-
I recommend not actually generating spec file fragments, but rather using a Lua API. Generating text is convenient, but it is also very fragile and tends to break at unexpected times. Instead, a better approach would be to use Lua to modify the in-memory representation of the spec file, and provide an option to RPM to dump the spec file for debugging. |
Beta Was this translation helpful? Give feedback.
-
I think one issue which is kinda related to the compatibility concerns but are actually a different thing is discoverability. This feature is very implicit. Yes, it prints the files it reads and error reporting on parsing should point to the right place but these are all build time things. Right now the generated files are deleted together with the rest of the build. Yes, one can inspect them on error but the mainly remain invisible. The code producing them will often be centralized and also be invisible or at least out of sight. This is not by accident but the main benefit of the feature.
Not sure if I am really a fan of adding something to the srpm - it seems kinda odd to me. Otoh it is in line with what we do with dynamic build requires. May be someone has an even better idea. Mark the binary packages with the spec part they come from? |
Beta Was this translation helpful? Give feedback.
-
Ok, with #2047 we now have a place where the (parsed) content of the spec including these dynamic parts get stored. Guess printing the unparsed content out during build should make this visible enough for packagers. I'll add a patch that does that. |
Beta Was this translation helpful? Give feedback.
-
OK, #1485 is finally merged. This is the minimally useful step. I'll resubmit the patch to Still the current state is limited to complete sub packages and can't really interact with the content of the spec file. So we need to look at other - more complicated - use cases and come up with the next features needed. |
Beta Was this translation helpful? Give feedback.
-
The first version of the Feedback welcome! |
Beta Was this translation helpful? Give feedback.
-
Dynamic Specs File Generation
This gives a more detailed background to #1485 and which tries to address #329
Issues with static specs
Rpmbuild parses the spec file completely before starting the building process. This is of course necessary to know what to actually do as many important details are in there like the list of sources and patches and the build scripts. This has the disadvantage that information only discovered during the build can't be part of the spec file. So while there is a %include macro it can't be used on build artifacts as it also needs to be expanded at parse time.
To get around this limitations several pieces are expanded later on - after the build scripts have been run. But all of these are special mechanisms with limited scope. These include:
Everything not covered by these mechanisms needs to be statically declared in the spec file itself and though cannot be derived from the sources or the build process. Main issue here are sub packages which cannot be created after the initial parsing of the spec file. There are a few other issues like generating dependencies that are not bound to installed files but e.g. to manifest files in the sources for interpreted languages.
Other approaches
There are different possible ways to work around this limitation. A more powerful implementation may allow accessing and altering previously declared sub packages. There may be different rounds of declaring sub packages, process their file lists and then alter the packages - triggering pre-processing of the files and generated dependencies.
While this amount of power - that would allow reformatting unaware packages - is tempting it requires a lot of new APIs and forces the
code doing all this dynamic processing to be very intimately linked to these RPM APIs.
In the real world it is expected that most use cases are more simple and just generating sub package definitions will be
sufficient. Instead of altering previously declared packages these can be removed from the static spec file and also generated
dynamically. This shrinks the required feature set to be able to generate sub packages after the build scripts and feed them into the
regular file processing and package assembling mechanism as normal packages. This can even be achieved by parsing spec file sections using the normal spec parser.
Minimal viable Product
Between %install and %check read and parse *.specpart files generated by the build scripts and put in the buildSubdir. The files are read in alphabetical for consistent results.
This has multiple benefits:
Without additional feature this approach comes with a few limitations, though:
But it seems like these can be addressed as a second or third step. Some use cases - like language sub packages - can already be
implemented with this simple version.
Use cases
Post scriptum
We are not looking at the build scripts themselves here. As they are executable they are less in need of dynamic features. There is a line of injury on how to automate the build process. But this is not it.
Beta Was this translation helpful? Give feedback.
All reactions