[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: rpmInstall()



I just went through a port to the 4.1 rpmlib API
So I might as well give you some pointers.

first read the thread :

"librpm / corrupt free list in an FD_t (help please)"
(over the past week or two on this list)

I got enough support in this thread for it to be of
use to you.

basicly; to install:


rpmts ts = rpmtsCreate();
FD_t fd = Fopen(...);
Header h;

rpmReadPackageFile(ts, fd, "fileName", &h);
rpmtsAddInstallElement(ts, h, "fileName", 1, NULL);

rpmtsOrder(ts);
rpmtsCheck(ts);

rpmtsRun(ts);

ts = rpmtsFree(ts);


and to erase:


rpmts ts = rpmtsCreate();
FD_t fd = Fopen(...);
Header h;
rpmdbMatchIterator iter;

    if ((iter = 
	rpmtsInitIterator(ts, RPMDBI_PACKAGES, 
		   NULL, 0)) != NULL) {
	while ((h = rpmdbNextIterator(iter))) {
	    unsigned int offset = rpmdbGetIteratorOffset(iter);
	    char *name;
	    pkg = (fRpm_t *)l->data;
	    headerGetEntry(h, RPMTAG_NAME, NULL, (void **)&name, NULL);
	    if (strstr(name, "the rpm name I'm looking for")) {
		rpmtsAddEraseElement(ts, h, offset);
		break;
	    }
	} // while iter
	iter = rpmdbFreeIterator(iter);
    }

rpmtsOrder(ts);
rpmtsCheck(ts);

rpmtsRun(ts);

ts = rpmtsFree(ts);


good luck!
			-Tristan


"Adam H. Pendleton" wrote:
> 
> I had hoped to avoid sending a message to the list to get an answer to
> my questions, but keep running in circles with google and the API docs,
> so here goes.
> 
> I am trying to find some documentation on how to install a RPM.  It
> didn't take long to realize that "Maximum RPM" was outdated, so I
> started looking for the replacement function for rpmInstallPackage().
> I am assuming at this point that the function is rpmInstall(), so if I
> am wrong, please correct me.
> 
> I am finding conflicting function prototypes for rpmInstall(); the API
> docs on rpm.org have on version, and rpmcli.h on my RedHat 8.0 box has
> a different one.  Basically I need some information on how to use this
> function, hopefully with some sample code that I can take a look at.
> Is there such a place to get this, or can someone reply with some?
> Thanks!  :)
> 
> ahp
> 
>   ------------------------------------------------------------------------
>               Name: PGP.sig
>    PGP.sig    Type: application/pgp-signature
>           Encoding: 7bit





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []