[Rpm-maint] Logging rpm installation logs to file

viren.sharma at tcs.com viren.sharma at tcs.com
Mon Jan 7 11:31:32 UTC 2008


Hi Panu,

I've tried redirecting output using rpmtsSetScriptFd()but it is not 
working.

I've done something like this:
****************************************
>     FILE *fdLogFile;
>     fdLogFile = fopen("LogFile.txt", "w");
>     if (fdLogFile == NULL)
>     {
>         printf("Unable to open file LogFile.txt");
>         return RPM_FAILURE;
>     }
> 
..
..
> rpmtsSetScriptFd(ts, (FD_t)&fdLogFile);
..
..
>     fclose(fdLogFile);

****************************************

On running this I am getting the following error:

testRpm: ./rpmio_internal.h:525: c2f: Assertion `fd && fd->magic == 
0x04463138' failed.
Aborted

Please help me out.


- - -
Thanks,
Virendra
viren.sharma at tcs.com





Panu Matilainen <pmatilai at redhat.com> 
12/13/2007 11:23 AM

To
viren.sharma at tcs.com
cc
rpm-maint at lists.rpm.org
Subject
Re: [Rpm-maint] Logging rpm installation logs to file






On Wed, 12 Dec 2007, viren.sharma at tcs.com wrote:

> Hi all,
>
> I am trying to use rpmts library for installing RPMs.
> But I am facing a problem in creating logs of information which we get
> while installing a RPM package.
>
> When I install a RPM package, I get the following logs on STDOUT.
>
> Preparing...                %% 0.000000
> %% 33.333336
> %% 66.666672
> ########################################### [100%]
> XXXX YYYY ZZZZ
> %% 17.349287
> %% 20.712614
> XXXX YYYY ZZZZ
> %% 64.926155
> %% 99.915932
> %% 100.000000
>
> I think this is the output from the rpm scriptlets which are run as part
> of any install.
>
> I want to capture this information and log it to a file.
> But I am unable to find such a function in RPM library which does this
> job.  : -(
>
> Can anyone please suggest some mechanism to do this?

You can redirect the scriptlet execution output to arbitrary file with 
rpmtsSetScriptFd().

                 - Panu -

ForwardSourceID:NT0000D35E 
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rpm.org/pipermail/rpm-maint/attachments/20080107/46bc19d8/attachment-0001.htm 


More information about the Rpm-maint mailing list