RPM

How is possible to see what rpm scripts are done by default?

Asked by mmodem

How is possible to see what rpm scripts/triggers are done by default, for example running `rpm -q --showrc` i cant see that %clean is done by default, or that isnt needed anymore to set %BuildRoot in the .spec file?

Question information

Language:
English Edit question
Status:
Answered
For:
RPM Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
herrold (herrold) said :
#1

The word: script is a 'term of art' defined within the RPM program space, and indicates pre- and post-install 'scripts:

[herrold@centos-5 ~]$ rpm -q --scripts rpm
postinstall scriptlet (using /bin/sh):
# XXX Detect (and remove) incompatible dbenv files during upgrade.
# XXX Removing dbenv files in %post opens a lock race window, a tolerable
# XXX risk compared to the support issues involved with upgrading Berkeley DB.
[ -w /var/lib/rpm/__db.001 ] &&
/usr/lib/rpm/rpmdb_stat -CA -h /var/lib/rpm 2>&1 |
grep "db_stat: Program version ... doesn't match environment version" 2>&1 > /dev/null &&
        rm -f /var/lib/rpm/__db*

exit 0
[herrold@centos-5 ~]$

This particular script handles (conditionally) removal of stale files that hold 'lock state' information, such files being located in the directory: /var/lib/rpm/ and starting with a prefix of: __db

----------------------

You are, however referring to referring to the 'spec file stanza paragraphs under: RPMBUILD, such as: %setup, %build and so forth

These are parsed as simple shell scripts during the RPM build process, after some preliminary macro expansions are performed, and executed under a /bin/sh/ environment. You are aware of 'rpm --showrc' from your question, and that shows many of the macros

-- Russ herrold

Revision history for this message
mmodem (mmodem00) said :
#2

You have not understand well the question, i didnt speak regarding any particular package.

Im refering about what the user can do to see what are the current rpm defaults, to see if for example the current rpm version handles %buildroot upstream or if still needed to specify BuildRoot dir in .spec file.
Also for example check if %clean is handled by default or if is still neded to continue to have %clean section in .spec file.

Revision history for this message
devzero2000 (pinto-elia) said :
#3

I hope I have understood.

Well, there is no information available directly in rpm so far for verifying that exists a feature change such as those you ask. For this there are the release notes that describe whether or not BuildRoot is still used or not, if % clean is automatic or not. What is more it would be useful from time to time update the / usr / share / doc / rpm-xxxx /, and the rpm man pages by the maintainer: this was made sometime between release.

Regards

Revision history for this message
Michael Shigorin (shigorin) said :
#4

There's an inobvious difference:
%clean is a spec section (resulting in a "scriptlet"), see also below;
%buildroot is OTOH a macros, you might inspect those with rpm --eval (or --showrc).

In the particular case of %clean, I'd either make sure that it's supported in automated manner (as done in ALT Linux) *or* did a safety rm -rf in the code that's curious to know (after checking for a reasonable buildroot prefix and preferably still running as a pseudouser used to perform the build, of course).

Revision history for this message
devzero2000 (pinto-elia) said :
#5

For #4.

If %buildroot is a macro (or not) and %clean is a spec section (or not) is an implementation detail, that
can change between release, and between distro also, and it is also always possible to change as everyone want. And it is not good to base a decision if a feature is supported or not just based on an implementation detail. JMHO. Regards

Can you help with this problem?

Provide an answer of your own, or ask mmodem for more information if necessary.

To post a message you must log in.