OK, thanks for the answers. Most probably I'm going to modify rpm 4.8.1
package manager to log the packages that have failed post install script,
this just for making list of packages. Then I'll proceed with the fixing of
the packages.

Regards,
Levon

On 13 October 2011 13:38, Jeff Johnson <n3...@mac.com> wrote:

>
> On Oct 13, 2011, at 6:13 AM, Levon Poghosyan wrote:
>
> It seems to be there is no chance to do this in rpm 4.8.1, am I right ?
>
>
> rpm-4.8.1 (and later/earlier versions from @rpm.org) does not save
> scriptlet
> exit codes persistently.
>
> There are also side-effects introduced by ignoring scriptlet exit codes
> like here:
>     https://bugzilla.redhat.com/show_bug.cgi?id=569930
>
> If you have an application that is installing a bunch of rpm packages, and
> some of those packages have a %post scriptlet failing, then the failures
> need
> to be anaylized, classified, and remedied somehow.
>
> If you can detect "failure", then you should be able to diagnose and fix
> the
> package scriptlets.
>
> Asking RPM to detect failures, when the only information
> available is the scriptlet exit code, which is ignored and not saved
> persistently in
> rpm-4.8.1, simply isn't a feasible approach.
>
> 73 de Jeff
>
>
> On 13 October 2011 11:04, devzero2000 <pinto.e...@gmail.com> wrote:
>
>> On Thu, Oct 13, 2011 at 9:15 AM, Levon Poghosyan <deimusmeis...@gmail.com
>> > wrote:
>>
>>> Thanks for the reply.
>>>
>>> The situation is following. I've got an application which installs bunch
>>> of rpm packages.
>>> Some of those packages have post scriptlet failing, so I need to
>>> know/figure out which are failing.
>>> Those packages are many, so I think it wont be the best solution to
>>> modify all off them to store their post install scriptlet execution status
>>> in /var, any other solution for this case ?
>>>
>>> Regards,
>>> Levon
>>>
>>> FWIW, there is a related bugzilla for @rpm.org
>>
>> https://bugzilla.redhat.com/show_bug.cgi?id=569930
>>
>> (rpm exit 0 always on scriptlet execution)
>>
>> In other package management system exists state as "half installed" or so.
>> But
>> here are two issue relevant i think :
>>
>> - Should be failing script relevant or not (see the bugzilla for a
>> discussion on this, in
>> particular for %post) ? @rpm.org choose to exit always with 0
>>
>> - How should applications or users know that there is some errors ?
>>
>> In any case @rpm5.org add the scriplets exit code to the header
>> registrated in a rpmdb and also to the source rpm (for detecting a wrong use
>> of --short-circuit).
>>
>> rpm -q --yaml arbitrarytags
>> (snip)
>> .....
>>
>> Scriptstates:
>>     - 0
>>     - 0
>>     - 0
>>     - 131072                 <---- %post exit code : this number mean exit
>> 0
>> ................
>>
>> you can also use
>>
>> rpm -q --qf '[%{SCRIPTSTATES}]\n' arbitrarytag
>> 000*131072*0000000000000000000000000000
>>       --------
>>         ^
>>         |
>>
>> Hope this help
>>
>>
>> Best Regards
>>
>>
>>
>>
>>
>>
>> here are two issues relevant (imho
>>        Should failing scripts be permitted?
>>
>> and a obscurely related general design issue
>>
>>        How should applications and users and ... be notified of errors?
>>
>>
>>
>>
>>>
>>> On 12 October 2011 21:22, Jeff Johnson <n3npq....@gmail.com> wrote:
>>>
>>>>
>>>> On Oct 12, 2011, at 11:38 AM, Levon Poghosyan wrote:
>>>>
>>>> > Hello,
>>>> >
>>>> > How can I detect if the execution of post scriptlet of the rpm package
>>>> failed ?
>>>>
>>>> The simple answer here is:
>>>>        You don't.
>>>>
>>>> All I mean by that is that the %post script needs to be written
>>>> "robustly"
>>>> so that the exit code is always 0.
>>>>
>>>> If you need/want to tell whether some specific operation "worked",
>>>> then write a test after rpm has run for that specific operation.
>>>>
>>>> Another approach would be to have the %post script register its
>>>> state somewhere in /var so that you can easily test whether the script
>>>> "worked" or not.
>>>>
>>>> > I've generated the and rpm package which has a test command "lalala"
>>>> in post install section. So during the installation it prints out
>>>> information that command lalala was not found but the installation is still
>>>> successful.
>>>> > How do I identify this failure from post install section.
>>>>
>>>> A %post "scriptlet" (the only difference between script and scriptlet is
>>>> that a
>>>> scriplet is macro expanded and may eventually have some envvar's
>>>> prepended instead of having RPM add to the environ directly) is
>>>> just a script.
>>>>
>>>> SO use test(1) to test for existence and executability, and write that
>>>> into
>>>> the %post section directly.
>>>>
>>>> Because a %post is part of a package install state machine, the script
>>>> SHOULD return 0 for all but catasstrophic faiulures.
>>>>
>>>> There are side-effects of returning failure from %post, the most
>>>> important
>>>> of which is that on an upgrade, the erase will be skipped if/when the
>>>> install fails.
>>>>
>>>> >
>>>> > Please note I'm not interested in failure in other places, I just need
>>>> to be informed in post install scriptlet failed.
>>>> >
>>>>
>>>> Personal;ly, I'd just write the %post script to write 1 line into
>>>> /var/lib/application/state
>>>> with the message
>>>>        The %post script "succeeded"
>>>> or (on failure)
>>>>        The %post script "failed".
>>>>
>>>> I'd have to know more about what is implied by a %post success/failure
>>>> in order to suggest some other approach.
>>>>
>>>> hth
>>>>
>>>> 73 de Jeff
>>>>
>>>> ______________________________________________________________________
>>>> RPM Package Manager                                    http://rpm5.org
>>>> User Communication List                             rpm-users@rpm5.org
>>>>
>>>
>>>
>>>
>>> --
>>> Address  Yerevan, Baghramyan 70/75
>>>
>>
>>
>
>
> --
> Address  Yerevan, Baghramyan 70/75
>
>
>


-- 
Address  Yerevan, Baghramyan 70/75

Reply via email to