On Dec 29, 2010, at 9:40 AM, [email protected] wrote:

> Hi Experts,
>  
> I am new user using RPM libraries and C programming APIs for my project. I am 
> using rpmlib 5.1.6. but I am not getting any proper documentation on this. 
> Whatever document I can get by googling are of the version 4 of RPMlib and 
> most of them are out-dated. I mean the functions/APIs and headers file (like 
> dbindex.h, header.h etc) mentioned over there are no longer existing!!
>  

(aside)
You likely should move rpm-5.1.6 -> rpm-5.1.9. That should be a painless 
transition.

There's Doxygen content generated in tree when you build rpm.

Yes dbindex.h was removed like 8+ years ago.

Note that rpm5.org != rpm.org, these are different API's (albeit fairly 
similar).


> My action items will be mainly:
> 
> 1) Fresh Install.
> 2) Upgrade.
> 3) Downgrade.
> 4) Uninstall.
> 5) Abort of any actions.
> 6) To get the action status of any ongoing actions.
> 7) To get all package information. Identify what are they..??
> 8) Signature of the packages.
> 9) Package dependencies.
> 10) Search package by attributes (like name, version)
> 11) Checksum of a package.
> 12) Pre/post-install handling.
> 13) RPM DB connections:
>    a) To list all the installed packages.
>    b) To list downgradable packages
>    c) To list non-downgradable packages
>    d) List of the packages in sub-tree
>    e) To get all package information.
>  

OK. Basically you are attempting to write an installer.

> I have checked rpm.org and prm5.org documentations but no help from those…By 
> googling, I have found some APIs (from rpmlib version 4) such as :
> 1)  int rpmReadPackageInfo(int fd,
>                        Header * signatures,
>                        Header * hdr);
> 2)  int rpmInstallPackage(char * rootdir,
>                       rpmdb db,
>                       int fd,
>                       char * prefix, 
>                       int flags,
>                       rpmNotifyFunction notify,
>                       char * labelFormat,
>                       char * netsharedPath);
>  
> but there are no longer supported in v5.1.6.
>  

Yes. The install mode operations are in lib/rpminstall.c. Look at 
rpmcliInstall().

The method to read package metadata is this
/**
 * Return package header from file handle, verifying digests/signatures.
 * @todo The rpmts either needs to become void *, or changed to -lrpmdb scope.
 * @param ts            transaction set
 * @param fd            file handle
 * @param fn            file name
 * @retval hdrp         address of header (or NULL)
 * @return              RPMRC_OK on success
 */
rpmRC rpmReadPackageFile(rpmts ts, FD_t fd,
                const char * fn, /*...@null@*/ /*...@out@*/ Header * hdrp)
        /*...@globals fileSystem, internalState @*/
        /*...@modifies ts, fd, *hdrp, fileSystem, internalState @*/;

> When I tried to compile a cpp file with the following command:
> g++ -I/usr/include/rpm package-info.cpp -L/MM_BASE/host-tools/lib/rpm/ 
> -L/usr/lib/rpm -lrpmbuild -lrpm -lrpmdb -lrpmio
> /usr/bin/ld: cannot find -lrpmbuild
> collect2: ld returned 1 exit status

All RPM libraries have a version in the name.

So -lrpmbuild-5.1 ... etc is what is needed.

73 de Jeff

Reply via email to