#22 %pretrans guideline
Closed: Fixed None Opened 13 years ago by tibbs.

After seeing some discussion about %pretrans on IRC, I realize that some folks actually want to use it. Of course, any package with %pretrans cannot be used (for example) in the installer or as a build dependency in mock because there is simply nothing installed before the transaction is run. I suppose this is not sufficiently obvious and needs to be added to the guidelines.

I propose simply adding a line "Do not use %pretrans" possibly with some justification to the Scriptlets section. This may, however, be more of a FESCo decision; permitting %pretrans essentially creates a class of packages that can only be installed to a pre-existing system. I'm assuming that's a bad thing, but perhaps others don't feel that way.


Do we have a list of packages using pretrans? It might be helpful to see if they could be corrected.

It is a how to package question so I do think that it's up to us to decide.

Honestly I don't know if we've any packages that use %pretrans currently; it's not currently

It might be that there's a way to use %pretrans safely, though I'm unsure of how since as I understand it you can't even spawn a shell to run the script. Maybe it could use lua or something. Probably easier to say no.

From Panu (hicham seemed to be asking about it for doing symlink/dir. conversions):

{{{
<Panu> there are no magic bits and pieces when the %pretrans runs: it always runs on installation (but not erase)
<Panu> the biggest quirk with %pretrans is that one needs to use -p <lua> scripts for it to work at all in initial installation
}}}

...also running:

rpm -qp *.rpm --scripts | fgrep lua

...produces no output in F-13 or F-14.

Bah, the fgrep was for pretrans, not lua. Wrong paste.

Simple proposal - add a new section to the end of http://fedoraproject.org/wiki/Packaging:Guidelines#Scriptlets:

The %pretrans scriptlet

Note that the %pretrans scriptlet will, in the particular case of system installation, run before anything at all has been installed. This implies that it cannot have any dependencies at all. For this reason, %pretrans is best avoided, but if you must use it, the script must be written in Lua. See http://www.rpm.org/wiki/PackagerDocs/RpmLua for more information.

That's longer than I intended, but sums up the situation and gives a reference.

I've updated the guidelines. Release announcement:

A guideline was added explaining the %pretrans scriptlet and requiring that if used it must be written in Lua.

Metadata Update from @tibbs:
- Issue assigned to tibbs

7 years ago

Login to comment on this ticket.

Metadata