[Rpm-maint] The proper way to bootstrap rpm plugin data

Reshetova, Elena elena.reshetova at intel.com
Fri Jul 26 06:33:02 UTC 2013

Hi Panu, 


After a  while break I am back with new problems J with regards to the
plugins. The use case now is like this: 


Security plugin has a policy file (generalizing to any plugin, some
configuration file), which is complex enough that can be created/hardcoded
in plugin itself (even in some default values).

This file might come with the plugin or from some special package (plugin
configuration package): reason to keep it a separate package in our case is
that policy can be very different and it is easier to manage it separately
from the actual plugin.

Currently plugin has hardcoded path to where find the policy when it starts
(it checks in the INIT hook) and if policy is missing, it stops the
installation because it is meaningless to proceed without it. 

I never liked the hardcoded policy path at the first place, but now it bring
even bigger problem when you run rpm with "--root" option on the clean dir.
Rpm itself would recover from this quite nicely by creating a clean rpmdb
and proceeding fine, but plugin obviously runs into troubles. 


Solving this would seem to have two parts from my understanding: 


-          Plugin able to detect when we are in this specific state (run
with -root option, database needs to be created)

-          Plugin able to obtain the correct path of policy file outside of
-root and then nicely set it (I suppose by simply copying to the -root dir).
And here I would like to be able not to hardcode any path, but have it
configurable (that there is a possibility to use other policy that main
policy outside of the -root with hardcoded path)


For the first part, I guess the most correct solution like many people
advised is to add a new hook inside rpmtsInitDB() that would indicate to a
plugin the moment it needs to do smth about its policy file. 

Do you see any problems if we add such hook? The place can be just after we
initialized rpm db itself after this line:  rc = rpmdbInit(ts->rootDir,


One thing that I can see if that this new hook would be called after plugin
INIT hook and in the INIT hook I can't longer simply check that my policy is
missing and abort, I have to still return ok and then maybe hoping that it
is the initDB hook that would be called and create missing policy. And if it
doesn't, then I have to keep checking for missing policy and do its
initialization in pre_tsm hook for example. So, kind of not that clean
anymore compare to having it all in one INIT hook. 


The second part is more troublesome. What do you think should be a proper
way of passing the info to a plugin about where its policy file is? Should
it be done via macro configuration?


Best Regards,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20130726/977f77bf/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 7220 bytes
Desc: not available
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20130726/977f77bf/attachment-0001.p7s>

More information about the Rpm-maint mailing list