Blame lib/rpmlib.h

2ff057
#ifndef H_RPMLIB
2ff057
#define	H_RPMLIB
2ff057
2ff057
/** \ingroup rpmcli rpmrc rpmdep rpmtrans rpmdb lead signature header payload dbi
2ff057
 * \file lib/rpmlib.h
2ff057
 *
2ff057
 * In Memoriam: Steve Taylor <staylor@redhat.com> was here, now he's not.
2ff057
 *
2ff057
 */
2ff057
2ff057
#include <popt.h>
2ff057
2ff057
#include <rpm/rpmio.h>
2ff057
#include <rpm/header.h>
2ff057
#include <rpm/rpmtag.h>
2ff057
#include <rpm/rpmds.h>	/* XXX move rpmlib provides to rpmds instead */
2ff057
#include <rpm/rpmpgp.h>
2ff057
2ff057
#ifdef _RPM_4_4_COMPAT
2ff057
#warning RPM 4.4.x compatibility layer has been removed in RPM >= 4.14
2ff057
#endif
2ff057
2ff057
#ifdef __cplusplus
2ff057
extern "C" {
2ff057
#endif
2ff057
2ff057
extern struct rpmMacroContext_s * rpmGlobalMacroContext;
2ff057
2ff057
extern struct rpmMacroContext_s * rpmCLIMacroContext;
2ff057
2ff057
extern const char * const RPMVERSION;
2ff057
2ff057
extern const char * const rpmNAME;
2ff057
2ff057
extern const char * const rpmEVR;
2ff057
2ff057
extern const int rpmFLAGS;
2ff057
2ff057
/* ==================================================================== */
2ff057
/** \name RPMRC */
2ff057
2ff057
/** \ingroup rpmrc
2ff057
 * Build and install arch/os table identifiers.
2ff057
 * @todo Eliminate from API.
2ff057
 */
2ff057
enum rpm_machtable_e {
2ff057
    RPM_MACHTABLE_INSTARCH	= 0,	/*!< Install platform architecture. */
2ff057
    RPM_MACHTABLE_INSTOS	= 1,	/*!< Install platform operating system. */
2ff057
    RPM_MACHTABLE_BUILDARCH	= 2,	/*!< Build platform architecture. */
2ff057
    RPM_MACHTABLE_BUILDOS	= 3	/*!< Build platform operating system. */
2ff057
};
2ff057
#define	RPM_MACHTABLE_COUNT	4	/*!< No. of arch/os tables. */
2ff057
2ff057
/** \ingroup rpmrc
2ff057
 * Read macro configuration file(s) for a target.
2ff057
 * @param file		colon separated files to read (NULL uses default)
2ff057
 * @param target	target platform (NULL uses default)
2ff057
 * @return		0 on success, -1 on error
2ff057
 */
2ff057
int rpmReadConfigFiles(const char * file,
2ff057
		const char * target);
2ff057
2ff057
/** \ingroup rpmrc
2ff057
 * Return current arch name and/or number.
2ff057
 * @todo Generalize to extract arch component from target_platform macro.
2ff057
 * @retval name		address of arch name (or NULL)
2ff057
 * @retval num		address of arch number (or NULL)
2ff057
 */
2ff057
void rpmGetArchInfo( const char ** name,
2ff057
		int * num);
2ff057
2ff057
/** \ingroup rpmrc
2ff057
 * Return color for an arch
2ff057
 * @param arch		name of an architecture
2ff057
 * @return color        color of arch, -1 if the arch couldn't be determined
2ff057
 */
2ff057
int rpmGetArchColor(const char *arch);
2ff057
2ff057
/** \ingroup rpmrc
2ff057
 * Return current os name and/or number.
2ff057
 * @todo Generalize to extract os component from target_platform macro.
2ff057
 * @retval name		address of os name (or NULL)
2ff057
 * @retval num		address of os number (or NULL)
2ff057
 */
2ff057
void rpmGetOsInfo( const char ** name,
2ff057
		int * num);
2ff057
2ff057
/** \ingroup rpmrc
2ff057
 * Return arch/os score of a name.
2ff057
 * An arch/os score measures the "nearness" of a name to the currently
2ff057
 * running (or defined) platform arch/os. For example, the score of arch
2ff057
 * "i586" on an i686 platform is (usually) 2. The arch/os score is used
2ff057
 * to select one of several otherwise identical packages using the arch/os
2ff057
 * tags from the header as hints of the intended platform for the package.
2ff057
 * @todo Rewrite to use RE's against config.guess target platform output.
2ff057
 *
2ff057
 * @param type		any of the RPM_MACHTABLE_* constants
2ff057
 * @param name		name
2ff057
 * @return		arch score (0 is no match, lower is preferred)
2ff057
 */
2ff057
int rpmMachineScore(int type, const char * name);
2ff057
2ff057
/** \ingroup rpmrc
2ff057
 * Display current rpmrc (and macro) configuration.
2ff057
 * @param fp		output file handle
2ff057
 * @return		0 always
2ff057
 */
2ff057
int rpmShowRC(FILE * fp);
2ff057
2ff057
/** \ingroup rpmrc
2ff057
 * Destroy rpmrc arch/os compatibility tables.
2ff057
 * @todo Eliminate from API.
2ff057
 */
2ff057
void rpmFreeRpmrc(void);
2ff057
2ff057
/**
2ff057
 * Compare headers to determine which header is "newer".
2ff057
 * @param first		1st header
2ff057
 * @param second	2nd header
2ff057
 * @return		result of comparison
2ff057
 */
2ff057
int rpmVersionCompare(Header first, Header second);
2ff057
2ff057
/**  \ingroup header
2ff057
 * Check header consistency, performing headerGetEntry() the hard way.
2ff057
 *  
2ff057
 * Sanity checks on the header are performed while looking for a
2ff057
 * header-only digest or signature to verify the blob. If found,
2ff057
 * the digest or signature is verified.
2ff057
 *
2ff057
 * @param ts		transaction set
2ff057
 * @param uh		unloaded header blob
2ff057
 * @param uc		no. of bytes in blob (or 0 to disable)
2ff057
 * @retval *msg		verification error message (or NULL)
2ff057
 * @return		RPMRC_OK on success
2ff057
 */
2ff057
rpmRC headerCheck(rpmts ts, const void * uh, size_t uc, char ** msg);
2ff057
2ff057
/**  \ingroup header
2ff057
 * Return checked and loaded header.
2ff057
 * @param ts		unused
2ff057
 * @param fd		file handle
2ff057
 * @retval hdrp		address of header (or NULL)
2ff057
 * @retval *msg		verification error message (or NULL)
2ff057
 * @return		RPMRC_OK on success
2ff057
 */
2ff057
rpmRC rpmReadHeader(rpmts ts, FD_t fd, Header *hdrp, char ** msg);
2ff057
2ff057
/** \ingroup header
2ff057
 * Return package header from file handle, verifying digests/signatures.
2ff057
 * @param ts		transaction set
2ff057
 * @param fd		file handle
2ff057
 * @param fn		file name
2ff057
 * @retval hdrp		address of header (or NULL)
2ff057
 * @return		RPMRC_OK on success
2ff057
 */
2ff057
rpmRC rpmReadPackageFile(rpmts ts, FD_t fd,
2ff057
		const char * fn, Header * hdrp);
2ff057
2ff057
/** \ingroup rpmtrans
2ff057
 * Install source package.
2ff057
 * @param ts		transaction set
2ff057
 * @param fd		file handle
2ff057
 * @retval specFilePtr	address of spec file name (or NULL)
2ff057
 * @retval cookie	address of cookie pointer (or NULL)
2ff057
 * @return		rpmRC return code
2ff057
 */
2ff057
rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
2ff057
			char ** specFilePtr,
2ff057
			char ** cookie);
2ff057
2ff057
/** \ingroup rpmtrans
2ff057
 * Segmented string compare for version or release strings.
2ff057
 *
2ff057
 * @param a		1st string
2ff057
 * @param b		2nd string
2ff057
 * @return		+1 if a is "newer", 0 if equal, -1 if b is "newer"
2ff057
 */
2ff057
int rpmvercmp(const char * a, const char * b);
2ff057
2ff057
#ifdef __cplusplus
2ff057
}
2ff057
#endif
2ff057
2ff057
#endif	/* H_RPMLIB */