If you are working with are larger stack of recipes and update them frequently, you'll inevitably reach the point where a recipe becomes obsolete.
Nothing in your stack will use it, so it basically is just a burden (and a potential hypothetical security risk).
I had this situation with the insane amount of npm packages I maintain for my meta-sca layer. Those change nearly on a daily basis, with new dependencies coming in and replacing old dependencies.
One could read all the change logs, but lets be honest, nobody does that but just for a small chosen few recipes - so the question remains...
How to I identify obsolete recipes?
Simple, by looking up all the dependencies of each recipe to another in a layer - kind of obvious isn't it :-).
Lucky me, I don't have to do that manually, we are programmers, we automate stuff - so I did:
the result can be found in my meta-buildutils layer - a small script called unused
the result can be found in my meta-buildutils layer - a small script called unused
this one can be used without setting up bitbake at all, it just works with the power of python.
What does it do?
It just scans all the recipes in a layer for their DEPENDS and RDEPENDS values and sets them into relation with each other - a recipe that doesn't have someone else depends on it can be considered obsolete and therefore can be removed
...but what about images and feature xyz?
you're absolutely right - some recipes - images for instance - usually have no one depend on them - they are the end of the line, the stuff we are actually looking for... but fear not, you can configure exceptions easily in the script, so in fact only the real obsolete ones will be identified
Automate that process
and as I said, I like to automate stuff so I introduced a per layer configuration file called .unusedignore (an example can be found here), in which one can define all the ignores of a layer as part of the code.
So after every recipe update attempt, the unused script in run and puts stuff into the bin, where it belongs.
And the charming thing is, that the script will automatically use this configuration file if found in the path - zero config, but 100% convenience...
So after every recipe update attempt, the unused script in run and puts stuff into the bin, where it belongs.
And the charming thing is, that the script will automatically use this configuration file if found in the path - zero config, but 100% convenience...
Happy cleaning and be sure to check the other pieces in meta-buildutils
Kommentare
Kommentar veröffentlichen