misc.h | misc.h | |||
---|---|---|---|---|
#ifndef H_MISC | #ifndef H_MISC | |||
#define H_MISC | #define H_MISC | |||
/** | /** | |||
* \file lib/misc.h | * \file lib/misc.h | |||
* | * | |||
*/ | */ | |||
#include <string.h> | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
/** | /** | |||
* Create directory if it does not exist, and make sure path is writable. | ||||
* @note This will only create last component of directory path. | ||||
* @param dpath directory path | ||||
* @param dname directory use string | ||||
* @return rpmRC return code | ||||
*/ | ||||
rpmRC rpmMkdirPath (const char * dpath, const char * dname) | ||||
/*@globals h_errno, fileSystem, internalState @*/ | ||||
/*@modifies fileSystem, internalState @*/; | ||||
/** | ||||
* Split string into fields separated by a character. | * Split string into fields separated by a character. | |||
* @param str string | * @param str string | |||
* @param length length of string | * @param length length of string | |||
* @param sep separator character | * @param sep separator character | |||
* @return (malloc'd) argv array | * @return (malloc'd) argv array | |||
*/ | */ | |||
/*@only@*/ char ** splitString(const char * str, int length, char sep) | /*@only@*/ char ** splitString(const char * str, int length, char sep) | |||
/*@*/; | /*@*/; | |||
/** | /** | |||
skipping to change at line 41 | skipping to change at line 54 | |||
* Remove occurences of trailing character from string. | * Remove occurences of trailing character from string. | |||
* @param s string | * @param s string | |||
* @param c character to strip | * @param c character to strip | |||
* @return string | * @return string | |||
*/ | */ | |||
/*@unused@*/ static inline | /*@unused@*/ static inline | |||
/*@only@*/ char * stripTrailingChar(/*@only@*/ char * s, char c) | /*@only@*/ char * stripTrailingChar(/*@only@*/ char * s, char c) | |||
/*@modifies *s */ | /*@modifies *s */ | |||
{ | { | |||
char * t; | char * t; | |||
/*@-boundswrite@*/ | ||||
for (t = s + strlen(s) - 1; *t == c && t >= s; t--) | for (t = s + strlen(s) - 1; *t == c && t >= s; t--) | |||
*t = '\0'; | *t = '\0'; | |||
/*@=boundswrite@*/ | ||||
return s; | return s; | |||
} | } | |||
/** | /** | |||
* Like the libc function, but malloc()'s the space needed. | * Like the libc function, but malloc()'s the space needed. | |||
* @deprecated Use setenv(3) instead. | ||||
* @param name variable name | * @param name variable name | |||
* @param value variable value | * @param value variable value | |||
* @param overwrte should an existing variable be changed? | * @param overwrite should an existing variable be changed? | |||
* @return 0 on success | * @return 0 on success | |||
*/ | */ | |||
int dosetenv(const char * name, const char * value, int overwrite) | int dosetenv(const char * name, const char * value, int overwrite) | |||
/*@globals environ@*/ | /*@globals environ@*/ | |||
/*@modifies *environ @*/; | /*@modifies *environ @*/; | |||
/** | /** | |||
* Like the libc function, but malloc()'s the space needed. | * Like the libc function, but malloc()'s the space needed. | |||
* @deprecated Use setenv(3) instead. | ||||
* @param str "name=value" string | * @param str "name=value" string | |||
* @return 0 on success | * @return 0 on success | |||
*/ | */ | |||
int doputenv(const char * str) | int doputenv(const char * str) | |||
/*@globals environ@*/ | /*@globals environ@*/ | |||
/*@modifies *environ @*/; | /*@modifies *environ @*/; | |||
/** | /** | |||
* Return file handle for a temporaray file. | ||||
* A unique temporaray file path will be generated using | ||||
* rpmGenPath(prefix, "%{_tmppath}/", "rpm-tmp.XXXXX") | ||||
* where "XXXXXX" is filled in using rand(3). The file is opened, and | ||||
* the link count and (dev,ino) location are verified after opening. | ||||
* The file name and the open file handle are returned. | ||||
* | ||||
* @param prefix leading part of temp file path | ||||
* @retval fnptr temp file name (or NULL) | ||||
* @retval fdptr temp file handle | ||||
* @return 0 on success | ||||
*/ | ||||
int makeTempFile(/*@null@*/ const char * prefix, | ||||
/*@null@*/ /*@out@*/ const char ** fnptr, | ||||
/*@out@*/ FD_t * fdptr) | ||||
/*@globals rpmGlobalMacroContext, | ||||
fileSystem, internalState @*/ | ||||
/*@modifies *fnptr, *fdptr, rpmGlobalMacroContext, | ||||
fileSystem, internalState @*/; | ||||
/** | ||||
* Return (malloc'd) current working directory. | * Return (malloc'd) current working directory. | |||
* @return current working directory (malloc'ed) | * @return current working directory (malloc'ed) | |||
*/ | */ | |||
/*@only@*/ char * currentDirectory(void) | /*@only@*/ char * currentDirectory(void) | |||
/*@globals fileSystem @*/ | ||||
/*@modifies fileSystem @*/; | ||||
/** | ||||
* Convert absolute path tag to (dirname,basename,dirindex) tags. | ||||
* @param h header | ||||
*/ | ||||
void compressFilelist(Header h) | ||||
/*@modifies h @*/; | ||||
/** | ||||
* Convert (dirname,basename,dirindex) tags to absolute path tag. | ||||
* @param h header | ||||
*/ | ||||
void expandFilelist(Header h) | ||||
/*@modifies h @*/; | ||||
/** | ||||
* @param h header | ||||
*/ | ||||
void buildOrigFileList(Header h, /*@out@*/ const char *** fileListPtr, | ||||
/*@out@*/ int * fileCountPtr) | ||||
/*@modifies *fileListPtr, *fileCountPtr @*/; | ||||
/** | ||||
*/ | ||||
/*@-exportlocal@*/ | ||||
int myGlobPatternP (const char *patternURL) | ||||
/*@*/; | /*@*/; | |||
/*@=exportlocal@*/ | ||||
/** | ||||
*/ | ||||
int rpmGlob(const char * patterns, /*@out@*/ int * argcPtr, | ||||
/*@out@*/ const char *** argvPtr) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies *argcPtr, *argvPtr, fileSystem @*/; | ||||
/** | ||||
* Retrofit a Provides: name = version-release dependency into legacy | ||||
* packages. | ||||
* @param h header | ||||
*/ | ||||
void providePackageNVR(Header h) | ||||
/*@modifies h @*/; | ||||
/** | ||||
* Calculate MD5 sum for file. | ||||
* @todo Eliminate, use beecrypt instead. | ||||
* @param fn file name | ||||
* @retval digest address of md5sum | ||||
* @param asAscii return md5sum as ascii string? | ||||
* @return 0 on success, 1 on error | ||||
*/ | ||||
/*@-exportlocal@*/ | ||||
int domd5(const char * fn, /*@out@*/ unsigned char * digest, int asAscii) | ||||
/*@globals fileSystem@*/ | ||||
/*@modifies digest, fileSystem @*/; | ||||
/*@=exportlocal@*/ | ||||
/** | ||||
* Return MD5 sum of file as ASCII string. | ||||
* @todo Eliminate, use beecrypt instead. | ||||
* @param fn file name | ||||
* @retval digest MD5 digest | ||||
* @return 0 on success, 1 on error | ||||
*/ | ||||
/*@unused@*/ static inline | ||||
int mdfile(const char * fn, /*@out@*/ unsigned char * digest) | ||||
/*@globals fileSystem@*/ | ||||
/*@modifies digest, fileSystem @*/ | ||||
{ | ||||
return domd5(fn, digest, 1); | ||||
} | ||||
/** | ||||
* Return MD5 sum of file as binary data. | ||||
* @todo Eliminate, use beecrypt instead. | ||||
* @param fn file name | ||||
* @retval bindigest MD5 digest | ||||
* @return 0 on success, 1 on error | ||||
*/ | ||||
/*@unused@*/ static inline | ||||
int mdbinfile(const char * fn, /*@out@*/ unsigned char * bindigest) | ||||
/*@globals fileSystem@*/ | ||||
/*@modifies bindigest, fileSystem @*/ | ||||
{ | ||||
return domd5(fn, bindigest, 0); | ||||
} | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* H_MISC */ | #endif /* H_MISC */ | |||
End of changes. 11 change blocks. | ||||
111 lines changed or deleted | 19 lines changed or added | |||
rpmbuild.h | rpmbuild.h | |||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
#include "rpmspec.h" | #include "rpmspec.h" | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Bit(s) to control buildSpec() operation. | * Bit(s) to control buildSpec() operation. | |||
*/ | */ | |||
/*@-typeuse@*/ | /*@-typeuse@*/ | |||
typedef enum rpmBuildFlags_e { | typedef enum rpmBuildFlags_e { | |||
/*@-enummemuse@*/ | /*@-enummemuse@*/ | |||
RPMBUILD_NONE = 0, | RPMBUILD_NONE = 0, | |||
/*@=enummemuse@*/ | /*@=enummemuse@*/ | |||
RPMBUILD_PREP = (1 << 0), /*!< Execute %%prep. */ | RPMBUILD_PREP = (1 << 0), /*!< Execute %%prep. */ | |||
RPMBUILD_BUILD = (1 << 1), /*!< Execute %%build. */ | RPMBUILD_BUILD = (1 << 1), /*!< Execute %%build. */ | |||
RPMBUILD_INSTALL = (1 << 2), /*!< Execute %%install. */ | RPMBUILD_INSTALL = (1 << 2), /*!< Execute %%install. */ | |||
RPMBUILD_CLEAN = (1 << 3), /*!< Execute %%clean. */ | RPMBUILD_CHECK = (1 << 3), /*!< Execute %%check. */ | |||
RPMBUILD_FILECHECK = (1 << 4), /*!< Check %%files manifest. */ | RPMBUILD_CLEAN = (1 << 4), /*!< Execute %%clean. */ | |||
RPMBUILD_PACKAGESOURCE = (1 << 5), /*!< Create source package. */ | RPMBUILD_FILECHECK = (1 << 5), /*!< Check %%files manifest. */ | |||
RPMBUILD_PACKAGEBINARY = (1 << 6), /*!< Create binary package(s). */ | RPMBUILD_PACKAGESOURCE = (1 << 6), /*!< Create source package. | |||
RPMBUILD_RMSOURCE = (1 << 7), /*!< Remove source(s) and patch(s). | */ | |||
*/ | RPMBUILD_PACKAGEBINARY = (1 << 7), /*!< Create binary package(s | |||
RPMBUILD_RMBUILD = (1 << 8), /*!< Remove build sub-tree. */ | ). */ | |||
RPMBUILD_STRINGBUF = (1 << 9), /*!< only for doScript() */ | RPMBUILD_RMSOURCE = (1 << 8), /*!< Remove source(s) and patch(s). | |||
RPMBUILD_RMSPEC = (1 << 10) /*!< Remove spec file. */ | */ | |||
RPMBUILD_RMBUILD = (1 << 9), /*!< Remove build sub-tree. */ | ||||
RPMBUILD_STRINGBUF = (1 << 10), /*!< only for doScript() */ | ||||
RPMBUILD_TRACK = (1 << 11), /*!< Execute %%track. */ | ||||
RPMBUILD_RMSPEC = (1 << 12), /*!< Remove spec file. */ | ||||
RPMBUILD_FETCHSOURCE= (1 << 13) /*!< Fetch source(s) and patch(s). * | ||||
/ | ||||
} rpmBuildFlags; | } rpmBuildFlags; | |||
/*@=typeuse@*/ | /*@=typeuse@*/ | |||
#include <ctype.h> | ||||
#define SKIPSPACE(s) { while (*(s) && xisspace(*(s))) (s)++; } | #define SKIPSPACE(s) { while (*(s) && xisspace(*(s))) (s)++; } | |||
#define SKIPNONSPACE(s) { while (*(s) && !xisspace(*(s))) (s)++; } | #define SKIPNONSPACE(s) { while (*(s) && !xisspace(*(s))) (s)++; } | |||
#define PART_SUBNAME 0 | #define PART_SUBNAME 0 | |||
#define PART_NAME 1 | #define PART_NAME 1 | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Spec file parser states. | * Spec file parser states. | |||
*/ | */ | |||
#define PART_BASE 100 | ||||
typedef enum rpmParseState_e { | typedef enum rpmParseState_e { | |||
PART_NONE = 0, /*!< */ | PART_NONE = 0+PART_BASE, /*!< */ | |||
PART_PREAMBLE = 1, /*!< */ | /* leave room for RPMRC_NOTFOUND returns. */ | |||
PART_PREP = 2, /*!< */ | PART_PREAMBLE = 11+PART_BASE, /*!< */ | |||
PART_BUILD = 3, /*!< */ | PART_PREP = 12+PART_BASE, /*!< */ | |||
PART_INSTALL = 4, /*!< */ | PART_BUILD = 13+PART_BASE, /*!< */ | |||
PART_CLEAN = 5, /*!< */ | PART_INSTALL = 14+PART_BASE, /*!< */ | |||
PART_FILES = 6, /*!< */ | PART_CHECK = 15+PART_BASE, /*!< */ | |||
PART_PRE = 7, /*!< */ | PART_CLEAN = 16+PART_BASE, /*!< */ | |||
PART_POST = 8, /*!< */ | PART_FILES = 17+PART_BASE, /*!< */ | |||
PART_PREUN = 9, /*!< */ | PART_PRE = 18+PART_BASE, /*!< */ | |||
PART_POSTUN = 10, /*!< */ | PART_POST = 19+PART_BASE, /*!< */ | |||
PART_DESCRIPTION = 11, /*!< */ | PART_PREUN = 20+PART_BASE, /*!< */ | |||
PART_CHANGELOG = 12, /*!< */ | PART_POSTUN = 21+PART_BASE, /*!< */ | |||
PART_TRIGGERIN = 13, /*!< */ | PART_PRETRANS = 22+PART_BASE, /*!< */ | |||
PART_TRIGGERUN = 14, /*!< */ | PART_POSTTRANS = 23+PART_BASE, /*!< */ | |||
PART_VERIFYSCRIPT = 15, /*!< */ | PART_DESCRIPTION = 24+PART_BASE, /*!< */ | |||
PART_BUILDARCHITECTURES= 16,/*!< */ | PART_CHANGELOG = 25+PART_BASE, /*!< */ | |||
PART_TRIGGERPOSTUN = 17, /*!< */ | PART_TRIGGERIN = 26+PART_BASE, /*!< */ | |||
PART_LAST = 18 /*!< */ | PART_TRIGGERUN = 27+PART_BASE, /*!< */ | |||
PART_VERIFYSCRIPT = 28+PART_BASE, /*!< */ | ||||
PART_BUILDARCHITECTURES= 29+PART_BASE,/*!< */ | ||||
PART_TRIGGERPOSTUN = 30+PART_BASE, /*!< */ | ||||
PART_TRIGGERPREIN = 31+PART_BASE, /*!< */ | ||||
/* support "%sanitycheck" script */ | ||||
PART_SANITYCHECK = 32+PART_BASE, /*!< */ | ||||
PART_ARBITRARY = 33+PART_BASE, /*!< */ | ||||
PART_LAST = 34+PART_BASE /*!< */ | ||||
} rpmParseState; | } rpmParseState; | |||
#define STRIP_NOTHING 0 | #define STRIP_NOTHING 0 | |||
#define STRIP_TRAILINGSPACE (1 << 0) | #define STRIP_TRAILINGSPACE (1 << 0) | |||
#define STRIP_COMMENTS (1 << 1) | #define STRIP_COMMENTS (1 << 1) | |||
/*@unchecked@*/ | ||||
extern int _rpmbuildFlags; | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
/*@-redecl@*/ | /*@-redecl@*/ | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Destroy uid/gid caches. | * Destroy uid/gid caches. | |||
*/ | */ | |||
void freeNames(void) | void freeNames(void) | |||
/*@globals internalState@*/ | /*@globals internalState@*/ | |||
/*@modifies internalState */; | /*@modifies internalState */; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Return cached user name from user id. | * Return cached user name from user id. | |||
* @todo Implement using hash. | * @todo Implement using hash. | |||
* @param user id | * @param uid user id | |||
* @return cached user name | * @return cached user name | |||
*/ | */ | |||
extern /*@observer@*/ const char * getUname(uid_t uid) /*@*/; | extern /*@observer@*/ const char * getUname(uid_t uid) | |||
/*@globals internalState @*/ | ||||
/*@modifies internalState @*/; | ||||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Return cached user name. | * Return cached user name. | |||
* @todo Implement using hash. | * @todo Implement using hash. | |||
* @param user name | * @param uname user name | |||
* @return cached user name | * @return cached user name | |||
*/ | */ | |||
extern /*@observer@*/ const char * getUnameS(const char * uname) /*@* | extern /*@observer@*/ const char * getUnameS(const char * uname) | |||
/; | /*@globals internalState @*/ | |||
/*@modifies internalState @*/; | ||||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Return cached user id. | * Return cached user id. | |||
* @todo Implement using hash. | * @todo Implement using hash. | |||
* @param user name | * @param uname user name | |||
* @return cached uid | * @return cached uid | |||
*/ | */ | |||
uid_t getUidS(const char * uname) /*@*/; | uid_t getUidS(const char * uname) | |||
/*@globals internalState @*/ | ||||
/*@modifies internalState @*/; | ||||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Return cached group name from group id. | * Return cached group name from group id. | |||
* @todo Implement using hash. | * @todo Implement using hash. | |||
* @param group id | * @param gid group id | |||
* @return cached group name | * @return cached group name | |||
*/ | */ | |||
extern /*@observer@*/ const char * getGname(gid_t gid) /*@*/; | extern /*@observer@*/ const char * getGname(gid_t gid) | |||
/*@globals internalState @*/ | ||||
/*@modifies internalState @*/; | ||||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Return cached group name. | * Return cached group name. | |||
* @todo Implement using hash. | * @todo Implement using hash. | |||
* @param group name | * @param gname group name | |||
* @return cached group name | * @return cached group name | |||
*/ | */ | |||
extern /*@observer@*/ const char * getGnameS(const char * gname) /*@* | extern /*@observer@*/ const char * getGnameS(const char * gname) | |||
/; | /*@globals internalState @*/ | |||
/*@modifies internalState @*/; | ||||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Return cached group id. | * Return cached group id. | |||
* @todo Implement using hash. | * @todo Implement using hash. | |||
* @param group name | * @param gname group name | |||
* @return cached gid | * @return cached gid | |||
*/ | */ | |||
gid_t getGidS(const char * gname) /*@*/; | gid_t getGidS(const char * gname) | |||
/*@globals internalState @*/ | ||||
/*@modifies internalState @*/; | ||||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Return build hostname. | * Return build hostname. | |||
* @return build hostname | * @return build hostname | |||
*/ | */ | |||
extern /*@observer@*/ const char * const buildHost(void) /*@*/; | /*@observer@*/ | |||
extern const char * buildHost(void) | ||||
/*@*/; | ||||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Return build time stamp. | * Return build time stamp. | |||
* @return build time stamp | * @return build time stamp | |||
*/ | */ | |||
extern /*@observer@*/ int_32 * const getBuildTime(void) /*@*/; | /*@observer@*/ | |||
extern uint32_t * getBuildTime(void) | ||||
/*@*/; | ||||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Read next line from spec file. | * Read next line from spec file. | |||
* @param spec spec file control structure | * @param spec spec file control structure | |||
* @param strip truncate comments? | * @param strip truncate comments? | |||
* @return 0 on success, 1 on EOF, <0 on error | * @return 0 on success, 1 on EOF, <0 on error | |||
*/ | */ | |||
int readLine(Spec spec, int strip) | int readLine(Spec spec, int strip) | |||
/*@globals rpmGlobalMacroContext, | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | |||
fileSystem@*/ | @*/ | |||
/*@modifies spec->fileStack, spec->readStack, spec->line, spec->line Num, | /*@modifies spec->fileStack, spec->readStack, spec->line, spec->line Num, | |||
spec->lbufPtr, | ||||
spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, | spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, | |||
rpmGlobalMacroContext, fileSystem @*/; | rpmGlobalMacroContext, fileSystem, internalState @*/; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Stop reading from spec file, freeing resources. | * Stop reading from spec file, freeing resources. | |||
* @param spec spec file control structure | * @param spec spec file control structure | |||
*/ | */ | |||
void closeSpec(/*@partial@*/ Spec spec) | void closeSpec(/*@partial@*/ Spec spec) | |||
/*@globals fileSystem@*/ | /*@globals fileSystem, internalState @*/ | |||
/*@modifies spec->fileStack, fileSystem @*/; | /*@modifies spec->fileStack, fileSystem, internalState @*/; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Truncate comment lines. | * Truncate comment lines. | |||
* @param s skip white space, truncate line at '#' | * @param s skip white space, truncate line at '#' | |||
*/ | */ | |||
void handleComments(char * s) | void handleComments(char * s) | |||
/*@modifies s @*/; | /*@modifies s @*/; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Check line for section separator, return next parser state. | * Check line for section separator, return next parser state. | |||
* @param line from spec file | * @param spec spec file control structure | |||
* @return next parser state | * @return next parser state | |||
*/ | */ | |||
rpmParseState isPart(const char * line) /*@*/; | rpmParseState isPart(Spec spec) | |||
/*@modifies spec->foo, spec->nfoo @*/; | ||||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Parse a number. | * Parse a number. | |||
* @param line from spec file | * @param line from spec file | |||
* @retval res pointer to int | * @retval res pointer to int | |||
* @return 0 on success, 1 on failure | * @return 0 on success, 1 on failure | |||
*/ | */ | |||
int parseNum(/*@null@*/ const char * line, /*@null@*/ /*@out@*/int * res) | int parseNum(/*@null@*/ const char * line, /*@null@*/ /*@out@*/uint32_t * r es) | |||
/*@modifies *res @*/; | /*@modifies *res @*/; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Add changelog entry to header. | * Add changelog entry to header. | |||
* @todo addChangelogEntry should be static. | ||||
* @param h header | * @param h header | |||
* @param time time of change | * @param time time of change | |||
* @param name person who made the change | * @param name person who made the change | |||
* @param text description of change | * @param text description of change | |||
*/ | */ | |||
void addChangelogEntry(Header h, time_t time, const char * name, | void addChangelogEntry(Header h, time_t time, const char * name, | |||
const char * text) | const char * text) | |||
/*@modifies h @*/; | /*@modifies h @*/; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Parse %%build/%%install/%%clean section(s) of a spec file. | * Parse %%build/%%install/%%clean section(s) of a spec file. | |||
* @param spec spec file control structure | * @param spec spec file control structure | |||
* @param parsePart current rpmParseState | * @param parsePart current rpmParseState | |||
* @return >= 0 next rpmParseState, < 0 on error | * @return >= 0 next rpmParseState, < 0 on error | |||
*/ | */ | |||
int parseBuildInstallClean(Spec spec, rpmParseState parsePart) | int parseBuildInstallClean(Spec spec, rpmParseState parsePart) | |||
/*@globals rpmGlobalMacroContext, | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | |||
fileSystem @*/ | @*/ | |||
/*@modifies spec->build, spec->install, spec->clean, spec->macros, | /*@modifies spec->build, spec->install, spec->check, spec->clean, | |||
spec->macros, spec->foo, spec->nfoo, spec->lbufPtr, | ||||
spec->fileStack, spec->readStack, spec->line, spec->lineNum, | spec->fileStack, spec->readStack, spec->line, spec->lineNum, | |||
spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, | spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, | |||
rpmGlobalMacroContext, fileSystem @*/; | rpmGlobalMacroContext, fileSystem, internalState @*/; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Parse %%changelog section of a spec file. | * Parse %%changelog section of a spec file. | |||
* @param spec spec file control structure | * @param spec spec file control structure | |||
* @return >= 0 next rpmParseState, < 0 on error | * @return >= 0 next rpmParseState, < 0 on error | |||
*/ | */ | |||
int parseChangelog(Spec spec) | int parseChangelog(Spec spec) | |||
/*@globals rpmGlobalMacroContext, | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | |||
fileSystem@*/ | @*/ | |||
/*@modifies spec->fileStack, spec->readStack, spec->line, spec->line Num, | /*@modifies spec->fileStack, spec->readStack, spec->line, spec->line Num, | |||
spec->foo, spec->nfoo, spec->lbufPtr, | ||||
spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, | spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, | |||
spec->packages->header, | spec->packages->header, | |||
rpmGlobalMacroContext, fileSystem @*/; | rpmGlobalMacroContext, fileSystem, internalState @*/; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Parse %%description section of a spec file. | * Parse %%description section of a spec file. | |||
* @param spec spec file control structure | * @param spec spec file control structure | |||
* @return >= 0 next rpmParseState, < 0 on error | * @return >= 0 next rpmParseState, < 0 on error | |||
*/ | */ | |||
int parseDescription(Spec spec) | int parseDescription(Spec spec) | |||
/*@globals rpmGlobalMacroContext, | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | |||
fileSystem@*/ | @*/ | |||
/*@modifies spec->packages, | /*@modifies spec->packages, | |||
spec->foo, spec->nfoo, spec->lbufPtr, | ||||
spec->fileStack, spec->readStack, spec->line, spec->lineNum, | spec->fileStack, spec->readStack, spec->line, spec->lineNum, | |||
spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, | spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, | |||
spec->st, | spec->st, | |||
rpmGlobalMacroContext, fileSystem @*/; | rpmGlobalMacroContext, fileSystem, internalState @*/; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Parse %%files section of a spec file. | * Parse %%files section of a spec file. | |||
* @param spec spec file control structure | * @param spec spec file control structure | |||
* @return >= 0 next rpmParseState, < 0 on error | * @return >= 0 next rpmParseState, < 0 on error | |||
*/ | */ | |||
int parseFiles(Spec spec) | int parseFiles(Spec spec) | |||
/*@globals rpmGlobalMacroContext, | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | |||
fileSystem@*/ | @*/ | |||
/*@modifies spec->packages, | /*@modifies spec->packages, | |||
spec->foo, spec->nfoo, spec->lbufPtr, | ||||
spec->fileStack, spec->readStack, spec->line, spec->lineNum, | spec->fileStack, spec->readStack, spec->line, spec->lineNum, | |||
spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, | spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, | |||
rpmGlobalMacroContext, fileSystem @*/; | rpmGlobalMacroContext, fileSystem, internalState @*/; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Parse tags from preamble of a spec file. | * Parse tags from preamble of a spec file. | |||
* @param spec spec file control structure | * @param spec spec file control structure | |||
* @param initialPackage | * @param initialPackage | |||
* @return >= 0 next rpmParseState, < 0 on error | * @return >= 0 next rpmParseState, < 0 on error | |||
*/ | */ | |||
int parsePreamble(Spec spec, int initialPackage) | int parsePreamble(Spec spec, int initialPackage) | |||
/*@globals rpmGlobalMacroContext, | /*@globals rpmGlobalMacroContext, h_errno, | |||
fileSystem, internalState @*/ | fileSystem, internalState @*/ | |||
/*@modifies spec->packages, | /*@modifies spec->packages, | |||
spec->foo, spec->nfoo, spec->lbufPtr, | ||||
spec->fileStack, spec->readStack, spec->line, spec->lineNum, | spec->fileStack, spec->readStack, spec->line, spec->lineNum, | |||
spec->buildSubdir, | spec->buildSubdir, | |||
spec->macros, spec->st, spec->buildRootURL, | spec->macros, spec->st, | |||
spec->sources, spec->numSources, spec->noSource, | spec->sources, spec->numSources, spec->noSource, | |||
spec->buildRestrictions, spec->BANames, spec->BACount, | spec->sourceHeader, spec->BANames, spec->BACount, | |||
spec->gotBuildRootURL, | ||||
spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, | spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, | |||
rpmGlobalMacroContext, fileSystem, internalState @*/; | rpmGlobalMacroContext, fileSystem, internalState @*/; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Parse %%prep section of a spec file. | * Parse %%prep section of a spec file. | |||
* @param spec spec file control structure | * @param spec spec file control structure | |||
* @param verify verify existence of sources/patches? | ||||
* @return >= 0 next rpmParseState, < 0 on error | * @return >= 0 next rpmParseState, < 0 on error | |||
*/ | */ | |||
int parsePrep(Spec spec) | int parsePrep(Spec spec, int verify) | |||
/*@globals rpmGlobalMacroContext, | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | |||
fileSystem@*/ | @*/ | |||
/*@modifies spec->prep, spec->buildSubdir, spec->macros, | /*@modifies spec->prep, spec->buildSubdir, spec->macros, | |||
spec->foo, spec->nfoo, spec->lbufPtr, | ||||
spec->fileStack, spec->readStack, spec->line, spec->lineNum, | spec->fileStack, spec->readStack, spec->line, spec->lineNum, | |||
spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, | spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, | |||
rpmGlobalMacroContext, fileSystem @*/; | spec->packages->header, | |||
rpmGlobalMacroContext, fileSystem, internalState @*/; | ||||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Parse dependency relations from spec file and/or autogenerated output bu ffer. | * Parse dependency relations from spec file and/or autogenerated output bu ffer. | |||
* @param spec spec file control structure | * @param spec spec file control structure | |||
* @param pkg package control structure | * @param pkg package control structure | |||
* @param field text to parse (e.g. "foo < 0:1.2-3, bar = 5: 6.7") | * @param field text to parse (e.g. "foo < 0:1.2-3, bar = 5: 6.7") | |||
* @param tag tag, identifies type of dependency | * @param tagN tag, identifies type of dependency | |||
* @param index (0 always) | * @param index (0 always) | |||
* @param tagflags dependency flags already known from context | * @param tagflags dependency flags already known from context | |||
* @return 0 on success, RPMERR_BADSPEC on failure | * @return RPMRC_OK on success | |||
*/ | */ | |||
int parseRCPOT(Spec spec, Package pkg, const char * field, int tag, int ind | rpmRC parseRCPOT(Spec spec, Package pkg, const char * field, rpmTag tagN, | |||
ex, | uint32_t index, rpmsenseFlags tagflags) | |||
rpmsenseFlags tagflags) | /*@*/; | |||
/*@globals rpmGlobalMacroContext @*/ | ||||
/*@modifies rpmGlobalMacroContext @*/; | ||||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Parse %%pre et al scriptlets from a spec file. | * Parse %%pre et al scriptlets from a spec file. | |||
* @param spec spec file control structure | * @param spec spec file control structure | |||
* @param parsePart current rpmParseState | * @param parsePart current rpmParseState | |||
* @return >= 0 next rpmParseState, < 0 on error | * @return >= 0 next rpmParseState, < 0 on error | |||
*/ | */ | |||
int parseScript(Spec spec, int parsePart) | int parseScript(Spec spec, int parsePart) | |||
/*@globals rpmGlobalMacroContext, | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | |||
fileSystem@*/ | @*/ | |||
/*@modifies spec->packages, | /*@modifies spec->packages, | |||
spec->foo, spec->nfoo, spec->lbufPtr, | ||||
spec->fileStack, spec->readStack, spec->line, spec->lineNum, | spec->fileStack, spec->readStack, spec->line, spec->lineNum, | |||
spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, | spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, | |||
rpmGlobalMacroContext, fileSystem @*/; | rpmGlobalMacroContext, fileSystem, internalState @*/; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Evaluate boolean expression. | * Evaluate boolean expression. | |||
* @param spec spec file control structure | * @param spec spec file control structure | |||
* @param expr expression to parse | * @param expr expression to parse | |||
* @return | * @return | |||
*/ | */ | |||
int parseExpressionBoolean(Spec spec, const char * expr) | int parseExpressionBoolean(Spec spec, const char * expr) | |||
/*@globals rpmGlobalMacroContext @*/ | /*@globals rpmGlobalMacroContext, h_errno @*/ | |||
/*@modifies rpmGlobalMacroContext @*/; | /*@modifies rpmGlobalMacroContext @*/; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Evaluate string expression. | * Evaluate string expression. | |||
* @param spec spec file control structure | * @param spec spec file control structure | |||
* @param expr expression to parse | * @param expr expression to parse | |||
* @return | * @return | |||
*/ | */ | |||
/*@unused@*/ | /*@unused@*/ /*@null@*/ | |||
char * parseExpressionString(Spec spec, const char * expr) | char * parseExpressionString(Spec spec, const char * expr) | |||
/*@globals rpmGlobalMacroContext @*/ | /*@globals rpmGlobalMacroContext, h_errno @*/ | |||
/*@modifies rpmGlobalMacroContext @*/; | /*@modifies rpmGlobalMacroContext @*/; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Run a build script, assembled from spec file scriptlet section. | * Run a build script, assembled from spec file scriptlet section. | |||
* | * | |||
* @param spec spec file control structure | * @param spec spec file control structure | |||
* @param what type of script | * @param what type of script | |||
* @param name name of scriptlet section | * @param name name of scriptlet section | |||
* @param sb lines that compose script body | * @param sb lines that compose script body | |||
* @param test don't execute scripts or package if testing | * @param test don't execute scripts or package if testing | |||
* @return 0 on success, RPMERR_SCRIPT on failure | * @return RPMRC_OK on success, RPMRC_FAIL on failure | |||
*/ | */ | |||
int doScript(Spec spec, int what, const char * name, StringBuf sb, int test | rpmRC doScript(Spec spec, int what, /*@null@*/ const char * name, | |||
) | /*@null@*/ StringBuf sb, int test) | |||
/*@globals rpmGlobalMacroContext, | /*@globals rpmGlobalMacroContext, h_errno, | |||
fileSystem, internalState @*/ | fileSystem, internalState @*/ | |||
/*@modifies spec->macros, | /*@modifies spec->macros, | |||
rpmGlobalMacroContext, fileSystem, internalState @*/; | rpmGlobalMacroContext, fileSystem, internalState @*/; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Find sub-package control structure by name. | * Find sub-package control structure by name. | |||
* @param spec spec file control structure | * @param spec spec file control structure | |||
* @param name (sub-)package name | * @param name (sub-)package name | |||
* @param flag if PART_SUBNAME, then 1st package name is prepended | * @param flag if PART_SUBNAME, then 1st package name is prepended | |||
* @retval pkg package control structure | * @retval pkg package control structure | |||
* @return 0 on success, 1 on failure | * @return RPMRC_OK on success | |||
*/ | */ | |||
int lookupPackage(Spec spec, /*@null@*/ const char * name, int flag, | rpmRC lookupPackage(Spec spec, /*@null@*/ const char * name, int flag, | |||
/*@out@*/ Package * pkg) | /*@out@*/ Package * pkg) | |||
/*@modifies spec->packages, *pkg @*/; | /*@modifies spec->packages, *pkg @*/; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Create and initialize package control structure. | * Create and initialize package control structure. | |||
* @param spec spec file control structure | * @param spec spec file control structure | |||
* @return package control structure | * @return package control structure | |||
*/ | */ | |||
/*@only@*/ Package newPackage(Spec spec) | /*@only@*/ | |||
Package newPackage(Spec spec) | ||||
/*@modifies spec->packages, spec->packages->next @*/; | /*@modifies spec->packages, spec->packages->next @*/; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Destroy all packages associated with spec file. | * Destroy all packages associated with spec file. | |||
* @param packages package control structure chain | * @param packages package control structure chain | |||
* @return NULL | * @return NULL | |||
*/ | */ | |||
/*@null@*/ Package freePackages(/*@only@*/ /*@null@*/ Package packages) | /*@null@*/ | |||
/*@modifies packages @*/; | Package freePackages(/*@only@*/ /*@null@*/ Package packages) | |||
/*@globals fileSystem @*/ | ||||
/*@modifies packages, fileSystem @*/; | ||||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Destroy package control structure. | * Destroy package control structure. | |||
* @param pkg package control structure | * @param pkg package control structure | |||
* @return NULL | * @return NULL | |||
*/ | */ | |||
/*@null@*/ Package freePackage(/*@only@*/ /*@null@*/ Package pkg) | /*@null@*/ | |||
/*@modifies pkg @*/; | Package freePackage(/*@only@*/ /*@null@*/ Package pkg) | |||
/*@globals fileSystem @*/ | ||||
/*@modifies pkg, fileSystem @*/; | ||||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Add dependency to header, filtering duplicates. | * Add dependency to header, filtering duplicates. | |||
* @param spec spec file control structure | * @param spec spec file control structure | |||
* @param h header | * @param h header | |||
* @param depFlags (e.g. Requires: foo < 0:1.2-3, both "Requires:" and | * @param tagN tag, identifies type of dependency | |||
"<") | * @param N (e.g. Requires: foo < 0:1.2-3, "foo") | |||
* @param depName (e.g. Requires: foo < 0:1.2-3, "foo") | * @param EVR (e.g. Requires: foo < 0:1.2-3, "0:1.2-3") | |||
* @param depEVR (e.g. Requires: foo < 0:1.2-3, "0:1.2-3") | * @param Flags (e.g. Requires: foo < 0:1.2-3, both "Require | |||
s:" and "<") | ||||
* @param index (0 always) | * @param index (0 always) | |||
* @return 0 always | * @return 0 always | |||
*/ | */ | |||
int addReqProv(/*@unused@*/Spec spec, Header h, | int addReqProv(/*@unused@*/Spec spec, Header h, rpmTag tagN, | |||
rpmsenseFlags depFlags, const char * depName, | const char * N, const char * EVR, rpmsenseFlags Flags, | |||
const char * depEVR, int index) | uint32_t index) | |||
/*@modifies h @*/; | ||||
/** | ||||
* Append files (if any) to scriptlet tags. | ||||
* @param spec spec file control structure | ||||
* @param pkg package control structure | ||||
* @return RPMRC_OK on success | ||||
*/ | ||||
rpmRC processScriptFiles(Spec spec, Package pkg) | ||||
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | ||||
@*/ | ||||
/*@modifies pkg->header, rpmGlobalMacroContext, | ||||
fileSystem, internalState @*/; | ||||
/** | ||||
* Retrofit an explicit Provides: N = E:V-R dependency into package headers | ||||
. | ||||
* Up to rpm 3.0.4, packages implicitly provided their own name-version-rel | ||||
ease. | ||||
* @param h header | ||||
*/ | ||||
void providePackageNVR(Header h) | ||||
/*@modifies h @*/; | /*@modifies h @*/; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Add rpmlib feature dependency. | * Add rpmlib feature dependency. | |||
* @param h header | * @param h header | |||
* @param feature rpm feature name (i.e. "rpmlib(Foo)" for feature Foo ) | * @param feature rpm feature name (i.e. "rpmlib(Foo)" for feature Foo ) | |||
* @param featureEVR rpm feature epoch/version/release | * @param featureEVR rpm feature epoch/version/release | |||
* @return 0 always | * @return 0 always | |||
*/ | */ | |||
int rpmlibNeedsFeature(Header h, const char * feature, const char * feature EVR) | int rpmlibNeedsFeature(Header h, const char * feature, const char * feature EVR) | |||
/*@modifies h @*/; | /*@modifies h @*/; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Post-build processing for binary package(s). | * Post-build processing for binary package(s). | |||
* @param spec spec file control structure | * @param spec spec file control structure | |||
* @param installSpecialDoc | * @param installSpecialDoc | |||
* @param test don't execute scripts or package if testing | * @param test don't execute scripts or package if testing | |||
* @return 0 on success | * @return RPMRC_OK on success | |||
*/ | */ | |||
int processBinaryFiles(Spec spec, int installSpecialDoc, int test) | rpmRC processBinaryFiles(Spec spec, int installSpecialDoc, int test) | |||
/*@globals rpmGlobalMacroContext, | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | |||
fileSystem, internalState @*/ | @*/ | |||
/*@modifies spec->macros, | /*@modifies spec->macros, *spec->packages, | |||
spec->packages->cpioList, spec->packages->fileList, | spec->packages->cpioList, spec->packages->fileList, | |||
spec->packages->specialDoc, spec->packages->header, | spec->packages->specialDoc, spec->packages->header, | |||
rpmGlobalMacroContext, fileSystem, internalState @*/; | rpmGlobalMacroContext, fileSystem, internalState @*/; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Create and initialize header for source package. | * Create and initialize header for source package. | |||
* @param spec spec file control structure | * @param spec spec file control structure | |||
* @retval *sfp srpm file list (may be NULL) | ||||
* @return 0 always | ||||
*/ | */ | |||
void initSourceHeader(Spec spec) | int initSourceHeader(Spec spec, /*@null@*/ StringBuf *sfp) | |||
/*@modifies spec->sourceHeader, | /*@globals rpmGlobalMacroContext, h_errno @*/ | |||
spec->buildRestrictions, spec->BANames, | /*@modifies spec->sourceHeader, spec->sourceHdrInit, | |||
spec->packages->header @*/; | spec->BANames, *sfp, | |||
spec->packages->header, | ||||
rpmGlobalMacroContext @*/; | ||||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Post-build processing for source package. | * Post-build processing for source package. | |||
* @param spec spec file control structure | * @param spec spec file control structure | |||
* @return 0 on success | * @return 0 on success | |||
*/ | */ | |||
int processSourceFiles(Spec spec) | int processSourceFiles(Spec spec) | |||
/*@globals rpmGlobalMacroContext, | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | |||
fileSystem @*/ | @*/ | |||
/*@modifies spec->sourceHeader, spec->sourceCpioList, | /*@modifies spec->sourceHeader, spec->sourceCpioList, | |||
spec->buildRestrictions, spec->BANames, | spec->BANames, spec->sourceHdrInit, | |||
spec->packages->header, | spec->packages->header, | |||
rpmGlobalMacroContext, fileSystem @*/; | rpmGlobalMacroContext, fileSystem, internalState @*/; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Parse spec file into spec control structure. | * Parse spec file into spec control structure. | |||
* @retval specp spec file control structure | * @param ts transaction set (spec file control in ts->spec) | |||
* @param specFile | * @param specFile | |||
* @param rootURL | * @param rootURL | |||
* @param buildRootURL | ||||
* @param recursing parse is recursive? | * @param recursing parse is recursive? | |||
* @param passPhrase | * @param passPhrase | |||
* @param cookie | * @param cookie | |||
* @param anyarch | * @param anyarch | |||
* @param force | * @param force | |||
* @param verify | ||||
* @return | * @return | |||
*/ | */ | |||
int parseSpec(/*@out@*/ Spec * specp, const char * specFile, | int parseSpec(rpmts ts, const char * specFile, | |||
/*@null@*/ const char * rootURL, | /*@null@*/ const char * rootURL, | |||
/*@null@*/ const char * buildRootURL, | ||||
int recursing, | ||||
/*@null@*/ const char * passPhrase, | ||||
/*@null@*/ char * cookie, | ||||
int anyarch, int force) | ||||
/*@globals rpmGlobalMacroContext, | ||||
fileSystem, internalState @*/ | ||||
/*@modifies *specp, | ||||
rpmGlobalMacroContext, fileSystem, internalState @*/; | ||||
/** \ingroup rpmbuild | ||||
* @retval specp spec file control structure | ||||
* @param specFile | ||||
* @param rootdir | ||||
* @param buildRoot | ||||
* @param recursing parse is recursive? | ||||
* @param passPhrase | ||||
* @param cookie | ||||
* @param anyarch | ||||
* @param force | ||||
* @return | ||||
*/ | ||||
/*@-declundef@*/ | ||||
extern int (*parseSpecVec) (Spec * specp, const char * specFile, | ||||
const char * rootdir, | ||||
/*@null@*/ const char * buildRoot, | ||||
int recursing, | int recursing, | |||
/*@null@*/ const char * passPhrase, | /*@null@*/ const char * passPhrase, | |||
/*@null@*/ char * cookie, | /*@null@*/ const char * cookie, | |||
int anyarch, int force) | int anyarch, int force, int verify) | |||
/*@globals rpmGlobalMacroContext, | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | |||
fileSystem, internalState @*/ | @*/ | |||
/*@modifies *specp, | /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/ | |||
rpmGlobalMacroContext, fileSystem, internalState @*/; | ; | |||
/*@=declundef@*/ | ||||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Build stages state machine driver. | * Build stages state machine driver. | |||
* @param ts transaction set | ||||
* @param spec spec file control structure | * @param spec spec file control structure | |||
* @param what bit(s) to enable stages of build | * @param what bit(s) to enable stages of build | |||
* @param test don't execute scripts or package if testing | * @param test don't execute scripts or package if testing | |||
* @return 0 on success | * @return RPMRC_OK on success | |||
*/ | */ | |||
int buildSpec(Spec spec, int what, int test) | rpmRC buildSpec(rpmts ts, Spec spec, int what, int test) | |||
/*@globals rpmGlobalMacroContext, | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | |||
fileSystem, internalState @*/ | @*/ | |||
/*@modifies spec->sourceHeader, spec->sourceCpioList, spec->cookie, | /*@modifies spec->sourceHeader, spec->sourceCpioList, spec->cookie, | |||
spec->sourceRpmName, spec->macros, | spec->sourceRpmName, spec->sourcePkgId, spec->sourceHdrInit, | |||
spec->BASpecs, | spec->macros, spec->BASpecs, | |||
spec->buildRestrictions, spec->BANames, | spec->BANames, *spec->packages, | |||
spec->packages->cpioList, spec->packages->fileList, | spec->packages->cpioList, spec->packages->fileList, | |||
spec->packages->specialDoc, spec->packages->header, | spec->packages->specialDoc, spec->packages->header, | |||
rpmGlobalMacroContext, fileSystem, internalState @*/; | rpmGlobalMacroContext, fileSystem, internalState @*/; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Generate binary package(s). | * Generate binary package(s). | |||
* @param spec spec file control structure | * @param spec spec file control structure | |||
* @return 0 on success | * @return rpmRC on success | |||
*/ | */ | |||
int packageBinaries(Spec spec) | rpmRC packageBinaries(Spec spec) | |||
/*@globals rpmGlobalMacroContext, | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | |||
fileSystem, internalState @*/ | @*/ | |||
/*@modifies spec->packages->header, | /*@modifies spec->packages->header, spec->packages->cpioList, | |||
spec->sourceRpmName, | spec->sourceRpmName, spec->cookie, spec->sourcePkgId, | |||
rpmGlobalMacroContext, fileSystem, internalState @*/; | rpmGlobalMacroContext, fileSystem, internalState @*/; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Generate source package. | * Generate source package. | |||
* @param spec spec file control structure | * @param spec spec file control structure | |||
* @return 0 on success | * @return RPMRC_OK on success | |||
*/ | */ | |||
int packageSources(Spec spec) | rpmRC packageSources(Spec spec) | |||
/*@globals rpmGlobalMacroContext, | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | |||
fileSystem, internalState @*/ | @*/ | |||
/*@modifies spec->sourceHeader, spec->cookie, | /*@modifies spec->sourceHeader, spec->cookie, spec->sourceCpioList, | |||
spec->sourceRpmName, | spec->sourceRpmName, spec->sourcePkgId, spec->packages->head | |||
er, | ||||
rpmGlobalMacroContext, fileSystem, internalState @*/; | rpmGlobalMacroContext, fileSystem, internalState @*/; | |||
/*@=redecl@*/ | /*@=redecl@*/ | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* _H_RPMBUILD_ */ | #endif /* _H_RPMBUILD_ */ | |||
End of changes. 85 change blocks. | ||||
177 lines changed or deleted | 223 lines changed or added | |||
rpmcli.h | rpmcli.h | |||
---|---|---|---|---|
#ifndef H_RPMCLI | #ifndef H_RPMCLI | |||
#define H_RPMCLI | #define H_RPMCLI | |||
/** \ingroup rpmcli rpmbuild | /** \ingroup rpmcli rpmbuild | |||
* \file lib/rpmcli.h | * \file lib/rpmcli.h | |||
*/ | */ | |||
#include "rpmlib.h" | #include "popt.h" | |||
#include "rpmurl.h" | #include "argv.h" | |||
#include "rpmcb.h" | ||||
#include "rpmmacro.h" | #include "rpmmacro.h" | |||
#include "rpmurl.h" | ||||
#include "rpmlib.h" | ||||
#include "rpmps.h" | ||||
#include "rpmte.h" | ||||
#include "rpmts.h" | ||||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
* Should version 3 packages be produced? | * Should version 3 packages be produced? | |||
*/ | */ | |||
/*@-redecl@*/ | /*@-redecl@*/ | |||
/*@unchecked@*/ | /*@unchecked@*/ | |||
extern int _noDirTokens; | extern int _noDirTokens; | |||
/*@=redecl@*/ | /*@=redecl@*/ | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
/* ==================================================================== */ | ||||
/** \name RPMBT */ | ||||
/*@{*/ | ||||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
* Describe build command line request. | * Popt option table for options shared by all modes and executables. | |||
*/ | ||||
/*@unchecked@*/ | ||||
extern struct poptOption rpmcliAllPoptTable[]; | ||||
/*@unchecked@*/ | ||||
extern int global_depFlags; | ||||
/*@unchecked@*/ | ||||
extern struct poptOption rpmcliDepFlagsPoptTable[]; | ||||
/*@unchecked@*/ /*@observer@*/ /*@null@*/ | ||||
extern const char * rpmcliTargets; | ||||
/*@=redecl@*/ | ||||
/** | ||||
* Initialize most everything needed by an rpm CLI executable context. | ||||
* @param argc no. of args | ||||
* @param argv arg array | ||||
* @param optionsTable popt option table | ||||
* @return popt context (or NULL) | ||||
*/ | */ | |||
struct rpmBuildArguments_s { | ||||
int buildAmount; /*!< Bit(s) to control operation. */ | ||||
/*@null@*/ | ||||
const char * buildRootOverride; /*!< from --buildroot */ | ||||
/*@null@*/ | /*@null@*/ | |||
char * targets; /*!< Target platform(s), comma separated. */ | poptContext | |||
int force; /*!< from --force */ | rpmcliInit(int argc, char *const argv[], struct poptOption * optionsTable) | |||
int noBuild; /*!< from --nobuild */ | /*@globals rpmCLIMacroContext, rpmGlobalMacroContext, h_errno, stder | |||
int noDeps; /*!< from --nodeps */ | r, | |||
int noLang; /*!< from --nolang */ | fileSystem, internalState @*/ | |||
int shortCircuit; /*!< from --short-circuit */ | /*@modifies rpmCLIMacroContext, rpmGlobalMacroContext, stderr, | |||
int sign; /*!< from --sign */ | fileSystem, internalState @*/; | |||
int useCatalog; /*!< from --usecatalog */ | ||||
char buildMode; /*!< Build mode (one of "btBC") */ | ||||
char buildChar; /*!< Build stage (one of "abcilps ") */ | ||||
/*@observer@*/ /*@null@*/ | ||||
const char * rootdir; | ||||
}; | ||||
/** \ingroup rpmcli | /** | |||
* Make sure that rpm configuration has been read. | ||||
* @warning Options like --rcfile and --verbose must precede callers option | ||||
. | ||||
*/ | */ | |||
typedef struct rpmBuildArguments_s * BTA_t; | /*@mayexit@*/ | |||
void rpmcliConfigured(void) | ||||
/*@globals rpmCLIMacroContext, | ||||
rpmGlobalMacroContext, h_errno, fileSystem, internalState @* | ||||
/ | ||||
/*@modifies rpmCLIMacroContext, rpmGlobalMacroContext, | ||||
fileSystem, internalState @*/; | ||||
/** \ingroup rpmcli | /** | |||
* Destroy most everything needed by an rpm CLI executable context. | ||||
* @param optCon popt context | ||||
* @return NULL always | ||||
*/ | */ | |||
/*@unchecked@*/ | poptContext | |||
extern struct rpmBuildArguments_s rpmBTArgs; | rpmcliFini(/*@only@*/ /*@null@*/ poptContext optCon) | |||
/*@globals rpmTags, rpmGlobalMacroContext, | ||||
fileSystem, internalState @*/ | ||||
/*@modifies optCon, rpmTags, rpmGlobalMacroContext, | ||||
fileSystem, internalState @*/; | ||||
/** \ingroup rpmcli | /** | |||
* Common/global popt tokens used for command line option tables. | ||||
*/ | */ | |||
/*@unchecked@*/ | #define RPMCLI_POPT_NODEPS -1026 | |||
extern struct poptOption rpmBuildPoptTable[]; | #define RPMCLI_POPT_NOFDIGESTS -1027 | |||
#define RPMCLI_POPT_NOSCRIPTS -1028 | ||||
#define RPMCLI_POPT_NOSIGNATURE -1029 | ||||
#define RPMCLI_POPT_NODIGEST -1030 | ||||
#define RPMCLI_POPT_NOHDRCHK -1031 | ||||
#define RPMCLI_POPT_NOCONTEXTS -1032 | ||||
#define RPMCLI_POPT_TARGETPLATFORM -1033 | ||||
/*@}*/ | ||||
/* ==================================================================== */ | /* ==================================================================== */ | |||
/** \name RPMQV */ | /** \name RPMQV */ | |||
/*@{*/ | /*@{*/ | |||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
* Query/Verify argument qualifiers. | ||||
* @todo Reassign to tag values. | ||||
*/ | ||||
typedef enum rpmQVSources_e { | ||||
RPMQV_PACKAGE = 0, /*!< ... from package name db search. */ | ||||
RPMQV_PATH, /*!< ... from file path db search. */ | ||||
RPMQV_ALL, /*!< ... from each installed package. */ | ||||
RPMQV_RPM, /*!< ... from reading binary rpm package. */ | ||||
RPMQV_GROUP, /*!< ... from group db search. */ | ||||
RPMQV_WHATPROVIDES, /*!< ... from provides db search. */ | ||||
RPMQV_WHATREQUIRES, /*!< ... from requires db search. */ | ||||
RPMQV_TRIGGEREDBY, /*!< ... from trigger db search. */ | ||||
RPMQV_DBOFFSET, /*!< ... from database header instance. */ | ||||
RPMQV_SPECFILE, /*!< ... from spec file parse (query only). */ | ||||
RPMQV_PKGID, /*!< ... from package id (header+payload MD5). */ | ||||
RPMQV_HDRID, /*!< ... from header id (immutable header SHA1). */ | ||||
RPMQV_FILEID, /*!< ... from file id (file digest, usually MD5). */ | ||||
RPMQV_TID, /*!< ... from install transaction id (time stamp). * | ||||
/ | ||||
RPMQV_HDLIST, /*!< ... from system hdlist. */ | ||||
RPMQV_FTSWALK, /*!< ... from fts(3) walk. */ | ||||
RPMQV_WHATNEEDS, /*!< ... from requires using contained provides. */ | ||||
RPMQV_SPECSRPM, /*!< ... srpm from spec file parse (query only). */ | ||||
RPMQV_SOURCEPKGID /*!< ... from source package id (header+payload MD5) | ||||
. */ | ||||
} rpmQVSources; | ||||
/** \ingroup rpmcli | ||||
* Bit(s) for rpmVerifyFile() attributes and result. | ||||
*/ | ||||
typedef enum rpmVerifyAttrs_e { | ||||
RPMVERIFY_NONE = 0, /*!< */ | ||||
RPMVERIFY_FDIGEST = (1 << 0), /*!< from %verify(digest) */ | ||||
RPMVERIFY_FILESIZE = (1 << 1), /*!< from %verify(size) */ | ||||
RPMVERIFY_LINKTO = (1 << 2), /*!< from %verify(link) */ | ||||
RPMVERIFY_USER = (1 << 3), /*!< from %verify(user) */ | ||||
RPMVERIFY_GROUP = (1 << 4), /*!< from %verify(group) */ | ||||
RPMVERIFY_MTIME = (1 << 5), /*!< from %verify(mtime) */ | ||||
RPMVERIFY_MODE = (1 << 6), /*!< from %verify(mode) */ | ||||
RPMVERIFY_RDEV = (1 << 7), /*!< from %verify(rdev) */ | ||||
/* bits 8-14 unused, reserved for rpmVerifyAttrs */ | ||||
RPMVERIFY_CONTEXTS = (1 << 15), /*!< verify: from --nocontexts */ | ||||
/* bits 16-22 used in rpmVerifyFlags */ | ||||
/* bits 23-27 used in rpmQueryFlags */ | ||||
RPMVERIFY_READLINKFAIL= (1 << 28), /*!< readlink failed */ | ||||
RPMVERIFY_READFAIL = (1 << 29), /*!< file read failed */ | ||||
RPMVERIFY_LSTATFAIL = (1 << 30), /*!< lstat failed */ | ||||
RPMVERIFY_LGETFILECONFAIL = (1 << 31) /*!< lgetfilecon failed */ | ||||
} rpmVerifyAttrs; | ||||
#define RPMVERIFY_MD5 RPMVERIFY_FDIGEST | ||||
#define RPMVERIFY_ALL ~(RPMVERIFY_NONE) | ||||
#define RPMVERIFY_FAILURES \ | ||||
(RPMVERIFY_LSTATFAIL|RPMVERIFY_READFAIL|RPMVERIFY_READLINKFAIL|RPMVERIFY_ | ||||
LGETFILECONFAIL) | ||||
/** \ingroup rpmcli | ||||
* Bit(s) to control rpmQuery() operation, stored in qva_flags. | * Bit(s) to control rpmQuery() operation, stored in qva_flags. | |||
* @todo Merge rpmQueryFlags, rpmVerifyFlags, and rpmVerifyAttrs?. | * @todo Merge rpmQueryFlags, rpmVerifyFlags, and rpmVerifyAttrs?. | |||
*/ | */ | |||
typedef enum rpmQueryFlags_e { | typedef enum rpmQueryFlags_e { | |||
QUERY_FOR_DEFAULT = 0, /*!< */ | ||||
/*@-enummemuse@*/ | /*@-enummemuse@*/ | |||
QUERY_MD5 = (1 << 0), /*!< from --nomd5 */ | QUERY_FOR_DEFAULT = 0, /*!< */ | |||
QUERY_FDIGEST = (1 << 0), /*!< from --nofdigest */ | ||||
QUERY_SIZE = (1 << 1), /*!< from --nosize */ | QUERY_SIZE = (1 << 1), /*!< from --nosize */ | |||
QUERY_LINKTO = (1 << 2), /*!< from --nolink */ | QUERY_LINKTO = (1 << 2), /*!< from --nolink */ | |||
QUERY_USER = (1 << 3), /*!< from --nouser) */ | QUERY_USER = (1 << 3), /*!< from --nouser) */ | |||
QUERY_GROUP = (1 << 4), /*!< from --nogroup) */ | QUERY_GROUP = (1 << 4), /*!< from --nogroup) */ | |||
QUERY_MTIME = (1 << 5), /*!< from --nomtime) */ | QUERY_MTIME = (1 << 5), /*!< from --nomtime) */ | |||
QUERY_MODE = (1 << 6), /*!< from --nomode) */ | QUERY_MODE = (1 << 6), /*!< from --nomode) */ | |||
QUERY_RDEV = (1 << 7), /*!< from --nodev */ | QUERY_RDEV = (1 << 7), /*!< from --nodev */ | |||
/* bits 8-15 unused, reserved for rpmVerifyAttrs */ | /* bits 8-14 unused, reserved for rpmVerifyAttrs */ | |||
QUERY_CONTEXTS = (1 << 15), /*!< verify: from --nocontexts */ | ||||
QUERY_FILES = (1 << 16), /*!< verify: from --nofiles */ | QUERY_FILES = (1 << 16), /*!< verify: from --nofiles */ | |||
QUERY_DEPS = (1 << 17), /*!< verify: from --nodeps */ | QUERY_DEPS = (1 << 17), /*!< verify: from --nodeps */ | |||
QUERY_SCRIPT = (1 << 18), /*!< verify: from --noscripts */ | QUERY_SCRIPT = (1 << 18), /*!< verify: from --noscripts */ | |||
QUERY_DIGEST = (1 << 19), /*!< verify: from --nodigest */ | QUERY_DIGEST = (1 << 19), /*!< verify: from --nodigest */ | |||
QUERY_SIGNATURE = (1 << 20), /*!< verify: from --nosignature */ | ||||
QUERY_PATCHES = (1 << 21), /*!< verify: from --nopatches */ | ||||
QUERY_HDRCHK = (1 << 22), /*!< verify: from --nohdrchk */ | ||||
/*@=enummemuse@*/ | /*@=enummemuse@*/ | |||
/* bits 20-22 unused */ | ||||
QUERY_FOR_LIST = (1 << 23), /*!< query: from --list */ | QUERY_FOR_LIST = (1 << 23), /*!< query: from --list */ | |||
QUERY_FOR_STATE = (1 << 24), /*!< query: from --state */ | QUERY_FOR_STATE = (1 << 24), /*!< query: from --state */ | |||
QUERY_FOR_DOCS = (1 << 25), /*!< query: from --docfiles */ | QUERY_FOR_DOCS = (1 << 25), /*!< query: from --docfiles */ | |||
QUERY_FOR_CONFIG = (1 << 26), /*!< query: from --configfiles */ | QUERY_FOR_CONFIG = (1 << 26), /*!< query: from --configfiles */ | |||
QUERY_FOR_DUMPFILES = (1 << 27) /*!< query: from --dump */ | QUERY_FOR_DUMPFILES = (1 << 27) /*!< query: from --dump */ | |||
} rpmQueryFlags; | } rpmQueryFlags; | |||
#define _QUERY_FOR_BITS \ | ||||
(QUERY_FOR_LIST|QUERY_FOR_STATE|QUERY_FOR_DOCS|QUERY_FOR_CONFIG|\ | ||||
QUERY_FOR_DUMPFILES) | ||||
/** \ingroup rpmcli | ||||
* Bit(s) from common command line options. | ||||
*/ | ||||
/*@unchecked@*/ | ||||
extern rpmQueryFlags rpmcliQueryFlags; | ||||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
* Bit(s) to control rpmVerify() operation, stored in qva_flags. | * Bit(s) to control rpmVerify() operation, stored in qva_flags. | |||
* @todo Merge rpmQueryFlags, rpmVerifyFlags, and rpmVerifyAttrs values?. | * @todo Merge rpmQueryFlags, rpmVerifyFlags, and rpmVerifyAttrs values?. | |||
*/ | */ | |||
typedef enum rpmVerifyFlags_e { | typedef enum rpmVerifyFlags_e { | |||
/*@-enummemuse@*/ | /*@-enummemuse@*/ | |||
VERIFY_DEFAULT = 0, /*!< */ | VERIFY_DEFAULT = 0, /*!< */ | |||
/*@=enummemuse@*/ | /*@=enummemuse@*/ | |||
VERIFY_MD5 = (1 << 0), /*!< from --nomd5 */ | VERIFY_FDIGEST = (1 << 0), /*!< from --nofdigest */ | |||
VERIFY_SIZE = (1 << 1), /*!< from --nosize */ | VERIFY_SIZE = (1 << 1), /*!< from --nosize */ | |||
VERIFY_LINKTO = (1 << 2), /*!< from --nolinkto */ | VERIFY_LINKTO = (1 << 2), /*!< from --nolinkto */ | |||
VERIFY_USER = (1 << 3), /*!< from --nouser */ | VERIFY_USER = (1 << 3), /*!< from --nouser */ | |||
VERIFY_GROUP = (1 << 4), /*!< from --nogroup */ | VERIFY_GROUP = (1 << 4), /*!< from --nogroup */ | |||
VERIFY_MTIME = (1 << 5), /*!< from --nomtime */ | VERIFY_MTIME = (1 << 5), /*!< from --nomtime */ | |||
VERIFY_MODE = (1 << 6), /*!< from --nomode */ | VERIFY_MODE = (1 << 6), /*!< from --nomode */ | |||
VERIFY_RDEV = (1 << 7), /*!< from --nodev */ | VERIFY_RDEV = (1 << 7), /*!< from --nodev */ | |||
/* bits 8-15 unused, reserved for rpmVerifyAttrs */ | /* bits 8-14 unused, reserved for rpmVerifyAttrs */ | |||
VERIFY_CONTEXTS = (1 << 15), /*!< verify: from --nocontexts */ | ||||
VERIFY_FILES = (1 << 16), /*!< verify: from --nofiles */ | VERIFY_FILES = (1 << 16), /*!< verify: from --nofiles */ | |||
VERIFY_DEPS = (1 << 17), /*!< verify: from --nodeps * / | VERIFY_DEPS = (1 << 17), /*!< verify: from --nodeps * / | |||
VERIFY_SCRIPT = (1 << 18), /*!< verify: from --noscripts */ | VERIFY_SCRIPT = (1 << 18), /*!< verify: from --noscripts */ | |||
VERIFY_DIGEST = (1 << 19), /*!< verify: from --nodigest */ | VERIFY_DIGEST = (1 << 19), /*!< verify: from --nodigest */ | |||
/* bits 20-22 unused */ | VERIFY_SIGNATURE = (1 << 20), /*!< verify: from --nosignature */ | |||
VERIFY_PATCHES = (1 << 21), /*!< verify: from --nopatches */ | ||||
VERIFY_HDRCHK = (1 << 22), /*!< verify: from --nohdrchk */ | ||||
/*@-enummemuse@*/ | /*@-enummemuse@*/ | |||
VERIFY_FOR_LIST = (1 << 23), /*!< query: from --list */ | VERIFY_FOR_LIST = (1 << 23), /*!< query: from --list */ | |||
VERIFY_FOR_STATE = (1 << 24), /*!< query: from --state */ | VERIFY_FOR_STATE = (1 << 24), /*!< query: from --state */ | |||
VERIFY_FOR_DOCS = (1 << 25), /*!< query: from --docfiles */ | VERIFY_FOR_DOCS = (1 << 25), /*!< query: from --docfiles */ | |||
VERIFY_FOR_CONFIG = (1 << 26), /*!< query: from --configfiles */ | VERIFY_FOR_CONFIG = (1 << 26), /*!< query: from --configfiles */ | |||
VERIFY_FOR_DUMPFILES= (1 << 27) /*!< query: from --dump */ | VERIFY_FOR_DUMPFILES= (1 << 27) /*!< query: from --dump */ | |||
/*@=enummemuse@*/ | /*@=enummemuse@*/ | |||
/* bits 28-30 used in rpmVerifyAttrs */ | /* bits 28-31 used in rpmVerifyAttrs */ | |||
} rpmVerifyFlags; | } rpmVerifyFlags; | |||
#define VERIFY_ATTRS \ | #define VERIFY_ATTRS \ | |||
( VERIFY_MD5 | VERIFY_SIZE | VERIFY_LINKTO | VERIFY_USER | VERIFY_GROUP | | ( VERIFY_FDIGEST | VERIFY_SIZE | VERIFY_LINKTO | VERIFY_USER | VERIFY_GRO | |||
\ | UP | \ | |||
VERIFY_MTIME | VERIFY_MODE | VERIFY_RDEV ) | VERIFY_MTIME | VERIFY_MODE | VERIFY_RDEV | VERIFY_CONTEXTS ) | |||
#define VERIFY_ALL \ | #define VERIFY_ALL \ | |||
( VERIFY_ATTRS | VERIFY_FILES | VERIFY_DEPS | VERIFY_SCRIPT | VERIFY_DIGE | ( VERIFY_ATTRS | VERIFY_FILES | VERIFY_DEPS | VERIFY_SCRIPT | VERIFY_DIGE | |||
ST ) | ST |\ | |||
VERIFY_SIGNATURE | VERIFY_HDRCHK ) | ||||
/** \ingroup rpmcli | ||||
*/ | ||||
typedef struct rpmQVKArguments_s * QVA_t; | ||||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
* Function to display iterator matches. | ||||
* | ||||
* @param qva parsed query/verify options | * @param qva parsed query/verify options | |||
* @param db rpm database | * @param ts transaction set | |||
* @param h header to use for query/verify | * @param h header to use for query/verify | |||
* @return 0 on success | ||||
*/ | */ | |||
typedef int (*QVF_t) (QVA_t qva, rpmdb db, Header h) | typedef int (*QVF_t) (QVA_t qva, rpmts ts, Header h) | |||
/*@globals fileSystem @*/ | /*@globals fileSystem @*/ | |||
/*@modifies db, fileSystem @*/; | /*@modifies qva, ts, fileSystem @*/; | |||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
* Display query/verify information for each header in iterator. | * Function to query spec file. | |||
* | ||||
* @param ts transaction set | ||||
* @param qva parsed query/verify options | * @param qva parsed query/verify options | |||
* @param mi rpm database iterator | * @param arg query argument | |||
* @param showPackage query/verify display routine | * @return 0 on success | |||
* @return result of last non-zero showPackage() return | ||||
*/ | */ | |||
int showMatches(QVA_t qva, /*@only@*/ /*@null@*/ rpmdbMatchIterator mi, | typedef int (*QSpecF_t) (rpmts ts, QVA_t qva, const char * arg) | |||
QVF_t showPackage) | /*@globals rpmGlobalMacroContext, h_errno, | |||
/*@modifies mi @*/; | fileSystem, internalState @*/ | |||
/*@modifies ts, qva, rpmGlobalMacroContext, | ||||
fileSystem, internalState @*/; | ||||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
* Display list of tags that can be used in --queryformat. | ||||
* @param fp file handle to use for display | ||||
*/ | */ | |||
void rpmDisplayQueryTags(FILE * fp) | /*@unchecked@*/ | |||
/*@globals fileSystem @*/ | extern struct poptOption rpmQVSourcePoptTable[]; | |||
/*@modifies *fp, fileSystem @*/; | ||||
/** \ingroup rpmcli | ||||
*/ | ||||
/*@unchecked@*/ | ||||
extern int specedit; | ||||
/** \ingroup rpmcli | ||||
*/ | ||||
/*@unchecked@*/ | ||||
extern struct poptOption rpmQueryPoptTable[]; | ||||
/** \ingroup rpmcli | ||||
*/ | ||||
/*@unchecked@*/ | ||||
extern struct poptOption rpmVerifyPoptTable[]; | ||||
/** \ingroup rpmcli | ||||
* Display query/verify information for each header in iterator. | ||||
* | ||||
* This routine uses: | ||||
* - qva->qva_mi rpm database iterator | ||||
* - qva->qva_showPackage query/verify display routine | ||||
* | ||||
* @param qva parsed query/verify options | ||||
* @param ts transaction set | ||||
* @return result of last non-zero showPackage() return | ||||
*/ | ||||
int rpmcliShowMatches(QVA_t qva, rpmts ts) | ||||
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | ||||
@*/ | ||||
/*@modifies qva, rpmGlobalMacroContext, fileSystem, internalState @* | ||||
/; | ||||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
* Common query/verify source interface, called once for each CLI arg. | * Common query/verify source interface, called once for each CLI arg. | |||
* | ||||
* This routine uses: | ||||
* - qva->qva_mi rpm database iterator | ||||
* - qva->qva_showPackage query/verify display routine | ||||
* | ||||
* @param qva parsed query/verify options | * @param qva parsed query/verify options | |||
* @param source type of source to query/verify | * @param ts transaction set | |||
* @param arg name of source to query/verify | * @param arg name of source to query/verify | |||
* @param db rpm database | ||||
* @param showPackage query/verify specific display routine | ||||
* @return showPackage() result, 1 if rpmdbInitIterator() is NU LL | * @return showPackage() result, 1 if rpmdbInitIterator() is NU LL | |||
*/ | */ | |||
int rpmQueryVerify(QVA_t qva, rpmQVSources source, const char * arg, | int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg) | |||
rpmdb db, QVF_t showPackage) | /*@globals rpmGlobalMacroContext, h_errno, | |||
/*@globals rpmGlobalMacroContext, fileSystem @*/ | fileSystem, internalState @*/ | |||
/*@modifies db, rpmGlobalMacroContext, fileSystem @*/; | /*@modifies qva, ts, rpmGlobalMacroContext, | |||
fileSystem, internalState @*/; | ||||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
* Display results of package query. | * Display results of package query. | |||
* @todo Devise a meaningful return code. | * @todo Devise a meaningful return code. | |||
* @param qva parsed query/verify options | * @param qva parsed query/verify options | |||
* @param db rpm database (unused for queries) | * @param ts transaction set | |||
* @param h header to use for query | * @param h header to use for query | |||
* @return 0 always | * @return 0 always | |||
*/ | */ | |||
int showQueryPackage(QVA_t qva, rpmdb db, Header h) | int showQueryPackage(QVA_t qva, rpmts ts, Header h) | |||
/*@globals fileSystem @*/ | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | |||
/*@modifies db, fileSystem @*/; | @*/ | |||
/*@modifies ts, h, rpmGlobalMacroContext, fileSystem, internalState | ||||
@*/; | ||||
/** \ingroup rpmcli | ||||
* Iterate over query/verify arg list. | ||||
* @param ts transaction set | ||||
* @param qva parsed query/verify options | ||||
* @param argv query argument(s) (or NULL) | ||||
* @return 0 on success, else no. of failures | ||||
*/ | ||||
int rpmcliArgIter(rpmts ts, QVA_t qva, /*@null@*/ ARGV_t argv) | ||||
/*@globals rpmGlobalMacroContext, h_errno, | ||||
fileSystem, internalState @*/ | ||||
/*@modifies ts, qva, rpmGlobalMacroContext, | ||||
fileSystem, internalState @*/; | ||||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
* Display package information. | * Display package information. | |||
* @todo hack: RPMQV_ALL can pass char ** arglist = NULL, not char * arg. U nion? | * @todo hack: RPMQV_ALL can pass char ** arglist = NULL, not char * arg. U nion? | |||
* @param ts transaction set | ||||
* @param qva parsed query/verify options | * @param qva parsed query/verify options | |||
* @param source type of source to query | * @param argv query argument(s) (or NULL) | |||
* @param arg name of source to query | * @return 0 on success, else no. of failures | |||
* @return rpmQueryVerify() result, or 1 on rpmdbOpen() failure | ||||
*/ | */ | |||
int rpmQuery(QVA_t qva, rpmQVSources source, const char * arg) | int rpmcliQuery(rpmts ts, QVA_t qva, /*@null@*/ const char ** argv) | |||
/*@globals rpmGlobalMacroContext, fileSystem @*/ | /*@globals rpmGlobalMacroContext, h_errno, | |||
/*@modifies rpmGlobalMacroContext, fileSystem @*/; | fileSystem, internalState @*/ | |||
/*@modifies ts, qva, rpmGlobalMacroContext, | ||||
fileSystem, internalState @*/; | ||||
/** \ingroup rpmcli | ||||
* Verify file attributes (including file digest). | ||||
* @todo gnorpm and python bindings prevent this from being static. | ||||
* @param ts transaction set | ||||
* @param fi file info (with linked header and current file index | ||||
) | ||||
* @retval *res bit(s) returned to indicate failure | ||||
* @param omitMask bit(s) to disable verify checks | ||||
* @return 0 on success (or not installed), 1 on error | ||||
*/ | ||||
/*@-incondefs@*/ | ||||
int rpmVerifyFile(const rpmts ts, rpmfi fi, | ||||
/*@out@*/ rpmVerifyAttrs * res, rpmVerifyAttrs omitMask) | ||||
/*@globals h_errno, fileSystem, internalState @*/ | ||||
/*@modifies ts, fi, *res, fileSystem, internalState @*/ | ||||
/*@requires maxSet(res) >= 0 @*/; | ||||
/*@=incondefs@*/ | ||||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
* Display results of package verify. | * Display results of package verify. | |||
* @param qva parsed query/verify options | * @param qva parsed query/verify options | |||
* @param db rpm database | * @param ts transaction set | |||
* @param h header to use for verify | * @param h header to use for verify | |||
* @return result of last non-zero verify return | * @return result of last non-zero verify return | |||
*/ | */ | |||
int showVerifyPackage(QVA_t qva, /*@only@*/ rpmdb db, Header h) | int showVerifyPackage(QVA_t qva, rpmts ts, Header h) | |||
/*@globals rpmGlobalMacroContext, fileSystem @*/ | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | |||
/*@modifies db, h, rpmGlobalMacroContext, fileSystem @*/; | @*/ | |||
/*@modifies ts, h, rpmGlobalMacroContext, fileSystem, internalState | ||||
@*/; | ||||
/** | /** | |||
* Check original header digest. | * Check package and header signatures. | |||
* @todo Make digest check part of rpmdb iterator. | * @param qva parsed query/verify options | |||
* @param h header | * @param ts transaction set | |||
* @return 0 on success (or unavailable), 1 on digest mismatch | * @param fd package file handle | |||
* @param fn package file name | ||||
* @return 0 on success, 1 on failure | ||||
*/ | */ | |||
int rpmVerifyDigest(Header h) | int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, const char * fn) | |||
/*@modifies nothing @*/; | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | |||
@*/ | ||||
/*@modifies qva, ts, fd, rpmGlobalMacroContext, h_errno, | ||||
fileSystem, internalState @*/; | ||||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
* Verify package install. | * Verify package install. | |||
* @todo hack: RPMQV_ALL can pass char ** arglist = NULL, not char * arg. U | ||||
nion? | ||||
* @param ts transaction set | ||||
* @param qva parsed query/verify options | * @param qva parsed query/verify options | |||
* @param source type of source to verify | * @param argv verify argument(s) (or NULL) | |||
* @param arg name of source to verify | * @return 0 on success, else no. of failures | |||
* @return rpmQueryVerify() result, or 1 on rpmdbOpen() failure | ||||
*/ | */ | |||
int rpmVerify(QVA_t qva, rpmQVSources source, const char *arg) | int rpmcliVerify(rpmts ts, QVA_t qva, /*@null@*/ const char ** argv) | |||
/*@globals rpmGlobalMacroContext, fileSystem @*/ | /*@globals rpmGlobalMacroContext, h_errno, | |||
/*@modifies rpmGlobalMacroContext, fileSystem @*/; | fileSystem, internalState @*/ | |||
/*@modifies ts, qva, rpmGlobalMacroContext, | ||||
fileSystem, internalState @*/; | ||||
/** \ingroup rpmcli | /*@}*/ | |||
* Describe query/verify command line request. | /* ==================================================================== */ | |||
*/ | /** \name RPMEIU */ | |||
struct rpmQVArguments_s { | /*@{*/ | |||
rpmQVSources qva_source; /*!< Identify CLI arg type. */ | /* --- install/upgrade/erase modes */ | |||
int qva_sourceCount;/*!< Exclusive check (>1 is error). */ | ||||
rpmQueryFlags qva_flags; /*!< Bit(s) to control operation. */ | ||||
rpmfileAttrs qva_fflags; /*!< Bit(s) to filter on attribute. */ | ||||
/*@unused@*/ | ||||
int qva_verbose; /*!< (unused) */ | ||||
/*@only@*/ /*@null@*/ | ||||
const char * qva_queryFormat; /*!< Format for headerSprintf(). */ | ||||
/*@observer@*/ /*@null@*/ | ||||
const char * qva_prefix; /*!< Path to top of install tree. */ | ||||
char qva_mode; /*!< 'q' is query, 'v' is verify mode. */ | ||||
char qva_char; /*!< (unused) always ' ' */ | ||||
}; | ||||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
* Bit(s) to control rpmcliInstall() and rpmErase() operation. | ||||
*/ | */ | |||
typedef enum rpmInstallInterfaceFlags_e { | ||||
INSTALL_NONE = 0, | ||||
INSTALL_PERCENT = (1 << 0), /*!< from --percent */ | ||||
INSTALL_HASH = (1 << 1), /*!< from --hash */ | ||||
INSTALL_NODEPS = (1 << 2), /*!< from --nodeps */ | ||||
INSTALL_NOORDER = (1 << 3), /*!< from --noorder */ | ||||
INSTALL_LABEL = (1 << 4), /*!< from --verbose (notify) */ | ||||
INSTALL_UPGRADE = (1 << 5), /*!< from --upgrade */ | ||||
INSTALL_FRESHEN = (1 << 6), /*!< from --freshen */ | ||||
INSTALL_INSTALL = (1 << 7), /*!< from --install */ | ||||
INSTALL_ERASE = (1 << 8), /*!< from --erase */ | ||||
INSTALL_ALLMATCHES = (1 << 9) /*!< from --allmatches (erase) */ | ||||
} rpmInstallInterfaceFlags; | ||||
/*@-redecl@*/ | ||||
/*@unchecked@*/ | /*@unchecked@*/ | |||
extern struct rpmQVArguments_s rpmQVArgs; | extern int rpmcliPackagesTotal; | |||
/*@=redecl@*/ | ||||
/*@unchecked@*/ | ||||
extern int rpmcliHashesCurrent; | ||||
/*@unchecked@*/ | ||||
extern int rpmcliHashesTotal; | ||||
/*@unchecked@*/ | ||||
extern uint64_t rpmcliProgressCurrent; | ||||
/*@unchecked@*/ | ||||
extern uint64_t rpmcliProgressTotal; | ||||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
* The rpm CLI generic transaction callback handler. | ||||
* @todo Remove headerSprintf() from the progress callback. | ||||
* @warning This function's args have changed, so the function cannot be | ||||
* used portably | ||||
* @deprecated Transaction callback arguments need to change, so don't rely | ||||
on | ||||
* this routine in the rpmcli API. | ||||
* | ||||
* @param arg per-callback private data (e.g. an rpm header) | ||||
* @param what callback identifier | ||||
* @param amount per-callback progress info | ||||
* @param total per-callback progress info | ||||
* @param key opaque header key (e.g. file name or PyObject) | ||||
* @param data private data (e.g. rpmInstallInterfaceFlags) | ||||
* @return per-callback data (e.g. an opened FD_t) | ||||
*/ | */ | |||
/*@unchecked@*/ | /*@null@*/ | |||
extern struct poptOption rpmQVSourcePoptTable[]; | void * rpmShowProgress(/*@null@*/ const void * arg, | |||
const rpmCallbackType what, | ||||
const uint64_t amount, | ||||
const uint64_t total, | ||||
/*@null@*/ fnpyKey key, | ||||
/*@null@*/ void * data) | ||||
/*@globals rpmcliHashesCurrent, | ||||
rpmcliProgressCurrent, rpmcliProgressTotal, | ||||
h_errno, fileSystem, internalState @*/ | ||||
/*@modifies rpmcliHashesCurrent, | ||||
rpmcliProgressCurrent, rpmcliProgressTotal, | ||||
fileSystem, internalState @*/; | ||||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
* Install source rpm package. | ||||
* @param ts transaction set | ||||
* @param arg source rpm file name | ||||
* @retval *specFilePtr (installed) spec file name | ||||
* @retval *cookie | ||||
* @return 0 on success | ||||
*/ | */ | |||
/*@unchecked@*/ | int rpmInstallSource(rpmts ts, const char * arg, | |||
extern int specedit; | /*@null@*/ /*@out@*/ const char ** specFilePtr, | |||
/*@null@*/ /*@out@*/ const char ** cookie) | ||||
/*@globals rpmGlobalMacroContext, h_errno, | ||||
fileSystem, internalState@*/ | ||||
/*@modifies ts, *specFilePtr, *cookie, rpmGlobalMacroContext, | ||||
fileSystem, internalState @*/; | ||||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
* Report package problems (if any). | ||||
* @param ts transaction set | ||||
* @param msg problem context string to display | ||||
* @param rc result of a tranbsaction operation | ||||
* @return no. of (added) packages | ||||
*/ | */ | |||
/*@unchecked@*/ | int rpmcliInstallProblems(rpmts ts, /*@null@*/ const char * msg, int rc) | |||
extern struct poptOption rpmQueryPoptTable[]; | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | |||
@*/ | ||||
/*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/ | ||||
; | ||||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
* Report packages(if any) that satisfy unresolved dependencies. | ||||
* @param ts transaction set | ||||
* @return 0 always | ||||
*/ | */ | |||
/*@unchecked@*/ | int rpmcliInstallSuggests(rpmts ts) | |||
extern struct poptOption rpmVerifyPoptTable[]; | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | |||
@*/ | ||||
/*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/ | ||||
; | ||||
/*@}*/ | /** \ingroup rpmcli | |||
/* ==================================================================== */ | * Check package element dependencies in a transaction set, reporting probl | |||
/** \name RPMEIU */ | ems. | |||
/*@{*/ | * @param ts transaction set | |||
/* --- install/upgrade/erase modes */ | * @return no. of (added) packages | |||
*/ | ||||
int rpmcliInstallCheck(rpmts ts) | ||||
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | ||||
@*/ | ||||
/*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/ | ||||
; | ||||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
* Install/upgrade/freshen binary rpm package. | * Order package elements in a transaction set, reporting problems. | |||
* @param rootdir path to top of install tree | * @param ts transaction set | |||
* @param fileArgv array of package file names (NULL terminated) | * @return no. of (added) packages | |||
* @param transFlags bits to control rpmRunTransactions() | ||||
* @param interfaceFlags bits to control rpmInstall() | ||||
* @param probFilter bits to filter problem types | ||||
* @param relocations package file relocations | ||||
* @return 0 on success | ||||
*/ | */ | |||
int rpmInstall(/*@null@*/ const char * rootdir, | int rpmcliInstallOrder(rpmts ts) | |||
/*@null@*/ const char ** fileArgv, | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | |||
rpmtransFlags transFlags, | @*/ | |||
rpmInstallInterfaceFlags interfaceFlags, | /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/ | |||
rpmprobFilterFlags probFilter, | ; | |||
/*@null@*/ rpmRelocation * relocations) | ||||
/*@globals rpmGlobalMacroContext, fileSystem @*/ | ||||
/*@modifies *relocations, rpmGlobalMacroContext, fileSystem @*/; | ||||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
* Install source rpm package. | * Install/erase package elements in a transaction set, reporting problems. | |||
* @param rootdir path to top of install tree | * @param ts transaction set | |||
* @param arg source rpm file name | * @param okProbs previously known problems (or NULL) | |||
* @retval specFile address of (installed) spec file name | * @param ignoreSet bits to filter problem types | |||
* @retval cookie | * @return 0 on success, -1 on error, >0 no, of failed elements | |||
* @return 0 on success | ||||
*/ | */ | |||
int rpmInstallSource(const char * rootdir, const char * arg, | int rpmcliInstallRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet) | |||
/*@null@*/ /*@out@*/ const char ** specFile, | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | |||
/*@null@*/ /*@out@*/ char ** cookie) | @*/ | |||
/*@globals fileSystem @*/ | /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/ | |||
/*@modifies *specFile, *cookie, fileSystem @*/; | ; | |||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
* Erase binary rpm package. | * Install/upgrade/freshen binary rpm package. | |||
* @param rootdir path to top of install tree | * @todo Use rpmdsCompare rather than rpmVersionCompare. | |||
* @param ts transaction set | ||||
* @param ia mode flags and parameters | ||||
* @param argv array of package file names (NULL terminated) | * @param argv array of package file names (NULL terminated) | |||
* @param transFlags bits to control rpmRunTransactions() | ||||
* @param interfaceFlags bits to control rpmInstall() | ||||
* @return 0 on success | * @return 0 on success | |||
*/ | */ | |||
int rpmErase(/*@null@*/ const char * rootdir, /*@null@*/ const char ** argv | int rpmcliInstall(rpmts ts, QVA_t ia, /*@null@*/ const char ** argv) | |||
, | /*@globals rpmcliPackagesTotal, rpmGlobalMacroContext, h_errno, | |||
rpmtransFlags transFlags, | fileSystem, internalState@*/ | |||
rpmEraseInterfaceFlags interfaceFlags) | /*@modifies ts, ia, rpmcliPackagesTotal, rpmGlobalMacroContext, | |||
/*@globals rpmGlobalMacroContext, fileSystem @*/ | fileSystem, internalState @*/; | |||
/*@modifies rpmGlobalMacroContext, fileSystem @*/; | ||||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
* Describe database command line requests. | * Erase binary rpm package. | |||
* @param ts transaction set | ||||
* @param ia control args/bits | ||||
* @param argv array of package names (NULL terminated) | ||||
* @return 0 on success | ||||
*/ | */ | |||
struct rpmInstallArguments_s { | int rpmErase(rpmts ts, QVA_t ia, /*@null@*/ const char ** argv) | |||
rpmtransFlags transFlags; | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | |||
rpmprobFilterFlags probFilter; | @*/ | |||
rpmInstallInterfaceFlags installInterfaceFlags; | /*@modifies ts, ia, rpmGlobalMacroContext, | |||
rpmEraseInterfaceFlags eraseInterfaceFlags; | fileSystem, internalState @*/; | |||
/*@only@*/ /*@null@*/ | ||||
rpmRelocation * relocations; | ||||
int numRelocations; | ||||
int noDeps; | ||||
int incldocs; | ||||
/*@null@*/ | ||||
const char * prefix; | ||||
/*@observer@*/ /*@null@*/ | ||||
const char * rootdir; | ||||
uint_32 rbtid; /*!< from --rollback */ | ||||
}; | ||||
/** | /** | |||
* A rollback transaction id element. | * A rollback transaction id element. | |||
*/ | */ | |||
typedef /*@abstract@*/ struct IDT_s { | /*@-fielduse@*/ | |||
typedef /*@abstract@*/ struct IDT_s * IDT; | ||||
#if !defined(SWIG) | ||||
struct IDT_s { | ||||
int done; /*!< package processed? */ | ||||
unsigned int instance; /*!< installed package transaction id. */ | unsigned int instance; /*!< installed package transaction id. */ | |||
/*@owned@*/ /*@null@*/ | /*@owned@*/ /*@null@*/ | |||
const char * key; /*! removed package file name. */ | const char * key; /*! removed package file name. */ | |||
Header h; /*!< removed package header. */ | Header h; /*!< removed package header. */ | |||
const char * n; /*!< package name. */ | ||||
const char * v; /*!< package version. */ | ||||
const char * r; /*!< package release. */ | ||||
union { | union { | |||
uint_32 u32; /*!< install/remove transaction id */ | uint32_t u32; /*!< install/remove transaction id */ | |||
} val; | } val; | |||
} * IDT; | }; | |||
#endif | ||||
/*@=fielduse@*/ | ||||
/** | /** | |||
* A rollback transaction id index. | * A rollback transaction id index. | |||
*/ | */ | |||
typedef /*@abstract@*/ struct IDTindex_s { | typedef /*@abstract@*/ struct IDTindex_s * IDTX; | |||
#if !defined(SWIG) | ||||
struct IDTindex_s { | ||||
int delta; /*!< no. elements to realloc as a chunk. */ | int delta; /*!< no. elements to realloc as a chunk. */ | |||
int size; /*!< size of id index element. */ | int size; /*!< size of id index element. */ | |||
int alloced; /*!< current number of elements allocated. * / | int alloced; /*!< current number of elements allocated. * / | |||
int nidt; /*!< current number of elements initialized. */ | int nidt; /*!< current number of elements initialized. */ | |||
/*@only@*/ /*@null@*/ | /*@only@*/ /*@null@*/ | |||
IDT idt; /*!< id index elements. */ | IDT idt; /*!< id index elements. */ | |||
} * IDTX; | }; | |||
#endif | ||||
/** | /** | |||
* Destroy id index. | * Destroy id index. | |||
* @param idtx id index | * @param idtx id index | |||
* @return NULL always | * @return NULL always | |||
*/ | */ | |||
/*@null@*/ IDTX IDTXfree(/*@only@*/ /*@null@*/ IDTX idtx) | /*@null@*/ | |||
IDTX IDTXfree(/*@only@*/ /*@null@*/ IDTX idtx) | ||||
/*@modifies idtx @*/; | /*@modifies idtx @*/; | |||
/** | /** | |||
* Create id index. | * Create id index. | |||
* @return new id index | * @return new id index | |||
*/ | */ | |||
/*@only@*/ IDTX IDTXnew(void) | /*@only@*/ | |||
IDTX IDTXnew(void) | ||||
/*@*/; | /*@*/; | |||
/** | /** | |||
* Insure that index has room for "need" elements. | * Insure that index has room for "need" elements. | |||
* @param idtx id index | * @param idtx id index | |||
* @param need additional no. of elements needed | * @param need additional no. of elements needed | |||
* @return id index (with room for "need" elements) | * @return id index (with room for "need" elements) | |||
*/ | */ | |||
/*@only@*/ /*@null@*/ IDTX IDTXgrow(/*@only@*/ /*@null@*/ IDTX idtx, int ne | /*@only@*/ /*@null@*/ | |||
ed) | IDTX IDTXgrow(/*@only@*/ /*@null@*/ IDTX idtx, int need) | |||
/*@modifies idtx @*/; | /*@modifies idtx @*/; | |||
/** | /** | |||
* Sort tag (instance,value) pairs. | * Sort tag (instance,value) pairs. | |||
* @param idtx id index | * @param idtx id index | |||
* @return id index | * @return id index | |||
*/ | */ | |||
/*@only@*/ /*@null@*/ IDTX IDTXsort(/*@only@*/ /*@null@*/ IDTX idtx) | /*@only@*/ /*@null@*/ | |||
IDTX IDTXsort(/*@only@*/ /*@null@*/ IDTX idtx) | ||||
/*@modifies idtx @*/; | /*@modifies idtx @*/; | |||
/** | /** | |||
* Load tag (instance,value) pairs from rpm databse, and return sorted id i ndex. | * Load tag (instance,value) pairs from rpm databse, and return sorted id i ndex. | |||
* @param db rpm database | * @param ts transaction set | |||
* @param tag rpm tag | * @param tag rpm tag | |||
* @param rbtid rollback goal | ||||
* @return id index | * @return id index | |||
*/ | */ | |||
/*@only@*/ /*@null@*/ IDTX IDTXload(rpmdb db, rpmTag tag) | /*@only@*/ /*@null@*/ | |||
/*@modifies db @*/; | IDTX IDTXload(rpmts ts, rpmTag tag, uint32_t rbtid) | |||
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | ||||
@*/ | ||||
/*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @* | ||||
/; | ||||
/** | /** | |||
* Load tag (instance,value) pairs from packages, and return sorted id inde x. | * Load tag (instance,value) pairs from packages, and return sorted id inde x. | |||
* @param db glob expression | * @param ts transaction set | |||
* @param globstr glob expression | ||||
* @param tag rpm tag | * @param tag rpm tag | |||
* @param rbtid rollback goal | ||||
* @return id index | * @return id index | |||
*/ | */ | |||
/*@only@*/ /*@null@*/ IDTX IDTXglob(const char * globstr, rpmTag tag) | /*@only@*/ /*@null@*/ | |||
/*@globals fileSystem @*/ | IDTX IDTXglob(rpmts ts, const char * globstr, rpmTag tag, uint32_t rbtid) | |||
/*@modifies fileSystem @*/; | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | |||
@*/ | ||||
/** | /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/ | |||
* The rpm CLI generic transaction callback. | ; | |||
* @deprecated Transaction callback arguments need to change, so don't rely | ||||
on | ||||
* this routine in the rpmcli API. | ||||
* | ||||
* @param arg per-callback private data (e.g. an rpm header) | ||||
* @param what callback identifier | ||||
* @param amount per-callback progress info | ||||
* @param total per-callback progress info | ||||
* @param pkgkey opaque header key (e.g. file name or PyObject) | ||||
* @param data private data (e.g. rpmInstallInterfaceFlags) | ||||
* @return per-callback data (e.g. an opened FD_t) | ||||
*/ | ||||
/*@null@*/ void * rpmShowProgress(/*@null@*/ const void * arg, | ||||
const rpmCallbackType what, | ||||
const unsigned long amount, | ||||
const unsigned long total, | ||||
/*@null@*/ const void * pkgKey, | ||||
/*@null@*/ void * data) | ||||
/*@globals internalState, fileSystem @*/ | ||||
/*@modifies internalState, fileSystem @*/; | ||||
/*@unchecked@*/ | ||||
extern int packagesTotal; | ||||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
* Rollback transactions, erasing new, reinstalling old, package(s). | * Rollback transactions, erasing new, reinstalling old, package(s). | |||
* @param ts transaction set | ||||
* @param ia mode flags and parameters | ||||
* @param argv array of arguments (NULL terminated) | ||||
* @return 0 on success | * @return 0 on success | |||
*/ | */ | |||
int rpmRollback(struct rpmInstallArguments_s * ia, | int rpmRollback(rpmts ts, QVA_t ia, /*@null@*/ const char ** argv) | |||
/*@null@*/ const char ** argv) | /*@globals rpmcliPackagesTotal, rpmGlobalMacroContext, h_errno, | |||
/*@globals rpmGlobalMacroContext, fileSystem @*/ | fileSystem, internalState @*/ | |||
/*@modifies rpmGlobalMacroContext, fileSystem @*/; | /*@modifies ts, ia, rpmcliPackagesTotal, rpmGlobalMacroContext, | |||
fileSystem, internalState @*/; | ||||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
*/ | */ | |||
/*@unchecked@*/ | /*@unchecked@*/ | |||
extern struct rpmInstallArguments_s rpmIArgs; | extern struct poptOption rpmInstallPoptTable[]; | |||
/*@}*/ | ||||
/* ==================================================================== */ | ||||
/** \name RPMDB */ | ||||
/*@{*/ | ||||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
*/ | */ | |||
/*@unchecked@*/ | /*@unchecked@*/ | |||
extern struct poptOption rpmInstallPoptTable[]; | extern struct poptOption rpmDatabasePoptTable[]; | |||
/*@}*/ | /*@}*/ | |||
/* ==================================================================== */ | /* ==================================================================== */ | |||
/** \name RPMDB */ | /** \name RPMK */ | |||
/*@{*/ | /*@{*/ | |||
/* --- database modes */ | ||||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
* Describe database command line requests. | * Import public key packet(s). | |||
* @todo Implicit --update policy for gpg-pubkey headers. | ||||
* @param ts transaction set | ||||
* @param pkt pgp pubkey packet(s) | ||||
* @param pktlen pgp pubkey length | ||||
* @return RPMRC_OK/RPMRC_FAIL | ||||
*/ | */ | |||
struct rpmDatabaseArguments_s { | rpmRC rpmcliImportPubkey(const rpmts ts, | |||
int init; /*!< from --initdb */ | const unsigned char * pkt, ssize_t pktlen) | |||
int rebuild; /*!< from --rebuilddb */ | /*@globals RPMVERSION, rpmGlobalMacroContext, h_errno, | |||
int verify; /*!< from --verifydb */ | fileSystem, internalState @*/ | |||
}; | /*@modifies ts, rpmGlobalMacroContext, | |||
fileSystem, internalState @*/; | ||||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
* Bit(s) to control rpmReSign() operation. | ||||
*/ | */ | |||
/*@unchecked@*/ | /*@-typeuse@*/ | |||
extern struct rpmDatabaseArguments_s rpmDBArgs; | #if !defined(SWIG) | |||
typedef enum rpmSignFlags_e { | ||||
RPMSIGN_NONE = 0, | ||||
RPMSIGN_CHK_SIGNATURE = 'K', /*!< from --checksig */ | ||||
RPMSIGN_NEW_SIGNATURE = 'R', /*!< from --resign */ | ||||
RPMSIGN_ADD_SIGNATURE = 'A', /*!< from --addsign */ | ||||
RPMSIGN_DEL_SIGNATURE = 'D', /*!< from --delsign */ | ||||
RPMSIGN_IMPORT_PUBKEY = 'I', /*!< from --import */ | ||||
} rpmSignFlags; | ||||
#endif | ||||
/*@=typeuse@*/ | ||||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
*/ | */ | |||
/*@unchecked@*/ | /*@unchecked@*/ | |||
extern struct poptOption rpmDatabasePoptTable[]; | extern struct poptOption rpmSignPoptTable[]; | |||
/** \ingroup rpmcli | ||||
* Create/Modify/Check elements from signature header. | ||||
* @param ts transaction set | ||||
* @param qva mode flags and parameters | ||||
* @param argv array of arguments (NULL terminated) | ||||
* @return 0 on success | ||||
*/ | ||||
int rpmcliSign(rpmts ts, QVA_t qva, /*@null@*/ const char ** argv) | ||||
/*@globals RPMVERSION, rpmGlobalMacroContext, h_errno, | ||||
fileSystem, internalState @*/ | ||||
/*@modifies ts, qva, rpmGlobalMacroContext, | ||||
fileSystem, internalState @*/; | ||||
/*@}*/ | /*@}*/ | |||
/* ==================================================================== */ | ||||
/** \name RPMK */ | ||||
/*@{*/ | ||||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
* Bit(s) to control rpmCheckSig() operation. | * Command line option information. | |||
*/ | */ | |||
typedef enum rpmCheckSigFlags_e { | #if !defined(SWIG) | |||
/*@-enummemuse@*/ | struct rpmQVKArguments_s { | |||
CHECKSIG_NONE = 0, /*!< Don't check any signatures. */ | rpmQVSources qva_source; /*!< Identify CLI arg type. */ | |||
/*@=enummemuse@*/ | int qva_sourceCount;/*!< Exclusive option check (>1 is error). * | |||
CHECKSIG_PGP = (1 << 0), /*!< if not --nopgp */ | / | |||
CHECKSIG_MD5 = (1 << 1), /*!< if not --nomd5 */ | rpmQueryFlags qva_flags; /*!< Bit(s) to control operation. */ | |||
CHECKSIG_GPG = (1 << 2) /*!< if not --nogpg */ | rpmfileAttrs qva_fflags; /*!< Bit(s) to filter on attribute. */ | |||
} rpmCheckSigFlags; | /*@only@*/ /*@null@*/ | |||
#define CHECKSIG_ALL (CHECKSIG_PGP|CHECKSIG_MD5|CHECKSIG_GPG) | rpmdbMatchIterator qva_mi; /*!< Match iterator on selected headers. */ | |||
/*@refccounted@*/ /*@relnull@*/ | ||||
rpmgi qva_gi; /*!< Generalized iterator on args. */ | ||||
rpmRC qva_rc; /*!< Current return code. */ | ||||
/*@null@*/ | ||||
QVF_t qva_showPackage; /*!< Function to display iterator matches. * | ||||
/ | ||||
int qva_showOK; /*!< No. of successes. */ | ||||
int qva_showFAIL; /*!< No. of failures. */ | ||||
/*@null@*/ | ||||
QSpecF_t qva_specQuery; /*!< Function to query spec file. */ | ||||
/*@unused@*/ | ||||
int qva_verbose; /*!< (unused) */ | ||||
/*@only@*/ /*@null@*/ | ||||
const char * qva_queryFormat;/*!< Format for headerSprintf(). */ | ||||
int sign; /*!< Is a passphrase needed? */ | ||||
int trust; /*!< Trust metric when importing pubkeys. */ | ||||
/*@observer@*/ | ||||
const char * passPhrase; /*!< Pass phrase. */ | ||||
/*@owned@*/ /*@null@*/ | ||||
const char * qva_prefix; /*!< Path to top of install tree. */ | ||||
char qva_mode; | ||||
/*!< | ||||
- 'q' from --query, -q | ||||
- 'Q' from --querytags | ||||
- 'V' from --verify, -V | ||||
- 'A' from --addsign | ||||
- 'I' from --import | ||||
- 'K' from --checksig, -K | ||||
- 'R' from --resign | ||||
*/ | ||||
char qva_char; /*!< (unused) always ' ' */ | ||||
/* install/erase mode arguments */ | ||||
rpmdepFlags depFlags; | ||||
rpmtransFlags transFlags; | ||||
rpmprobFilterFlags probFilter; | ||||
rpmInstallInterfaceFlags installInterfaceFlags; | ||||
uint32_t arbtid; /*!< from --arbgoal */ | ||||
uint32_t rbtid; /*!< from --rollback */ | ||||
uint32_t *rbtidExcludes; /*!< from --rollback */ | ||||
int numrbtidExcludes; /*!< from --rollback */ | ||||
int numRelocations; | ||||
int noDeps; | ||||
int incldocs; | ||||
int no_rollback_links; | ||||
/*@owned@*/ /*@null@*/ | ||||
rpmRelocation relocations; | ||||
/* database mode arguments */ | ||||
int init; /*!< from --initdb */ | ||||
int rebuild; /*!< from --rebuilddb */ | ||||
int verify; /*!< from --verifydb */ | ||||
/* rollback vectors */ | ||||
int (*rbCheck) (rpmts ts); | ||||
int (*rbOrder) (rpmts ts); | ||||
int (*rbRun) (rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet); | ||||
}; | ||||
#endif | ||||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
* Check elements in signature header. | ||||
* @param flags bit(s) to enable signature checks | ||||
* @param argv array of package file names (NULL terminated) | ||||
* @return 0 on success | ||||
*/ | */ | |||
int rpmCheckSig(rpmCheckSigFlags flags, /*@null@*/ const char ** argv) | /*@unchecked@*/ | |||
/*@globals rpmGlobalMacroContext, fileSystem @*/ | extern struct rpmQVKArguments_s rpmQVKArgs; | |||
/*@modifies rpmGlobalMacroContext, fileSystem @*/; | ||||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
* Bit(s) to control rpmReSign() operation. | ||||
*/ | */ | |||
typedef enum rpmResignFlags_e { | /*@unchecked@*/ | |||
RESIGN_NONE = 0, | extern struct rpmQVKArguments_s rpmIArgs; | |||
RESIGN_CHK_SIGNATURE = 1, /*!< from --checksig */ | ||||
RESIGN_NEW_SIGNATURE, /*!< from --resign */ | ||||
RESIGN_ADD_SIGNATURE /*!< from --addsign */ | ||||
} rpmResignFlags; | ||||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
* Create/modify elements in signature header. | ||||
* @param add type of signature operation | ||||
* @param passPhrase | ||||
* @param argv array of package file names (NULL terminated) | ||||
* @return 0 on success | ||||
*/ | */ | |||
int rpmReSign(rpmResignFlags add, char * passPhrase, | /*@unchecked@*/ | |||
/*@null@*/ const char ** argv) | extern struct rpmQVKArguments_s rpmDBArgs; | |||
/*@globals rpmGlobalMacroContext, fileSystem @*/ | ||||
/*@modifies rpmGlobalMacroContext, fileSystem @*/; | /* ==================================================================== */ | |||
/** \name RPMBT */ | ||||
/*@{*/ | ||||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
* Describe signature command line request. | * Describe build command line request. | |||
*/ | */ | |||
struct rpmSignArguments_s { | struct rpmBuildArguments_s { | |||
rpmResignFlags addSign; /*!< from --checksig/--resign/--addsign */ | rpmQueryFlags qva_flags; /*!< Bit(s) to control verification. */ | |||
rpmCheckSigFlags checksigFlags; /*!< bits to control --checksig */ | int buildAmount; /*!< Bit(s) to control operation. */ | |||
int sign; /*!< Is a passphrase needed? */ | /*@observer@*/ | |||
/*@unused@*/ char * passPhrase; | const char * passPhrase; /*!< Pass phrase. */ | |||
/*@only@*/ /*@null@*/ | ||||
const char * cookie; /*!< NULL for binary, ??? for source, rpm's | ||||
*/ | ||||
int noBuild; /*!< from --nobuild */ | ||||
int noDeps; /*!< from --nodeps */ | ||||
int noLang; /*!< from --nolang */ | ||||
int shortCircuit; /*!< from --short-circuit */ | ||||
int sign; /*!< from --sign */ | ||||
int useCatalog; /*!< from --usecatalog */ | ||||
char buildMode; /*!< Build mode (one of "btBC") */ | ||||
char buildChar; /*!< Build stage (one of "abcilps ") */ | ||||
/*@observer@*/ /*@null@*/ | ||||
const char * rootdir; | ||||
}; | }; | |||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
*/ | */ | |||
typedef struct rpmBuildArguments_s * BTA_t; | ||||
/** \ingroup rpmcli | ||||
*/ | ||||
/*@unchecked@*/ | /*@unchecked@*/ | |||
extern struct rpmSignArguments_s rpmKArgs; | extern struct rpmBuildArguments_s rpmBTArgs; | |||
/** \ingroup rpmcli | /** \ingroup rpmcli | |||
*/ | */ | |||
/*@unchecked@*/ | /*@unchecked@*/ | |||
extern struct poptOption rpmSignPoptTable[]; | extern struct poptOption rpmBuildPoptTable[]; | |||
/*@}*/ | /*@}*/ | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* H_RPMCLI */ | #endif /* H_RPMCLI */ | |||
End of changes. 115 change blocks. | ||||
286 lines changed or deleted | 627 lines changed or added | |||
rpmdb.h | rpmdb.h | |||
---|---|---|---|---|
#ifndef H_RPMDB | #ifndef H_RPMDB | |||
#define H_RPMDB | #define H_RPMDB | |||
/*@-bounds@*/ | ||||
/** \ingroup rpmdb dbi db1 db3 | /** \ingroup rpmdb dbi db1 db3 | |||
* \file rpmdb/rpmdb.h | * \file rpmdb/rpmdb.h | |||
* Access RPM indices using Berkeley DB interface(s). | * Access RPM indices using Berkeley DB interface(s). | |||
*/ | */ | |||
#include <assert.h> | ||||
#include <rpmlib.h> | #include <rpmlib.h> | |||
#include <mire.h> | ||||
#if defined(WITH_DB) | ||||
#include "db.h" | ||||
#else | ||||
#include "db_emu.h" | ||||
#endif | ||||
/*@-exportlocal@*/ | ||||
/*@unchecked@*/ | ||||
extern int _rpmdb_debug; | ||||
/*@=exportlocal@*/ | ||||
#ifdef NOTYET | ||||
/** \ingroup rpmdb | ||||
* Database of headers and tag value indices. | ||||
*/ | ||||
typedef /*@abstract@*/ /*@refcounted@*/ struct rpmdb_s * rpmdb; | ||||
/** \ingroup rpmdb | ||||
* Database iterator. | ||||
*/ | ||||
typedef /*@abstract@*/ struct rpmdbMatchIterator_s * rpmdbMatchIterator; | ||||
#endif | ||||
/** | /** | |||
*/ | */ | |||
typedef /*@abstract@*/ struct _dbiIndexItem * dbiIndexItem; | typedef /*@abstract@*/ struct _dbiIndexItem * dbiIndexItem; | |||
/** \ingroup rpmdb | ||||
* A single element (i.e. inverted list from tag values) of a database. | ||||
*/ | ||||
typedef /*@abstract@*/ struct _dbiIndexSet * dbiIndexSet; | ||||
/** | /** | |||
*/ | */ | |||
typedef /*@abstract@*/ struct _dbiIndex * dbiIndex; | typedef /*@abstract@*/ struct _dbiIndex * dbiIndex; | |||
/* this will break if sizeof(int) != 4 */ | #if defined(_RPMDB_INTERNAL) | |||
#include <rpmsw.h> | ||||
#if !defined(SWIG) /* XXX inline dbiFoo() need */ | ||||
/** \ingroup dbi | /** \ingroup dbi | |||
* A single item from an index database (i.e. the "data returned"). | * A single item from an index database (i.e. the "data returned"). | |||
* Note: In rpm-3.0.4 and earlier, this structure was passed by value, | * Note: In rpm-3.0.4 and earlier, this structure was passed by value, | |||
* and was identical to the "data saved" structure below. | * and was identical to the "data saved" structure below. | |||
*/ | */ | |||
struct _dbiIndexItem { | struct _dbiIndexItem { | |||
unsigned int hdrNum; /*!< header instance in db */ | uint32_t hdrNum; /*!< header instance in db */ | |||
unsigned int tagNum; /*!< tag index in header */ | uint32_t tagNum; /*!< tag index in header */ | |||
unsigned int fpNum; /*!< finger print index */ | uint32_t fpNum; /*!< finger print index */ | |||
unsigned int dbNum; /*!< database index */ | ||||
}; | }; | |||
/** \ingroup dbi | /** \ingroup dbi | |||
* Items retrieved from the index database. | * Items retrieved from the index database. | |||
*/ | */ | |||
struct _dbiIndexSet { | struct _dbiIndexSet { | |||
/*@owned@*/ struct _dbiIndexItem * recs; /*!< array of records */ | /*@owned@*/ struct _dbiIndexItem * recs; /*!< array of records */ | |||
int count; /*!< number of records */ | int count; /*!< number of records */ | |||
}; | }; | |||
/* XXX hack to get prototypes correct */ | ||||
#if !defined(DB_VERSION_MAJOR) | ||||
#define DB void | ||||
#define DB_ENV void | ||||
#define DBC void | ||||
#define DBT void | ||||
#define DB_LSN void | ||||
#endif | ||||
/** \ingroup dbi | /** \ingroup dbi | |||
* Private methods for accessing an index database. | * Private methods for accessing an index database. | |||
*/ | */ | |||
struct _dbiVec { | struct _dbiVec { | |||
int dbv_major; /*!< Berkeley db version major */ | int dbv_major; /*!< Berkeley db version major */ | |||
int dbv_minor; /*!< Berkeley db version minor */ | int dbv_minor; /*!< Berkeley db version minor */ | |||
int dbv_patch; /*!< Berkeley db version patch */ | int dbv_patch; /*!< Berkeley db version patch */ | |||
/** \ingroup dbi | /** \ingroup dbi | |||
* Return handle for an index database. | * Return handle for an index database. | |||
* @param rpmdb rpm database | * @param rpmdb rpm database | |||
* @param rpmtag rpm tag | * @param rpmtag rpm tag | |||
* @return 0 on success | * @return 0 on success | |||
*/ | */ | |||
int (*open) (rpmdb rpmdb, int rpmtag, /*@out@*/ dbiIndex * dbip) | int (*open) (rpmdb rpmdb, rpmTag rpmtag, /*@out@*/ dbiIndex * dbip) | |||
/*@globals fileSystem@*/ | /*@globals fileSystem @*/ | |||
/*@modifies *dbip, fileSystem @*/; | /*@modifies *dbip, fileSystem @*/; | |||
/** \ingroup dbi | /** \ingroup dbi | |||
* Close index database, and destroy database handle. | * Close index database, and destroy database handle. | |||
* @param dbi index database handle | * @param dbi index database handle | |||
* @param flags (unused) | * @param flags (unused) | |||
* @return 0 on success | * @return 0 on success | |||
*/ | */ | |||
int (*close) (/*@only@*/ dbiIndex dbi, unsigned int flags) | int (*close) (/*@only@*/ dbiIndex dbi, unsigned int flags) | |||
/*@globals fileSystem@*/ | /*@globals fileSystem @*/ | |||
/*@modifies dbi, fileSystem @*/; | /*@modifies dbi, fileSystem @*/; | |||
/** \ingroup dbi | /** \ingroup dbi | |||
* Flush pending operations to disk. | * Flush pending operations to disk. | |||
* @param dbi index database handle | * @param dbi index database handle | |||
* @param flags (unused) | * @param flags (unused) | |||
* @return 0 on success | * @return 0 on success | |||
*/ | */ | |||
int (*sync) (dbiIndex dbi, unsigned int flags) | int (*sync) (dbiIndex dbi, unsigned int flags) | |||
/*@globals fileSystem@*/ | /*@globals fileSystem @*/ | |||
/*@modifies fileSystem @*/; | /*@modifies fileSystem @*/; | |||
/** \ingroup dbi | /** \ingroup dbi | |||
* Open database cursor. | * Associate secondary database with primary. | |||
* @param dbi index database handle | * @param dbi index database handle | |||
* @param dbcp address of database cursor | * @param dbisecondary secondary index database handle | |||
* @param flags (unused) | * @param callback create secondary key from primary (NULL if DB_RDONLY | |||
) | ||||
* @param flags DB_CREATE or 0 | ||||
* @return 0 on success | ||||
*/ | */ | |||
int (*copen) (dbiIndex dbi, /*@out@*/ DBC ** dbcp, unsigned int flags) | int (*associate) (dbiIndex dbi, dbiIndex dbisecondary, | |||
/*@globals fileSystem@*/ | int (*callback) (DB *, const DBT *, const DBT *, DBT *), | |||
unsigned int flags) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies dbi, fileSystem @*/; | ||||
/** \ingroup dbi | ||||
* Return join cursor for list of cursors. | ||||
* @param dbi index database handle | ||||
* @param curslist NULL terminated list of database cursors | ||||
* @retval dbcp address of join database cursor | ||||
* @param flags DB_JOIN_NOSORT or 0 | ||||
* @return 0 on success | ||||
*/ | ||||
int (*join) (dbiIndex dbi, DBC ** curslist, /*@out@*/ DBC ** dbcp, | ||||
unsigned int flags) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies dbi, *dbcp, fileSystem @*/; | /*@modifies dbi, *dbcp, fileSystem @*/; | |||
/** \ingroup dbi | /** \ingroup dbi | |||
* Open database cursor. | ||||
* @param dbi index database handle | ||||
* @param txnid database transaction handle | ||||
* @retval dbcp address of new database cursor | ||||
* @param dbiflags DB_WRITECURSOR or 0 | ||||
* @return 0 on success | ||||
*/ | ||||
int (*copen) (dbiIndex dbi, /*@null@*/ DB_TXN * txnid, | ||||
/*@out@*/ DBC ** dbcp, unsigned int dbiflags) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies dbi, *txnid, *dbcp, fileSystem @*/; | ||||
/** \ingroup dbi | ||||
* Close database cursor. | * Close database cursor. | |||
* @param dbi index database handle | * @param dbi index database handle | |||
* @param dbcursor database cursor | * @param dbcursor database cursor | |||
* @param flags (unused) | * @param flags (unused) | |||
* @return 0 on success | ||||
*/ | */ | |||
int (*cclose) (dbiIndex dbi, /*@only@*/ DBC * dbcursor, unsigned int fl ags) | int (*cclose) (dbiIndex dbi, /*@only@*/ DBC * dbcursor, unsigned int fl ags) | |||
/*@globals fileSystem@*/ | /*@globals fileSystem @*/ | |||
/*@modifies dbi, *dbcursor, fileSystem @*/; | /*@modifies dbi, *dbcursor, fileSystem @*/; | |||
/** \ingroup dbi | /** \ingroup dbi | |||
* Delete (key,data) pair(s) using db->del or dbcursor->c_del. | * Duplicate a database cursor. | |||
* @param dbi index database handle | * @param dbi index database handle | |||
* @param dbcursor database cursor | * @param dbcursor database cursor | |||
* @param keyp key data | * @retval dbcp address of new database cursor | |||
* @param keylen key data length | * @param flags DB_POSITION for same position, 0 for uniniti | |||
alized | ||||
* @return 0 on success | ||||
*/ | ||||
int (*cdup) (dbiIndex dbi, DBC * dbcursor, /*@out@*/ DBC ** dbcp, | ||||
unsigned int flags) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies dbi, *dbcp, fileSystem @*/; | ||||
/** \ingroup dbi | ||||
* Delete (key,data) pair(s) using db->del or dbcursor->c_del. | ||||
* @param dbi index database handle | ||||
* @param dbcursor database cursor (NULL will use db->del) | ||||
* @param key delete key value/length/flags | ||||
* @param data delete data value/length/flags | ||||
* @param flags (unused) | * @param flags (unused) | |||
* @return 0 on success | * @return 0 on success | |||
*/ | */ | |||
int (*cdel) (dbiIndex dbi, DBC * dbcursor, | int (*cdel) (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * | |||
const void * keyp, size_t keylen, unsigned int flags | data, | |||
) | unsigned int flags) | |||
/*@globals fileSystem@*/ | /*@globals fileSystem @*/ | |||
/*@modifies *dbcursor, fileSystem @*/; | /*@modifies *dbcursor, fileSystem @*/; | |||
/** \ingroup dbi | /** \ingroup dbi | |||
* Retrieve (key,data) pair using db->get or dbcursor->c_get. | * Retrieve (key,data) pair using db->get or dbcursor->c_get. | |||
* @param dbi index database handle | * @param dbi index database handle | |||
* @param dbcursor database cursor | * @param dbcursor database cursor (NULL will use db->get) | |||
* @param keypp address of key data | * @param key retrieve key value/length/flags | |||
* @param keylenp address of key data length | * @param data retrieve data value/length/flags | |||
* @param datapp address of data pointer | ||||
* @param datalenp address of data length | ||||
* @param flags (unused) | * @param flags (unused) | |||
* @return 0 on success | * @return 0 on success | |||
*/ | */ | |||
int (*cget) (dbiIndex dbi, DBC * dbcursor, | int (*cget) (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * | |||
/*@null@*/ void ** keypp, /*@null@*/ size_t * keylen | data, | |||
p, | ||||
/*@null@*/ void ** datapp, /*@null@*/ size_t * datal | ||||
enp, | ||||
unsigned int flags) | unsigned int flags) | |||
/*@globals fileSystem@*/ | /*@globals fileSystem @*/ | |||
/*@modifies *dbcursor, *keypp, *keylenp, *datapp, *datalenp, | /*@modifies *dbcursor, *key, *data, fileSystem @*/; | |||
fileSystem @*/; | ||||
/** \ingroup dbi | /** \ingroup dbi | |||
* Store (key,data) pair using db->put or dbcursor->c_put. | * Retrieve (key,data) pair using dbcursor->c_pget. | |||
* @param dbi index database handle | * @param dbi index database handle | |||
* @param dbcursor database cursor | * @param dbcursor database cursor | |||
* @param keyp key data | * @param key secondary retrieve key value/length/flags | |||
* @param keylen key data length | * @param pkey primary retrieve key value/length/flags | |||
* @param datap data pointer | * @param data primary retrieve data value/length/flags | |||
* @param datalen data length | * @param flags DB_NEXT, DB_SET, or 0 | |||
* @return 0 on success | ||||
*/ | ||||
int (*cpget) (dbiIndex dbi, /*@null@*/ DBC * dbcursor, | ||||
DBT * key, DBT * pkey, DBT * data, unsigned int flags) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies *dbcursor, *key, *pkey, *data, fileSystem @*/; | ||||
/** \ingroup dbi | ||||
* Store (key,data) pair using db->put or dbcursor->c_put. | ||||
* @param dbi index database handle | ||||
* @param dbcursor database cursor (NULL will use db->put) | ||||
* @param key store key value/length/flags | ||||
* @param data store data value/length/flags | ||||
* @param flags (unused) | * @param flags (unused) | |||
* @return 0 on success | * @return 0 on success | |||
*/ | */ | |||
int (*cput) (dbiIndex dbi, DBC * dbcursor, | int (*cput) (dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * | |||
const void * keyp, size_t keylen, | data, | |||
const void * datap, size_t datalen, | ||||
unsigned int flags) | unsigned int flags) | |||
/*@globals fileSystem@*/ | /*@globals fileSystem @*/ | |||
/*@modifies *dbcursor, fileSystem @*/; | /*@modifies *dbcursor, fileSystem @*/; | |||
/** \ingroup dbi | /** \ingroup dbi | |||
* Retrieve count of (possible) duplicate items using dbcursor->c_count. | * Retrieve count of (possible) duplicate items using dbcursor->c_count. | |||
* @param dbi index database handle | * @param dbi index database handle | |||
* @param dbcursor database cursor | * @param dbcursor database cursor | |||
* @param countp address of count | * @param countp address of count | |||
* @param flags (unused) | * @param flags (unused) | |||
* @return 0 on success | * @return 0 on success | |||
*/ | */ | |||
int (*ccount) (dbiIndex dbi, DBC * dbcursor, | int (*ccount) (dbiIndex dbi, DBC * dbcursor, | |||
/*@out@*/ unsigned int * countp, | /*@out@*/ unsigned int * countp, | |||
unsigned int flags) | unsigned int flags) | |||
/*@globals fileSystem@*/ | /*@globals fileSystem @*/ | |||
/*@modifies *dbcursor, fileSystem @*/; | /*@modifies *dbcursor, fileSystem @*/; | |||
/** \ingroup dbi | /** \ingroup dbi | |||
* Is database byte swapped? | * Is database byte swapped? | |||
* @param dbi index database handle | * @param dbi index database handle | |||
* @return 0 no | * @return 0 no | |||
*/ | */ | |||
int (*byteswapped) (dbiIndex dbi) | int (*byteswapped) (dbiIndex dbi) | |||
/*@globals fileSystem@*/ | /*@globals fileSystem @*/ | |||
/*@modifies fileSystem@*/; | /*@modifies fileSystem @*/; | |||
/** \ingroup dbi | /** \ingroup dbi | |||
* Save statistics in database handle. | * Save statistics in database handle. | |||
* @param dbi index database handle | * @param dbi index database handle | |||
* @param flags retrieve statistics that don't require trave rsal? | * @param flags retrieve statistics that don't require trave rsal? | |||
* @return 0 on success | * @return 0 on success | |||
*/ | */ | |||
int (*stat) (dbiIndex dbi, unsigned int flags) | int (*stat) (dbiIndex dbi, unsigned int flags) | |||
/*@globals fileSystem@*/ | /*@globals fileSystem @*/ | |||
/*@modifies dbi, fileSystem @*/; | /*@modifies dbi, fileSystem @*/; | |||
}; | }; | |||
/** \ingroup dbi | /** \ingroup dbi | |||
* Describes an index database (implemented on Berkeley db3 functionality). | * Describes an index database (implemented on Berkeley db3 functionality). | |||
*/ | */ | |||
struct _dbiIndex { | struct _dbiIndex { | |||
/*@null@*/ const char * dbi_root; /*!< chroot(2) component of | /*@relnull@*/ | |||
path */ | const char * dbi_root; /*!< chroot(2) component of path */ | |||
/*@null@*/ const char * dbi_home; /*!< directory component of | /*@null@*/ | |||
path */ | const char * dbi_home; /*!< directory component of path */ | |||
/*@null@*/ const char * dbi_file; /*!< file component of path | /*@relnull@*/ | |||
*/ | const char * dbi_file; /*!< file component of path */ | |||
/*@null@*/ const char * dbi_subfile; | /*@relnull@*/ | |||
/*@null@*/ const char * dbi_tmpdir; /*!< temporary directory */ | const char * dbi_subfile; | |||
/*@null@*/ | ||||
const char * dbi_tmpdir; /*!< temporary directory */ | ||||
int dbi_ecflags; /*!< db_env_create flags */ | int dbi_ecflags; /*!< db_env_create flags */ | |||
int dbi_cflags; /*!< db_create flags */ | int dbi_cflags; /*!< db_create flags */ | |||
int dbi_oeflags; /*!< common (db,dbenv}->open | int dbi_oeflags; /*!< common (db,dbenv}->open flags * | |||
flags */ | / | |||
int dbi_eflags; /*!< dbenv->open flags */ | int dbi_eflags; /*!< dbenv->open flags */ | |||
int dbi_oflags; /*!< db->open flags */ | int dbi_oflags; /*!< db->open flags */ | |||
int dbi_tflags; /*!< dbenv->txn_begin flags | int dbi_tflags; /*!< dbenv->txn_begin flags */ | |||
*/ | ||||
int dbi_type; /*!< db index type */ | int dbi_type; /*!< db index type */ | |||
unsigned dbi_mode; /*!< mode to use on open */ | unsigned dbi_mode; /*!< mode to use on open */ | |||
int dbi_perms; /*!< file permission to use | int dbi_perms; /*!< file permission to use on open | |||
on open */ | */ | |||
long dbi_shmkey; /*!< shared memory base key */ | long dbi_shmkey; /*!< shared memory base key */ | |||
int dbi_api; /*!< Berkeley API type */ | int dbi_api; /*!< Berkeley API type */ | |||
int dbi_verify_on_close; | int dbi_verify_on_close; | |||
int dbi_tear_down; /*!< tear down dbenv on clos | int dbi_use_dbenv; /*!< use db environment? */ | |||
e */ | int dbi_permit_dups; /*!< permit duplicate entries? */ | |||
int dbi_use_cursors;/*!< access with cursors? (a | int dbi_no_fsync; /*!< no-op fsync for db */ | |||
lways) */ | int dbi_no_dbsync; /*!< don't call dbiSync */ | |||
int dbi_use_dbenv; /*!< use db environment? */ | int dbi_lockdbfd; /*!< do fcntl lock on db fd */ | |||
int dbi_permit_dups;/*!< permit duplicate entrie | int dbi_temporary; /*!< non-persistent index/table */ | |||
s? */ | int dbi_noload; /*!< standalone index/table */ | |||
int dbi_get_rmw_cursor; | int dbi_debug; | |||
int dbi_no_fsync; /*!< no-op fsync for db */ | int dbi_byteswapped; | |||
int dbi_no_dbsync; /*!< don't call dbiSync */ | ||||
int dbi_lockdbfd; /*!< do fcntl lock on db fd | ||||
*/ | ||||
int dbi_temporary; /*!< non-persistent */ | ||||
int dbi_debug; | ||||
int dbi_byteswapped; | ||||
/*@null@*/ char * dbi_host; | /*@null@*/ | |||
long dbi_cl_timeout; | char * dbi_host; | |||
long dbi_sv_timeout; | unsigned long dbi_cl_timeout; | |||
unsigned long dbi_sv_timeout; | ||||
/* dbenv parameters */ | /* dbenv parameters */ | |||
int dbi_lorder; | int dbi_lorder; | |||
/*@unused@*/ /*@null@*/ void (*db_errcall) (const char *db_errpfx | /*@unused@*/ | |||
, char *buffer) | /* XXX db-4.3.14 adds dbenv as 1st arg. */ | |||
/*@globals fileSystem@*/ | void (*db_errcall) (void * dbenv, const char *db_errpfx, char *buffer) | |||
/*@globals fileSystem @*/ | ||||
/*@modifies fileSystem @*/; | /*@modifies fileSystem @*/; | |||
/*@unused@*/ /*@shared@*/ FILE * dbi_errfile; | /*@unused@*/ /*@shared@*/ | |||
const char * dbi_errpfx; | FILE * dbi_errfile; | |||
int dbi_verbose; | const char * dbi_errpfx; | |||
int dbi_region_init; | int dbi_verbose; | |||
int dbi_tas_spins; | int dbi_region_init; | |||
unsigned int dbi_thread_count; | ||||
/* locking sub-system parameters */ | ||||
unsigned int dbi_lk_max_lockers; | ||||
unsigned int dbi_lk_max_locks; | ||||
unsigned int dbi_lk_max_objects; | ||||
unsigned int dbi_lk_detect; | ||||
/*@unused@*/ | ||||
int dbi_lk_nmodes; | ||||
/*@unused@*/ | ||||
unsigned char * dbi_lk_conflicts; | ||||
/* logging sub-system parameters */ | ||||
unsigned int dbi_lg_bsize; | ||||
/*@unused@*/ | ||||
const char * dbi_lg_dir; | ||||
/*@unused@*/ | ||||
unsigned int dbi_lg_filemode; | ||||
unsigned int dbi_lg_max; | ||||
unsigned int dbi_lg_regionmax; | ||||
/* mpool sub-system parameters */ | /* mpool sub-system parameters */ | |||
int dbi_mp_mmapsize; /*!< (10Mb) */ | int dbi_mmapsize; /*!< (10Mb) */ | |||
int dbi_mp_size; /*!< (128Kb) */ | int dbi_cachesize; /*!< (128Kb) */ | |||
/* lock sub-system parameters */ | /* mutex sub-system parameters */ | |||
unsigned int dbi_lk_max; | unsigned int dbi_mutex_align; | |||
unsigned int dbi_lk_detect; | unsigned int dbi_mutex_increment; | |||
/*@unused@*/ int dbi_lk_nmodes; | unsigned int dbi_mutex_max; | |||
/*@unused@*/ unsigned char * dbi_lk_conflicts; | unsigned int dbi_mutex_tas_spins; | |||
/* log sub-system parameters */ | /* replication sub-system parameters */ | |||
unsigned int dbi_lg_max; | /* sequences sub-system parameters */ | |||
unsigned int dbi_lg_bsize; | unsigned int dbi_seq_cachesize; | |||
unsigned int dbi_seq_flags; | ||||
#if 0 /* needs signed 64 bit type */ | ||||
int64_t dbi_seq_min; | ||||
int64_t dbi_seq_max; | ||||
#endif | ||||
/* transaction sub-system parameters */ | /* transaction sub-system parameters */ | |||
unsigned int dbi_tx_max; | unsigned int dbi_tx_max; | |||
#if 0 | #if 0 | |||
int (*dbi_tx_recover) (DB_ENV *dbenv, DBT *log_r ec, | int (*dbi_tx_recover) (DB_ENV *dbenv, DBT *log_rec, | |||
DB_LSN *lsnp, int redo, void *info) | DB_LSN *lsnp, int redo, void *info) | |||
/*@globals fileSystem@*/ | /*@globals fileSystem @*/ | |||
/*@modifies fileSystem @*/; | /*@modifies fileSystem @*/; | |||
#endif | #endif | |||
/* dbinfo parameters */ | /* dbinfo parameters */ | |||
int dbi_cachesize; /*!< */ | int dbi_pagesize; /*!< (fs blksize) */ | |||
int dbi_pagesize; /*!< (fs blksize) */ | /*@unused@*/ /*@null@*/ | |||
/*@unused@*/ /*@null@*/ void * (*dbi_malloc) (size_t nbytes) | void * (*dbi_malloc) (size_t nbytes) | |||
/*@*/; | /*@*/; | |||
/* hash access parameters */ | /* hash access parameters */ | |||
unsigned int dbi_h_ffactor; /*!< */ | unsigned int dbi_h_ffactor; /*!< */ | |||
/*@null@*/ unsigned int (*dbi_h_hash_fcn) (DB *, const void *bytes, | unsigned int (*dbi_h_hash_fcn) (DB *, const void *bytes, | |||
unsigned int length) /*@*/; | unsigned int length) | |||
unsigned int dbi_h_nelem; /*!< */ | /*@*/; | |||
unsigned int dbi_h_flags; /*!< DB_DUP, DB_DUPSORT */ | unsigned int dbi_h_nelem; /*!< */ | |||
/*@null@*/ int (*dbi_h_dup_compare_fcn) (DB *, const DBT *, const D | unsigned int dbi_h_flags; /*!< DB_DUP, DB_DUPSORT */ | |||
BT *) /*@*/; | int (*dbi_h_dup_compare_fcn) (DB *, const DBT *, const DBT *) | |||
/*@*/; | ||||
/* btree access parameters */ | /* btree access parameters */ | |||
int dbi_bt_flags; | int dbi_bt_flags; | |||
int dbi_bt_minkey; | int dbi_bt_minkey; | |||
/*@null@*/ int (*dbi_bt_compare_fcn) (DB *, const DBT *, const DBT | int (*dbi_bt_compare_fcn) (DB *, const DBT *, const DBT *) | |||
*) /*@*/; | /*@*/; | |||
/*@null@*/ int (*dbi_bt_dup_compare_fcn) (DB *, const DBT *, const | int (*dbi_bt_dup_compare_fcn) (DB *, const DBT *, const DBT *) | |||
DBT *) /*@*/; | /*@*/; | |||
/*@null@*/ size_t (*dbi_bt_prefix_fcn) (DB *, const DBT *, const DBT * | size_t (*dbi_bt_prefix_fcn) (DB *, const DBT *, const DBT *) | |||
) /*@*/; | /*@*/; | |||
/* recno access parameters */ | /* recno access parameters */ | |||
int dbi_re_flags; | int dbi_re_flags; | |||
int dbi_re_delim; | int dbi_re_delim; | |||
unsigned int dbi_re_len; | unsigned int dbi_re_len; | |||
int dbi_re_pad; | int dbi_re_pad; | |||
const char * dbi_re_source; | const char * dbi_re_source; | |||
/* queue access parameters */ | /* queue access parameters */ | |||
unsigned int dbi_q_extentsize; | unsigned int dbi_q_extentsize; | |||
/*@kept@*/ rpmdb dbi_rpmdb; | ||||
rpmTag dbi_rpmtag; /*!< rpm tag used for index */ | ||||
int dbi_jlen; /*!< size of join key */ | ||||
unsigned int dbi_lastoffset; /*!< db1 with falloc.c needs this */ | /*@refcounted@*/ | |||
rpmdb dbi_rpmdb; /*!< the parent rpm database */ | ||||
rpmTag dbi_rpmtag; /*!< rpm tag used for index */ | ||||
size_t dbi_jlen; /*!< size of join key */ | ||||
/*@only@*//*@null@*/ void * dbi_db; /*!< Berkeley DB handle */ | /*@only@*//*@relnull@*/ | |||
/*@only@*//*@null@*/ void * dbi_rmw; /*!< db cursor (with DB_WRITECURSOR) | DB * dbi_db; /*!< Berkeley DB * handle */ | |||
*/ | /*@only@*//*@null@*/ | |||
/*@only@*//*@null@*/ void * dbi_stats; /*!< Berkeley db statistics */ | DB_TXN * dbi_txnid; /*!< Bekerley DB_TXN * transaction i | |||
d */ | ||||
/*@only@*//*@null@*/ | ||||
void * dbi_stats; /*!< Berkeley DB statistics */ | ||||
/*@observer@*/ const struct _dbiVec * dbi_vec; /*!< private methods */ | /*@observer@*/ | |||
const struct _dbiVec * dbi_vec; /*!< private methods */ | ||||
}; | }; | |||
#endif /* !defined(SWIG) */ | ||||
/** \ingroup rpmdb | /** \ingroup rpmdb | |||
* Describes the collection of index databases used by rpm. | * Describes the collection of index databases used by rpm. | |||
*/ | */ | |||
struct rpmdb_s { | struct rpmdb_s { | |||
/*@owned@*/ const char * db_root;/*!< path prefix */ | /*@owned@*/ /*@relnull@*/ | |||
/*@owned@*/ const char * db_home;/*!< directory path */ | const char * db_root; /*!< rpmdb path prefix */ | |||
/*@owned@*/ | ||||
const char * db_home; /*!< rpmdb directory path */ | ||||
int db_flags; | int db_flags; | |||
int db_mode; /*!< open mode */ | int db_mode; /*!< rpmdb pen mode */ | |||
int db_perms; /*!< open permissions */ | int db_perms; /*!< rpmdb open permissions */ | |||
int db_api; /*!< Berkeley API type */ | int db_api; /*!< Berkeley API type */ | |||
/*@owned@*/ const char * db_errpfx; | /*@owned@*/ | |||
int db_remove_env; | const char * db_errpfx; /*!< Berkeley DB error msg prefix. */ | |||
int db_filter_dups; | ||||
int db_remove_env; /*!< Discard dbenv on close? */ | ||||
int db_filter_dups; /*!< Skip duplicate headers with --r | ||||
ebuilddb? */ | ||||
int db_verifying; | ||||
int db_chrootDone; /*!< If chroot(2) done, ignore db_ro ot. */ | int db_chrootDone; /*!< If chroot(2) done, ignore db_ro ot. */ | |||
void (*db_errcall) (const char *db_errpfx, char *buffer) | void (*db_errcall) (const char * db_errpfx, char * buffer) | |||
/*@*/; | /*@*/; | |||
/*@shared@*/ FILE * db_errfile; | /*@shared@*/ | |||
/*@only@*/ void * (*db_malloc) (size_t nbytes) | FILE * db_errfile; /*!< Berkeley DB stderr clone. */ | |||
/*@only@*/ | ||||
void * (*db_malloc) (size_t nbytes) | ||||
/*@*/; | /*@*/; | |||
/*@only@*/ void * (*db_realloc) (/*@only@*//*@null@*/ void * ptr, | /*@only@*/ | |||
size_t nbytes) | void * (*db_realloc) (/*@only@*//*@null@*/ void * ptr, size_t nbytes) | |||
/*@*/; | /*@*/; | |||
void (*db_free) (/*@only@*/ void * ptr) | void (*db_free) (/*@only@*/ void * ptr) | |||
/*@modifies *ptr @*/; | /*@modifies *ptr @*/; | |||
int db_opens; | ||||
/*@only@*//*@null@*/ void * db_dbenv; /*!< Berkeley DB_ENV handle */ | ||||
int db_ndbi; /*!< No. of tag indices. */ | ||||
dbiIndex * _dbi; /*!< Tag indices. */ | ||||
int (*db_export) (rpmdb db, Header h, int adding); | ||||
/*@only@*/ /*@null@*/ | ||||
unsigned char * db_bits; /*!< Header instance bit mask. */ | ||||
int db_nbits; /*!< No. of bits in mask. */ | ||||
rpmdb db_next; /*!< Chain of rpmdbOpen'ed rpmdb's. */ | ||||
int db_opens; /*!< No. of opens for this rpmdb. */ | ||||
/*@only@*/ /*@null@*/ | ||||
void * db_dbenv; /*!< Berkeley DB_ENV handle. */ | ||||
tagStore_t db_tags; /*!< Tag name/value mappings. */ | ||||
size_t db_ndbi; /*!< No. of tag indices. */ | ||||
/*@only@*/ /*@null@*/ | ||||
dbiIndex * _dbi; /*!< Tag indices. */ | ||||
struct rpmop_s db_getops; /*!< dbiGet statistics. */ | ||||
struct rpmop_s db_putops; /*!< dbiPut statistics. */ | ||||
struct rpmop_s db_delops; /*!< dbiDel statistics. */ | ||||
/*@refs@*/ | ||||
int nrefs; /*!< Reference count. */ | int nrefs; /*!< Reference count. */ | |||
}; | }; | |||
#endif /* defined(_RPMDB_INTERNAL) */ | ||||
/* for RPM's internal use only */ | /* for RPM's internal use only */ | |||
/** \ingroup rpmdb | /** \ingroup rpmdb | |||
*/ | */ | |||
enum rpmdbFlags { | enum rpmdbFlags { | |||
RPMDB_FLAG_JUSTCHECK = (1 << 0), | RPMDB_FLAG_JUSTCHECK = (1 << 0), | |||
RPMDB_FLAG_MINIMAL = (1 << 1), | RPMDB_FLAG_MINIMAL = (1 << 1), | |||
/*@-enummemuse@*/ | /*@-enummemuse@*/ | |||
RPMDB_FLAG_CHROOT = (1 << 2) | RPMDB_FLAG_CHROOT = (1 << 2) | |||
/*@=enummemuse@*/ | /*@=enummemuse@*/ | |||
}; | }; | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
#if defined(_RPMDB_INTERNAL) | ||||
/*@-exportlocal@*/ | /*@-exportlocal@*/ | |||
#if defined(WITH_DB) || defined(WITH_SQLITE) | ||||
/** \ingroup db3 | /** \ingroup db3 | |||
* Return new configured index database handle instance. | * Return new configured index database handle instance. | |||
* @param rpmdb rpm database | * @param rpmdb rpm database | |||
* @param rpmtag rpm tag | ||||
* @return index database handle | ||||
*/ | */ | |||
/*@only@*/ /*@null@*/ dbiIndex db3New(rpmdb rpmdb, int rpmtag) | /*@unused@*/ /*@only@*/ /*@null@*/ | |||
/*@globals rpmGlobalMacroContext @*/ | dbiIndex db3New(rpmdb rpmdb, rpmTag rpmtag) | |||
/*@modifies rpmGlobalMacroContext @*/; | /*@globals rpmGlobalMacroContext, h_errno, internalState @*/ | |||
/*@modifies rpmGlobalMacroContext, internalState @*/; | ||||
/** \ingroup db3 | /** \ingroup db3 | |||
* Destroy index database handle instance. | * Destroy index database handle instance. | |||
* @param dbi index database handle | * @param dbi index database handle | |||
* @return NULL always | * @return NULL always | |||
*/ | */ | |||
/*@null@*/ dbiIndex db3Free( /*@only@*/ /*@null@*/ dbiIndex dbi) | /*@null@*/ | |||
dbiIndex db3Free( /*@only@*/ /*@null@*/ dbiIndex dbi) | ||||
/*@*/; | /*@*/; | |||
/** \ingroup db3 | /** \ingroup db3 | |||
* Format db3 open flags for debugging print. | * Format db3 open flags for debugging print. | |||
* @param dbflags db open flags | * @param dbflags db open flags | |||
* @param print_dbenv_flags format db env flags instead? | * @param print_dbenv_flags format db env flags instead? | |||
* @return formatted flags (static buffer) | * @return formatted flags (static buffer) | |||
*/ | */ | |||
/*@-redecl@*/ | /*@-redecl@*/ | |||
/*@exposed@*/ extern const char *const prDbiOpenFlags(int dbflags, | /*@exposed@*/ | |||
int print_dbenv_flags) | extern const char * prDbiOpenFlags(int dbflags, int print_dbenv_flags) | |||
/*@*/; | /*@*/; | |||
/*@=redecl@*/ | /*@=redecl@*/ | |||
#endif | ||||
/** \ingroup dbi | /** \ingroup dbi | |||
* Return handle for an index database. | * Return handle for an index database. | |||
* @param db rpm database | * @param db rpm database | |||
* @param rpmtag rpm tag | * @param rpmtag rpm tag | |||
* @param flags (unused) | * @param flags (unused) | |||
* @return index database handle | * @return index database handle | |||
*/ | */ | |||
/*@only@*/ /*@null@*/ dbiIndex dbiOpen(/*@null@*/ rpmdb db, int rpmtag, | /*@only@*/ /*@null@*/ dbiIndex dbiOpen(/*@null@*/ rpmdb db, rpmTag rpmtag, | |||
unsigned int flags) | unsigned int flags) | |||
/*@modifies db @*/; | /*@globals rpmGlobalMacroContext, errno, h_errno @*/ | |||
/*@modifies db, rpmGlobalMacroContext, errno @*/; | ||||
/** \ingroup dbi | /** | |||
* Return dbiStats accumulator structure. | ||||
* @param dbi index database handle | * @param dbi index database handle | |||
* @param flags DBI_WRITECURSOR, DBI_ITERATOR or 0 | * @param opx per-rpmdb accumulator index (aka rpmtsOpX) | |||
* @return per-rpmdb accumulator pointer | ||||
*/ | */ | |||
int dbiCopen(dbiIndex dbi, /*@out@*/ DBC ** dbcp, unsigned int flags) | void * dbiStatsAccumulator(dbiIndex dbi, int opx) | |||
/*@globals fileSystem@*/ | /*@*/; | |||
/*@modifies dbi, *dbcp, fileSystem @*/; | ||||
#define DBI_WRITECURSOR (1 << 0) | #if !defined(SWIG) | |||
#define DBI_ITERATOR (1 << 1) | /*@-globuse -mustmod @*/ /* FIX: vector annotations */ | |||
/** \ingroup dbi | ||||
* Open a database cursor. | ||||
* @param dbi index database handle | ||||
* @param txnid database transaction handle | ||||
* @retval dbcp returned database cursor | ||||
* @param flags DB_WRITECURSOR if writing, or 0 | ||||
* @return 0 on success | ||||
*/ | ||||
/*@unused@*/ static inline | ||||
int dbiCopen(dbiIndex dbi, /*@null@*/ DB_TXN * txnid, | ||||
/*@out@*/ DBC ** dbcp, unsigned int flags) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies dbi, *dbcp, fileSystem @*/ | ||||
{ | ||||
return (*dbi->dbi_vec->copen) (dbi, txnid, dbcp, flags); | ||||
} | ||||
/** \ingroup dbi | /** \ingroup dbi | |||
* Close a database cursor. | ||||
* @param dbi index database handle | * @param dbi index database handle | |||
* @param dbcursor database cursor | ||||
* @param flags (unused) | * @param flags (unused) | |||
* @return 0 on success | ||||
*/ | */ | |||
/*@unused@*/ static inline | ||||
int dbiCclose(dbiIndex dbi, /*@only@*/ DBC * dbcursor, unsigned int flags) | int dbiCclose(dbiIndex dbi, /*@only@*/ DBC * dbcursor, unsigned int flags) | |||
/*@globals fileSystem@*/ | /*@globals fileSystem @*/ | |||
/*@modifies dbi, *dbcursor, fileSystem @*/; | /*@modifies dbi, *dbcursor, fileSystem @*/ | |||
{ | ||||
return (*dbi->dbi_vec->cclose) (dbi, dbcursor, flags); | ||||
} | ||||
/** \ingroup dbi | ||||
* Duplicate a database cursor. | ||||
* @param dbi index database handle | ||||
* @param dbcursor database cursor | ||||
* @retval dbcp address of new database cursor | ||||
* @param flags DB_POSITION for same position, 0 for uniniti | ||||
alized | ||||
* @return 0 on success | ||||
*/ | ||||
/*@unused@*/ static inline | ||||
int dbiCdup(dbiIndex dbi, DBC * dbcursor, /*@out@*/ DBC ** dbcp, | ||||
unsigned int flags) | ||||
/*@modifies dbi, *dbcp @*/ | ||||
{ | ||||
return (*dbi->dbi_vec->cdup) (dbi, dbcursor, dbcp, flags); | ||||
} | ||||
/** \ingroup dbi | /** \ingroup dbi | |||
* Delete (key,data) pair(s) from index database. | * Delete (key,data) pair(s) from index database. | |||
* @param dbi index database handle | * @param dbi index database handle | |||
* @param keyp key data | * @param dbcursor database cursor (NULL will use db->del) | |||
* @param keylen key data length | * @param key delete key value/length/flags | |||
* @param data delete data value/length/flags | ||||
* @param flags (unused) | * @param flags (unused) | |||
* @return 0 on success | * @return 0 on success | |||
*/ | */ | |||
int dbiDel(dbiIndex dbi, DBC * dbcursor, const void * keyp, size_t keylen, | /*@unused@*/ static inline | |||
int dbiDel(dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data, | ||||
unsigned int flags) | unsigned int flags) | |||
/*@globals fileSystem@*/ | /*@globals fileSystem, internalState @*/ | |||
/*@modifies *dbcursor, fileSystem @*/; | /*@modifies dbi, *dbcursor, fileSystem, internalState @*/ | |||
{ | ||||
rpmop sw = (rpmop)dbiStatsAccumulator(dbi, 16); /* RPMTS_OP_DBDEL */ | ||||
int rc; | ||||
assert(key->data != NULL && key->size > 0); | ||||
(void) rpmswEnter(sw, 0); | ||||
rc = (dbi->dbi_vec->cdel) (dbi, dbcursor, key, data, flags); | ||||
(void) rpmswExit(sw, data->size); | ||||
return rc; | ||||
} | ||||
/** \ingroup dbi | /** \ingroup dbi | |||
* Retrieve (key,data) pair from index database. | * Retrieve (key,data) pair from index database. | |||
* @param dbi index database handle | * @param dbi index database handle | |||
* @param keypp address of key data | * @param dbcursor database cursor (NULL will use db->get) | |||
* @param keylenp address of key data length | * @param key retrieve key value/length/flags | |||
* @param datapp address of data pointer | * @param data retrieve data value/length/flags | |||
* @param datalenp address of data length | ||||
* @param flags (unused) | * @param flags (unused) | |||
* @return 0 on success | * @return 0 on success | |||
*/ | */ | |||
int dbiGet(dbiIndex dbi, DBC * dbcursor, void ** keypp, | /*@unused@*/ static inline | |||
/*@null@*/ size_t * keylenp, | int dbiGet(dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data, | |||
/*@null@*/ void ** datapp, | ||||
/*@null@*/ size_t * datalenp, | ||||
unsigned int flags) | unsigned int flags) | |||
/*@globals fileSystem@*/ | /*@globals fileSystem, internalState @*/ | |||
/*@modifies *dbcursor, **keypp, *keylenp, **datapp, *datalenp, | /*@modifies dbi, *dbcursor, *key, *data, fileSystem, internalState @ | |||
fileSystem @*/; | */ | |||
{ | ||||
rpmop sw = (rpmop)dbiStatsAccumulator(dbi, 14); /* RPMTS_OP_DBGET */ | ||||
int rc; | ||||
assert((flags == DB_NEXT) || (key->data != NULL && key->size > 0)); | ||||
(void) rpmswEnter(sw, 0); | ||||
rc = (dbi->dbi_vec->cget) (dbi, dbcursor, key, data, flags); | ||||
(void) rpmswExit(sw, data->size); | ||||
return rc; | ||||
} | ||||
/** \ingroup dbi | ||||
* Retrieve (key,data) pair using dbcursor->c_pget. | ||||
* @param dbi index database handle | ||||
* @param dbcursor database cursor (NULL will use db->get) | ||||
* @param key secondary retrieve key value/length/flags | ||||
* @param pkey primary retrieve key value/length/flags | ||||
* @param data primary retrieve data value/length/flags | ||||
* @param flags DB_NEXT, DB_SET, or 0 | ||||
* @return 0 on success | ||||
*/ | ||||
/*@unused@*/ static inline | ||||
int dbiPget(dbiIndex dbi, /*@null@*/ DBC * dbcursor, | ||||
DBT * key, DBT * pkey, DBT * data, unsigned int flags) | ||||
/*@globals fileSystem, internalState @*/ | ||||
/*@modifies dbi, *dbcursor, *key, *pkey, *data, fileSystem, internal | ||||
State @*/ | ||||
{ | ||||
rpmop sw = (rpmop)dbiStatsAccumulator(dbi, 14); /* RPMTS_OP_DBGET */ | ||||
int rc; | ||||
assert((flags == DB_NEXT) || (key->data != NULL && key->size > 0)); | ||||
(void) rpmswEnter(sw, 0); | ||||
rc = (dbi->dbi_vec->cpget) (dbi, dbcursor, key, pkey, data, flags); | ||||
(void) rpmswExit(sw, data->size); | ||||
return rc; | ||||
} | ||||
/** \ingroup dbi | /** \ingroup dbi | |||
* Store (key,data) pair in index database. | * Store (key,data) pair in index database. | |||
* @param dbi index database handle | * @param dbi index database handle | |||
* @param keyp key data | * @param dbcursor database cursor (NULL will use db->put) | |||
* @param keylen key data length | * @param key store key value/length/flags | |||
* @param datap data pointer | * @param data store data value/length/flags | |||
* @param datalen data length | ||||
* @param flags (unused) | * @param flags (unused) | |||
* @return 0 on success | * @return 0 on success | |||
*/ | */ | |||
int dbiPut(dbiIndex dbi, DBC * dbcursor, const void * keyp, size_t keylen, | /*@unused@*/ static inline | |||
const void * datap, size_t datalen, unsigned int flags) | int dbiPut(dbiIndex dbi, /*@null@*/ DBC * dbcursor, DBT * key, DBT * data, | |||
/*@globals fileSystem@*/ | unsigned int flags) | |||
/*@modifies *dbcursor, fileSystem @*/; | /*@globals fileSystem, internalState @*/ | |||
/*@modifies dbi, *dbcursor, *key, fileSystem, internalState @*/ | ||||
{ | ||||
rpmop sw = (rpmop)dbiStatsAccumulator(dbi, 15); /* RPMTS_OP_DBPUT */ | ||||
int rc; | ||||
assert(key->data != NULL && key->size > 0 && data->data != NULL && data | ||||
->size > 0); | ||||
(void) rpmswEnter(sw, 0); | ||||
rc = (dbi->dbi_vec->cput) (dbi, dbcursor, key, data, flags); | ||||
(void) rpmswExit(sw, data->size); | ||||
return rc; | ||||
} | ||||
/** \ingroup dbi | /** \ingroup dbi | |||
* Retrieve count of (possible) duplicate items. | * Retrieve count of (possible) duplicate items. | |||
* @param dbi index database handle | * @param dbi index database handle | |||
* @param dbcursor database cursor | * @param dbcursor database cursor | |||
* @param countp address of count | * @param countp address of count | |||
* @param flags (unused) | * @param flags (unused) | |||
* @return 0 on success | * @return 0 on success | |||
*/ | */ | |||
/*@unused@*/ | /*@unused@*/ static inline | |||
int dbiCount(dbiIndex dbi, DBC * dbcursor, /*@out@*/ unsigned int * countp, | int dbiCount(dbiIndex dbi, DBC * dbcursor, /*@out@*/ unsigned int * countp, | |||
unsigned int flags) | unsigned int flags) | |||
/*@globals fileSystem@*/ | /*@globals fileSystem @*/ | |||
/*@modifies *dbcursor, fileSystem @*/; | /*@modifies *dbcursor, fileSystem @*/ | |||
{ | ||||
return (*dbi->dbi_vec->ccount) (dbi, dbcursor, countp, flags); | ||||
} | ||||
/** \ingroup dbi | /** \ingroup dbi | |||
* Verify (and close) index database. | * Verify (and close) index database. | |||
* @param dbi index database handle | * @param dbi index database handle | |||
* @param flags (unused) | * @param flags (unused) | |||
* @return 0 on success | * @return 0 on success | |||
*/ | */ | |||
/*@unused@*/ static inline | ||||
int dbiVerify(/*@only@*/ dbiIndex dbi, unsigned int flags) | int dbiVerify(/*@only@*/ dbiIndex dbi, unsigned int flags) | |||
/*@globals fileSystem@*/ | /*@globals fileSystem @*/ | |||
/*@modifies dbi, fileSystem @*/; | /*@modifies dbi, fileSystem @*/ | |||
{ | ||||
dbi->dbi_verify_on_close = 1; | ||||
return (*dbi->dbi_vec->close) (dbi, flags); | ||||
} | ||||
/** \ingroup dbi | /** \ingroup dbi | |||
* Close index database. | * Close index database. | |||
* @param dbi index database handle | * @param dbi index database handle | |||
* @param flags (unused) | * @param flags (unused) | |||
* @return 0 on success | * @return 0 on success | |||
*/ | */ | |||
/*@unused@*/ static inline | ||||
int dbiClose(/*@only@*/ dbiIndex dbi, unsigned int flags) | int dbiClose(/*@only@*/ dbiIndex dbi, unsigned int flags) | |||
/*@globals fileSystem@*/ | /*@globals fileSystem @*/ | |||
/*@modifies dbi, fileSystem @*/; | /*@modifies dbi, fileSystem @*/ | |||
{ | ||||
return (*dbi->dbi_vec->close) (dbi, flags); | ||||
} | ||||
/** \ingroup dbi | /** \ingroup dbi | |||
* Flush pending operations to disk. | * Flush pending operations to disk. | |||
* @param dbi index database handle | * @param dbi index database handle | |||
* @param flags (unused) | * @param flags (unused) | |||
* @return 0 on success | * @return 0 on success | |||
*/ | */ | |||
/*@unused@*/ static inline | ||||
int dbiSync (dbiIndex dbi, unsigned int flags) | int dbiSync (dbiIndex dbi, unsigned int flags) | |||
/*@globals fileSystem@*/ | /*@globals fileSystem @*/ | |||
/*@modifies fileSystem @*/; | /*@modifies fileSystem @*/ | |||
{ | ||||
return (*dbi->dbi_vec->sync) (dbi, flags); | ||||
} | ||||
/** \ingroup dbi | ||||
* Associate secondary database with primary. | ||||
* @param dbi index database handle | ||||
* @param dbisecondary secondary index database handle | ||||
* @param callback create secondary key from primary (NULL if DB_RDONLY | ||||
) | ||||
* @param flags DB_CREATE or 0 | ||||
* @return 0 on success | ||||
*/ | ||||
/*@unused@*/ static inline | ||||
int dbiAssociate(dbiIndex dbi, dbiIndex dbisecondary, | ||||
int (*callback) (DB *, const DBT *, const DBT *, DBT *), | ||||
unsigned int flags) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies dbi, fileSystem @*/ | ||||
{ | ||||
return (*dbi->dbi_vec->associate) (dbi, dbisecondary, callback, flags); | ||||
} | ||||
/** \ingroup dbi | ||||
* Return join cursor for list of cursors. | ||||
* @param dbi index database handle | ||||
* @param curslist NULL terminated list of database cursors | ||||
* @retval dbcp address of join database cursor | ||||
* @param flags DB_JOIN_NOSORT or 0 | ||||
* @return 0 on success | ||||
*/ | ||||
/*@unused@*/ static inline | ||||
int dbiJoin(dbiIndex dbi, DBC ** curslist, /*@out@*/ DBC ** dbcp, | ||||
unsigned int flags) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies dbi, *dbcp, fileSystem @*/ | ||||
{ | ||||
return (*dbi->dbi_vec->join) (dbi, curslist, dbcp, flags); | ||||
} | ||||
/** \ingroup dbi | /** \ingroup dbi | |||
* Is database byte swapped? | * Is database byte swapped? | |||
* @param dbi index database handle | * @param dbi index database handle | |||
* @return 0 no | * @return 0 same order, 1 swapped order | |||
*/ | */ | |||
/*@unused@*/ static inline | ||||
int dbiByteSwapped(dbiIndex dbi) | int dbiByteSwapped(dbiIndex dbi) | |||
/*@*/; | /*@modifies dbi @*/ | |||
{ | ||||
if (dbi->dbi_byteswapped == -1) | ||||
dbi->dbi_byteswapped = (*dbi->dbi_vec->byteswapped) (dbi); | ||||
return dbi->dbi_byteswapped; | ||||
} | ||||
/** \ingroup db1 | /** \ingroup dbi | |||
* Return base file name for db1 database (legacy). | * Return dbi statistics. | |||
* @param rpmtag rpm tag | * @param dbi index database handle | |||
* @return base file name of db1 database | * @param flags DB_FAST_STAT or 0 | |||
* @return 0 on success | ||||
*/ | */ | |||
char * db1basename(int rpmtag) | /*@unused@*/ static inline | |||
/*@*/; | int dbiStat(dbiIndex dbi, unsigned int flags) | |||
/*@=exportlocal@*/ | /*@modifies dbi @*/ | |||
{ | ||||
return (*dbi->dbi_vec->stat) (dbi, flags); | ||||
} | ||||
/** \ingroup rpmdb | /** \ingroup dbi | |||
* Return dbi transaction id. | ||||
* @param dbi index database handle | ||||
* @return transaction id | ||||
*/ | */ | |||
/*@unused@*/ | /*@unused@*/ static inline /*@observer@*/ /*@null@*/ | |||
unsigned int rpmdbGetIteratorFileNum(rpmdbMatchIterator mi) | DB_TXN * dbiTxnid(dbiIndex dbi) | |||
/*@*/; | /*@*/ | |||
{ | ||||
return dbi->dbi_txnid; | ||||
} | ||||
/*@=globuse =mustmod @*/ | ||||
#endif /* !defined(SWIG) */ | ||||
/*@=exportlocal@*/ | ||||
/** \ingroup dbi | /** \ingroup dbi | |||
* Destroy set of index database items. | * Destroy set of index database items. | |||
* @param set set of index database items | * @param set set of index database items | |||
* @return NULL always | * @return NULL always | |||
*/ | */ | |||
/*@null@*/ dbiIndexSet dbiFreeIndexSet(/*@only@*/ /*@null@*/ dbiIndexSet se | /*@null@*/ | |||
t) | dbiIndexSet dbiFreeIndexSet(/*@only@*/ /*@null@*/ dbiIndexSet set) | |||
/*@modifies set @*/; | /*@modifies set @*/; | |||
/** \ingroup dbi | /** \ingroup dbi | |||
* Count items in index database set. | * Count items in index database set. | |||
* @param set set of index database items | * @param set set of index database items | |||
* @return number of items | * @return number of items | |||
*/ | */ | |||
unsigned int dbiIndexSetCount(dbiIndexSet set) | unsigned int dbiIndexSetCount(dbiIndexSet set) | |||
/*@*/; | /*@*/; | |||
skipping to change at line 556 | skipping to change at line 860 | |||
/*@*/; | /*@*/; | |||
/** \ingroup dbi | /** \ingroup dbi | |||
* Return file index from element in index database set. | * Return file index from element in index database set. | |||
* @param set set of index database items | * @param set set of index database items | |||
* @param recno index of item in set | * @param recno index of item in set | |||
* @return file index | * @return file index | |||
*/ | */ | |||
unsigned int dbiIndexRecordFileNumber(dbiIndexSet set, int recno) | unsigned int dbiIndexRecordFileNumber(dbiIndexSet set, int recno) | |||
/*@*/; | /*@*/; | |||
#endif /* defined(_RPMDB_INTERNAL) */ | ||||
/** \ingroup rpmdb | ||||
* Unreference a database instance. | ||||
* @param db rpm database | ||||
* @param msg | ||||
* @return NULL always | ||||
*/ | ||||
/*@unused@*/ /*@null@*/ | ||||
rpmdb rpmdbUnlink (/*@killref@*/ /*@only@*/ rpmdb db, const char * msg) | ||||
/*@modifies db @*/; | ||||
/** @todo Remove debugging entry from the ABI. */ | ||||
/*@-exportlocal@*/ | ||||
/*@null@*/ | ||||
rpmdb XrpmdbUnlink (/*@killref@*/ /*@only@*/ rpmdb db, const char * msg, | ||||
const char * fn, unsigned ln) | ||||
/*@modifies db @*/; | ||||
/*@=exportlocal@*/ | ||||
#define rpmdbUnlink(_db, _msg) XrpmdbUnlink(_db, _msg, __FILE__, __ | ||||
LINE__) | ||||
/** \ingroup rpmdb | ||||
* Reference a database instance. | ||||
* @param db rpm database | ||||
* @param msg | ||||
* @return new rpm database reference | ||||
*/ | ||||
/*@unused@*/ | ||||
rpmdb rpmdbLink (rpmdb db, const char * msg) | ||||
/*@modifies db @*/; | ||||
/** @todo Remove debugging entry from the ABI. */ | ||||
/*@-exportlocal@*/ | ||||
rpmdb XrpmdbLink (rpmdb db, const char * msg, | ||||
const char * fn, unsigned ln) | ||||
/*@modifies db @*/; | ||||
/*@=exportlocal@*/ | ||||
#define rpmdbLink(_db, _msg) XrpmdbLink(_db, _msg, __FILE__, __LI | ||||
NE__) | ||||
/** @todo document rpmdbNew | ||||
*/ | ||||
/*@only@*/ /*@null@*/ | ||||
rpmdb rpmdbNew(/*@kept@*/ /*@null@*/ const char * root, | ||||
/*@kept@*/ /*@null@*/ const char * home, | ||||
int mode, int perms, int flags); | ||||
/** @todo document rpmdbOpenDatabase | ||||
*/ | ||||
int rpmdbOpenDatabase(/*@null@*/ const char * prefix, | ||||
/*@null@*/ const char * dbpath, | ||||
int _dbapi, /*@null@*/ /*@out@*/ rpmdb *dbp, | ||||
int mode, int perms, int flags) | ||||
/*@globals rpmGlobalMacroContext, h_errno, | ||||
fileSystem, internalState @*/ | ||||
/*@modifies *dbp, rpmGlobalMacroContext, | ||||
fileSystem, internalState @*/; | ||||
/** \ingroup rpmdb | ||||
* Open rpm database. | ||||
* @param prefix path to top of install tree | ||||
* @retval dbp address of rpm database | ||||
* @param mode open(2) flags: O_RDWR or O_RDONLY (O_CREAT also) | ||||
* @param perms database permissions | ||||
* @return 0 on success | ||||
*/ | ||||
int rpmdbOpen (/*@null@*/ const char * prefix, /*@null@*/ /*@out@*/ rpmdb * | ||||
dbp, | ||||
int mode, int perms) | ||||
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | ||||
@*/ | ||||
/*@modifies *dbp, rpmGlobalMacroContext, fileSystem, internalState @ | ||||
*/; | ||||
/** \ingroup rpmdb | ||||
* Initialize database. | ||||
* @param prefix path to top of install tree | ||||
* @param perms database permissions | ||||
* @return 0 on success | ||||
*/ | ||||
int rpmdbInit(/*@null@*/ const char * prefix, int perms) | ||||
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | ||||
@*/ | ||||
/*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/; | ||||
/** \ingroup rpmdb | ||||
* Verify all database components. | ||||
* @param db rpm database | ||||
* @return 0 on success | ||||
*/ | ||||
int rpmdbVerifyAllDBI(rpmdb db) | ||||
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | ||||
@*/ | ||||
/*@modifies db, rpmGlobalMacroContext, fileSystem, internalState @*/ | ||||
; | ||||
/** \ingroup rpmdb | ||||
* Open and verify all database components. | ||||
* @param prefix path to top of install tree | ||||
* @return 0 on success | ||||
*/ | ||||
int rpmdbVerify(/*@null@*/ const char * prefix) | ||||
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | ||||
@*/ | ||||
/*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/; | ||||
/** | ||||
* Block access to a single database index. | ||||
* @param db rpm database | ||||
* @param rpmtag rpm tag (negative to block) | ||||
* @return 0 on success | ||||
*/ | ||||
int rpmdbBlockDBI(/*@null@*/ rpmdb db, int rpmtag) | ||||
/*@modifies db @*/; | ||||
/** | ||||
* Close a single database index. | ||||
* @param db rpm database | ||||
* @param rpmtag rpm tag | ||||
* @return 0 on success | ||||
*/ | ||||
int rpmdbCloseDBI(/*@null@*/ rpmdb db, int rpmtag) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies db, fileSystem @*/; | ||||
/** \ingroup rpmdb | ||||
* Close all database indices and free rpmdb. | ||||
* @param db rpm database | ||||
* @return 0 on success | ||||
*/ | ||||
int rpmdbClose (/*@killref@*/ /*@only@*/ /*@null@*/ rpmdb db) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies db, fileSystem @*/; | ||||
/** \ingroup rpmdb | ||||
* Sync all database indices. | ||||
* @param db rpm database | ||||
* @return 0 on success | ||||
*/ | ||||
int rpmdbSync (/*@null@*/ rpmdb db) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies fileSystem @*/; | ||||
/** \ingroup rpmdb | ||||
* Open all database indices. | ||||
* @param db rpm database | ||||
* @return 0 on success | ||||
*/ | ||||
/*@-exportlocal@*/ | ||||
int rpmdbOpenAll (/*@null@*/ rpmdb db) | ||||
/*@globals rpmGlobalMacroContext, h_errno @*/ | ||||
/*@modifies db, rpmGlobalMacroContext @*/; | ||||
/*@=exportlocal@*/ | ||||
/** \ingroup rpmdb | ||||
* Return number of instances of key in a tag index. | ||||
* @param db rpm database | ||||
* @param tag rpm tag | ||||
* @param keyp key data | ||||
* @param keylen key data length (0 will use strlen(keyp)) | ||||
* @return number of instances | ||||
*/ | ||||
int rpmdbCount(/*@null@*/ rpmdb db, rpmTag tag, | ||||
const void * keyp, size_t keylen) | ||||
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | ||||
@*/ | ||||
/*@modifies db, rpmGlobalMacroContext, fileSystem, internalState @*/ | ||||
; | ||||
/** \ingroup rpmdb | ||||
* Return number of instances of package in Name index. | ||||
* @param db rpm database | ||||
* @param name rpm package name | ||||
* @return number of instances | ||||
*/ | ||||
int rpmdbCountPackages(/*@null@*/ rpmdb db, const char * name) | ||||
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | ||||
@*/ | ||||
/*@modifies db, rpmGlobalMacroContext, fileSystem, internalState @*/ | ||||
; | ||||
/** \ingroup rpmdb | ||||
* Return header instance join key for current position of rpmdb iterator. | ||||
* @param mi rpm database iterator | ||||
* @return current header join key | ||||
*/ | ||||
unsigned int rpmdbGetIteratorOffset(/*@null@*/ rpmdbMatchIterator mi) | ||||
/*@*/; | ||||
/** \ingroup rpmdb | ||||
* Return header tag index join key for current position of rpmdb iterator. | ||||
* @param mi rpm database iterator | ||||
*/ | ||||
unsigned int rpmdbGetIteratorFileNum(rpmdbMatchIterator mi) | ||||
/*@*/; | ||||
/** \ingroup rpmdb | ||||
* Return number of elements in rpm database iterator. | ||||
* @param mi rpm database iterator | ||||
* @return number of elements | ||||
*/ | ||||
int rpmdbGetIteratorCount(/*@null@*/ rpmdbMatchIterator mi) | ||||
/*@*/; | ||||
/** \ingroup rpmdb | ||||
* Append items to set of package instances to iterate. | ||||
* @param mi rpm database iterator | ||||
* @param hdrNums array of package instances | ||||
* @param nHdrNums number of elements in array | ||||
* @return 0 on success, 1 on failure (bad args) | ||||
*/ | ||||
int rpmdbAppendIterator(/*@null@*/ rpmdbMatchIterator mi, | ||||
/*@null@*/ const int * hdrNums, int nHdrNums) | ||||
/*@modifies mi @*/; | ||||
/** \ingroup rpmdb | ||||
* Remove items from set of package instances to iterate. | ||||
* @note Sorted hdrNums are always passed in rpmlib. | ||||
* @param mi rpm database iterator | ||||
* @param hdrNums array of package instances | ||||
* @param nHdrNums number of elements in array | ||||
* @param sorted is the array sorted? (array will be sorted on return | ||||
) | ||||
* @return 0 on success, 1 on failure (bad args) | ||||
*/ | ||||
int rpmdbPruneIterator(/*@null@*/ rpmdbMatchIterator mi, | ||||
/*@null@*/ int * hdrNums, int nHdrNums, int sorted) | ||||
/*@modifies mi, hdrNums @*/; | ||||
/** \ingroup rpmdb | ||||
* Add pattern to iterator selector. | ||||
* @param mi rpm database iterator | ||||
* @param tag rpm tag | ||||
* @param mode type of pattern match | ||||
* @param pattern pattern to match | ||||
* @return 0 on success | ||||
*/ | ||||
int rpmdbSetIteratorRE(/*@null@*/ rpmdbMatchIterator mi, rpmTag tag, | ||||
rpmMireMode mode, /*@null@*/ const char * pattern) | ||||
/*@globals rpmGlobalMacroContext, h_errno @*/ | ||||
/*@modifies mi, mode, rpmGlobalMacroContext @*/; | ||||
/** \ingroup rpmdb | ||||
* Prepare iterator for lazy writes. | ||||
* @note Must be called before rpmdbNextIterator() with CDB model database. | ||||
* @param mi rpm database iterator | ||||
* @param rewrite new value of rewrite | ||||
* @return previous value | ||||
*/ | ||||
int rpmdbSetIteratorRewrite(/*@null@*/ rpmdbMatchIterator mi, int rewrite) | ||||
/*@modifies mi @*/; | ||||
/** \ingroup rpmdb | ||||
* Modify iterator to mark header for lazy write on release. | ||||
* @param mi rpm database iterator | ||||
* @param modified new value of modified | ||||
* @return previous value | ||||
*/ | ||||
int rpmdbSetIteratorModified(/*@null@*/ rpmdbMatchIterator mi, int modified | ||||
) | ||||
/*@modifies mi @*/; | ||||
/** \ingroup rpmdb | ||||
* Modify iterator to verify retrieved header blobs. | ||||
* @param mi rpm database iterator | ||||
* @param ts transaction set | ||||
* @return 0 always | ||||
*/ | ||||
int rpmdbSetHdrChk(/*@null@*/ rpmdbMatchIterator mi, /*@null@*/ rpmts ts) | ||||
/*@modifies mi @*/; | ||||
/** \ingroup rpmdb | ||||
* Return database iterator. | ||||
* @param db rpm database | ||||
* @param rpmtag rpm tag | ||||
* @param keyp key data (NULL for sequential access) | ||||
* @param keylen key data length (0 will use strlen(keyp)) | ||||
* @return NULL on failure | ||||
*/ | ||||
/*@only@*/ /*@null@*/ | ||||
rpmdbMatchIterator rpmdbInitIterator(/*@null@*/ rpmdb db, rpmTag rpmtag, | ||||
/*@null@*/ const void * keyp, size_t keylen) | ||||
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | ||||
@*/ | ||||
/*@modifies db, rpmGlobalMacroContext, fileSystem, internalState @*/ | ||||
; | ||||
/** \ingroup rpmdb | ||||
* Return next package header from iteration. | ||||
* @param mi rpm database iterator | ||||
* @return NULL on end of iteration. | ||||
*/ | ||||
/*@null@*/ | ||||
Header rpmdbNextIterator(/*@null@*/ rpmdbMatchIterator mi) | ||||
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | ||||
@*/ | ||||
/*@modifies mi, rpmGlobalMacroContext, fileSystem, internalState @*/ | ||||
; | ||||
/** \ingroup rpmdb | ||||
* Check rpmdb signal handler for trapped signal and/or requested exit. | ||||
* Clean up any open iterators and databases on termination condition. | ||||
* On non-zero exit any open references to rpmdb are invalid and cannot | ||||
* be accessed anymore, calling process should terminate immediately. | ||||
* | ||||
* @param terminate 0 to only check for signals, 1 to terminate anyway | ||||
* @return 0 to continue, 1 if termination cleanup was done. | ||||
*/ | ||||
/*@mayexit@*/ | ||||
int rpmdbCheckTerminate(int terminate) | ||||
/*@globals fileSystem, internalState @*/ | ||||
/*@modifies fileSystem, internalState @*/; | ||||
/** \ingroup rpmdb | ||||
* Check for and exit on termination signals. | ||||
*/ | ||||
/*@mayexit@*/ | ||||
int rpmdbCheckSignals(void) | ||||
/*@globals fileSystem, internalState @*/ | ||||
/*@modifies fileSystem, internalState @*/; | ||||
/** \ingroup rpmdb | ||||
* Destroy rpm database iterator. | ||||
* @param mi rpm database iterator | ||||
* @return NULL always | ||||
*/ | ||||
/*@null@*/ | ||||
rpmdbMatchIterator rpmdbFreeIterator(/*@only@*/ /*@null@*/rpmdbMatchIterato | ||||
r mi) | ||||
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | ||||
@*/ | ||||
/*@modifies mi, rpmGlobalMacroContext, fileSystem, internalState @*/ | ||||
; | ||||
/** \ingroup rpmdb | ||||
* Add package header to rpm database and indices. | ||||
* @param db rpm database | ||||
* @param iid install transaction id (iid = 0 or -1 to skip) | ||||
* @param h header | ||||
* @param ts (unused) transaction set (or NULL) | ||||
* @return 0 on success | ||||
*/ | ||||
int rpmdbAdd(/*@null@*/ rpmdb db, int iid, Header h, /*@null@*/ rpmts ts) | ||||
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | ||||
@*/ | ||||
/*@modifies db, h, ts, | ||||
rpmGlobalMacroContext, fileSystem, internalState @*/; | ||||
/** \ingroup rpmdb | ||||
* Remove package header from rpm database and indices. | ||||
* @param db rpm database | ||||
* @param rid (unused) remove transaction id (rid = 0 or -1 to ski | ||||
p) | ||||
* @param hdrNum package instance number in database | ||||
* @param ts (unused) transaction set (or NULL) | ||||
* @return 0 on success | ||||
*/ | ||||
int rpmdbRemove(/*@null@*/ rpmdb db, /*@unused@*/ int rid, unsigned int hdr | ||||
Num, | ||||
/*@null@*/ rpmts ts) | ||||
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | ||||
@*/ | ||||
/*@modifies db, ts, | ||||
rpmGlobalMacroContext, fileSystem, internalState @*/; | ||||
/** \ingroup rpmdb | ||||
* Rebuild database indices from package headers. | ||||
* @param prefix path to top of install tree | ||||
* @param ts transaction set (or NULL) | ||||
* @return 0 on success | ||||
*/ | ||||
int rpmdbRebuild(/*@null@*/ const char * prefix, /*@null@*/ rpmts ts) | ||||
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | ||||
@*/ | ||||
/*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/ | ||||
; | ||||
/** | ||||
* Mergesort, same arguments as qsort(2). | ||||
*/ | ||||
/*@unused@*/ | ||||
int rpm_mergesort(void *base, size_t nmemb, size_t size, | ||||
int (*cmp) (const void *, const void *)) | ||||
/*@globals errno @*/ | ||||
/*@modifies base, errno @*/; | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
/*@=bounds@*/ | ||||
#endif /* H_RPMDB */ | #endif /* H_RPMDB */ | |||
End of changes. 103 change blocks. | ||||
236 lines changed or deleted | 920 lines changed or added | |||
rpmio.h | rpmio.h | |||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
/** \ingroup rpmio | /** \ingroup rpmio | |||
* \file rpmio/rpmio.h | * \file rpmio/rpmio.h | |||
* | * | |||
*/ | */ | |||
#include <sys/types.h> | #include <sys/types.h> | |||
#include <sys/stat.h> | #include <sys/stat.h> | |||
#include <dirent.h> | #include <dirent.h> | |||
/*@-noparams@*/ | /*@-noparams@*/ | |||
#include <glob.h> | #include "glob.h" | |||
/*@=noparams@*/ | /*@=noparams@*/ | |||
#include <stdio.h> | #include <stdio.h> | |||
#include <stdlib.h> | #include <stdlib.h> | |||
#include <unistd.h> | #include <unistd.h> | |||
/** | ||||
*/ | ||||
#ifdef NOTYET | ||||
typedef /*@abstract@*/ struct pgpDig_s * pgpDig; | ||||
#endif | ||||
/** \ingroup rpmio | /** \ingroup rpmio | |||
* Hide libio API lossage. | * Hide libio API lossage. | |||
* The libio interface changed after glibc-2.1.3 to pass the seek offset | * The libio interface changed after glibc-2.1.3 to pass the seek offset | |||
* argument as a pointer rather than as an off_t. The snarl below defines | * argument as a pointer rather than as an off_t. The snarl below defines | |||
* typedefs to isolate the lossage. | * typedefs to isolate the lossage. | |||
* API unchanged. | ||||
*/ | */ | |||
/*@{*/ | /*@{*/ | |||
#if !defined(__LCLINT__) && defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC | #if !defined(__LCLINT__) && !defined(__UCLIBC__) && defined(__GLIBC__) && \ | |||
_MINOR__ == 2 | (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) | |||
#define USE_COOKIE_SEEK_POINTER 1 | #define USE_COOKIE_SEEK_POINTER 1 | |||
typedef _IO_off64_t _libio_off_t; | typedef _IO_off64_t _libio_off_t; | |||
typedef _libio_off_t * _libio_pos_t; | typedef _libio_off_t * _libio_pos_t; | |||
#else | #else | |||
typedef off_t _libio_off_t; | typedef off_t _libio_off_t; | |||
typedef off_t _libio_pos_t; | typedef off_t _libio_pos_t; | |||
#endif | #endif | |||
/*@}*/ | /*@}*/ | |||
/** \ingroup rpmio | /** \ingroup rpmio | |||
skipping to change at line 55 | skipping to change at line 49 | |||
typedef /*@abstract@*/ /*@refcounted@*/ struct _FD_s * FD_t; | typedef /*@abstract@*/ /*@refcounted@*/ struct _FD_s * FD_t; | |||
/** \ingroup rpmio | /** \ingroup rpmio | |||
*/ | */ | |||
typedef /*@observer@*/ struct FDIO_s * FDIO_t; | typedef /*@observer@*/ struct FDIO_s * FDIO_t; | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
/** | ||||
* RPM return codes. | ||||
*/ | ||||
typedef enum rpmRC_e { | ||||
RPMRC_OK = 0, /*!< Generic success code */ | ||||
RPMRC_NOTFOUND = 1, /*!< Generic not found code. */ | ||||
RPMRC_FAIL = 2, /*!< Generic failure code. */ | ||||
RPMRC_NOTTRUSTED = 3, /*!< Signature is OK, but key is not trusted | ||||
. */ | ||||
RPMRC_NOKEY = 4 /*!< Public key is unavailable. */ | ||||
} rpmRC; | ||||
/** \ingroup rpmio | /** \ingroup rpmio | |||
* \name RPMIO Vectors. | * \name RPMIO Vectors. | |||
*/ | */ | |||
/*@{*/ | /*@{*/ | |||
/** | /** | |||
*/ | */ | |||
typedef ssize_t (*fdio_read_function_t) (void *cookie, char *buf, size_t nb ytes) | typedef ssize_t (*fdio_read_function_t) (void *cookie, char *buf, size_t nb ytes) | |||
/*@globals fileSystem @*/ | /*@globals errno, fileSystem @*/ | |||
/*@modifies *cookie, fileSystem @*/; | /*@modifies *cookie, errno, fileSystem @*/ | |||
/*@requires maxSet(buf) >= (nbytes - 1) @*/ | ||||
/*@ensures maxRead(buf) == result @*/ ; | ||||
/** | /** | |||
*/ | */ | |||
typedef ssize_t (*fdio_write_function_t) (void *cookie, const char *buf, si ze_t nbytes) | typedef ssize_t (*fdio_write_function_t) (void *cookie, const char *buf, si ze_t nbytes) | |||
/*@globals fileSystem @*/ | /*@globals errno, fileSystem @*/ | |||
/*@modifies *cookie, fileSystem @*/; | /*@modifies *cookie, errno, fileSystem @*/; | |||
/** | /** | |||
*/ | */ | |||
typedef int (*fdio_seek_function_t) (void *cookie, _libio_pos_t pos, int wh ence) | typedef int (*fdio_seek_function_t) (void *cookie, _libio_pos_t pos, int wh ence) | |||
/*@globals fileSystem @*/ | /*@globals errno, fileSystem @*/ | |||
/*@modifies *cookie, fileSystem @*/; | /*@modifies *cookie, errno, fileSystem @*/; | |||
/** | /** | |||
*/ | */ | |||
typedef int (*fdio_close_function_t) (void *cookie) | typedef int (*fdio_close_function_t) (void *cookie) | |||
/*@globals fileSystem @*/ | /*@globals errno, fileSystem, systemState @*/ | |||
/*@modifies *cookie, fileSystem @*/; | /*@modifies *cookie, errno, fileSystem, systemState @*/; | |||
/** | ||||
*/ | ||||
typedef /*@only@*/ /*@null@*/ FD_t (*fdio_ref_function_t) ( /*@only@*/ void | ||||
* cookie, | ||||
const char * msg, const char * file, unsigned line) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies fileSystem @*/; | ||||
/** | ||||
*/ | ||||
typedef /*@only@*/ /*@null@*/ FD_t (*fdio_deref_function_t) ( /*@only@*/ FD | ||||
_t fd, | ||||
const char * msg, const char * file, unsigned line) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies fd, fileSystem @*/; | ||||
/** | ||||
*/ | ||||
typedef /*@only@*/ /*@null@*/ FD_t (*fdio_new_function_t) (const char * msg | ||||
, | ||||
const char * file, unsigned line) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies fileSystem @*/; | ||||
/** | ||||
*/ | ||||
typedef int (*fdio_fileno_function_t) (void * cookie) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies *cookie, fileSystem @*/; | ||||
/** | ||||
*/ | ||||
typedef FD_t (*fdio_open_function_t) (const char * path, int flags, mode_t | ||||
mode) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies fileSystem @*/; | ||||
/** | /** | |||
*/ | */ | |||
typedef FD_t (*fdio_fopen_function_t) (const char * path, const char * fmod e) | typedef FD_t (*fdio_fopen_function_t) (const char * path, const char * fmod e) | |||
/*@globals fileSystem @*/ | /*@globals errno, fileSystem @*/ | |||
/*@modifies fileSystem @*/; | /*@modifies errno, fileSystem @*/; | |||
/** | ||||
*/ | ||||
typedef void * (*fdio_ffileno_function_t) (FD_t fd) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies fileSystem @*/; | ||||
/** | ||||
*/ | ||||
typedef int (*fdio_fflush_function_t) (FD_t fd) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies fileSystem @*/; | ||||
/*@}*/ | ||||
/** \ingroup rpmrpc | ||||
* \name RPMRPC Vectors. | ||||
*/ | ||||
/*@{*/ | ||||
/** | ||||
*/ | ||||
typedef int (*fdio_mkdir_function_t) (const char * path, mode_t mode) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies fileSystem @*/; | ||||
/** | ||||
*/ | ||||
typedef int (*fdio_chdir_function_t) (const char * path) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies fileSystem @*/; | ||||
/** | ||||
*/ | ||||
typedef int (*fdio_rmdir_function_t) (const char * path) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies fileSystem @*/; | ||||
/** | ||||
*/ | ||||
typedef int (*fdio_rename_function_t) (const char * oldpath, const char * n | ||||
ewpath) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies fileSystem @*/; | ||||
/** | ||||
*/ | ||||
typedef int (*fdio_unlink_function_t) (const char * path) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies fileSystem @*/; | ||||
/*@-typeuse@*/ | ||||
/** | ||||
*/ | ||||
typedef int (*fdio_stat_function_t) (const char * path, /*@out@*/ struct st | ||||
at * st) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies *st, fileSystem @*/; | ||||
/** | /** | |||
*/ | */ | |||
typedef int (*fdio_lstat_function_t) (const char * path, /*@out@*/ struct s | typedef FD_t (*fdio_fdopen_function_t) (void * cookie, const char * fmode) | |||
tat * st) | /*@globals errno, fileSystem @*/ | |||
/*@globals fileSystem @*/ | /*@modifies errno, fileSystem @*/; | |||
/*@modifies *st, fileSystem @*/; | ||||
/** | ||||
*/ | ||||
typedef int (*fdio_access_function_t) (const char * path, int amode) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies fileSystem @*/; | ||||
/*@=typeuse@*/ | ||||
/*@}*/ | /*@}*/ | |||
/** \ingroup rpmio | /** \ingroup rpmio | |||
*/ | */ | |||
struct FDIO_s { | struct FDIO_s { | |||
fdio_read_function_t read; | fdio_read_function_t read; | |||
fdio_write_function_t write; | fdio_write_function_t write; | |||
fdio_seek_function_t seek; | fdio_seek_function_t seek; | |||
fdio_close_function_t close; | fdio_close_function_t close; | |||
fdio_ref_function_t _fdref; | ||||
fdio_deref_function_t _fdderef; | ||||
fdio_new_function_t _fdnew; | ||||
fdio_fileno_function_t _fileno; | ||||
fdio_open_function_t _open; | ||||
fdio_fopen_function_t _fopen; | fdio_fopen_function_t _fopen; | |||
fdio_ffileno_function_t _ffileno; | fdio_fdopen_function_t _fdopen; | |||
fdio_fflush_function_t _fflush; | ||||
fdio_mkdir_function_t _mkdir; | ||||
fdio_chdir_function_t _chdir; | ||||
fdio_rmdir_function_t _rmdir; | ||||
fdio_rename_function_t _rename; | ||||
fdio_unlink_function_t _unlink; | ||||
}; | }; | |||
/** \ingroup rpmio | /** \ingroup rpmio | |||
* \name RPMIO Interface. | * \name RPMIO Interface. | |||
*/ | */ | |||
/*@{*/ | /*@{*/ | |||
/** | /** | |||
* strerror(3) clone. | * strerror(3) clone. | |||
*/ | */ | |||
/*@-redecl@*/ | ||||
/*@observer@*/ const char * Fstrerror(/*@null@*/ FD_t fd) | /*@observer@*/ const char * Fstrerror(/*@null@*/ FD_t fd) | |||
/*@*/; | /*@*/; | |||
/*@=redecl@*/ | ||||
/** | /** | |||
* fread(3) clone. | * fread(3) clone. | |||
*/ | */ | |||
/*@-incondefs@*/ | ||||
size_t Fread(/*@out@*/ void * buf, size_t size, size_t nmemb, FD_t fd) | size_t Fread(/*@out@*/ void * buf, size_t size, size_t nmemb, FD_t fd) | |||
/*@globals fileSystem @*/ | /*@globals fileSystem @*/ | |||
/*@modifies fd, *buf, fileSystem @*/; | /*@modifies fd, *buf, fileSystem @*/ | |||
/*@requires maxSet(buf) >= (nmemb - 1) @*/ | ||||
/*@ensures maxRead(buf) == result @*/; | ||||
/*@=incondefs@*/ | ||||
/** | /** | |||
* fwrite(3) clone. | * fwrite(3) clone. | |||
*/ | */ | |||
/*@-incondefs@*/ | ||||
size_t Fwrite(const void * buf, size_t size, size_t nmemb, FD_t fd) | size_t Fwrite(const void * buf, size_t size, size_t nmemb, FD_t fd) | |||
/*@globals fileSystem @*/ | /*@globals fileSystem @*/ | |||
/*@modifies fd, fileSystem @*/; | /*@modifies fd, fileSystem @*/ | |||
/*@requires maxRead(buf) >= nmemb @*/; | ||||
/*@=incondefs@*/ | ||||
/** | /** | |||
* fseek(3) clone. | * fseek(3) clone. | |||
*/ | */ | |||
int Fseek(FD_t fd, _libio_off_t offset, int whence) | int Fseek(FD_t fd, _libio_off_t offset, int whence) | |||
/*@globals fileSystem @*/ | /*@globals fileSystem @*/ | |||
/*@modifies fileSystem @*/; | /*@modifies fileSystem @*/; | |||
/** | /** | |||
* fclose(3) clone. | * fclose(3) clone. | |||
*/ | */ | |||
int Fclose( /*@killref@*/ FD_t fd) | int Fclose( /*@killref@*/ FD_t fd) | |||
/*@globals fileSystem @*/ | /*@globals fileSystem, internalState @*/ | |||
/*@modifies fd, fileSystem @*/; | /*@modifies fd, fileSystem, internalState @*/; | |||
/** | /** | |||
*/ | */ | |||
/*@null@*/ FD_t Fdopen(FD_t ofd, const char * fmode) | /*@null@*/ FD_t Fdopen(FD_t ofd, const char * fmode) | |||
/*@globals fileSystem @*/ | /*@globals fileSystem, internalState @*/ | |||
/*@modifies ofd, fileSystem @*/; | /*@modifies ofd, fileSystem, internalState @*/; | |||
/** | /** | |||
* fopen(3) clone. | * fopen(3) clone. | |||
*/ | */ | |||
/*@null@*/ FD_t Fopen(/*@null@*/ const char * path, | /*@null@*/ FD_t Fopen(/*@null@*/ const char * path, | |||
/*@null@*/ const char * fmode) | /*@null@*/ const char * fmode) | |||
/*@globals fileSystem @*/ | /*@globals h_errno, fileSystem, internalState @*/ | |||
/*@modifies fileSystem @*/; | /*@modifies fileSystem, internalState @*/; | |||
/** | /** | |||
* fflush(3) clone. | * fflush(3) clone. | |||
*/ | */ | |||
int Fflush(/*@null@*/ FD_t fd) | int Fflush(/*@null@*/ FD_t fd) | |||
/*@globals fileSystem @*/ | /*@globals fileSystem @*/ | |||
/*@modifies fd, fileSystem @*/; | /*@modifies fd, fileSystem @*/; | |||
/** | /** | |||
* ferror(3) clone. | * ferror(3) clone. | |||
skipping to change at line 295 | skipping to change at line 199 | |||
/** | /** | |||
* fileno(3) clone. | * fileno(3) clone. | |||
*/ | */ | |||
int Fileno(FD_t fd) | int Fileno(FD_t fd) | |||
/*@globals fileSystem @*/ | /*@globals fileSystem @*/ | |||
/*@modifies fileSystem@*/; | /*@modifies fileSystem@*/; | |||
/** | /** | |||
* fcntl(2) clone. | * fcntl(2) clone. | |||
*/ | */ | |||
/*@unused@*/ | ||||
int Fcntl(FD_t fd, int op, void *lip) | int Fcntl(FD_t fd, int op, void *lip) | |||
/*@globals fileSystem @*/ | /*@globals errno, fileSystem @*/ | |||
/*@modifies fd, *lip, fileSystem @*/; | /*@modifies fd, *lip, errno, fileSystem @*/; | |||
/*@}*/ | /*@}*/ | |||
/** \ingroup rpmrpc | /** \ingroup rpmrpc | |||
* \name RPMRPC Interface. | * \name RPMRPC Interface. | |||
*/ | */ | |||
/*@{*/ | /*@{*/ | |||
/** | /** | |||
* mkdir(2) clone. | * mkdir(2) clone. | |||
*/ | */ | |||
int Mkdir(const char * path, mode_t mode) | int Mkdir(const char * path, mode_t mode) | |||
/*@globals fileSystem @*/ | /*@globals errno, h_errno, fileSystem, internalState @*/ | |||
/*@modifies fileSystem @*/; | /*@modifies errno, fileSystem, internalState @*/; | |||
/** | /** | |||
* chdir(2) clone. | * chdir(2) clone. | |||
*/ | */ | |||
int Chdir(const char * path) | int Chdir(const char * path) | |||
/*@globals fileSystem @*/ | /*@globals errno, h_errno, fileSystem, internalState @*/ | |||
/*@modifies fileSystem @*/; | /*@modifies errno, fileSystem, internalState @*/; | |||
/** | /** | |||
* rmdir(2) clone. | * rmdir(2) clone. | |||
*/ | */ | |||
int Rmdir(const char * path) | int Rmdir(const char * path) | |||
/*@globals fileSystem @*/ | /*@globals errno, h_errno, fileSystem, internalState @*/ | |||
/*@modifies fileSystem @*/; | /*@modifies errno, fileSystem, internalState @*/; | |||
/*@unchecked@*/ /*@observer@*/ /*@null@*/ | ||||
extern const char * _chroot_prefix; | ||||
/** | ||||
* chroot(2) clone. | ||||
* @todo Implement remotely. | ||||
*/ | ||||
int Chroot(const char * path) | ||||
/*@globals _chroot_prefix, errno, fileSystem, internalState @*/ | ||||
/*@modifies _chroot_prefix, errno, fileSystem, internalState @*/; | ||||
/** | ||||
* open(2) clone. | ||||
* @todo Implement remotely. | ||||
*/ | ||||
int Open(const char * path, int flags, mode_t mode) | ||||
/*@globals errno, fileSystem, internalState @*/ | ||||
/*@modifies errno, fileSystem, internalState @*/; | ||||
/** | /** | |||
* rename(2) clone. | * rename(2) clone. | |||
*/ | */ | |||
int Rename(const char * oldpath, const char * newpath) | int Rename(const char * oldpath, const char * newpath) | |||
/*@globals fileSystem @*/ | /*@globals errno, h_errno, fileSystem, internalState @*/ | |||
/*@modifies fileSystem @*/; | /*@modifies errno, fileSystem, internalState @*/; | |||
/** | /** | |||
* link(2) clone. | * link(2) clone. | |||
*/ | */ | |||
int Link(const char * oldpath, const char * newpath) | int Link(const char * oldpath, const char * newpath) | |||
/*@globals fileSystem @*/ | /*@globals errno, fileSystem, internalState @*/ | |||
/*@modifies fileSystem @*/; | /*@modifies errno, fileSystem, internalState @*/; | |||
/** | /** | |||
* unlink(2) clone. | * unlink(2) clone. | |||
*/ | */ | |||
int Unlink(const char * path) | int Unlink(const char * path) | |||
/*@globals fileSystem @*/ | /*@globals errno, h_errno, fileSystem, internalState @*/ | |||
/*@modifies fileSystem @*/; | /*@modifies errno, fileSystem, internalState @*/; | |||
/** | ||||
* readlink(2) clone. | ||||
*/ | ||||
int Readlink(const char * path, /*@out@*/ char * buf, size_t bufsiz) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies *buf, fileSystem @*/; | ||||
/** | /** | |||
* stat(2) clone. | * stat(2) clone. | |||
*/ | */ | |||
int Stat(const char * path, /*@out@*/ struct stat * st) | int Stat(const char * path, /*@out@*/ struct stat * st) | |||
/*@globals fileSystem @*/ | /*@globals errno, h_errno, fileSystem, internalState @*/ | |||
/*@modifies *st, fileSystem @*/; | /*@modifies *st, errno, fileSystem, internalState @*/; | |||
/** | /** | |||
* lstat(2) clone. | * lstat(2) clone. | |||
*/ | */ | |||
int Lstat(const char * path, /*@out@*/ struct stat * st) | int Lstat(const char * path, /*@out@*/ struct stat * st) | |||
/*@globals fileSystem @*/ | /*@globals errno, h_errno, fileSystem, internalState @*/ | |||
/*@modifies *st, fileSystem @*/; | /*@modifies *st, errno, fileSystem, internalState @*/; | |||
/** | ||||
* chown(2) clone. | ||||
* @todo Implement remotely. | ||||
*/ | ||||
int Chown(const char * path, uid_t owner, gid_t group) | ||||
/*@globals errno, fileSystem, internalState @*/ | ||||
/*@modifies errno, fileSystem, internalState @*/; | ||||
/** | ||||
* lchown(2) clone. | ||||
* @todo Implement remotely. | ||||
*/ | ||||
int Lchown(const char * path, uid_t owner, gid_t group) | ||||
/*@globals errno, fileSystem, internalState @*/ | ||||
/*@modifies errno, fileSystem, internalState @*/; | ||||
/** | ||||
* chmod(2) clone. | ||||
* @todo Implement remotely. | ||||
*/ | ||||
int Chmod(const char * path, mode_t mode) | ||||
/*@globals errno, fileSystem, internalState @*/ | ||||
/*@modifies errno, fileSystem, internalState @*/; | ||||
/** | ||||
* mkfifo(3) clone. | ||||
* @todo Implement remotely. | ||||
*/ | ||||
int Mkfifo(const char * path, mode_t mode) | ||||
/*@globals errno, fileSystem, internalState @*/ | ||||
/*@modifies errno, fileSystem, internalState @*/; | ||||
/** | ||||
* mknod(3) clone. | ||||
* @todo Implement remotely. | ||||
*/ | ||||
int Mknod(const char * path, mode_t mode, dev_t dev) | ||||
/*@globals errno, fileSystem, internalState @*/ | ||||
/*@modifies errno, fileSystem, internalState @*/; | ||||
/** | ||||
* utime(2) clone. | ||||
* @todo Implement remotely. | ||||
*/ | ||||
struct utimbuf; | ||||
int Utime(const char * path, const struct utimbuf * buf) | ||||
/*@globals errno, fileSystem, internalState @*/ | ||||
/*@modifies errno, fileSystem, internalState @*/; | ||||
/** | ||||
* utimes(2) clone. | ||||
* @todo Implement remotely. | ||||
*/ | ||||
int Utimes(const char * path, const struct timeval * times) | ||||
/*@globals errno, fileSystem, internalState @*/ | ||||
/*@modifies errno, fileSystem, internalState @*/; | ||||
/** | ||||
* symlink(3) clone. | ||||
* @todo Implement remotely. | ||||
*/ | ||||
int Symlink(const char * oldpath, const char * newpath) | ||||
/*@globals errno, fileSystem, internalState @*/ | ||||
/*@modifies errno, fileSystem, internalState @*/; | ||||
/** | ||||
* readlink(2) clone. | ||||
* @todo Implement remotely. | ||||
*/ | ||||
/*@-incondefs@*/ | ||||
int Readlink(const char * path, /*@out@*/ char * buf, size_t bufsiz) | ||||
/*@globals errno, h_errno, fileSystem, internalState @*/ | ||||
/*@modifies *buf, errno, fileSystem, internalState @*/ | ||||
/*@requires maxSet(buf) >= (bufsiz - 1) @*/ | ||||
/*@ensures maxRead(buf) <= bufsiz @*/; | ||||
/*@=incondefs@*/ | ||||
/** | /** | |||
* access(2) clone. | * access(2) clone. | |||
* @todo Implement remotely. | ||||
*/ | */ | |||
int Access(const char * path, int amode) | int Access(const char * path, int amode) | |||
/*@globals fileSystem @*/ | /*@globals errno, fileSystem @*/ | |||
/*@modifies fileSystem @*/; | /*@modifies errno, fileSystem @*/; | |||
#if defined(__linux__) | ||||
/** | ||||
* mount(2) clone. | ||||
*/ | ||||
int Mount(const char *source, const char *target, | ||||
const char *filesystemtype, unsigned long mountflags, | ||||
const void *data) | ||||
/*@globals errno, fileSystem @*/ | ||||
/*@modifies errno, fileSystem @*/; | ||||
/** | ||||
* umount(2) clone. | ||||
*/ | ||||
int Umount(const char *target) | ||||
/*@globals errno, fileSystem @*/ | ||||
/*@modifies errno, fileSystem @*/; | ||||
/** | ||||
* umount2(2) clone. | ||||
*/ | ||||
int Umount2(const char *target, int flags) | ||||
/*@globals errno, fileSystem @*/ | ||||
/*@modifies errno, fileSystem @*/; | ||||
#endif | ||||
/** | ||||
* glob_pattern_p(3) clone. | ||||
*/ | ||||
int Glob_pattern_p (const char *pattern, int quote) | ||||
/*@*/; | ||||
/** | ||||
* glob_error(3) clone. | ||||
*/ | ||||
int Glob_error(const char * epath, int eerrno) | ||||
/*@*/; | ||||
/** | /** | |||
* glob(3) clone. | * glob(3) clone. | |||
*/ | */ | |||
int Glob(const char * pattern, int flags, | int Glob(const char * pattern, int flags, | |||
int errfunc(const char * epath, int eerrno), | int errfunc(const char * epath, int eerrno), | |||
/*@out@*/ glob_t * pglob) | /*@out@*/ glob_t * pglob) | |||
/*@globals fileSystem @*/ | /*@globals fileSystem @*/ | |||
/*@modifies *pglob, fileSystem @*/; | /*@modifies *pglob, fileSystem @*/; | |||
skipping to change at line 397 | skipping to change at line 429 | |||
*/ | */ | |||
void Globfree( /*@only@*/ glob_t * pglob) | void Globfree( /*@only@*/ glob_t * pglob) | |||
/*@globals fileSystem @*/ | /*@globals fileSystem @*/ | |||
/*@modifies *pglob, fileSystem @*/; | /*@modifies *pglob, fileSystem @*/; | |||
/** | /** | |||
* opendir(3) clone. | * opendir(3) clone. | |||
*/ | */ | |||
/*@null@*/ | /*@null@*/ | |||
DIR * Opendir(const char * path) | DIR * Opendir(const char * path) | |||
/*@globals fileSystem @*/ | /*@globals errno, h_errno, fileSystem, internalState @*/ | |||
/*@modifies fileSystem @*/; | /*@modifies errno, fileSystem, internalState @*/; | |||
/** | /** | |||
* readdir(3) clone. | * readdir(3) clone. | |||
*/ | */ | |||
/*@null@*/ struct dirent * Readdir(DIR * dir) | /*@dependent@*/ /*@null@*/ | |||
/*@globals fileSystem @*/ | struct dirent * Readdir(DIR * dir) | |||
/*@modifies *dir, fileSystem @*/; | /*@globals errno, fileSystem @*/ | |||
/*@modifies *dir, errno, fileSystem @*/; | ||||
/** | /** | |||
* closedir(3) clone. | * closedir(3) clone. | |||
*/ | */ | |||
int Closedir(/*@only@*/ DIR * dir) | int Closedir(/*@only@*/ DIR * dir) | |||
/*@globals fileSystem @*/ | /*@globals errno, fileSystem @*/ | |||
/*@modifies *dir, fileSystem @*/; | /*@modifies *dir, errno, fileSystem @*/; | |||
/** | ||||
* realpath(3) clone. | ||||
*/ | ||||
char * Realpath(const char * path, /*@out@*/ /*@null@*/ char * resolved_pat | ||||
h) | ||||
/*@globals errno, fileSystem, internalState @*/ | ||||
/*@modifies *resolved_path, errno, fileSystem, internalState @*/; | ||||
/** | ||||
* lseek(2) clone. | ||||
* @todo Implement SEEK_HOLE/SEEK_DATA. | ||||
*/ | ||||
off_t Lseek(int fdno, off_t offset, int whence) | ||||
/*@globals errno, fileSystem @*/ | ||||
/*@modifies errno, fileSystem @*/; | ||||
/*@}*/ | /*@}*/ | |||
/** \ingroup rpmio | /** \ingroup rpmio | |||
* \name RPMIO Utilities. | * \name RPMIO Utilities. | |||
*/ | */ | |||
/*@{*/ | /*@{*/ | |||
/** | /** | |||
*/ | */ | |||
off_t fdSize(FD_t fd) | off_t fdSize(FD_t fd) | |||
/*@globals fileSystem @*/ | /*@globals fileSystem @*/ | |||
/*@modifies fd, fileSystem@*/; | /*@modifies fd, fileSystem@*/; | |||
/** | /** | |||
*/ | */ | |||
/*@null@*/ FD_t fdDup(int fdno) | /*@null@*/ FD_t fdDup(int fdno) | |||
/*@globals fileSystem @*/ | /*@globals fileSystem, internalState @*/ | |||
/*@modifies fileSystem@*/; | /*@modifies fileSystem, internalState @*/; | |||
#ifdef UNUSED | ||||
/*@null@*/ FILE *fdFdopen( /*@only@*/ void * cookie, const char * mode); | ||||
#endif | ||||
/* XXX Legacy interfaces needed by gnorpm, rpmfind et al */ | ||||
/*@-exportlocal@*/ | /*@-exportlocal@*/ | |||
/** | /** | |||
*/ | */ | |||
#ifndef H_RPMIO_INTERNAL /* XXX avoid gcc warning */ | /*@-incondefs@*/ | |||
/*@unused@*/ int fdFileno(void * cookie) | ||||
/*@*/; | ||||
#define fdFileno(_fd) fdio->_fileno(_fd) | ||||
#endif | ||||
/** | ||||
*/ | ||||
/*@null@*/ FD_t fdOpen(const char *path, int flags, mode_t mode) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies fileSystem @*/; | ||||
#define fdOpen(_path, _flags, _mode) fdio->_open((_path), (_flags | ||||
), (_mode)) | ||||
/** | ||||
*/ | ||||
ssize_t fdRead(void * cookie, /*@out@*/ char * buf, size_t count) | ssize_t fdRead(void * cookie, /*@out@*/ char * buf, size_t count) | |||
/*@globals fileSystem @*/ | /*@globals errno, fileSystem, internalState @*/ | |||
/*@modifies *cookie, *buf, fileSystem @*/; | /*@modifies *cookie, *buf, errno, fileSystem, internalState @*/ | |||
/*@requires maxSet(buf) >= (count - 1) @*/ | ||||
/*@ensures maxRead(buf) == result @*/ ; | ||||
#define fdRead(_fd, _buf, _count) fdio->read((_fd), (_buf), (_ count)) | #define fdRead(_fd, _buf, _count) fdio->read((_fd), (_buf), (_ count)) | |||
/*@=incondefs@*/ | ||||
/** | /** | |||
*/ | */ | |||
ssize_t fdWrite(void * cookie, const char * buf, size_t count) | ssize_t fdWrite(void * cookie, const char * buf, size_t count) | |||
/*@globals fileSystem @*/ | /*@globals errno, fileSystem, internalState @*/ | |||
/*@modifies *cookie, fileSystem @*/; | /*@modifies *cookie, errno, fileSystem, internalState @*/; | |||
#define fdWrite(_fd, _buf, _count) fdio->write((_fd), (_buf), ( _count)) | #define fdWrite(_fd, _buf, _count) fdio->write((_fd), (_buf), ( _count)) | |||
/** | /** | |||
*/ | */ | |||
int fdClose( /*@only@*/ void * cookie) | int fdClose( /*@only@*/ void * cookie) | |||
/*@globals fileSystem @*/ | /*@globals errno, fileSystem, systemState, internalState @*/ | |||
/*@modifies *cookie, fileSystem @*/; | /*@modifies *cookie, errno, fileSystem, systemState, internalState @ | |||
#define fdCLose(_fd) fdio->close(_fd) | */; | |||
#define fdClose(_fd) fdio->close(_fd) | ||||
/** | ||||
*/ | ||||
/*@null@*/ FD_t fdOpen(const char *path, int flags, mode_t mode) | ||||
/*@globals errno, fileSystem, internalState @*/ | ||||
/*@modifies errno, fileSystem, internalState @*/; | ||||
#define fdOpen(_path, _flags, _mode) fdio->_open((_path), (_flags | ||||
), (_mode)) | ||||
/** | /** | |||
*/ | */ | |||
/*@unused@*/ | /*@unused@*/ | |||
/*@only@*/ /*@null@*/ | /*@only@*/ /*@null@*/ | |||
FD_t fdLink (/*@only@*/ void * cookie, const char * msg) | FD_t fdLink (/*@only@*/ void * cookie, const char * msg) | |||
/*@globals fileSystem @*/ | /*@globals fileSystem @*/ | |||
/*@modifies *cookie, fileSystem @*/; | /*@modifies *cookie, fileSystem @*/; | |||
#define fdLink(_fd, _msg) fdio->_fdref(_fd, _msg, __FILE__, __ | /*@unused@*/ | |||
LINE__) | /*@only@*/ /*@null@*/ | |||
FD_t XfdLink (/*@only@*/ void * cookie, const char * msg, const char * fn, | ||||
unsigned ln) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies *cookie, fileSystem @*/; | ||||
#define fdLink(_fd, _msg) XfdLink(_fd, _msg, __FILE__, __LINE_ | ||||
_) | ||||
/** | /** | |||
*/ | */ | |||
/*@unused@*/ | /*@unused@*/ | |||
/*@only@*/ /*@null@*/ | /*@only@*/ /*@null@*/ | |||
FD_t fdFree(/*@only@*/ FD_t fd, const char * msg) | FD_t fdFree(/*@only@*/ FD_t fd, const char * msg) | |||
/*@globals fileSystem @*/ | /*@globals fileSystem @*/ | |||
/*@modifies fd, fileSystem @*/; | /*@modifies fd, fileSystem @*/; | |||
#define fdFree(_fd, _msg) fdio->_fdderef(_fd, _msg, __FILE__, | /*@unused@*/ | |||
__LINE__) | /*@only@*/ /*@null@*/ | |||
FD_t XfdFree(/*@only@*/ FD_t fd, const char * msg, const char * fn, unsigne | ||||
d ln) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies fd, fileSystem @*/; | ||||
#define fdFree(_fd, _msg) XfdFree(_fd, _msg, __FILE__, __LINE_ | ||||
_) | ||||
/** | /** | |||
*/ | */ | |||
/*@unused@*/ | /*@unused@*/ | |||
/*@only@*/ /*@null@*/ | /*@only@*/ /*@null@*/ | |||
FD_t fdNew (const char * msg) | FD_t fdNew (const char * msg) | |||
/*@globals fileSystem @*/ | /*@globals fileSystem @*/ | |||
/*@modifies fileSystem @*/; | /*@modifies fileSystem @*/; | |||
#define fdNew(_msg) fdio->_fdnew(_msg, __FILE__, __LINE_ | /*@unused@*/ | |||
_) | /*@only@*/ /*@null@*/ | |||
FD_t XfdNew (const char * msg, const char * fn, unsigned ln) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies fileSystem @*/; | ||||
#define fdNew(_msg) XfdNew(_msg, __FILE__, __LINE__) | ||||
/** | /** | |||
*/ | */ | |||
int fdWritable(FD_t fd, int secs) | int fdWritable(FD_t fd, int secs) | |||
/*@globals errno, fileSystem @*/ | /*@globals errno, fileSystem @*/ | |||
/*@modifies fd, errno, fileSystem @*/; | /*@modifies fd, errno, fileSystem @*/; | |||
/** | /** | |||
*/ | */ | |||
int fdReadable(FD_t fd, int secs) | int fdReadable(FD_t fd, int secs) | |||
/*@globals errno @*/ | /*@globals errno @*/ | |||
/*@modifies fd, errno @*/; | /*@modifies fd, errno @*/; | |||
/*@=exportlocal@*/ | /*@=exportlocal@*/ | |||
/** | /** | |||
* Insure that directories in path exist, creating as needed. | ||||
* @param path directory path | ||||
* @param mode directory mode (if created) | ||||
* @param uid directory uid (if created), or -1 to skip | ||||
* @param gid directory uid (if created), or -1 to skip | ||||
* @return 0 on success, errno (or -1) on error | ||||
*/ | ||||
int rpmioMkpath(const char * path, mode_t mode, uid_t uid, gid_t gid) | ||||
/*@globals h_errno, fileSystem, internalState @*/ | ||||
/*@modifies fileSystem, internalState @*/; | ||||
/** | ||||
* Check FN access, expanding relative paths and twiddles. | ||||
* @param FN file path to check | ||||
* @param path colon separated search path (NULL uses $PATH) | ||||
* @param mode type of access(2) to check (0 uses X_OK) | ||||
* @return 0 if accessible | ||||
*/ | ||||
int rpmioAccess(const char *FN, /*@null@*/ const char * path, int mode) | ||||
/*@globals fileSystem, internalState @*/ | ||||
/*@modifies fileSystem, internalState @*/; | ||||
/** | ||||
* Return a password. | ||||
* @param prompt prompt string | ||||
* @return password | ||||
*/ | ||||
extern char * (*Getpass) (const char * prompt) | ||||
/*@*/; | ||||
char * _GetPass (const char * prompt) | ||||
/*@*/; | ||||
char * _RequestPass (const char * prompt) | ||||
/*@*/; | ||||
/** | ||||
* FTP and HTTP error codes. | * FTP and HTTP error codes. | |||
*/ | */ | |||
/*@-typeuse@*/ | /*@-typeuse@*/ | |||
typedef enum ftperrCode_e { | typedef enum ftperrCode_e { | |||
FTPERR_BAD_SERVER_RESPONSE = -1, /*!< Bad server response */ | FTPERR_NE_ERROR = -1, /*!< Generic error. */ | |||
FTPERR_SERVER_IO_ERROR = -2, /*!< Server I/O error */ | FTPERR_NE_LOOKUP = -2, /*!< Hostname lookup failed. */ | |||
FTPERR_SERVER_TIMEOUT = -3, /*!< Server timeout */ | FTPERR_NE_AUTH = -3, /*!< Server authentication failed. * | |||
FTPERR_BAD_HOST_ADDR = -4, /*!< Unable to lookup server host ad | / | |||
dress */ | FTPERR_NE_PROXYAUTH = -4, /*!< Proxy authentication fa | |||
FTPERR_BAD_HOSTNAME = -5, /*!< Unable to lookup server | iled. */ | |||
host name */ | FTPERR_NE_CONNECT = -5, /*!< Could not connect to server. */ | |||
FTPERR_FAILED_CONNECT = -6, /*!< Failed to connect to server */ | FTPERR_NE_TIMEOUT = -6, /*!< Connection timed out. */ | |||
FTPERR_FILE_IO_ERROR = -7, /*!< Failed to establish data connec | FTPERR_NE_FAILED = -7, /*!< The precondition failed. */ | |||
tion to server */ | FTPERR_NE_RETRY = -8, /*!< Retry request. */ | |||
FTPERR_PASSIVE_ERROR = -8, /*!< I/O error to local file */ | FTPERR_NE_REDIRECT = -9, /*!< Redirect received. */ | |||
FTPERR_FAILED_DATA_CONNECT = -9, /*!< Error setting remote server to | ||||
passive mode */ | FTPERR_BAD_SERVER_RESPONSE = -81, /*!< Bad server response */ | |||
FTPERR_FILE_NOT_FOUND = -10, /*!< File not found on server */ | FTPERR_SERVER_IO_ERROR = -82, /*!< Server I/O error */ | |||
FTPERR_NIC_ABORT_IN_PROGRESS= -11, /*!< Abort in progress */ | FTPERR_SERVER_TIMEOUT = -83, /*!< Server timeout */ | |||
FTPERR_BAD_HOST_ADDR = -84, /*!< Unable to lookup server host ad | ||||
dress */ | ||||
FTPERR_BAD_HOSTNAME = -85, /*!< Unable to lookup server | ||||
host name */ | ||||
FTPERR_FAILED_CONNECT = -86, /*!< Failed to connect to server */ | ||||
FTPERR_FILE_IO_ERROR = -87, /*!< Failed to establish data connec | ||||
tion to server */ | ||||
FTPERR_PASSIVE_ERROR = -88, /*!< I/O error to local file */ | ||||
FTPERR_FAILED_DATA_CONNECT = -89, /*!< Error setting remote server to | ||||
passive mode */ | ||||
FTPERR_FILE_NOT_FOUND = -90, /*!< File not found on server */ | ||||
FTPERR_NIC_ABORT_IN_PROGRESS= -91, /*!< Abort in progress */ | ||||
FTPERR_UNKNOWN = -100 /*!< Unknown or unexpected error */ | FTPERR_UNKNOWN = -100 /*!< Unknown or unexpected error */ | |||
} ftperrCode; | } ftperrCode; | |||
/*@=typeuse@*/ | /*@=typeuse@*/ | |||
/** | /** | |||
*/ | */ | |||
/*@-redecl@*/ | /*@-redecl@*/ | |||
/*@observer@*/ const char *const ftpStrerror(int errorNumber) /*@*/; | /*@observer@*/ const char * ftpStrerror(int errorNumber) | |||
/*@*/; | ||||
/*@=redecl@*/ | /*@=redecl@*/ | |||
/** | /** | |||
*/ | */ | |||
/*@unused@*/ | /*@unused@*/ | |||
/*@dependent@*/ /*@null@*/ void * ufdGetUrlinfo(FD_t fd) | /*@dependent@*/ /*@null@*/ void * ufdGetUrlinfo(FD_t fd) | |||
/*@modifies fd @*/; | /*@modifies fd @*/; | |||
/** | /** | |||
*/ | */ | |||
/*@-redecl@*/ | /*@-redecl@*/ | |||
/*@unused@*/ | /*@unused@*/ | |||
/*@observer@*/ const char * urlStrerror(const char * url) /*@*/; | /*@observer@*/ const char * urlStrerror(const char * url) | |||
/*@globals h_errno, internalState @*/ | ||||
/*@modifies internalState @*/; | ||||
/*@=redecl@*/ | /*@=redecl@*/ | |||
/** | /** | |||
*/ | */ | |||
/*@-exportlocal@*/ | /*@-exportlocal@*/ | |||
int ufdCopy(FD_t sfd, FD_t tfd) | int ufdCopy(FD_t sfd, FD_t tfd) | |||
/*@globals fileSystem @*/ | /*@globals fileSystem @*/ | |||
/*@modifies sfd, tfd, fileSystem @*/; | /*@modifies sfd, tfd, fileSystem @*/; | |||
/*@=exportlocal@*/ | /*@=exportlocal@*/ | |||
/** | /** | |||
*/ | */ | |||
int ufdGetFile( /*@killref@*/ FD_t sfd, FD_t tfd) | int ufdGetFile( /*@killref@*/ FD_t sfd, FD_t tfd) | |||
/*@globals fileSystem @*/ | /*@globals fileSystem, internalState @*/ | |||
/*@modifies sfd, tfd, fileSystem @*/; | /*@modifies sfd, tfd, fileSystem, internalState @*/; | |||
/** | ||||
*/ | ||||
/*@unused@*/ int timedRead(FD_t fd, /*@out@*/ void * bufptr, int length) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies fd, *bufptr, fileSystem @*/; | ||||
#define timedRead ufdio->read | ||||
/*@-exportlocal@*/ | /*@-exportlocal@*/ | |||
/** | /** | |||
*/ | */ | |||
/*@observer@*/ /*@unchecked@*/ extern FDIO_t fdio; | /*@observer@*/ /*@unchecked@*/ extern FDIO_t fdio; | |||
/** | /** | |||
*/ | */ | |||
/*@observer@*/ /*@unchecked@*/ extern FDIO_t fpio; | /*@observer@*/ /*@unchecked@*/ extern FDIO_t fpio; | |||
skipping to change at line 599 | skipping to change at line 693 | |||
/** | /** | |||
*/ | */ | |||
/*@observer@*/ /*@unchecked@*/ extern FDIO_t gzdio; | /*@observer@*/ /*@unchecked@*/ extern FDIO_t gzdio; | |||
/** | /** | |||
*/ | */ | |||
/*@observer@*/ /*@unchecked@*/ extern FDIO_t bzdio; | /*@observer@*/ /*@unchecked@*/ extern FDIO_t bzdio; | |||
/** | /** | |||
*/ | */ | |||
/*@observer@*/ /*@unchecked@*/ extern FDIO_t fadio; | /*@observer@*/ /*@unchecked@*/ extern FDIO_t lzdio; | |||
/*@=exportlocal@*/ | /*@=exportlocal@*/ | |||
/*@}*/ | /*@}*/ | |||
/*@unused@*/ static inline int xislower(int c) /*@*/ { | /*@unused@*/ static inline int xislower(int c) /*@*/ { | |||
return (c >= 'a' && c <= 'z'); | return (c >= (int)'a' && c <= (int)'z'); | |||
} | } | |||
/*@unused@*/ static inline int xisupper(int c) /*@*/ { | /*@unused@*/ static inline int xisupper(int c) /*@*/ { | |||
return (c >= 'A' && c <= 'Z'); | return (c >= (int)'A' && c <= (int)'Z'); | |||
} | } | |||
/*@unused@*/ static inline int xisalpha(int c) /*@*/ { | /*@unused@*/ static inline int xisalpha(int c) /*@*/ { | |||
return (xislower(c) || xisupper(c)); | return (xislower(c) || xisupper(c)); | |||
} | } | |||
/*@unused@*/ static inline int xisdigit(int c) /*@*/ { | /*@unused@*/ static inline int xisdigit(int c) /*@*/ { | |||
return (c >= '0' && c <= '9'); | return (c >= (int)'0' && c <= (int)'9'); | |||
} | } | |||
/*@unused@*/ static inline int xisalnum(int c) /*@*/ { | /*@unused@*/ static inline int xisalnum(int c) /*@*/ { | |||
return (xisalpha(c) || xisdigit(c)); | return (xisalpha(c) || xisdigit(c)); | |||
} | } | |||
/*@unused@*/ static inline int xisblank(int c) /*@*/ { | /*@unused@*/ static inline int xisblank(int c) /*@*/ { | |||
return (c == ' ' || c == '\t'); | return (c == (int)' ' || c == (int)'\t'); | |||
} | } | |||
/*@unused@*/ static inline int xisspace(int c) /*@*/ { | /*@unused@*/ static inline int xisspace(int c) /*@*/ { | |||
return (xisblank(c) || c == '\n' || c == '\r' || c == '\f' || c == '\v' | return (xisblank(c) || c == (int)'\n' || c == (int)'\r' || c == (int)'\ | |||
); | f' || c == (int)'\v'); | |||
} | ||||
/*@unused@*/ static inline int xiscntrl(int c) /*@*/ { | ||||
return (c < (int)' '); | ||||
} | ||||
/*@unused@*/ static inline int xisascii(int c) /*@*/ { | ||||
return ((c & 0x80) != 0x80); | ||||
} | ||||
/*@unused@*/ static inline int xisprint(int c) /*@*/ { | ||||
return (c >= (int)' ' && xisascii(c)); | ||||
} | ||||
/*@unused@*/ static inline int xisgraph(int c) /*@*/ { | ||||
return (c > (int)' ' && xisascii(c)); | ||||
} | ||||
/*@unused@*/ static inline int xispunct(int c) /*@*/ { | ||||
return (xisgraph(c) && !xisalnum(c)); | ||||
} | } | |||
/*@unused@*/ static inline int xtolower(int c) /*@*/ { | /*@unused@*/ static inline int xtolower(int c) /*@*/ { | |||
return ((xisupper(c)) ? (c | ('a' - 'A')) : c); | return ((xisupper(c)) ? (c | ('a' - 'A')) : c); | |||
} | } | |||
/*@unused@*/ static inline int xtoupper(int c) /*@*/ { | /*@unused@*/ static inline int xtoupper(int c) /*@*/ { | |||
return ((xislower(c)) ? (c & ~('a' - 'A')) : c); | return ((xislower(c)) ? (c & ~('a' - 'A')) : c); | |||
} | } | |||
/** \ingroup rpmio | /** \ingroup rpmio | |||
* Locale insensitive strcasecmp(3). | * Locale insensitive strcasecmp(3). | |||
*/ | */ | |||
int xstrcasecmp(const char * s1, const char * s2) /*@*/; | int xstrcasecmp(const char * s1, const char * s2) /*@*/; | |||
/** \ingroup rpmio | /** \ingroup rpmio | |||
* Locale insensitive strncasecmp(3). | * Locale insensitive strncasecmp(3). | |||
*/ | */ | |||
int xstrncasecmp(const char *s1, const char * s2, size_t n) /*@*/; | int xstrncasecmp(const char *s1, const char * s2, size_t n) /*@*/; | |||
/** \ingroup rpmio | ||||
* Force encoding of string. | ||||
*/ | ||||
/*@only@*/ /*@null@*/ | ||||
const char * xstrtolocale(/*@only@*/ const char *str) | ||||
/*@modifies *str @*/; | ||||
#if !defined(SWIG) | ||||
/** | ||||
* Wrapper to free(3), hides const compilation noise, permit NULL, return N | ||||
ULL. | ||||
* @param p memory to free | ||||
* @return NULL always | ||||
*/ | ||||
#if defined(WITH_DMALLOC) | ||||
#define _free(p) ((p) != NULL ? free((void *)(p)) : (void)0, NULL) | ||||
#else | ||||
/*@unused@*/ static inline /*@null@*/ | ||||
void * _free(/*@only@*/ /*@null@*/ /*@out@*/ const void * p) | ||||
/*@modifies p @*/ | ||||
{ | ||||
if (p != NULL) free((void *)p); | ||||
return NULL; | ||||
} | ||||
#endif | ||||
#endif | ||||
/** | ||||
* Free all memory allocated by rpmio usage. | ||||
*/ | ||||
void rpmioClean(void) | ||||
/*@globals internalState, fileSystem @*/ | ||||
/*@modifies internalState, fileSystem @*/; | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* H_RPMIO */ | #endif /* H_RPMIO */ | |||
End of changes. 59 change blocks. | ||||
254 lines changed or deleted | 396 lines changed or added | |||
rpmlib.h | rpmlib.h | |||
---|---|---|---|---|
#ifndef H_RPMLIB | #ifndef H_RPMLIB | |||
#define H_RPMLIB | #define H_RPMLIB | |||
/** \ingroup rpmcli rpmrc rpmdep rpmtrans rpmdb lead signature header paylo ad dbi | /** \ingroup rpmcli rpmrc rpmts rpmte rpmds rpmfi rpmdb lead signature head er payload dbi | |||
* \file lib/rpmlib.h | * \file lib/rpmlib.h | |||
* | ||||
* In Memoriam: Steve Taylor <staylor@redhat.com> was here, now he's not. | ||||
* | ||||
*/ | */ | |||
#include "rpmio.h" | #include <rpmtag.h> | |||
#include "rpmmessages.h" | #include <rpmversion.h> | |||
#include "rpmerr.h" | ||||
#include "header.h" | ||||
#include "popt.h" | ||||
/** | #define RPM_FORMAT_VERSION 5 | |||
* Package read return codes. | #define RPM_MAJOR_VERSION 0 | |||
*/ | #define RPM_MINOR_VERSION 0 | |||
typedef enum rpmRC_e { | ||||
RPMRC_OK = 0, | ||||
RPMRC_BADMAGIC = 1, | ||||
RPMRC_FAIL = 2, | ||||
RPMRC_BADSIZE = 3, | ||||
RPMRC_SHORTREAD = 4 | ||||
} rpmRC; | ||||
/*@-redecl@*/ | /*@-redecl@*/ | |||
/*@-incondefs@*/ | ||||
/*@checked@*/ | /*@checked@*/ | |||
extern struct MacroContext_s * rpmGlobalMacroContext; | extern struct MacroContext_s * rpmGlobalMacroContext; | |||
/*@checked@*/ | /*@checked@*/ | |||
extern struct MacroContext_s * rpmCLIMacroContext; | extern struct MacroContext_s * rpmCLIMacroContext; | |||
/*@=incondefs@*/ | ||||
/*@observer@*/ /*@checked@*/ | /*@unchecked@*/ /*@observer@*/ | |||
extern const char * RPMVERSION; | extern const char * RPMVERSION; | |||
/*@observer@*/ /*@checked@*/ | /*@unchecked@*/ /*@observer@*/ | |||
extern const char * rpmNAME; | extern const char * rpmNAME; | |||
/*@observer@*/ /*@checked@*/ | /*@unchecked@*/ /*@observer@*/ | |||
extern const char * rpmEVR; | extern const char * rpmEVR; | |||
/*@checked@*/ | /*@unchecked@*/ | |||
extern int rpmFLAGS; | extern int rpmFLAGS; | |||
/*@=redecl@*/ | /*@=redecl@*/ | |||
/*@unchecked@*/ /*@only@*/ /*@null@*/ | ||||
extern unsigned int * keyids; | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
/** | /** \ingroup rpmts | |||
* Wrapper to free(3), hides const compilation noise, permit NULL, return N | * The RPM Transaction Set. | |||
ULL. | * Transaction sets are inherently unordered! RPM may reorder transaction | |||
* @param p memory to free | * sets to reduce errors. In general, installs/upgrades are done before | |||
* @return NULL always | * strict removals, and prerequisite ordering is done on installs/upgrades. | |||
*/ | ||||
/*@unused@*/ static inline /*@null@*/ | ||||
void * _free(/*@only@*/ /*@null@*/ /*@out@*/ const void * p) | ||||
/*@modifies p @*/ | ||||
{ | ||||
if (p != NULL) free((void *)p); | ||||
return NULL; | ||||
} | ||||
/** | ||||
* Return package signatures and header from file handle. | ||||
* @deprecated Signature tags are appended to header in rpm-4.0.2. | ||||
* @todo Eliminate. | ||||
* @param fd file handle | ||||
* @retval sigp address of signature header (or NULL) | ||||
* @retval hdrp address of header (or NULL) | ||||
* @return rpmRC return code | ||||
*/ | */ | |||
rpmRC rpmReadPackageInfo(FD_t fd, /*@null@*/ /*@out@*/ Header * sigp, | typedef /*@abstract@*/ /*@refcounted@*/ struct rpmts_s * rpmts; | |||
/*@null@*/ /*@out@*/ Header * hdrp) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies fd, *sigp, *hdrp, fileSystem @*/; | ||||
/** | /** \ingroup rpmbuild | |||
* Return package header and lead info from file handle. | ||||
* @param fd file handle | ||||
* @retval hdrp address of header (or NULL) | ||||
* @retval isSource address to return lead source flag (or NULL) | ||||
* @retval major address to return lead major (or NULL) | ||||
* @retval minor address to return lead minor (or NULL) | ||||
* @return rpmRC return code | ||||
*/ | */ | |||
rpmRC rpmReadPackageHeader(FD_t fd, /*@null@*/ /*@out@*/ Header * hdrp, | typedef struct Spec_s * Spec; | |||
/*@null@*/ /*@out@*/ int * isSource, | ||||
/*@null@*/ /*@out@*/ int * major, | ||||
/*@null@*/ /*@out@*/ int * minor) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies fd, *hdrp, *isSource, *major, *minor, fileSystem @*/; | ||||
/** \ingroup header | /** \ingroup rpmts | |||
* Return name, version, release strings from header. | * An added/available package retrieval key. | |||
* @param h header | ||||
* @retval np address of name pointer (or NULL) | ||||
* @retval vp address of version pointer (or NULL) | ||||
* @retval rp address of release pointer (or NULL) | ||||
* @return 0 always | ||||
*/ | */ | |||
int headerNVR(Header h, | typedef /*@abstract@*/ void * alKey; | |||
/*@null@*/ /*@out@*/ const char ** np, | #define RPMAL_NOMATCH ((alKey)-1L) | |||
/*@null@*/ /*@out@*/ const char ** vp, | ||||
/*@null@*/ /*@out@*/ const char ** rp) | ||||
/*@modifies *np, *vp, *rp @*/; | ||||
/** \ingroup header | /** \ingroup rpmts | |||
* Translate and merge legacy signature tags into header. | * An added/available package retrieval index. | |||
* @param h header | ||||
* @param sig signature header | ||||
*/ | */ | |||
void headerMergeLegacySigs(Header h, const Header sig) | /*@-mutrep@*/ | |||
/*@modifies h @*/; | typedef /*@abstract@*/ int alNum; | |||
/*@=mutrep@*/ | ||||
/** \ingroup header | /** \ingroup rpmds | |||
* Regenerate signature header. | * Dependency tag sets from a header, so that a header can be discarded ear | |||
* @param h header | ly. | |||
* @return regenerated signature header | ||||
*/ | */ | |||
Header headerRegenSigHeader(const Header h) | typedef /*@abstract@*/ /*@refcounted@*/ struct rpmds_s * rpmds; | |||
/*@*/; | ||||
/** | /** \ingroup rpmds | |||
* Retrieve file names from header. | * Container for commonly extracted dependency set(s). | |||
* The representation of file names in package headers changed in rpm-4.0. | ||||
* Originally, file names were stored as an array of paths. In rpm-4.0, | ||||
* file names are stored as separate arrays of dirname's and basename's, | ||||
* with a dirname index to associate the correct dirname with each basname. | ||||
* This function is used to retrieve file names independent of how the | ||||
* file names are represented in the package header. | ||||
* | ||||
* @param h header | ||||
* @retval fileListPtr address of array of file names | ||||
* @retval fileCountPtr address of number of files | ||||
*/ | */ | |||
void rpmBuildFileList(Header h, /*@out@*/ const char *** fileListPtr, | typedef struct rpmPRCO_s * rpmPRCO; | |||
/*@out@*/ int * fileCountPtr) | ||||
/*@modifies *fileListPtr, *fileCountPtr @*/; | ||||
/** | /** \ingroup rpmte | |||
* Retrieve tag info from header. | * An element of a transaction set, i.e. a TR_ADDED or TR_REMOVED package. | |||
* This is a "dressed" entry to headerGetEntry to do: | ||||
* 1) DIRNAME/BASENAME/DIRINDICES -> FILENAMES tag conversions. | ||||
* 2) i18n lookaside (if enabled). | ||||
* | ||||
* @param h header | ||||
* @param tag tag | ||||
* @retval type address of tag value data type | ||||
* @retval p address of pointer to tag value(s) | ||||
* @retval c address of number of values | ||||
* @return 0 on success, 1 on bad magic, 2 on error | ||||
*/ | */ | |||
int rpmHeaderGetEntry(Header h, int_32 tag, /*@out@*/ int_32 *type, | typedef /*@abstract@*/ struct rpmte_s * rpmte; | |||
/*@out@*/ void **p, /*@out@*/ int_32 *c) | ||||
/*@modifies *type, *p, *c @*/; | ||||
/** | /** \ingroup rpmdb | |||
* Retrieve tag info from header. | * Database of headers and tag value indices. | |||
* Yet Another "dressed" entry to headerGetEntry in order to unify | ||||
* signature/header tag retrieval. | ||||
* @deprecated Signature tags are now duplicated into header when installed | ||||
. | ||||
* @todo Eliminate from API. | ||||
* @param leadp rpm lead | ||||
* @param h header | ||||
* @param sigs signatures | ||||
* @param tag tag | ||||
* @retval type address of tag value data type | ||||
* @retval p address of pointer to tag value(s) | ||||
* @retval c address of number of values | ||||
* @return 0 on success, 1 on bad magic, 2 on error | ||||
*/ | */ | |||
/*@unused@*/ | typedef /*@abstract@*/ /*@refcounted@*/ struct rpmdb_s * rpmdb; | |||
int rpmPackageGetEntry(void *leadp, Header sigs, Header h, | ||||
int_32 tag, int_32 *type, void **p, int_32 *c) | ||||
/*@modifies h, *type, *p, *c @*/; | ||||
/** | /** \ingroup rpmdb | |||
* Automatically generated table of tag name/value pairs. | * Database iterator. | |||
*/ | */ | |||
/*@-redecl@*/ | typedef /*@abstract@*/ struct rpmdbMatchIterator_s * rpmdbMatchIterator; | |||
/*@observer@*/ /*@unchecked@*/ | ||||
extern const struct headerTagTableEntry_s rpmTagTable[]; | ||||
/*@=redecl@*/ | ||||
/** | /** \ingroup rpmgi | |||
* Number of entries in rpmTagTable. | * Generalized iterator. | |||
*/ | */ | |||
/*@-redecl@*/ | typedef /*@abstract@*/ /*@refcounted@*/ struct rpmgi_s * rpmgi; | |||
/*@unchecked@*/ | ||||
extern const int rpmTagTableSize; | ||||
/*@=redecl@*/ | ||||
/** | /** | |||
* Table of query format extensions. | * Table of query format extensions. | |||
* @note Chains to headerDefaultFormats[]. | * @note Chains *headerCompoundFormats -> *headerDefaultFormats. | |||
*/ | */ | |||
/*@-redecl@*/ | /*@-redecl@*/ | |||
/*@observer@*/ /*@unchecked@*/ | /*@unchecked@*/ | |||
extern const struct headerSprintfExtension_s rpmHeaderFormats[]; | extern headerSprintfExtension rpmHeaderFormats; | |||
/*@=redecl@*/ | /*@=redecl@*/ | |||
/** | /** | |||
* Pseudo-tags used by the rpmdb iterator API. | * Scriptlet identifiers. | |||
*/ | ||||
#define RPMDBI_PACKAGES 0 /*!< Installed package heade | ||||
rs. */ | ||||
#define RPMDBI_DEPENDS 1 /*!< Dependency resolution c | ||||
ache. */ | ||||
#define RPMDBI_LABEL 2 /*!< Fingerprint search mark | ||||
er. */ | ||||
#define RPMDBI_ADDED 3 /*!< Added package headers. | ||||
*/ | ||||
#define RPMDBI_REMOVED 4 /*!< Removed package headers | ||||
. */ | ||||
#define RPMDBI_AVAILABLE 5 /*!< Available package heade | ||||
rs. */ | ||||
/** | ||||
* Tags identify data in package headers. | ||||
* @note tags should not have value 0! | ||||
*/ | ||||
typedef enum rpmTag_e { | ||||
RPMTAG_HEADERIMAGE = HEADER_IMAGE, /*!< Current image. | ||||
*/ | ||||
RPMTAG_HEADERSIGNATURES = HEADER_SIGNATURES, /*!< Signatures. */ | ||||
RPMTAG_HEADERIMMUTABLE = HEADER_IMMUTABLE, /*!< Original image. | ||||
*/ | ||||
/*@-enummemuse@*/ | ||||
RPMTAG_HEADERREGIONS = HEADER_REGIONS, /*!< Regions. */ | ||||
RPMTAG_HEADERI18NTABLE = HEADER_I18NTABLE, /*!< I18N string locales | ||||
. */ | ||||
/*@=enummemuse@*/ | ||||
/* Retrofit (and uniqify) signature tags for use by tagName() and rpmQuery. | ||||
*/ | ||||
/* the md5 sum was broken *twice* on big endian machines */ | ||||
/* XXX 2nd underscore prevents tagTable generation */ | ||||
RPMTAG_SIG_BASE = HEADER_SIGBASE, | ||||
RPMTAG_SIGSIZE = RPMTAG_SIG_BASE+1, | ||||
RPMTAG_SIGLEMD5_1 = RPMTAG_SIG_BASE+2, /*!< internal */ | ||||
RPMTAG_SIGPGP = RPMTAG_SIG_BASE+3, | ||||
RPMTAG_SIGLEMD5_2 = RPMTAG_SIG_BASE+4, /*!< internal */ | ||||
RPMTAG_SIGMD5 = RPMTAG_SIG_BASE+5, | ||||
RPMTAG_SIGGPG = RPMTAG_SIG_BASE+6, | ||||
RPMTAG_SIGPGP5 = RPMTAG_SIG_BASE+7, /*!< internal */ | ||||
/*@-enummemuse@*/ | ||||
RPMTAG_BADSHA1HEADER = RPMTAG_SIG_BASE+8, /*!< internal */ | ||||
/*@=enummemuse@*/ | ||||
RPMTAG_SHA1HEADER = RPMTAG_SIG_BASE+9, | ||||
RPMTAG_NAME = 1000, | ||||
RPMTAG_VERSION = 1001, | ||||
RPMTAG_RELEASE = 1002, | ||||
RPMTAG_EPOCH = 1003, | ||||
#define RPMTAG_SERIAL RPMTAG_EPOCH /* backward comaptibility */ | ||||
RPMTAG_SUMMARY = 1004, | ||||
RPMTAG_DESCRIPTION = 1005, | ||||
RPMTAG_BUILDTIME = 1006, | ||||
RPMTAG_BUILDHOST = 1007, | ||||
RPMTAG_INSTALLTIME = 1008, | ||||
RPMTAG_SIZE = 1009, | ||||
RPMTAG_DISTRIBUTION = 1010, | ||||
RPMTAG_VENDOR = 1011, | ||||
RPMTAG_GIF = 1012, | ||||
RPMTAG_XPM = 1013, | ||||
RPMTAG_LICENSE = 1014, | ||||
#define RPMTAG_COPYRIGHT RPMTAG_LICENSE /* backward comaptibility */ | ||||
RPMTAG_PACKAGER = 1015, | ||||
RPMTAG_GROUP = 1016, | ||||
/*@-enummemuse@*/ | ||||
RPMTAG_CHANGELOG = 1017, /*!< internal */ | ||||
/*@=enummemuse@*/ | ||||
RPMTAG_SOURCE = 1018, | ||||
RPMTAG_PATCH = 1019, | ||||
RPMTAG_URL = 1020, | ||||
RPMTAG_OS = 1021, | ||||
RPMTAG_ARCH = 1022, | ||||
RPMTAG_PREIN = 1023, | ||||
RPMTAG_POSTIN = 1024, | ||||
RPMTAG_PREUN = 1025, | ||||
RPMTAG_POSTUN = 1026, | ||||
RPMTAG_OLDFILENAMES = 1027, /* obsolete */ | ||||
RPMTAG_FILESIZES = 1028, | ||||
RPMTAG_FILESTATES = 1029, | ||||
RPMTAG_FILEMODES = 1030, | ||||
RPMTAG_FILEUIDS = 1031, /*!< internal */ | ||||
RPMTAG_FILEGIDS = 1032, /*!< internal */ | ||||
RPMTAG_FILERDEVS = 1033, | ||||
RPMTAG_FILEMTIMES = 1034, | ||||
RPMTAG_FILEMD5S = 1035, | ||||
RPMTAG_FILELINKTOS = 1036, | ||||
RPMTAG_FILEFLAGS = 1037, | ||||
/*@-enummemuse@*/ | ||||
RPMTAG_ROOT = 1038, /*!< internal - obsolete */ | ||||
/*@=enummemuse@*/ | ||||
RPMTAG_FILEUSERNAME = 1039, | ||||
RPMTAG_FILEGROUPNAME = 1040, | ||||
/*@-enummemuse@*/ | ||||
RPMTAG_EXCLUDE = 1041, /*!< internal - obsolete */ | ||||
RPMTAG_EXCLUSIVE = 1042, /*!< internal - obsolete */ | ||||
/*@=enummemuse@*/ | ||||
RPMTAG_ICON = 1043, | ||||
RPMTAG_SOURCERPM = 1044, | ||||
RPMTAG_FILEVERIFYFLAGS = 1045, | ||||
RPMTAG_ARCHIVESIZE = 1046, | ||||
RPMTAG_PROVIDENAME = 1047, | ||||
#define RPMTAG_PROVIDES RPMTAG_PROVIDENAME /* backward comaptib | ||||
ility */ | ||||
RPMTAG_REQUIREFLAGS = 1048, | ||||
RPMTAG_REQUIRENAME = 1049, | ||||
RPMTAG_REQUIREVERSION = 1050, | ||||
RPMTAG_NOSOURCE = 1051, /*!< internal */ | ||||
RPMTAG_NOPATCH = 1052, /*!< internal */ | ||||
RPMTAG_CONFLICTFLAGS = 1053, | ||||
RPMTAG_CONFLICTNAME = 1054, | ||||
RPMTAG_CONFLICTVERSION = 1055, | ||||
RPMTAG_DEFAULTPREFIX = 1056, /*!< internal - deprecated */ | ||||
RPMTAG_BUILDROOT = 1057, /*!< internal */ | ||||
RPMTAG_INSTALLPREFIX = 1058, /*!< internal - deprecated */ | ||||
RPMTAG_EXCLUDEARCH = 1059, | ||||
RPMTAG_EXCLUDEOS = 1060, | ||||
RPMTAG_EXCLUSIVEARCH = 1061, | ||||
RPMTAG_EXCLUSIVEOS = 1062, | ||||
RPMTAG_AUTOREQPROV = 1063, /*!< internal */ | ||||
RPMTAG_RPMVERSION = 1064, | ||||
RPMTAG_TRIGGERSCRIPTS = 1065, | ||||
RPMTAG_TRIGGERNAME = 1066, | ||||
RPMTAG_TRIGGERVERSION = 1067, | ||||
RPMTAG_TRIGGERFLAGS = 1068, | ||||
RPMTAG_TRIGGERINDEX = 1069, | ||||
RPMTAG_VERIFYSCRIPT = 1079, | ||||
RPMTAG_CHANGELOGTIME = 1080, | ||||
RPMTAG_CHANGELOGNAME = 1081, | ||||
RPMTAG_CHANGELOGTEXT = 1082, | ||||
/*@-enummemuse@*/ | ||||
RPMTAG_BROKENMD5 = 1083, /*!< internal */ | ||||
/*@=enummemuse@*/ | ||||
RPMTAG_PREREQ = 1084, /*!< internal */ | ||||
RPMTAG_PREINPROG = 1085, | ||||
RPMTAG_POSTINPROG = 1086, | ||||
RPMTAG_PREUNPROG = 1087, | ||||
RPMTAG_POSTUNPROG = 1088, | ||||
RPMTAG_BUILDARCHS = 1089, | ||||
RPMTAG_OBSOLETENAME = 1090, | ||||
#define RPMTAG_OBSOLETES RPMTAG_OBSOLETENAME /* backward comaptib | ||||
ility */ | ||||
RPMTAG_VERIFYSCRIPTPROG = 1091, | ||||
RPMTAG_TRIGGERSCRIPTPROG = 1092, | ||||
RPMTAG_DOCDIR = 1093, /*!< internal */ | ||||
RPMTAG_COOKIE = 1094, | ||||
RPMTAG_FILEDEVICES = 1095, | ||||
RPMTAG_FILEINODES = 1096, | ||||
RPMTAG_FILELANGS = 1097, | ||||
RPMTAG_PREFIXES = 1098, | ||||
RPMTAG_INSTPREFIXES = 1099, | ||||
RPMTAG_TRIGGERIN = 1100, /*!< internal */ | ||||
RPMTAG_TRIGGERUN = 1101, /*!< internal */ | ||||
RPMTAG_TRIGGERPOSTUN = 1102, /*!< internal */ | ||||
RPMTAG_AUTOREQ = 1103, /*!< internal */ | ||||
RPMTAG_AUTOPROV = 1104, /*!< internal */ | ||||
/*@-enummemuse@*/ | ||||
RPMTAG_CAPABILITY = 1105, /*!< internal - obsolete */ | ||||
/*@=enummemuse@*/ | ||||
RPMTAG_SOURCEPACKAGE = 1106, /*!< internal */ | ||||
/*@-enummemuse@*/ | ||||
RPMTAG_OLDORIGFILENAMES = 1107, /*!< internal - obsolete */ | ||||
/*@=enummemuse@*/ | ||||
RPMTAG_BUILDPREREQ = 1108, /*!< internal */ | ||||
RPMTAG_BUILDREQUIRES = 1109, /*!< internal */ | ||||
RPMTAG_BUILDCONFLICTS = 1110, /*!< internal */ | ||||
/*@-enummemuse@*/ | ||||
RPMTAG_BUILDMACROS = 1111, /*!< internal */ | ||||
/*@=enummemuse@*/ | ||||
RPMTAG_PROVIDEFLAGS = 1112, | ||||
RPMTAG_PROVIDEVERSION = 1113, | ||||
RPMTAG_OBSOLETEFLAGS = 1114, | ||||
RPMTAG_OBSOLETEVERSION = 1115, | ||||
RPMTAG_DIRINDEXES = 1116, | ||||
RPMTAG_BASENAMES = 1117, | ||||
RPMTAG_DIRNAMES = 1118, | ||||
RPMTAG_ORIGDIRINDEXES = 1119, /*!< internal */ | ||||
RPMTAG_ORIGBASENAMES = 1120, /*!< internal */ | ||||
RPMTAG_ORIGDIRNAMES = 1121, /*!< internal */ | ||||
RPMTAG_OPTFLAGS = 1122, | ||||
RPMTAG_DISTURL = 1123, | ||||
RPMTAG_PAYLOADFORMAT = 1124, | ||||
RPMTAG_PAYLOADCOMPRESSOR = 1125, | ||||
RPMTAG_PAYLOADFLAGS = 1126, | ||||
RPMTAG_MULTILIBS = 1127, | ||||
RPMTAG_INSTALLTID = 1128, | ||||
RPMTAG_REMOVETID = 1129, | ||||
RPMTAG_SHA1RHN = 1130, /*!< internal */ | ||||
RPMTAG_RHNPLATFORM = 1131, | ||||
RPMTAG_PLATFORM = 1132, | ||||
/*@-enummemuse@*/ | ||||
RPMTAG_FIRSTFREE_TAG /*!< internal */ | ||||
/*@=enummemuse@*/ | ||||
} rpmTag; | ||||
#define RPMTAG_EXTERNAL_TAG 1000000 | ||||
/** | ||||
* File States (when installed). | ||||
*/ | ||||
typedef enum rpmfileState_e { | ||||
RPMFILE_STATE_NORMAL = 0, | ||||
RPMFILE_STATE_REPLACED = 1, | ||||
RPMFILE_STATE_NOTINSTALLED = 2, | ||||
RPMFILE_STATE_NETSHARED = 3 | ||||
} rpmfileState; | ||||
/** | ||||
* File Attributes. | ||||
*/ | */ | |||
typedef enum rpmfileAttrs_e { | typedef enum rpmScriptID_e { | |||
/*@-enummemuse@*/ | RPMSCRIPT_UNKNOWN = 0, /*!< unknown scriptlet */ | |||
RPMFILE_NONE = 0, | RPMSCRIPT_PRETRANS = 1, /*!< %pretrans scriptlet */ | |||
/*@=enummemuse@*/ | RPMSCRIPT_TRIGGERPREIN = 2, /*!< %triggerprein scriptlet */ | |||
RPMFILE_CONFIG = (1 << 0), /*!< from %%config */ | RPMSCRIPT_PREIN = 3, /*!< %pre scriptlet */ | |||
RPMFILE_DOC = (1 << 1), /*!< from %%doc */ | RPMSCRIPT_POSTIN = 4, /*!< %post scriptlet */ | |||
/*@-enummemuse@*/ | RPMSCRIPT_TRIGGERIN = 5, /*!< %triggerin scriptlet * | |||
RPMFILE_DONOTUSE = (1 << 2), /*!< @todo (unimplemented) from %don | / | |||
otuse. */ | RPMSCRIPT_TRIGGERUN = 6, /*!< %triggerun scriptlet * | |||
/*@=enummemuse@*/ | / | |||
RPMFILE_MISSINGOK = (1 << 3), /*!< from %%config(missingok) */ | RPMSCRIPT_PREUN = 7, /*!< %preun scriptlet */ | |||
RPMFILE_NOREPLACE = (1 << 4), /*!< from %%config(noreplace) */ | RPMSCRIPT_POSTUN = 8, /*!< %postun scriptlet */ | |||
RPMFILE_SPECFILE = (1 << 5), /*!< @todo (unnecessary) marks 1st f | RPMSCRIPT_TRIGGERPOSTUN = 9, /*!< %triggerpostun scriptlet */ | |||
ile in srpm. */ | RPMSCRIPT_POSTTRANS = 10, /*!< %posttrans scriptlet * | |||
RPMFILE_GHOST = (1 << 6), /*!< from %%ghost */ | / | |||
RPMFILE_LICENSE = (1 << 7), /*!< from %%license */ | /* 11-15 unused */ | |||
RPMFILE_README = (1 << 8), /*!< from %%readme */ | RPMSCRIPT_VERIFY = 16, /*!< %verify scriptlet */ | |||
RPMFILE_EXCLUDE = (1 << 9) /*!< from %%exclude */ | RPMSCRIPT_SANITYCHECK = 17, /*!< %sanitycheck scriptlet */ | |||
} rpmfileAttrs; | RPMSCRIPT_MAX = 32 | |||
#define RPMFILE_MULTILIB_SHIFT 9 | } rpmScriptID; | |||
#define RPMFILE_MULTILIB(N) ((N) << RPMFILE_MULTILIB_SHI | ||||
FT) | ||||
#define RPMFILE_MULTILIB_MASK RPMFILE_MULTILIB(7) | ||||
#define RPMFILE_ALL ~(RPMFILE_NONE) | ||||
/* XXX Check file flags for multilib marker. */ | ||||
#define isFileMULTILIB(_fflags) ((_fflags) & RPMFILE_MULTILI | ||||
B_MASK) | ||||
/** | /** | |||
* Dependency Attributes. | * Scriptlet states (when installed). | |||
*/ | */ | |||
typedef enum rpmsenseFlags_e { | typedef enum rpmScriptState_e { | |||
RPMSENSE_ANY = 0, | RPMSCRIPT_STATE_UNKNOWN = 0, | |||
/*@-enummemuse@*/ | /* 0-15 reserved for waitpid return. */ | |||
RPMSENSE_SERIAL = (1 << 0), /*!< @todo Legacy. */ | RPMSCRIPT_STATE_EXEC = (1 << 16), /*!< scriptlet was exec'd */ | |||
/*@=enummemuse@*/ | RPMSCRIPT_STATE_REAPED = (1 << 17), /*!< scriptlet was reaped */ | |||
RPMSENSE_LESS = (1 << 1), | /* 18-23 unused */ | |||
RPMSENSE_GREATER = (1 << 2), | RPMSCRIPT_STATE_SELINUX = (1 << 24), /*!< scriptlet exec by SELinux | |||
RPMSENSE_EQUAL = (1 << 3), | */ | |||
RPMSENSE_PROVIDES = (1 << 4), /* only used internally by builds */ | RPMSCRIPT_STATE_EMULATOR = (1 << 25), /*!< scriptlet exec in emulator | |||
RPMSENSE_CONFLICTS = (1 << 5), /* only used internally by builds */ | */ | |||
RPMSENSE_PREREQ = (1 << 6), /*!< @todo Legacy. */ | RPMSCRIPT_STATE_LUA = (1 << 26) /*!< scriptlet exec wit | |||
RPMSENSE_OBSOLETES = (1 << 7), /* only used internally by builds */ | h lua */ | |||
RPMSENSE_INTERP = (1 << 8), /*!< Interpreter used by scriptlet. | } rpmScriptState; | |||
*/ | ||||
RPMSENSE_SCRIPT_PRE = ((1 << 9)|RPMSENSE_PREREQ), /*!< %pre depe | ||||
ndency. */ | ||||
RPMSENSE_SCRIPT_POST = ((1 << 10)|RPMSENSE_PREREQ), /*!< %post dependen | ||||
cy. */ | ||||
RPMSENSE_SCRIPT_PREUN = ((1 << 11)|RPMSENSE_PREREQ), /*!< %preun depend | ||||
ency. */ | ||||
RPMSENSE_SCRIPT_POSTUN = ((1 << 12)|RPMSENSE_PREREQ), /*!< %postun depe | ||||
ndency. */ | ||||
RPMSENSE_SCRIPT_VERIFY = (1 << 13), /*!< %verify dependency. */ | ||||
RPMSENSE_FIND_REQUIRES = (1 << 14), /*!< find-requires generated depend | ||||
ency. */ | ||||
RPMSENSE_FIND_PROVIDES = (1 << 15), /*!< find-provides generated depend | ||||
ency. */ | ||||
RPMSENSE_TRIGGERIN = (1 << 16), /*!< %triggerin dependency. */ | ||||
RPMSENSE_TRIGGERUN = (1 << 17), /*!< %triggerun dependency. */ | ||||
RPMSENSE_TRIGGERPOSTUN = (1 << 18), /*!< %triggerpostun dependen | ||||
cy. */ | ||||
RPMSENSE_MULTILIB = (1 << 19), | ||||
RPMSENSE_SCRIPT_PREP = (1 << 20), /*!< %prep build dependency. */ | ||||
RPMSENSE_SCRIPT_BUILD = (1 << 21), /*!< %build build dependency. */ | ||||
RPMSENSE_SCRIPT_INSTALL = (1 << 22),/*!< %install build dependency. */ | ||||
RPMSENSE_SCRIPT_CLEAN = (1 << 23), /*!< %clean build dependency. */ | ||||
RPMSENSE_RPMLIB = ((1 << 24) | RPMSENSE_PREREQ), /*!< rpmlib(feature | ||||
) dependency. */ | ||||
/*@-enummemuse@*/ | ||||
RPMSENSE_TRIGGERPREIN = (1 << 25), /*!< @todo Implement %triggerprein. | ||||
*/ | ||||
/*@=enummemuse@*/ | ||||
/*@-enummemuse@*/ | ||||
RPMSENSE_KEYRING = (1 << 26) | ||||
/*@=enummemuse@*/ | ||||
} rpmsenseFlags; | ||||
#define RPMSENSE_SENSEMASK 15 /* Mask to get senses, ie s | ||||
erial, */ | ||||
/* less, greater, equal. | ||||
*/ | ||||
#define RPMSENSE_TRIGGER \ | ||||
(RPMSENSE_TRIGGERIN | RPMSENSE_TRIGGERUN | RPMSENSE_TRIGGERPOSTUN) | ||||
#define isDependsMULTILIB(_dflags) ((_dflags) & RPMSENSE_MULTIL | ||||
IB) | ||||
#define _ALL_REQUIRES_MASK (\ | ||||
RPMSENSE_INTERP | \ | ||||
RPMSENSE_SCRIPT_PRE | \ | ||||
RPMSENSE_SCRIPT_POST | \ | ||||
RPMSENSE_SCRIPT_PREUN | \ | ||||
RPMSENSE_SCRIPT_POSTUN | \ | ||||
RPMSENSE_SCRIPT_VERIFY | \ | ||||
RPMSENSE_FIND_REQUIRES | \ | ||||
RPMSENSE_SCRIPT_PREP | \ | ||||
RPMSENSE_SCRIPT_BUILD | \ | ||||
RPMSENSE_SCRIPT_INSTALL | \ | ||||
RPMSENSE_SCRIPT_CLEAN | \ | ||||
RPMSENSE_RPMLIB | \ | ||||
RPMSENSE_KEYRING ) | ||||
#define _notpre(_x) ((_x) & ~RPMSENSE_PREREQ) | ||||
#define _INSTALL_ONLY_MASK \ | ||||
_notpre(RPMSENSE_SCRIPT_PRE|RPMSENSE_SCRIPT_POST|RPMSENSE_RPMLIB|RPMSEN | ||||
SE_KEYRING) | ||||
#define _ERASE_ONLY_MASK \ | ||||
_notpre(RPMSENSE_SCRIPT_PREUN|RPMSENSE_SCRIPT_POSTUN) | ||||
#define isLegacyPreReq(_x) (((_x) & _ALL_REQUIRES_MASK) == RPMSENSE | ||||
_PREREQ) | ||||
#define isInstallPreReq(_x) ((_x) & _INSTALL_ONLY_MASK) | ||||
#define isErasePreReq(_x) ((_x) & _ERASE_ONLY_MASK) | ||||
/* ==================================================================== */ | /* ==================================================================== */ | |||
/** \name RPMRC */ | /** \name RPMRC */ | |||
/*@{*/ | /*@{*/ | |||
/* Stuff for maintaining "variables" like SOURCEDIR, BUILDDIR, etc */ | ||||
#define RPMVAR_OPTFLAGS 3 | ||||
#define RPMVAR_PROVIDES 38 | ||||
#define RPMVAR_INCLUDE 43 | ||||
#define RPMVAR_MACROFILES 49 | ||||
#define RPMVAR_NUM 55 /* number of RPMVAR | ||||
entries */ | ||||
/** \ingroup rpmrc | ||||
* Return value of an rpmrc variable. | ||||
* @deprecated Use rpmExpand() with appropriate macro expression. | ||||
* @todo Eliminate from API. | ||||
*/ | ||||
/*@-redecl@*/ | ||||
/*@observer@*/ /*@null@*/ extern const char * rpmGetVar(int var) | ||||
/*@*/; | ||||
/*@=redecl@*/ | ||||
/** \ingroup rpmrc | ||||
* Set value of an rpmrc variable. | ||||
* @deprecated Use rpmDefineMacro() to change appropriate macro instead. | ||||
* @todo Eliminate from API. | ||||
*/ | ||||
void rpmSetVar(int var, const char * val) | ||||
/*@globals internalState @*/ | ||||
/*@modifies internalState @*/; | ||||
/** \ingroup rpmrc | ||||
* List of macro files to read when configuring rpm. | ||||
* This is a colon separated list of files. URI's are permitted as well, | ||||
* identified by the token '://', so file paths must not begin with '//'. | ||||
*/ | ||||
/*@-redecl@*/ | ||||
/*@observer@*/ /*@unchecked@*/ | ||||
extern const char * macrofiles; | ||||
/*@=redecl@*/ | ||||
/** \ingroup rpmrc | /** \ingroup rpmrc | |||
* Build and install arch/os table identifiers. | * Build and install arch/os table identifiers. | |||
* @todo Eliminate from API. | * @deprecated Eliminate from API. | |||
* @todo Eliminate in rpm-5.1. | ||||
*/ | */ | |||
enum rpm_machtable_e { | enum rpm_machtable_e { | |||
RPM_MACHTABLE_INSTARCH = 0, /*!< Install platform architecture. */ | RPM_MACHTABLE_INSTARCH = 0, /*!< Install platform architecture. */ | |||
RPM_MACHTABLE_INSTOS = 1, /*!< Install platform operating syst em. */ | RPM_MACHTABLE_INSTOS = 1, /*!< Install platform operating syst em. */ | |||
RPM_MACHTABLE_BUILDARCH = 2, /*!< Build platform architecture. */ | RPM_MACHTABLE_BUILDARCH = 2, /*!< Build platform architecture. */ | |||
RPM_MACHTABLE_BUILDOS = 3 /*!< Build platform operating system . */ | RPM_MACHTABLE_BUILDOS = 3 /*!< Build platform operating system . */ | |||
}; | }; | |||
#define RPM_MACHTABLE_COUNT 4 /*!< No. of arch/os tables. */ | #define RPM_MACHTABLE_COUNT 4 /*!< No. of arch/os tables. */ | |||
/** \ingroup rpmrc | /** \ingroup rpmrc | |||
* Read macro configuration file(s) for a target. | * Read macro configuration file(s) for a target. | |||
* @param file colon separated files to read (NULL uses default) | * @param file NULL always | |||
* @param target target platform (NULL uses default) | * @param target target platform (NULL uses default) | |||
* @return 0 on success, -1 on error | * @return 0 on success, -1 on error | |||
*/ | */ | |||
int rpmReadConfigFiles(/*@null@*/ const char * file, | int rpmReadConfigFiles(/*@null@*/ const char * file, | |||
/*@null@*/ const char * target) | /*@null@*/ const char * target) | |||
/*@globals rpmGlobalMacroContext, rpmCLIMacroContext, | /*@globals rpmGlobalMacroContext, rpmCLIMacroContext, h_errno, | |||
fileSystem, internalState @*/ | fileSystem, internalState @*/ | |||
/*@modifies rpmGlobalMacroContext, rpmCLIMacroContext, | /*@modifies rpmGlobalMacroContext, rpmCLIMacroContext, | |||
fileSystem, internalState @*/; | fileSystem, internalState @*/; | |||
/** \ingroup rpmrc | /*@only@*/ /*@null@*/ /*@unchecked@*/ | |||
* Return current arch name and/or number. | extern void * platpat; | |||
* @todo Generalize to extract arch component from target_platform macro. | /*@unchecked@*/ | |||
* @retval name address of arch name (or NULL) | extern int nplatpat; | |||
* @retval num address of arch number (or NULL) | ||||
*/ | ||||
void rpmGetArchInfo( /*@null@*/ /*@out@*/ const char ** name, | ||||
/*@null@*/ /*@out@*/ int * num) | ||||
/*@modifies *name, *num @*/; | ||||
/** \ingroup rpmrc | ||||
* Return current os name and/or number. | ||||
* @todo Generalize to extract os component from target_platform macro. | ||||
* @retval name address of os name (or NULL) | ||||
* @retval num address of os number (or NULL) | ||||
*/ | ||||
void rpmGetOsInfo( /*@null@*/ /*@out@*/ const char ** name, | ||||
/*@null@*/ /*@out@*/ int * num) | ||||
/*@modifies *name, *num @*/; | ||||
/** \ingroup rpmrc | /** \ingroup rpmrc | |||
* Return arch/os score of a name. | * Return score of a platform string. | |||
* An arch/os score measures the "nearness" of a name to the currently | * A platform score measures the "nearness" of a platform string wrto | |||
* running (or defined) platform arch/os. For example, the score of arch | * configured platform patterns. The returned score is the line number | |||
* "i586" on an i686 platform is (usually) 2. The arch/os score is used | * of the 1st pattern in /etc/rpm/platform that matches the input string. | |||
* to select one of several otherwise identical packages using the arch/os | ||||
* tags from the header as hints of the intended platform for the package. | ||||
* @todo Rewrite to use RE's against config.guess target platform output. | ||||
* | * | |||
* @param type any of the RPM_MACHTABLE_* constants | * @param platform cpu-vendor-os platform string | |||
* @param name name | * @param mi_re pattern array (NULL uses /etc/rpm/platform p | |||
* @return arch score (0 is no match, lower is preferred) | atterns) | |||
* @param mi_nre no. of patterns | ||||
* @return platform score (0 is no match, lower is preferred) | ||||
*/ | */ | |||
int rpmMachineScore(int type, const char * name) | int rpmPlatformScore(const char * platform, /*@null@*/ void * mi_re, int mi | |||
/*@*/; | _nre) | |||
/*@modifies mi_re @*/; | ||||
/** \ingroup rpmrc | /** \ingroup rpmrc | |||
* Display current rpmrc (and macro) configuration. | * Display current rpmrc (and macro) configuration. | |||
* @param fp output file handle | * @param fp output file handle | |||
* @return 0 always | * @return 0 always | |||
*/ | */ | |||
int rpmShowRC(FILE * fp) | int rpmShowRC(FILE * fp) | |||
/*@globals rpmGlobalMacroContext, fileSystem @*/ | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | |||
/*@modifies *fp, rpmGlobalMacroContext, fileSystem @*/; | @*/ | |||
/*@modifies *fp, rpmGlobalMacroContext, fileSystem, internalState @ | ||||
*/; | ||||
/** \ingroup rpmrc | /** \ingroup rpmrc | |||
* @deprecated Use addMacro to set _target_* macros. | * @deprecated Use addMacro to set _target_* macros. | |||
* @todo Eliminate from API. | * @todo Eliminate in rpm-5.1. | |||
# @note Only used by build code. | # @note Only used by build code. | |||
* @param archTable | * @param archTable | |||
* @param osTable | * @param osTable | |||
*/ | */ | |||
void rpmSetTables(int archTable, int osTable) | void rpmSetTables(int archTable, int osTable) | |||
/*@globals internalState @*/ | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | |||
/*@modifies internalState @*/; | @*/ | |||
/*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/; | ||||
/** \ingroup rpmrc | ||||
* Set current arch/os names. | ||||
* NULL as argument is set to the default value (munged uname()) | ||||
* pushed through a translation table (if appropriate). | ||||
* @deprecated Use addMacro to set _target_* macros. | ||||
* @todo Eliminate from API. | ||||
* | ||||
* @param arch arch name (or NULL) | ||||
* @param os os name (or NULL) | ||||
*/ | ||||
void rpmSetMachine(/*@null@*/ const char * arch, /*@null@*/ const char * os | ||||
) | ||||
/*@globals internalState @*/ | ||||
/*@modifies internalState @*/; | ||||
/** \ingroup rpmrc | ||||
* Return current arch/os names. | ||||
* @deprecated Use rpmExpand on _target_* macros. | ||||
* @todo Eliminate from API. | ||||
* | ||||
* @retval arch address of arch name (or NULL) | ||||
* @retval os address of os name (or NULL) | ||||
*/ | ||||
/*@unused@*/ | ||||
void rpmGetMachine( /*@null@*/ /*@out@*/ const char **arch, | ||||
/*@null@*/ /*@out@*/ const char **os) | ||||
/*@modifies *arch, *os @*/; | ||||
/** \ingroup rpmrc | /** \ingroup rpmrc | |||
* @todo Eliminate in rpm-5.1. | ||||
* Destroy rpmrc arch/os compatibility tables. | * Destroy rpmrc arch/os compatibility tables. | |||
* @todo Eliminate from API. | * @todo Eliminate from API. | |||
*/ | */ | |||
void rpmFreeRpmrc(void) | void rpmFreeRpmrc(void) | |||
/*@globals internalState @*/ | /*@globals platpat, nplatpat, internalState @*/ | |||
/*@modifies internalState @*/; | /*@modifies platpat, nplatpat, internalState @*/; | |||
/*@}*/ | ||||
/* ==================================================================== */ | ||||
/** \name RPMDB */ | ||||
/*@{*/ | ||||
/** \ingroup rpmdb | ||||
*/ | ||||
typedef /*@abstract@*/ struct rpmdb_s * rpmdb; | ||||
/** \ingroup rpmdb | ||||
*/ | ||||
typedef /*@abstract@*/ struct _dbiIndexSet * dbiIndexSet; | ||||
/** \ingroup rpmdb | ||||
* Tags for which rpmdb indices will be built. | ||||
*/ | ||||
/*@unchecked@*/ | ||||
/*@only@*/ /*@null@*/ extern int * dbiTags; | ||||
/*@unchecked@*/ | ||||
extern int dbiTagsMax; | ||||
/** \ingroup rpmdb | ||||
* Open rpm database. | ||||
* @param prefix path to top of install tree | ||||
* @retval dbp address of rpm database | ||||
* @param mode open(2) flags: O_RDWR or O_RDONLY (O_CREAT also) | ||||
* @param perms database permissions | ||||
* @return 0 on success | ||||
*/ | ||||
int rpmdbOpen (/*@null@*/ const char * prefix, /*@null@*/ /*@out@*/ rpmdb * | ||||
dbp, | ||||
int mode, int perms) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies *dbp, fileSystem @*/; | ||||
/** \ingroup rpmdb | ||||
* Initialize database. | ||||
* @param prefix path to top of install tree | ||||
* @param perms database permissions | ||||
* @return 0 on success | ||||
*/ | ||||
int rpmdbInit(/*@null@*/ const char * prefix, int perms) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies fileSystem @*/; | ||||
/** \ingroup rpmdb | ||||
* Verify database components. | ||||
* @param prefix path to top of install tree | ||||
* @return 0 on success | ||||
*/ | ||||
int rpmdbVerify(/*@null@*/ const char * prefix) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies fileSystem @*/; | ||||
/** \ingroup rpmdb | ||||
* Close all database indices and free rpmdb. | ||||
* @param db rpm database | ||||
* @return 0 on success | ||||
*/ | ||||
int rpmdbClose (/*@only@*/ /*@null@*/ rpmdb db) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies fileSystem @*/; | ||||
/** \ingroup rpmdb | ||||
* Sync all database indices. | ||||
* @param db rpm database | ||||
* @return 0 on success | ||||
*/ | ||||
int rpmdbSync (/*@null@*/ rpmdb db) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies fileSystem @*/; | ||||
/** \ingroup rpmdb | ||||
* Open all database indices. | ||||
* @param db rpm database | ||||
* @return 0 on success | ||||
*/ | ||||
int rpmdbOpenAll (/*@null@*/ rpmdb db) | ||||
/*@modifies db @*/; | ||||
/** \ingroup rpmdb | ||||
* Return number of instances of package in rpm database. | ||||
* @param db rpm database | ||||
* @param name rpm package name | ||||
* @return number of instances | ||||
*/ | ||||
int rpmdbCountPackages(/*@null@*/ rpmdb db, const char * name) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies db, fileSystem @*/; | ||||
/** \ingroup rpmdb | ||||
*/ | ||||
typedef /*@abstract@*/ struct _rpmdbMatchIterator * rpmdbMatchIterator; | ||||
/** \ingroup rpmdb | ||||
* Destroy rpm database iterator. | ||||
* @param mi rpm database iterator | ||||
* @return NULL always | ||||
*/ | ||||
/*@null@*/ rpmdbMatchIterator rpmdbFreeIterator( | ||||
/*@only@*//*@null@*/rpmdbMatchIterator mi) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies mi, fileSystem @*/; | ||||
/** \ingroup rpmdb | ||||
* Return rpm database used by iterator. | ||||
* @param mi rpm database iterator | ||||
* @return rpm database handle | ||||
*/ | ||||
/*@kept@*/ /*@null@*/ rpmdb rpmdbGetIteratorRpmDB( | ||||
/*@null@*/ rpmdbMatchIterator mi) | ||||
/*@*/; | ||||
/** \ingroup rpmdb | ||||
* Return join key for current position of rpm database iterator. | ||||
* @param mi rpm database iterator | ||||
* @return current join key | ||||
*/ | ||||
unsigned int rpmdbGetIteratorOffset(/*@null@*/ rpmdbMatchIterator mi) | ||||
/*@*/; | ||||
/** \ingroup rpmdb | ||||
* Return number of elements in rpm database iterator. | ||||
* @param mi rpm database iterator | ||||
* @return number of elements | ||||
*/ | ||||
int rpmdbGetIteratorCount(/*@null@*/ rpmdbMatchIterator mi) | ||||
/*@*/; | ||||
/** \ingroup rpmdb | ||||
* Append items to set of package instances to iterate. | ||||
* @param mi rpm database iterator | ||||
* @param hdrNums array of package instances | ||||
* @param nHdrNums number of elements in array | ||||
* @return 0 on success, 1 on failure (bad args) | ||||
*/ | ||||
int rpmdbAppendIterator(/*@null@*/ rpmdbMatchIterator mi, | ||||
/*@null@*/ const int * hdrNums, int nHdrNums) | ||||
/*@modifies mi @*/; | ||||
/** \ingroup rpmdb | ||||
* Remove items from set of package instances to iterate. | ||||
* @note Sorted hdrNums are always passed in rpmlib. | ||||
* @param mi rpm database iterator | ||||
* @param hdrNums array of package instances | ||||
* @param nHdrNums number of elements in array | ||||
* @param sorted is the array sorted? (array will be sorted on return | ||||
) | ||||
* @return 0 on success, 1 on failure (bad args) | ||||
*/ | ||||
int rpmdbPruneIterator(/*@null@*/ rpmdbMatchIterator mi, | ||||
/*@null@*/ int * hdrNums, int nHdrNums, int sorted) | ||||
/*@modifies mi, hdrNums @*/; | ||||
/** | ||||
* Tag value pattern match mode. | ||||
*/ | ||||
typedef enum rpmMireMode_e { | ||||
RPMMIRE_DEFAULT = 0, /*!< regex with \., .* and ^...$ */ | ||||
RPMMIRE_STRCMP = 1, /*!< strcmp on strings */ | ||||
RPMMIRE_REGEX = 2, /*!< regex patterns */ | ||||
RPMMIRE_GLOB = 3 /*!< glob patterns */ | ||||
} rpmMireMode; | ||||
/** \ingroup rpmdb | ||||
* Add pattern to iterator selector. | ||||
* @param mi rpm database iterator | ||||
* @param tag rpm tag | ||||
* @param mode type of pattern match | ||||
* @param pattern pattern to match | ||||
* @return 0 on success | ||||
*/ | ||||
int rpmdbSetIteratorRE(/*@null@*/ rpmdbMatchIterator mi, rpmTag tag, | ||||
rpmMireMode mode, /*@null@*/ const char * pattern) | ||||
/*@modifies mi @*/; | ||||
/** \ingroup rpmdb | ||||
* Modify iterator to filter out headers that do not match version. | ||||
* @deprecated Use | ||||
* rpmdbSetIteratorRE(mi, RPMTAG_VERSION, RPMMIRE_DEFAULT, version) | ||||
* instead. | ||||
* @todo Eliminate from API. | ||||
* @param mi rpm database iterator | ||||
* @param version version to match (can be a regex pattern) | ||||
* @return 0 on success | ||||
*/ | ||||
/*@unused@*/ | ||||
int rpmdbSetIteratorVersion(/*@null@*/ rpmdbMatchIterator mi, | ||||
/*@null@*/ const char * version) | ||||
/*@modifies mi @*/; | ||||
/** \ingroup rpmdb | ||||
* Modify iterator to filter out headers that do not match release. | ||||
* @deprecated Use | ||||
* rpmdbSetIteratorRE(mi, RPMTAG_RELEASE, RPMMIRE_DEFAULT, release) | ||||
* instead. | ||||
* @todo Eliminate from API. | ||||
* @param mi rpm database iterator | ||||
* @param release release to match (can be a regex pattern) | ||||
* @return 0 on success | ||||
*/ | ||||
/*@unused@*/ | ||||
int rpmdbSetIteratorRelease(/*@null@*/ rpmdbMatchIterator mi, | ||||
/*@null@*/ const char * release) | ||||
/*@modifies mi @*/; | ||||
/** \ingroup rpmdb | ||||
* Prepare iterator for lazy writes. | ||||
* @note Must be called before rpmdbNextIterator() in CDB model database. | ||||
* @param mi rpm database iterator | ||||
* @param rewrite new value of rewrite | ||||
* @return previous value | ||||
*/ | ||||
int rpmdbSetIteratorRewrite(/*@null@*/ rpmdbMatchIterator mi, int rewrite) | ||||
/*@modifies mi @*/; | ||||
/** \ingroup rpmdb | ||||
* Modify iterator to mark header for lazy write. | ||||
* @param mi rpm database iterator | ||||
* @param modified new value of modified | ||||
* @return previous value | ||||
*/ | ||||
int rpmdbSetIteratorModified(/*@null@*/ rpmdbMatchIterator mi, int modified | ||||
) | ||||
/*@modifies mi @*/; | ||||
/** \ingroup rpmdb | ||||
* Return next package header from iteration. | ||||
* @param mi rpm database iterator | ||||
* @return NULL on end of iteration. | ||||
*/ | ||||
/*@null@*/ Header rpmdbNextIterator(/*@null@*/ rpmdbMatchIterator mi) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies mi, fileSystem @*/; | ||||
/** @todo Remove debugging entry from the ABI. */ | ||||
/*@unused@*/ | ||||
/*@null@*/ Header XrpmdbNextIterator(rpmdbMatchIterator mi, | ||||
const char * f, unsigned int l) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies mi, fileSystem @*/; | ||||
/** \ingroup rpmdb | ||||
* Return database iterator. | ||||
* @param db rpm database | ||||
* @param rpmtag rpm tag | ||||
* @param keyp key data (NULL for sequential access) | ||||
* @param keylen key data length (0 will use strlen(keyp)) | ||||
* @return NULL on failure | ||||
*/ | ||||
/*@only@*/ /*@null@*/ rpmdbMatchIterator rpmdbInitIterator( | ||||
/*@kept@*/ /*@null@*/ rpmdb db, int rpmtag, | ||||
/*@null@*/ const void * keyp, size_t keylen) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies db, fileSystem @*/; | ||||
/** \ingroup rpmdb | ||||
* Add package header to rpm database and indices. | ||||
* @param db rpm database | ||||
* @param iid install transaction id (iid = 0 or -1 to skip) | ||||
* @param h header | ||||
* @return 0 on success | ||||
*/ | ||||
int rpmdbAdd(/*@null@*/ rpmdb db, int iid, Header h) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies db, h, fileSystem @*/; | ||||
/** \ingroup rpmdb | ||||
* Remove package header from rpm database and indices. | ||||
* @param db rpm database | ||||
* @param rid remove transaction id (rid = 0 or -1 to skip) | ||||
* @param hdrNum package instance number in database | ||||
* @return 0 on success | ||||
*/ | ||||
int rpmdbRemove(/*@null@*/ rpmdb db, /*@unused@*/ int rid, unsigned int hdr | ||||
Num) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies db, fileSystem @*/; | ||||
/** \ingroup rpmdb | ||||
* Rebuild database indices from package headers. | ||||
* @param prefix path to top of install tree | ||||
* @return 0 on success | ||||
*/ | ||||
int rpmdbRebuild(/*@null@*/ const char * prefix) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies fileSystem @*/; | ||||
/*@}*/ | ||||
/* ==================================================================== */ | ||||
/** \name RPMPROBS */ | ||||
/*@{*/ | ||||
/** | ||||
* Enumerate transaction set problem types. | ||||
*/ | ||||
typedef enum rpmProblemType_e { | ||||
RPMPROB_BADARCH, /*!< package ... is for a different architecture */ | ||||
RPMPROB_BADOS, /*!< package ... is for a different operating system | ||||
*/ | ||||
RPMPROB_PKG_INSTALLED, /*!< package ... is already installed */ | ||||
RPMPROB_BADRELOCATE,/*!< path ... is not relocateable for package ... * | ||||
/ | ||||
RPMPROB_REQUIRES, /*!< package ... has unsatisfied Requires: ... */ | ||||
RPMPROB_CONFLICT, /*!< package ... has unsatisfied Conflicts: ... */ | ||||
RPMPROB_NEW_FILE_CONFLICT, /*!< file ... conflicts between attemped ins | ||||
talls of ... */ | ||||
RPMPROB_FILE_CONFLICT,/*!< file ... from install of ... conflicts with | ||||
file from package ... */ | ||||
RPMPROB_OLDPACKAGE, /*!< package ... (which is newer than ...) i | ||||
s already installed */ | ||||
RPMPROB_DISKSPACE, /*!< installing package ... needs ... on the ... fil | ||||
esystem */ | ||||
RPMPROB_DISKNODES, /*!< installing package ... needs ... on the ... fil | ||||
esystem */ | ||||
RPMPROB_BADPRETRANS /*!< (unimplemented) */ | ||||
} rpmProblemType; | ||||
/** | ||||
*/ | ||||
typedef /*@abstract@*/ struct rpmProblem_s { | ||||
/*@only@*/ /*@null@*/ const char * pkgNEVR; | ||||
/*@only@*/ /*@null@*/ const char * altNEVR; | ||||
/*@kept@*/ /*@null@*/ const void * key; | ||||
/*@null@*/ Header h; | ||||
rpmProblemType type; | ||||
int ignoreProblem; | ||||
/*@only@*/ /*@null@*/ const char * str1; | ||||
unsigned long ulong1; | ||||
} * rpmProblem; | ||||
/** | ||||
*/ | ||||
typedef /*@abstract@*/ struct rpmProblemSet_s { | ||||
int numProblems; /*!< Current probs array size. */ | ||||
int numProblemsAlloced; /*!< Allocated probs array size. */ | ||||
rpmProblem probs; /*!< Array of specific problems. */ | ||||
} * rpmProblemSet; | ||||
/** | ||||
*/ | ||||
void printDepFlags(FILE *fp, const char *version, int flags) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies *fp, fileSystem @*/; | ||||
/** | ||||
* Dependency problems found by rpmdepCheck(). | ||||
*/ | ||||
typedef /*@abstract@*/ struct rpmDependencyConflict_s { | ||||
const char * byName; /*!< package name */ | ||||
const char * byVersion; /*!< package version */ | ||||
const char * byRelease; /*!< package release */ | ||||
Header byHeader; /*!< header with dependency problems */ | ||||
/* | ||||
* These needs fields are misnamed -- they are used for the package | ||||
* which isn't needed as well. | ||||
*/ | ||||
const char * needsName; /*!< dependency name */ | ||||
const char * needsVersion; /*!< dependency epoch:version-release */ | ||||
int needsFlags; /*!< dependency flags */ | ||||
/*@owned@*/ /*@null@*/ const void ** suggestedPackages; /* terminated by NU | ||||
LL */ | ||||
enum { | ||||
RPMDEP_SENSE_REQUIRES, /*!< requirement not satisfied. */ | ||||
RPMDEP_SENSE_CONFLICTS /*!< conflict was found. */ | ||||
} sense; | ||||
} * rpmDependencyConflict; | ||||
/** | ||||
* Print results of rpmdepCheck() dependency check. | ||||
* @param fp output file | ||||
* @param conflicts dependency problems | ||||
* @param numConflicts no. of dependency problems | ||||
*/ | ||||
void printDepProblems(FILE * fp, const rpmDependencyConflict conflicts, | ||||
int numConflicts) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies *fp, fileSystem @*/; | ||||
/** | ||||
* Return formatted string representation of problem. | ||||
* @deprecated API: prob used to be passed by value, now passed by referenc | ||||
e. | ||||
* @param prob rpm problem | ||||
* @return formatted string (malloc'd) | ||||
*/ | ||||
/*@-redecl@*/ /* LCL: is confused. */ | ||||
/*@only@*/ extern const char * rpmProblemString(const rpmProblem prob) | ||||
/*@*/; | ||||
/*@=redecl@*/ | ||||
/** | ||||
* Output formatted string representation of problem to file handle. | ||||
* @deprecated API: prob used to be passed by value, now passed by referenc | ||||
e. | ||||
* @param fp file handle | ||||
* @param prob rpm problem | ||||
*/ | ||||
void rpmProblemPrint(FILE *fp, rpmProblem prob) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies prob, *fp, fileSystem @*/; | ||||
/** | ||||
* Print problems to file handle. | ||||
* @param fp file handle | ||||
* @param probs problem set | ||||
*/ | ||||
void rpmProblemSetPrint(FILE *fp, rpmProblemSet probs) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies probs, *fp, fileSystem @*/; | ||||
/** | ||||
* Destroy problem set. | ||||
* @param probs problem set | ||||
*/ | ||||
void rpmProblemSetFree( /*@only@*/ rpmProblemSet probs) | ||||
/*@modifies probs @*/; | ||||
/*@}*/ | /*@}*/ | |||
/* ==================================================================== */ | /* ==================================================================== */ | |||
/** \name RPMTS */ | /** \name RPMTS */ | |||
/*@{*/ | /*@{*/ | |||
/** | ||||
* Prototype for headerFreeData() vector. | ||||
* @param data address of data (or NULL) | ||||
* @param type type of data (or -1 to force free) | ||||
* @return NULL always | ||||
*/ | ||||
typedef /*@null@*/ | ||||
void * (*HFD_t) (/*@only@*/ /*@null@*/ const void * data, rpmTagType ty | ||||
pe) | ||||
/*@modifies data @*/; | ||||
/** | ||||
* Prototype for headerGetEntry() vector. | ||||
* Will never return RPM_I18NSTRING_TYPE! RPM_STRING_TYPE elements with | ||||
* RPM_I18NSTRING_TYPE equivalent entries are translated (if HEADER_I18NTAB | ||||
LE | ||||
* entry is present). | ||||
* | ||||
* @param h header | ||||
* @param tag tag | ||||
* @retval type address of tag value data type (or NULL) | ||||
* @retval p address of pointer to tag value(s) (or NULL) | ||||
* @retval c address of number of values (or NULL) | ||||
* @return 1 on success, 0 on failure | ||||
*/ | ||||
typedef int (*HGE_t) (Header h, rpmTag tag, | ||||
/*@null@*/ /*@out@*/ rpmTagType * type, | ||||
/*@null@*/ /*@out@*/ void ** p, | ||||
/*@null@*/ /*@out@*/ int_32 * c) | ||||
/*@modifies *type, *p, *c @*/; | ||||
/** | ||||
* Prototype for headerAddEntry() vector. | ||||
* Duplicate tags are okay, but only defined for iteration (with the | ||||
* exceptions noted below). While you are allowed to add i18n string | ||||
* arrays through this function, you probably don't mean to. See | ||||
* headerAddI18NString() instead. | ||||
* | ||||
* @param h header | ||||
* @param tag tag | ||||
* @param type tag value data type | ||||
* @param p pointer to tag value(s) | ||||
* @param c number of values | ||||
* @return 1 on success, 0 on failure | ||||
*/ | ||||
typedef int (*HAE_t) (Header h, rpmTag tag, rpmTagType type, | ||||
const void * p, int_32 c) | ||||
/*@modifies h @*/; | ||||
/** | ||||
* Prototype for headerModifyEntry() vector. | ||||
* If there are multiple entries with this tag, the first one gets replaced | ||||
. | ||||
* @param h header | ||||
* @param tag tag | ||||
* @param type tag value data type | ||||
* @param p pointer to tag value(s) | ||||
* @param c number of values | ||||
* @return 1 on success, 0 on failure | ||||
*/ | ||||
typedef int (*HME_t) (Header h, rpmTag tag, rpmTagType type, | ||||
const void * p, int_32 c) | ||||
/*@modifies h @*/; | ||||
/** | ||||
* Prototype for headerRemoveEntry() vector. | ||||
* Delete tag in header. | ||||
* Removes all entries of type tag from the header, returns 1 if none were | ||||
* found. | ||||
* | ||||
* @param h header | ||||
* @param tag tag | ||||
* @return 0 on success, 1 on failure (INCONSISTENT) | ||||
*/ | ||||
typedef int (*HRE_t) (Header h, int_32 tag) | ||||
/*@modifies h @*/; | ||||
/** | /** | |||
* We pass these around as an array with a sentinel. | * We pass these around as an array with a sentinel. | |||
*/ | */ | |||
typedef struct rpmRelocation_s { | typedef struct rpmRelocation_s * rpmRelocation; | |||
#if !defined(SWIG) | ||||
struct rpmRelocation_s { | ||||
/*@only@*/ /*@null@*/ | /*@only@*/ /*@null@*/ | |||
const char * oldPath; /*!< NULL here evals to RPMTAG_DEFAULTPREFIX , */ | const char * oldPath; /*!< NULL here evals to RPMTAG_DEFAULTPREFIX , */ | |||
/*@only@*/ /*@null@*/ | /*@only@*/ /*@null@*/ | |||
const char * newPath; /*!< NULL means to omit the file completely! */ | const char * newPath; /*!< NULL means to omit the file completely! */ | |||
} rpmRelocation; | }; | |||
#endif | ||||
/** | ||||
* Install source package. | ||||
* @param rootDir path to top of install tree (or NULL) | ||||
* @param fd file handle | ||||
* @retval specFilePtr address of spec file name (or NULL) | ||||
* @param notify progress callback | ||||
* @param notifyData progress callback private data | ||||
* @retval cooke address of cookie pointer (or NULL) | ||||
* @return rpmRC return code | ||||
*/ | ||||
rpmRC rpmInstallSourcePackage(/*@null@*/ const char * rootDir, FD_t fd, | ||||
/*@null@*/ /*@out@*/ const char ** specFilePtr, | ||||
/*@null@*/ rpmCallbackFunction notify, | ||||
/*@null@*/ rpmCallbackData notifyData, | ||||
/*@null@*/ /*@out@*/ char ** cookie) | ||||
/*@modifies fd, *specFilePtr, *cookie @*/; | ||||
/** | /** | |||
* Compare headers to determine which header is "newer". | * Compare headers to determine which header is "newer". | |||
* @deprecated Use rpmdsCompare instead. | ||||
* @todo Eliminate in rpm-5.1. | ||||
* @param first 1st header | * @param first 1st header | |||
* @param second 2nd header | * @param second 2nd header | |||
* @return result of comparison | * @return result of comparison | |||
*/ | */ | |||
int rpmVersionCompare(Header first, Header second) | int rpmVersionCompare(Header first, Header second) | |||
/*@*/; | /*@*/; | |||
/** | /** \ingroup rpmts | |||
* File disposition(s) during package install/erase transaction. | ||||
*/ | ||||
typedef enum fileAction_e { | ||||
FA_UNKNOWN = 0, /*!< initial action for file ... */ | ||||
FA_CREATE, /*!< ... copy in from payload. */ | ||||
FA_COPYIN, /*!< ... copy in from payload. */ | ||||
FA_COPYOUT, /*!< ... copy out to payload. */ | ||||
FA_BACKUP, /*!< ... renamed with ".rpmorig" extension. */ | ||||
FA_SAVE, /*!< ... renamed with ".rpmsave" extension. */ | ||||
FA_SKIP, /*!< ... already replaced, don't remove. */ | ||||
FA_ALTNAME, /*!< ... create with ".rpmnew" extension. */ | ||||
FA_ERASE, /*!< ... to be removed. */ | ||||
FA_SKIPNSTATE, /*!< ... untouched, state "not installed". */ | ||||
FA_SKIPNETSHARED, /*!< ... untouched, state "netshared". */ | ||||
FA_SKIPMULTILIB /*!< ... untouched. @todo state "multilib" ???. */ | ||||
} fileAction; | ||||
#define XFA_SKIPPING(_a) \ | ||||
((_a) == FA_SKIP || (_a) == FA_SKIPNSTATE || (_a) == FA_SKIPNETSHARED | | ||||
| (_a) == FA_SKIPMULTILIB) | ||||
/** | ||||
* File types. | ||||
* These are the file types used internally by rpm. The file | ||||
* type is determined by applying stat(2) macros like S_ISDIR to | ||||
* the file mode tag from a header. The values are arbitrary, | ||||
* but are identical to the linux stat(2) file types. | ||||
*/ | ||||
typedef enum fileTypes_e { | ||||
PIPE = 1, /*!< pipe/fifo */ | ||||
CDEV = 2, /*!< character device */ | ||||
XDIR = 4, /*!< directory */ | ||||
BDEV = 6, /*!< block device */ | ||||
REG = 8, /*!< regular file */ | ||||
LINK = 10, /*!< hard link */ | ||||
SOCK = 12 /*!< socket */ | ||||
} fileTypes; | ||||
/** \ingroup payload | ||||
* Iterator across package file info, forward on install, backward on erase | ||||
. | ||||
*/ | ||||
typedef /*@abstract@*/ struct fsmIterator_s * FSMI_t; | ||||
/** \ingroup payload | ||||
* File state machine data. | ||||
*/ | ||||
typedef /*@abstract@*/ struct fsm_s * FSM_t; | ||||
/** \ingroup rpmtrans | ||||
* Package state machine data. | * Package state machine data. | |||
*/ | */ | |||
typedef /*@abstract@*/ struct psm_s * PSM_t; | typedef /*@abstract@*/ /*@refcounted@*/ struct rpmpsm_s * rpmpsm; | |||
/** \ingroup rpmtrans | ||||
*/ | ||||
typedef /*@abstract@*/ struct transactionFileInfo_s * TFI_t; | ||||
/** \ingroup rpmtrans | ||||
* The RPM Transaction Set. | ||||
* Transaction sets are inherently unordered! RPM may reorder transaction | ||||
* sets to reduce errors. In general, installs/upgrades are done before | ||||
* strict removals, and prerequisite ordering is done on installs/upgrades. | ||||
*/ | ||||
typedef /*@abstract@*/ struct rpmTransactionSet_s * rpmTransactionSet; | ||||
/** \ingroup rpmtrans | ||||
* Create an empty transaction set. | ||||
* @param rpmdb rpm database (may be NULL if database is not | ||||
accessed) | ||||
* @param rootdir path to top of install tree | ||||
* @return transaction set | ||||
*/ | ||||
/*@only@*/ rpmTransactionSet rpmtransCreateSet( | ||||
/*@null@*/ /*@kept@*/ rpmdb rpmdb, | ||||
/*@null@*/ const char * rootDir) | ||||
/*@*/; | ||||
/** \ingroup rpmtrans | ||||
* Add package to be installed to unordered transaction set. | ||||
* | ||||
* If fd is NULL, the callback specified in rpmtransCreateSet() is used to | ||||
* open and close the file descriptor. If Header is NULL, the fd is always | ||||
* used, otherwise fd is only needed (and only opened) for actual package | ||||
* installation. | ||||
* | ||||
* @param ts transaction set | ||||
* @param h package header | ||||
* @param fd package file handle | ||||
* @param key package private data | ||||
* @param upgrade is package being upgraded? | ||||
* @param relocs package file relocations | ||||
* @return 0 on success, 1 on I/O error, 2 needs capabilities | ||||
*/ | ||||
int rpmtransAddPackage(rpmTransactionSet ts, Header h, /*@null@*/ FD_t fd, | ||||
/*@null@*/ /*@owned@*/ const void * key, int upgrade, | ||||
/*@null@*/ rpmRelocation * relocs) | ||||
/*@modifies fd, h, ts @*/; | ||||
/** \ingroup rpmtrans | ||||
* Add package to universe of possible packages to install in transaction s | ||||
et. | ||||
* @param ts transaction set | ||||
* @param h header | ||||
* @param key package private data | ||||
*/ | ||||
/*@unused@*/ | ||||
void rpmtransAvailablePackage(rpmTransactionSet ts, Header h, | ||||
/*@null@*/ /*@owned@*/ const void * key) | ||||
/*@modifies h, ts @*/; | ||||
/** \ingroup rpmtrans | ||||
* Add package to be removed to unordered transaction set. | ||||
* @param ts transaction set | ||||
* @param dboffset rpm database instance | ||||
* @return 0 on success | ||||
*/ | ||||
int rpmtransRemovePackage(rpmTransactionSet ts, int dboffset) | ||||
/*@modifies ts @*/; | ||||
/** \ingroup rpmtrans | ||||
* Destroy transaction set. | ||||
* @param ts transaction set | ||||
* @return NULL always | ||||
*/ | ||||
/*@null@*/ rpmTransactionSet | ||||
rpmtransFree(/*@only@*//*@null@*/ rpmTransactionSet ts) | ||||
/*@modifies ts @*/; | ||||
/** \ingroup rpmtrans | ||||
* Save file handle to be used as stderr when running package scripts. | ||||
* @param ts transaction set | ||||
* @param fd file handle | ||||
*/ | ||||
/*@unused@*/ | ||||
void rpmtransSetScriptFd(rpmTransactionSet ts, FD_t fd) | ||||
/*@modifies ts, fd @*/; | ||||
/** \ingroup rpmtrans | ||||
* Retrieve keys from ordered transaction set. | ||||
* @todo Removed packages have no keys, returned as interleaved NULL pointe | ||||
rs. | ||||
* @param ts transaction set | ||||
* @retval ep address of returned element array pointer (or NULL) | ||||
* @retval nep address of no. of returned elements (or NULL) | ||||
* @return 0 always | ||||
*/ | ||||
/*@unused@*/ | ||||
int rpmtransGetKeys(const rpmTransactionSet ts, | ||||
/*@null@*/ /*@out@*/ const void *** ep, | ||||
/*@null@*/ /*@out@*/ int * nep) | ||||
/*@modifies ep, nep @*/; | ||||
/** \ingroup rpmtrans | ||||
* Check that all dependencies can be resolved. | ||||
* @param ts transaction set | ||||
* @retval conflicts dependency problems | ||||
* @retval numConflicts no. of dependency problems | ||||
* @return 0 on success | ||||
*/ | ||||
int rpmdepCheck(rpmTransactionSet ts, | ||||
/*@exposed@*/ /*@out@*/ rpmDependencyConflict * conflicts, | ||||
/*@exposed@*/ /*@out@*/ int * numConflicts) | ||||
/*@globals fileSystem, internalState @*/ | ||||
/*@modifies ts, *conflicts, *numConflicts, | ||||
fileSystem, internalState @*/; | ||||
/** \ingroup rpmtrans | ||||
* Determine package order in a transaction set according to dependencies. | ||||
* | ||||
* Order packages, returning error if circular dependencies cannot be | ||||
* eliminated by removing PreReq's from the loop(s). Only dependencies from | ||||
* added or removed packages are used to determine ordering using a | ||||
* topological sort (Knuth vol. 1, p. 262). Use rpmdepCheck() to verify | ||||
* that all dependencies can be resolved. | ||||
* | ||||
* The final order ends up as installed packages followed by removed packag | ||||
es, | ||||
* with packages removed for upgrades immediately following the new package | ||||
* to be installed. | ||||
* | ||||
* The operation would be easier if we could sort the addedPackages array i | ||||
n the | ||||
* transaction set, but we store indexes into the array in various places. | ||||
* | ||||
* @param ts transaction set | ||||
* @return 0 if packages are successfully ordered, 1 otherwise | ||||
*/ | ||||
int rpmdepOrder(rpmTransactionSet ts) | ||||
/*@globals fileSystem, internalState@*/ | ||||
/*@modifies ts, fileSystem, internalState @*/; | ||||
/** \ingroup rpmtrans | ||||
* Destroy dependency conflicts storage. | ||||
* @param conflicts dependency problems | ||||
* @param numConflicts no. of dependency problems | ||||
* @retrun NULL always | ||||
*/ | ||||
/*@null@*/ rpmDependencyConflict rpmdepFreeConflicts( | ||||
/*@only@*/ /*@null@*/ rpmDependencyConflict conflicts, | ||||
int numConflicts) | ||||
/*@modifies conflicts @*/; | ||||
/** \ingroup rpmtrans | ||||
* Bit(s) to control rpmRunTransactions() operation. | ||||
*/ | ||||
typedef enum rpmtransFlags_e { | ||||
RPMTRANS_FLAG_NONE = 0, | ||||
RPMTRANS_FLAG_TEST = (1 << 0), /*!< from --test */ | ||||
RPMTRANS_FLAG_BUILD_PROBS = (1 << 1), /*!< @todo Document. */ | ||||
RPMTRANS_FLAG_NOSCRIPTS = (1 << 2), /*!< from --noscripts */ | ||||
RPMTRANS_FLAG_JUSTDB = (1 << 3), /*!< from --justdb */ | ||||
RPMTRANS_FLAG_NOTRIGGERS = (1 << 4), /*!< from --notriggers */ | ||||
RPMTRANS_FLAG_NODOCS = (1 << 5), /*!< from --excludedocs */ | ||||
RPMTRANS_FLAG_ALLFILES = (1 << 6), /*!< from --allfiles */ | ||||
/*@-enummemuse@*/ | ||||
RPMTRANS_FLAG_KEEPOBSOLETE = (1 << 7), /*!< @todo Document. */ | ||||
/*@=enummemuse@*/ | ||||
RPMTRANS_FLAG_MULTILIB = (1 << 8), /*!< @todo Document. */ | ||||
RPMTRANS_FLAG_DIRSTASH = (1 << 9), /*!< from --dirstash */ | ||||
RPMTRANS_FLAG_REPACKAGE = (1 << 10), /*!< from --repackage */ | ||||
RPMTRANS_FLAG_PKGCOMMIT = (1 << 11), | ||||
/*@-enummemuse@*/ | ||||
RPMTRANS_FLAG_PKGUNDO = (1 << 12), | ||||
/*@=enummemuse@*/ | ||||
RPMTRANS_FLAG_COMMIT = (1 << 13), | ||||
/*@-enummemuse@*/ | ||||
RPMTRANS_FLAG_UNDO = (1 << 14), | ||||
/*@=enummemuse@*/ | ||||
RPMTRANS_FLAG_REVERSE = (1 << 15), | ||||
RPMTRANS_FLAG_NOTRIGGERPREIN= (1 << 16), /*!< from --notriggerprein * | ||||
/ | ||||
RPMTRANS_FLAG_NOPRE = (1 << 17), /*!< from --nopre */ | ||||
RPMTRANS_FLAG_NOPOST = (1 << 18), /*!< from --nopost */ | ||||
RPMTRANS_FLAG_NOTRIGGERIN = (1 << 19), /*!< from --notriggerin */ | ||||
RPMTRANS_FLAG_NOTRIGGERUN = (1 << 20), /*!< from --notriggerun */ | ||||
RPMTRANS_FLAG_NOPREUN = (1 << 21), /*!< from --nopreun */ | ||||
RPMTRANS_FLAG_NOPOSTUN = (1 << 22), /*!< from --nopostun */ | ||||
RPMTRANS_FLAG_NOTRIGGERPOSTUN = (1 << 23), /*!< from --notriggerpostun | ||||
*/ | ||||
/*@-enummemuse@*/ | ||||
RPMTRANS_FLAG_NOPAYLOAD = (1 << 24), | ||||
/*@=enummemuse@*/ | ||||
RPMTRANS_FLAG_APPLYONLY = (1 << 25), | ||||
/*@-enummemuse@*/ | ||||
RPMTRANS_FLAG_CHAINSAW = (1 << 26), | ||||
/*@=enummemuse@*/ | ||||
RPMTRANS_FLAG_NOMD5 = (1 << 27) /*!< from --nomd5 */ | ||||
} rpmtransFlags; | ||||
#define _noTransScripts \ | ||||
( RPMTRANS_FLAG_NOPRE | \ | ||||
RPMTRANS_FLAG_NOPOST | \ | ||||
RPMTRANS_FLAG_NOPREUN | \ | ||||
RPMTRANS_FLAG_NOPOSTUN \ | ||||
) | ||||
#define _noTransTriggers \ | ||||
( RPMTRANS_FLAG_NOTRIGGERPREIN | \ | ||||
RPMTRANS_FLAG_NOTRIGGERIN | \ | ||||
RPMTRANS_FLAG_NOTRIGGERUN | \ | ||||
RPMTRANS_FLAG_NOTRIGGERPOSTUN \ | ||||
) | ||||
/** \ingroup rpmtrans | ||||
* Return copy of rpmlib internal provides. | ||||
* @retval address of array of rpmlib internal provide names | ||||
* @retval address of array of rpmlib internal provide flags | ||||
* @retval address of array of rpmlib internal provide versions | ||||
* @return no. of entries | ||||
*/ | ||||
/*@unused@*/ | ||||
int rpmGetRpmlibProvides(/*@null@*/ /*@out@*/ const char *** provNames, | ||||
/*@null@*/ /*@out@*/ int ** provFlags, | ||||
/*@null@*/ /*@out@*/ const char *** provVersions) | ||||
/*@modifies *provNames, *provFlags, *provVersions @*/; | ||||
/** \ingroup rpmtrans | ||||
* Segmented string compare for version and/or release. | ||||
* | ||||
* @param a 1st string | ||||
* @param b 2nd string | ||||
* @return +1 if a is "newer", 0 if equal, -1 if b is "newer" | ||||
*/ | ||||
int rpmvercmp(const char * a, const char * b) | ||||
/*@*/; | ||||
/** \ingroup rpmtrans | ||||
* Compare two versioned dependency ranges, looking for overlap. | ||||
* @param AName 1st dependncy name string | ||||
* @param AEVR 1st dependency [epoch:]version[-release] string | ||||
* @param AFlags 1st dependency logical range qualifiers | ||||
* @param BName 2nd dependncy name string | ||||
* @param BEVR 2nd dependency [epoch:]version[-release] string | ||||
* @param BFlags 2nd dependency logical range qualifiers | ||||
* @return 1 if dependencies overlap, 0 otherwise | ||||
*/ | ||||
int rpmRangesOverlap(const char * AName, const char * AEVR, int AFlags, | ||||
const char * BName, const char * BEVR, int BFlags) | ||||
/*@*/; | ||||
/** \ingroup rpmtrans | ||||
* Check dependency against internal rpmlib feature provides. | ||||
* @param keyName dependency name string | ||||
* @param keyEVR dependency [epoch:]version[-release] string | ||||
* @param keyFlags dependency logical range qualifiers | ||||
* @return 1 if dependency overlaps, 0 otherwise | ||||
*/ | ||||
int rpmCheckRpmlibProvides(const char * keyName, const char * keyEVR, | ||||
int keyFlags) | ||||
/*@*/; | ||||
/** \ingroup rpmcli | ||||
* Display current rpmlib feature provides. | ||||
* @param fp output file handle | ||||
*/ | ||||
void rpmShowRpmlibProvides(FILE * fp) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies *fp, fileSystem @*/; | ||||
/** | /** | |||
* @todo Generalize filter mechanism. | * Return package header from file handle, verifying digests/signatures. | |||
*/ | ||||
typedef enum rpmprobFilterFlags_e { | ||||
RPMPROB_FILTER_NONE = 0, | ||||
RPMPROB_FILTER_IGNOREOS = (1 << 0), /*!< from --ignoreos */ | ||||
RPMPROB_FILTER_IGNOREARCH = (1 << 1), /*!< from --ignorearch */ | ||||
RPMPROB_FILTER_REPLACEPKG = (1 << 2), /*!< from --replacepkgs */ | ||||
RPMPROB_FILTER_FORCERELOCATE= (1 << 3), /*!< from --badreloc */ | ||||
RPMPROB_FILTER_REPLACENEWFILES= (1 << 4), /*!< from --replacefiles */ | ||||
RPMPROB_FILTER_REPLACEOLDFILES= (1 << 5), /*!< from --replacefiles */ | ||||
RPMPROB_FILTER_OLDPACKAGE = (1 << 6), /*!< from --oldpackage */ | ||||
RPMPROB_FILTER_DISKSPACE = (1 << 7), /*!< from --ignoresize */ | ||||
RPMPROB_FILTER_DISKNODES = (1 << 8) /*!< from --ignoresize */ | ||||
} rpmprobFilterFlags; | ||||
/** \ingroup rpmtrans | ||||
* Process all packages in transaction set. | ||||
* @param ts transaction set | * @param ts transaction set | |||
* @param notify progress callback | * @param _fd file handle | |||
* @param notifyData progress callback private data | * @param fn file name | |||
* @param okProbs previously known problems (or NULL) | * @retval hdrp address of header (or NULL) | |||
* @retval newProbs address to return unfiltered problems (or NULL) | * @return RPMRC_OK on success | |||
* @param transFlags bits to control rpmRunTransactions() | ||||
* @param ignoreSet bits to filter problem types | ||||
* @return 0 on success, -1 on error, >0 with newProbs set | ||||
*/ | */ | |||
int rpmRunTransactions(rpmTransactionSet ts, | rpmRC rpmReadPackageFile(rpmts ts, void * _fd, | |||
rpmCallbackFunction notify, | const char * fn, /*@null@*/ /*@out@*/ Header * hdrp) | |||
/*@owned@*/ rpmCallbackData notifyData, | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | |||
rpmProblemSet okProbs, | @*/ | |||
/*@out@*/ rpmProblemSet * newProbs, | /*@modifies ts, *_fd, *hdrp, rpmGlobalMacroContext, | |||
rpmtransFlags transFlags, | ||||
rpmprobFilterFlags ignoreSet) | ||||
/*@globals rpmGlobalMacroContext, | ||||
fileSystem, internalState@*/ | ||||
/*@modifies ts, *newProbs, rpmGlobalMacroContext, | ||||
fileSystem, internalState @*/; | fileSystem, internalState @*/; | |||
/*@}*/ | ||||
/** | ||||
* Return name of tag from value. | ||||
* @param tag tag value | ||||
* @return name of tag | ||||
*/ | ||||
/*@-redecl@*/ | ||||
/*@observer@*/ extern const char *const tagName(int tag) | ||||
/*@*/; | ||||
/*@=redecl@*/ | ||||
/** | ||||
* Return value of tag from name. | ||||
* @param targstr name of tag | ||||
* @return tag value | ||||
*/ | ||||
int tagValue(const char *tagstr) | ||||
/*@*/; | ||||
#define RPMLEAD_BINARY 0 | ||||
#define RPMLEAD_SOURCE 1 | ||||
#define RPMLEAD_MAGIC0 0xed | ||||
#define RPMLEAD_MAGIC1 0xab | ||||
#define RPMLEAD_MAGIC2 0xee | ||||
#define RPMLEAD_MAGIC3 0xdb | ||||
#define RPMLEAD_SIZE 96 /*!< Don't rely on sizeof(struct) */ | ||||
/** \ingroup lead | ||||
* The lead data structure. | ||||
* The lead needs to be 8 byte aligned. | ||||
* @deprecated The lead (except for signature_type) is legacy. | ||||
* @todo Don't use any information from lead. | ||||
*/ | ||||
struct rpmlead { | ||||
unsigned char magic[4]; | ||||
unsigned char major, minor; | ||||
short type; | ||||
short archnum; | ||||
char name[66]; | ||||
short osnum; | ||||
short signature_type; /*!< Signature header type (RPMSIG_HEADERSIG | ||||
) */ | ||||
/*@unused@*/ char reserved[16]; /*!< Pad to 96 bytes -- 8 byte align | ||||
ed */ | ||||
} ; | ||||
/** | ||||
* Release storage used by file system usage cache. | ||||
*/ | ||||
void freeFilesystems(void) | ||||
/*@globals internalState@*/ | ||||
/*@modifies internalState@*/; | ||||
/** | ||||
* Return (cached) file system mount points. | ||||
* @retval listptr addess of file system names (or NULL) | ||||
* @retval num address of number of file systems (or NULL) | ||||
* @return 0 on success, 1 on error | ||||
*/ | ||||
int rpmGetFilesystemList( /*@null@*/ /*@out@*/ const char *** listptr, | ||||
/*@null@*/ /*@out@*/ int * num) | ||||
/*@globals fileSystem, internalState @*/ | ||||
/*@modifies *listptr, *num, fileSystem, internalState @*/; | ||||
/** | /** | |||
* Determine per-file system usage for a list of files. | * Install source package. | |||
* @param fileList array of absolute file names | * @deprecated This routine needs to DIE! DIE! DIE!. | |||
* @param fssizes array of file sizes | * @todo Eliminate in rpm-5.1, insturment rpmtsRun() state machine in | |||
* @param numFiles number of files in list | stead. | |||
* @retval usagesPtr address of per-file system usage array (or N | * @param ts transaction set | |||
ULL) | * @param _fd file handle | |||
* @param flags (unused) | * @retval specFilePtr address of spec file name (or NULL) | |||
* @return 0 on success, 1 on error | * @retval cookie address of cookie pointer (or NULL) | |||
* @return rpmRC return code | ||||
*/ | */ | |||
int rpmGetFilesystemUsage(const char ** fileList, int_32 * fssizes, | rpmRC rpmInstallSourcePackage(rpmts ts, void * _fd, | |||
int numFiles, /*@null@*/ /*@out@*/ uint_32 ** usagesPtr, | /*@null@*/ /*@out@*/ const char ** specFilePtr, | |||
int flags) | /*@null@*/ /*@out@*/ const char ** cookie) | |||
/*@globals rpmGlobalMacroContext, | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | |||
fileSystem, internalState @*/ | @*/ | |||
/*@modifies *usagesPtr, rpmGlobalMacroContext, | /*@modifies ts, _fd, *specFilePtr, *cookie, rpmGlobalMacroContext, | |||
fileSystem, internalState @*/; | fileSystem, internalState @*/; | |||
/* ==================================================================== */ | ||||
/** \name RPMQV */ | ||||
/*@{*/ | ||||
/** \ingroup rpmcli | ||||
*/ | ||||
typedef struct rpmQVArguments_s * QVA_t; | ||||
/** \ingroup rpmcli | ||||
* The command line argument will be used to retrieve header(s) ... | ||||
* @todo Move to rpmcli.h | ||||
*/ | ||||
typedef enum rpmQVSources_e { | ||||
RPMQV_PACKAGE = 0, /*!< ... from package name db search. */ | ||||
RPMQV_PATH, /*!< ... from file path db search. */ | ||||
RPMQV_ALL, /*!< ... from each installed package. */ | ||||
RPMQV_RPM, /*!< ... from reading binary rpm package. */ | ||||
RPMQV_GROUP, /*!< ... from group db search. */ | ||||
RPMQV_WHATPROVIDES, /*!< ... from provides db search. */ | ||||
RPMQV_WHATREQUIRES, /*!< ... from requires db search. */ | ||||
RPMQV_TRIGGEREDBY, /*!< ... from trigger db search. */ | ||||
RPMQV_DBOFFSET, /*!< ... from database header instance. */ | ||||
RPMQV_SPECFILE, /*!< ... from spec file parse (query only). */ | ||||
RPMQV_PKGID, /*!< ... from package id (header+payload MD5). */ | ||||
RPMQV_HDRID, /*!< ... from header id (immutable header SHA1). */ | ||||
RPMQV_FILEID, /*!< ... from file id (file MD5). */ | ||||
RPMQV_TID /*!< ... from install transaction id (time stamp). * | ||||
/ | ||||
} rpmQVSources; | ||||
/** \ingroup rpmcli | ||||
* Bit(s) for rpmVerifyFile() attributes and result. | ||||
* @todo Move to rpmcli.h. | ||||
*/ | ||||
typedef enum rpmVerifyAttrs_e { | ||||
RPMVERIFY_NONE = 0, /*!< */ | ||||
RPMVERIFY_MD5 = (1 << 0), /*!< from %verify(md5) */ | ||||
RPMVERIFY_FILESIZE = (1 << 1), /*!< from %verify(size) */ | ||||
RPMVERIFY_LINKTO = (1 << 2), /*!< from %verify(link) */ | ||||
RPMVERIFY_USER = (1 << 3), /*!< from %verify(user) */ | ||||
RPMVERIFY_GROUP = (1 << 4), /*!< from %verify(group) */ | ||||
RPMVERIFY_MTIME = (1 << 5), /*!< from %verify(mtime) */ | ||||
RPMVERIFY_MODE = (1 << 6), /*!< from %verify(mode) */ | ||||
RPMVERIFY_RDEV = (1 << 7), /*!< from %verify(rdev) */ | ||||
/* bits 8-15 unused, reserved for rpmVerifyAttrs */ | ||||
/* bits 16-19 used in rpmVerifyFlags */ | ||||
/* bits 20-22 unused */ | ||||
/* bits 23-27 used in rpmQueryFlags */ | ||||
RPMVERIFY_READLINKFAIL= (1 << 28), /*!< */ | ||||
RPMVERIFY_READFAIL = (1 << 29), /*!< */ | ||||
RPMVERIFY_LSTATFAIL = (1 << 30) /*!< */ | ||||
/* bit 31 unused */ | ||||
} rpmVerifyAttrs; | ||||
#define RPMVERIFY_ALL ~(RPMVERIFY_NONE) | ||||
/** \ingroup rpmcli | ||||
* Verify file attributes (including MD5 sum). | ||||
* @todo gnorpm and python bindings prevent this from being static. | ||||
* @param root path to top of install tree | ||||
* @param h header | ||||
* @param filenum index of file in header file info arrays | ||||
* @retval result address of bit(s) returned to indicate failure | ||||
* @param omitMask bit(s) to disable verify checks | ||||
* @return 0 on success (or not installed), 1 on error | ||||
*/ | ||||
int rpmVerifyFile(const char * root, Header h, int filenum, | ||||
/*@out@*/ rpmVerifyAttrs * result, rpmVerifyAttrs omitMask) | ||||
/*@globals fileSystem @*/ | ||||
/*@modifies h, *result, fileSystem @*/; | ||||
/** | ||||
* Return exit code from running verify script from header. | ||||
* @todo gnorpm/kpackage prevents static, should be using VERIFY_SCRIPT fla | ||||
g. | ||||
* @param rootDir path to top of install tree | ||||
* @param h header | ||||
* @param scriptFd file handle to use for stderr (or NULL) | ||||
* @return 0 on success | ||||
*/ | ||||
int rpmVerifyScript(const char * rootDir, Header h, /*@null@*/ FD_t scriptF | ||||
d) | ||||
/*@globals rpmGlobalMacroContext, fileSystem @*/ | ||||
/*@modifies h, scriptFd, | ||||
rpmGlobalMacroContext, fileSystem @*/; | ||||
/*@}*/ | ||||
/* ==================================================================== */ | ||||
/** \name RPMEIU */ | ||||
/*@{*/ | ||||
/* --- install/upgrade/erase modes */ | ||||
/** \ingroup rpmcli | ||||
* Bit(s) to control rpmInstall() operation. | ||||
* @todo Move to rpmcli.h | ||||
*/ | ||||
typedef enum rpmInstallInterfaceFlags_e { | ||||
INSTALL_NONE = 0, | ||||
INSTALL_PERCENT = (1 << 0), /*!< from --percent */ | ||||
INSTALL_HASH = (1 << 1), /*!< from --hash */ | ||||
INSTALL_NODEPS = (1 << 2), /*!< from --nodeps */ | ||||
INSTALL_NOORDER = (1 << 3), /*!< from --noorder */ | ||||
INSTALL_LABEL = (1 << 4), /*!< from --verbose (notify) */ | ||||
INSTALL_UPGRADE = (1 << 5), /*!< from --upgrade */ | ||||
INSTALL_FRESHEN = (1 << 6), /*!< from --freshen */ | ||||
INSTALL_INSTALL = (1 << 7), /*!< from --install */ | ||||
INSTALL_ERASE = (1 << 8) /*!< from --erase */ | ||||
} rpmInstallInterfaceFlags; | ||||
/** \ingroup rpmcli | ||||
* Bit(s) to control rpmErase() operation. | ||||
*/ | ||||
typedef enum rpmEraseInterfaceFlags_e { | ||||
UNINSTALL_NONE = 0, | ||||
UNINSTALL_NODEPS = (1 << 0), /*!< from --nodeps */ | ||||
UNINSTALL_ALLMATCHES= (1 << 1) /*!< from --allmatches */ | ||||
} rpmEraseInterfaceFlags; | ||||
/*@}*/ | ||||
/* ==================================================================== */ | ||||
/** \name RPMK */ | ||||
/*@{*/ | ||||
/** \ingroup signature | ||||
* Tags found in signature header from package. | ||||
*/ | ||||
enum rpmtagSignature { | ||||
RPMSIGTAG_SIZE = 1000, /*!< Header+Payload size in bytes. */ | ||||
/* the md5 sum was broken *twice* on big endian machines */ | ||||
RPMSIGTAG_LEMD5_1 = 1001, /*!< Broken MD5, take 1 */ | ||||
RPMSIGTAG_PGP = 1002, /*!< PGP 2.6.3 signature. */ | ||||
RPMSIGTAG_LEMD5_2 = 1003, /*!< Broken MD5, take 2 */ | ||||
RPMSIGTAG_MD5 = 1004, /*!< MD5 signature. */ | ||||
RPMSIGTAG_GPG = 1005, /*!< GnuPG signature. */ | ||||
RPMSIGTAG_PGP5 = 1006, /*!< PGP5 signature @deprecated legacy. */ | ||||
}; | ||||
/** | ||||
* Return codes from verifySignature(). | ||||
*/ | ||||
typedef enum rpmVerifySignatureReturn_e { | ||||
RPMSIG_OK = 0, /*!< Signature is OK. */ | ||||
RPMSIG_UNKNOWN = 1, /*!< Signature is unknown. */ | ||||
RPMSIG_BAD = 2, /*!< Signature does not verify. */ | ||||
RPMSIG_NOKEY = 3, /*!< Key is unavailable. */ | ||||
RPMSIG_NOTTRUSTED = 4 /*!< Signature is OK, but key is not trusted | ||||
. */ | ||||
} rpmVerifySignatureReturn; | ||||
/** \ingroup signature | ||||
* Verify a signature from a package. | ||||
* @param file file name of header+payload | ||||
* @param sigTag type of signature | ||||
* @param sig signature itself | ||||
* @param count no. of bytes in signature | ||||
* @retval result detailed text result of signature verification | ||||
* @return result of signature verification | ||||
*/ | ||||
rpmVerifySignatureReturn rpmVerifySignature(const char *file, | ||||
int_32 sigTag, const void * sig, int count, | ||||
/*@out@*/ char * result) | ||||
/*@globals rpmGlobalMacroContext, fileSystem @*/ | ||||
/*@modifies *result, rpmGlobalMacroContext, fileSystem @*/; | ||||
/** \ingroup signature | ||||
* Destroy signature header from package. | ||||
* @param h signature header | ||||
* @return NULL always | ||||
*/ | ||||
/*@null@*/ Header rpmFreeSignature(/*@null@*/ /*@killref@*/ Header h) | ||||
/*@modifies h @*/; | ||||
/*@}*/ | /*@}*/ | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* H_RPMLIB */ | #endif /* H_RPMLIB */ | |||
End of changes. 63 change blocks. | ||||
1705 lines changed or deleted | 157 lines changed or added | |||
rpmlog.h | rpmlog.h | |||
---|---|---|---|---|
#ifndef H_RPMLOG | #ifndef H_RPMLOG | |||
#define H_RPMLOG 1 | #define H_RPMLOG 1 | |||
/** \ingroup rpmio | /** \ingroup rpmio | |||
* \file rpmio/rpmlog.h | * \file rpmio/rpmlog.h | |||
* Yet Another syslog(3) API clone. | * Yet Another syslog(3) API clone. | |||
* Used to unify rpmError() and rpmMessage() interfaces in rpm. | ||||
*/ | */ | |||
#include <stdarg.h> | #include <stdarg.h> | |||
/** | /** | |||
* RPM Log levels. | * RPM Log levels. | |||
* priorities/facilities are encoded into a single 32-bit quantity, where t he | * priorities/facilities are encoded into a single 32-bit quantity, where t he | |||
* bottom 3 bits are the priority (0-7) and the top 28 bits are the facilit y | * bottom 3 bits are the priority (0-7) and the top 28 bits are the facilit y | |||
* (0-big number). Both the priorities and the facilities map roughly | * (0-big number). Both the priorities and the facilities map roughly | |||
* one-to-one to strings in the syslogd(8) source code. This mapping is | * one-to-one to strings in the syslogd(8) source code. This mapping is | |||
skipping to change at line 104 | skipping to change at line 103 | |||
#define RPMLOG_NFACILITIES 24 /*!< current number of facilities */ | #define RPMLOG_NFACILITIES 24 /*!< current number of facilities */ | |||
RPMLOG_ERRMSG = (((unsigned)(RPMLOG_NFACILITIES+0))<<3) | RPMLOG_ERRMSG = (((unsigned)(RPMLOG_NFACILITIES+0))<<3) | |||
} rpmlogFac; | } rpmlogFac; | |||
/*@=enummemuse =typeuse@*/ | /*@=enummemuse =typeuse@*/ | |||
#define RPMLOG_FACMASK 0x03f8 /*!< mask to extract facility part * / | #define RPMLOG_FACMASK 0x03f8 /*!< mask to extract facility part * / | |||
#define RPMLOG_FAC(p) (((p) & RPMLOG_FACMASK) >> 3) | #define RPMLOG_FAC(p) (((p) & RPMLOG_FACMASK) >> 3) | |||
#ifdef RPMLOG_NAMES | #ifdef RPMLOG_NAMES | |||
CODE facilitynames[] = | RPMCODE facilitynames[] = | |||
{ | { | |||
{ "auth", RPMLOG_AUTH }, | { "auth", RPMLOG_AUTH }, | |||
{ "authpriv",RPMLOG_AUTHPRIV }, | { "authpriv",RPMLOG_AUTHPRIV }, | |||
{ "cron", RPMLOG_CRON }, | { "cron", RPMLOG_CRON }, | |||
{ "daemon", RPMLOG_DAEMON }, | { "daemon", RPMLOG_DAEMON }, | |||
{ "ftp", RPMLOG_FTP }, | { "ftp", RPMLOG_FTP }, | |||
{ "kern", RPMLOG_KERN }, | { "kern", RPMLOG_KERN }, | |||
{ "lpr", RPMLOG_LPR }, | { "lpr", RPMLOG_LPR }, | |||
{ "mail", RPMLOG_MAIL }, | { "mail", RPMLOG_MAIL }, | |||
{ "mark", _RPMLOG_MARK }, /* INTERNAL */ | { "mark", _RPMLOG_MARK }, /* INTERNAL */ | |||
skipping to change at line 152 | skipping to change at line 151 | |||
* RPMLOG_NDELAY is the inverse of what it used to be. | * RPMLOG_NDELAY is the inverse of what it used to be. | |||
*/ | */ | |||
#define RPMLOG_PID 0x01 /*!< log the pid with each message * / | #define RPMLOG_PID 0x01 /*!< log the pid with each message * / | |||
#define RPMLOG_CONS 0x02 /*!< log on the console if errors in sending */ | #define RPMLOG_CONS 0x02 /*!< log on the console if errors in sending */ | |||
#define RPMLOG_ODELAY 0x04 /*!< delay open until first syslog() (default) */ | #define RPMLOG_ODELAY 0x04 /*!< delay open until first syslog() (default) */ | |||
#define RPMLOG_NDELAY 0x08 /*!< don't delay open */ | #define RPMLOG_NDELAY 0x08 /*!< don't delay open */ | |||
#define RPMLOG_NOWAIT 0x10 /*!< don't wait for console forks: D EPRECATED */ | #define RPMLOG_NOWAIT 0x10 /*!< don't wait for console forks: D EPRECATED */ | |||
#define RPMLOG_PERROR 0x20 /*!< log to stderr as well */ | #define RPMLOG_PERROR 0x20 /*!< log to stderr as well */ | |||
/** | /** | |||
* @todo Add argument(s), integrate with other types of callbacks. | ||||
*/ | */ | |||
typedef void (*rpmlogCallback) (void); | typedef /*@abstract@*/ struct rpmlogRec_s * rpmlogRec; | |||
/** | /** | |||
*/ | */ | |||
typedef /*@abstract@*/ struct rpmlogRec_s { | typedef /*@abstract@*/ void * rpmlogCallbackData; | |||
/** | ||||
* @param rec rpmlog record | ||||
* @param data private callback data | ||||
* @return flags to define further behavior: | ||||
* RPMLOG_DEFAULT to continue to default logger, | ||||
* RPMLOG_EXIT to exit after processing | ||||
* 0 to return after callback. | ||||
*/ | ||||
typedef int (*rpmlogCallback) (rpmlogRec rec, rpmlogCallbackData data) | ||||
/*@*/; | ||||
/** | ||||
* Option flags for callback return value. | ||||
*/ | ||||
#define RPMLOG_DEFAULT 0x01 /*!< perform default logging */ | ||||
#define RPMLOG_EXIT 0x02 /*!< exit after logging */ | ||||
#if defined(_RPMLOG_INTERNAL) | ||||
/** | ||||
*/ | ||||
struct rpmlogRec_s { | ||||
int code; | int code; | |||
/*@owned@*/ /*@null@*/ const char * message; | rpmlogLvl pri; /* priority */ | |||
} * rpmlogRec; | /*@owned@*/ /*@relnull@*/ | |||
const char * message; | ||||
}; | ||||
#endif | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
/** | /** | |||
* Return number of rpmError() ressages. | * Return translated prefix string (if any) given log level. | |||
* @param pri log priority | ||||
* @return message prefix (or "" for none) | ||||
*/ | ||||
/*@observer@*/ | ||||
const char * rpmlogLevelPrefix(rpmlogLvl pri) | ||||
/*@*/; | ||||
/** | ||||
* Set rpmlog callback function. | ||||
* @param cb rpmlog callback function | ||||
* @param data callback private (user) data | ||||
* @return previous rpmlog callback function | ||||
*/ | ||||
rpmlogCallback rpmlogSetCallback(rpmlogCallback cb, rpmlogCallbackData data | ||||
) | ||||
/*@globals internalState@*/ | ||||
/*@modifies internalState @*/; | ||||
/** | ||||
* Get rpmlog callback function and data. | ||||
* @param cb pointer to rpmlog callback function | ||||
* @param data pointer to callback private (user) data | ||||
* @return none | ||||
*/ | ||||
void rpmlogGetCallback(rpmlogCallback *cb, rpmlogCallbackData *data) | ||||
/*@globals internalState @*/ | ||||
/*@modifies *cb, *data, internalState @*/; | ||||
/** | ||||
* Return number of messages. | ||||
* @return number of messages | * @return number of messages | |||
*/ | */ | |||
int rpmlogGetNrecs(void) /*@*/; | int rpmlogGetNrecs(void) | |||
/*@*/; | ||||
/** | ||||
* Retrieve log message string from rpmlog record | ||||
* @param rec rpmlog record | ||||
* @return log message | ||||
*/ | ||||
/*@observer@*/ /*@retexpose@*/ | ||||
const char * rpmlogRecMessage(rpmlogRec rec) | ||||
/*@*/; | ||||
/** | ||||
* Retrieve log priority from rpmlog record | ||||
* @param rec rpmlog record | ||||
* @return log priority | ||||
*/ | ||||
rpmlogLvl rpmlogRecPriority(rpmlogRec rec) | ||||
/*@*/; | ||||
/** | /** | |||
* Print all rpmError() messages. | * Print all rpmError() messages. | |||
* @param f file handle (NULL uses stderr) | * @param f file handle (NULL uses stderr) | |||
*/ | */ | |||
void rpmlogPrint(FILE *f) | void rpmlogPrint(/*@null@*/ FILE *f) | |||
/*@modifies *f @*/; | /*@modifies *f @*/; | |||
/** | /** | |||
* Close desriptor used to write to system logger. | * Close desriptor used to write to system logger. | |||
* @todo Implement. | * @todo Implement. | |||
*/ | */ | |||
/*@unused@*/ | /*@unused@*/ | |||
void rpmlogClose (void) | void rpmlogClose (void) | |||
/*@globals internalState@*/ | /*@globals internalState@*/ | |||
/*@modifies internalState @*/; | /*@modifies internalState @*/; | |||
skipping to change at line 200 | skipping to change at line 270 | |||
* Open connection to system logger. | * Open connection to system logger. | |||
* @todo Implement. | * @todo Implement. | |||
*/ | */ | |||
/*@unused@*/ | /*@unused@*/ | |||
void rpmlogOpen (const char * ident, int option, int facility) | void rpmlogOpen (const char * ident, int option, int facility) | |||
/*@globals internalState@*/ | /*@globals internalState@*/ | |||
/*@modifies internalState @*/; | /*@modifies internalState @*/; | |||
/** | /** | |||
* Set the log mask level. | * Set the log mask level. | |||
* @param mask log mask (0 is no operation) | ||||
* @return previous log mask | ||||
*/ | */ | |||
int rpmlogSetMask (int mask) | int rpmlogSetMask (int mask) | |||
/*@globals internalState@*/ | /*@globals internalState@*/ | |||
/*@modifies internalState @*/; | /*@modifies internalState @*/; | |||
/** | /** | |||
* Generate a log message using FMT string and option arguments. | * Generate a log message using FMT string and option arguments. | |||
*/ | */ | |||
/*@mayexit@*/ /*@printflike@*/ void rpmlog (int code, const char *fmt, ...) | /*@mayexit@*/ /*@printflike@*/ void rpmlog (int code, const char *fmt, ...) | |||
#if defined(__GNUC__) && __GNUC__ >= 2 | ||||
/* issue a warning if the format string doesn't match arguments */ | ||||
__attribute__((format (printf, 2, 3))) | ||||
#endif | ||||
/*@*/; | /*@*/; | |||
/*@-exportlocal@*/ | /*@-exportlocal@*/ | |||
/** | /** | |||
* Return text of last rpmError() message. | * Return text of last rpmError() message. | |||
* @return text of last message | * @return text of last message | |||
*/ | */ | |||
/*@-redecl@*/ | /*@-redecl@*/ | |||
/*@observer@*/ /*@null@*/ const char * rpmlogMessage(void) /*@*/; | /*@observer@*/ /*@null@*/ const char * rpmlogMessage(void) | |||
/*@*/; | ||||
/*@=redecl@*/ | /*@=redecl@*/ | |||
/** | /** | |||
* Return error code from last rpmError() message. | * Return error code from last rpmError() message. | |||
* @deprecated Perl-RPM needs, what's really needed is predictable, non-i18 n | * @deprecated Perl-RPM needs, what's really needed is predictable, non-i18 n | |||
* encumbered, error text that can be retrieved through rpmlogMessage() | * encumbered, error text that can be retrieved through rpmlogMessage() | |||
* and parsed IMHO. | * and parsed IMHO. | |||
* @return code from last message | * @return code from last message | |||
*/ | */ | |||
int rpmlogCode(void) /*@*/; | int rpmlogCode(void) | |||
/*@*/; | ||||
/** | /** | |||
* Set rpmlog callback function. | * Set rpmlog file handle. | |||
* @param fp rpmlog file handle (NULL uses stdout/stderr) | ||||
* @return previous rpmlog file handle | ||||
*/ | */ | |||
rpmlogCallback rpmlogSetCallback(rpmlogCallback cb) | /*@null@*/ | |||
FILE * rpmlogSetFile(/*@null@*/ FILE * fp) | ||||
/*@globals internalState@*/ | /*@globals internalState@*/ | |||
/*@modifies internalState @*/; | /*@modifies internalState @*/; | |||
/*@=exportlocal@*/ | /*@=exportlocal@*/ | |||
/** | ||||
* Set rpmlog callback function. | ||||
* @deprecated gnorpm needs, use rpmlogSetCallback() instead. | ||||
*/ | ||||
extern rpmlogCallback rpmErrorSetCallback(rpmlogCallback cb) | ||||
/*@globals internalState@*/ | ||||
/*@modifies internalState @*/; | ||||
/** | ||||
* Return error code from last rpmError() message. | ||||
* @deprecated Perl-RPM needs, use rpmlogCode() instead. | ||||
* @return code from last message | ||||
*/ | ||||
extern int rpmErrorCode(void) /*@*/; | ||||
/** | ||||
* Return text of last rpmError() message. | ||||
* @deprecated gnorpm needs, use rpmlogMessage() instead. | ||||
* @return text of last message | ||||
*/ | ||||
/*@-redecl@*/ | ||||
/*@observer@*/ /*@null@*/ extern const char * rpmErrorString(void) /*@* | ||||
/; | ||||
/*@=redecl@*/ | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* H_RPMLOG */ | #endif /* H_RPMLOG */ | |||
End of changes. 16 change blocks. | ||||
39 lines changed or deleted | 96 lines changed or added | |||
rpmmacro.h | rpmmacro.h | |||
---|---|---|---|---|
#ifndef _H_MACRO_ | #ifndef _H_MACRO_ | |||
#define _H_MACRO_ | #define _H_MACRO_ | |||
#include <mire.h> | ||||
/** \ingroup rpmio | /** \ingroup rpmio | |||
* \file rpmio/rpmmacro.h | * \file rpmio/rpmmacro.h | |||
*/ | */ | |||
typedef /*@abstract@*/ struct MacroEntry_s * MacroEntry; | ||||
typedef /*@abstract@*/ struct MacroContext_s * MacroContext; | ||||
#if defined(_MACRO_INTERNAL) | ||||
/*! The structure used to store a macro. */ | /*! The structure used to store a macro. */ | |||
typedef /*@abstract@*/ struct MacroEntry_s { | struct MacroEntry_s { | |||
struct MacroEntry_s *prev;/*!< Macro entry stack. */ | struct MacroEntry_s *prev; /*!< Macro entry stack. */ | |||
const char *name; /*!< Macro name. */ | const char *name; /*!< Macro name. */ | |||
const char *opts; /*!< Macro parameters (a la getopt) */ | const char *opts; /*!< Macro parameters (a la getopt) */ | |||
const char *body; /*!< Macro body. */ | const char *body; /*!< Macro body. */ | |||
int used; /*!< No. of expansions. */ | int used; /*!< No. of expansions. */ | |||
int level; /*!< Scoping level. */ | short level; /*!< Scoping level. */ | |||
} * MacroEntry; | unsigned short flags; /*!< Flags. */ | |||
}; | ||||
/*! The structure used to store the set of macros in a context. */ | /*! The structure used to store the set of macros in a context. */ | |||
typedef /*@abstract@*/ struct MacroContext_s { | struct MacroContext_s { | |||
/*@owned@*//*@null@*/ MacroEntry *macroTable; /*!< Macro entry table for c | /*@owned@*//*@null@*/ | |||
ontext. */ | MacroEntry *macroTable; /*!< Macro entry table for context. */ | |||
int macrosAllocated;/*!< No. of allocated macros. */ | int macrosAllocated; /*!< No. of allocated macros. */ | |||
int firstFree; /*!< No. of macros. */ | int firstFree; /*!< No. of macros. */ | |||
} * MacroContext; | }; | |||
#endif | ||||
/*@-redecl@*/ | /*@-redecl@*/ | |||
/*@checked@*/ | /*@checked@*/ | |||
extern MacroContext rpmGlobalMacroContext; | extern MacroContext rpmGlobalMacroContext; | |||
/*@checked@*/ | /*@checked@*/ | |||
extern MacroContext rpmCLIMacroContext; | extern MacroContext rpmCLIMacroContext; | |||
/*@=redecl@*/ | ||||
/** \ingroup rpmrc | /** \ingroup rpmrc | |||
* List of macro files to read when configuring rpm. | * List of macro files to read when configuring rpm. | |||
* This is a colon separated list of files. URI's are permitted as well, | * This is a colon separated list of files. URI's are permitted as well, | |||
* identified by the token '://', so file paths must not begin with '//'. | * identified by the token '://', so file paths must not begin with '//'. | |||
*/ | */ | |||
/*@-redecl@*/ | /*@observer@*/ /*@checked@*/ | |||
/*@observer@*/ /*@unchecked@*/ | extern const char * rpmMacrofiles; | |||
extern const char * macrofiles; | ||||
/*@=redecl@*/ | /*@=redecl@*/ | |||
/** | /** | |||
* Markers for sources of macros added throughout rpm. | * Markers for sources of macros added throughout rpm. | |||
*/ | */ | |||
#define RMIL_DEFAULT -15 | #define RMIL_DEFAULT -15 | |||
#define RMIL_MACROFILES -13 | #define RMIL_MACROFILES -13 | |||
#define RMIL_RPMRC -11 | #define RMIL_RPMRC -11 | |||
#define RMIL_CMDLINE -7 | #define RMIL_CMDLINE -7 | |||
skipping to change at line 65 | skipping to change at line 71 | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
/** | /** | |||
* Print macros to file stream. | * Print macros to file stream. | |||
* @param mc macro context (NULL uses global context). | * @param mc macro context (NULL uses global context). | |||
* @param fp file stream (NULL uses stderr). | * @param fp file stream (NULL uses stderr). | |||
*/ | */ | |||
void rpmDumpMacroTable (/*@null@*/ MacroContext mc, | void rpmDumpMacroTable(/*@null@*/ MacroContext mc, /*@null@*/ FILE * fp) | |||
/*@null@*/ FILE * fp) | /*@globals rpmGlobalMacroContext, fileSystem @*/ | |||
/*@globals rpmGlobalMacroContext, | ||||
fileSystem@*/ | ||||
/*@modifies *fp, fileSystem @*/; | /*@modifies *fp, fileSystem @*/; | |||
/** | /** | |||
* Return macro entries as string array. | ||||
* @param mc macro context (NULL uses global context) | ||||
* @param mire pattern to match (NULL disables) | ||||
* @param used macro usage (<0 all, =0 unused, >=1 used count) | ||||
* @retval *avp macro definitions | ||||
* @return no. of entries | ||||
*/ | ||||
int | ||||
rpmGetMacroEntries(/*@null@*/ MacroContext mc, /*@null@*/ miRE mire, | ||||
int used, /*@null@*/ const char *** avp) | ||||
/*@globals rpmGlobalMacroContext @*/ | ||||
/*@modifies mire, *avp @*/; | ||||
/** | ||||
* Check whether configuration file is moderately secure to load. | ||||
* @param filename filename to check | ||||
* @return 1 on success, 0 on failure | ||||
*/ | ||||
int rpmSecuritySaneFile(const char *filename) | ||||
/*@globals internalState @*/; | ||||
/** | ||||
* Return URL path(s) from a (URL prefixed) pattern glob. | ||||
* @param patterns glob pattern | ||||
* @retval *argcPtr no. of paths | ||||
* @retval *argvPtr array of paths (malloc'd contiguous blob) | ||||
* @return 0 on success | ||||
*/ | ||||
int rpmGlob(const char * patterns, /*@out@*/ int * argcPtr, | ||||
/*@out@*/ const char *** argvPtr) | ||||
/*@globals fileSystem, internalState @*/ | ||||
/*@modifies *argcPtr, *argvPtr, fileSystem, internalState @*/; | ||||
/** | ||||
* Expand macro into buffer. | * Expand macro into buffer. | |||
* @deprecated Use rpmExpand(). | * @deprecated Use rpmExpand(). | |||
* @todo Eliminate from API. | * @todo Eliminate from API. | |||
* @param spec cookie (unused) | * @param spec cookie (unused) | |||
* @param mc macro context (NULL uses global context). | * @param mc macro context (NULL uses global context). | |||
* @retval sbuf input macro to expand, output expansion | * @retval sbuf input macro to expand, output expansion | |||
* @param slen size of buffer | * @param slen size of buffer | |||
* @return 0 on success | * @return 0 on success | |||
*/ | */ | |||
int expandMacros (/*@null@*/ void * spec, /*@null@*/ MacroContext mc, | int expandMacros(/*@null@*/ void * spec, /*@null@*/ MacroContext mc, | |||
/*@in@*/ /*@out@*/ char * sbuf, | /*@in@*/ /*@out@*/ char * sbuf, size_t slen) | |||
size_t slen) | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState | |||
/*@globals rpmGlobalMacroContext, | @*/ | |||
fileSystem @*/ | /*@modifies *sbuf, rpmGlobalMacroContext, fileSystem, internalState | |||
/*@modifies *sbuf, rpmGlobalMacroContext, fileSystem @*/; | @*/; | |||
/** | /** | |||
* Add macro to context. | * Add macro to context. | |||
* @deprecated Use rpmDefineMacro(). | * @deprecated Use rpmDefineMacro(). | |||
* @param mc macro context (NULL uses global context). | * @param mc macro context (NULL uses global context). | |||
* @param n macro name | * @param n macro name | |||
* @param o macro paramaters | * @param o macro paramaters | |||
* @param b macro body | * @param b macro body | |||
* @param level macro recursion level (0 is entry API) | * @param level macro recursion level (0 is entry API) | |||
*/ | */ | |||
void addMacro (/*@null@*/ MacroContext mc, const char * n, | void addMacro(/*@null@*/ MacroContext mc, const char * n, | |||
/*@null@*/ const char * o, | /*@null@*/ const char * o, /*@null@*/ const char * b, int le | |||
/*@null@*/ const char * b, int level) | vel) | |||
/*@globals rpmGlobalMacroContext@*/ | /*@globals rpmGlobalMacroContext, internalState @*/ | |||
/*@modifies mc, rpmGlobalMacroContext @*/; | /*@modifies mc, rpmGlobalMacroContext, internalState @*/; | |||
/** | /** | |||
* Delete macro from context. | * Delete macro from context. | |||
* @param mc macro context (NULL uses global context). | * @param mc macro context (NULL uses global context). | |||
* @param n macro name | * @param n macro name | |||
*/ | */ | |||
void delMacro (/*@null@*/ MacroContext mc, const char * n) | void delMacro(/*@null@*/ MacroContext mc, const char * n) | |||
/*@globals rpmGlobalMacroContext@*/ | /*@globals rpmGlobalMacroContext @*/ | |||
/*@modifies mc, rpmGlobalMacroContext @*/; | /*@modifies mc, rpmGlobalMacroContext @*/; | |||
/** | /** | |||
* Define macro in context. | * Define macro in context. | |||
* @param mc macro context (NULL uses global context). | * @param mc macro context (NULL uses global context). | |||
* @param n macro name, options, body | * @param macro macro name, options, body | |||
* @param level macro recursion level (0 is entry API) | * @param level macro recursion level (0 is entry API) | |||
* @return @todo Document. | * @return @todo Document. | |||
*/ | */ | |||
int rpmDefineMacro (/*@null@*/ MacroContext mc, const char * macro, | int rpmDefineMacro(/*@null@*/ MacroContext mc, const char * macro, int leve | |||
int level) | l) | |||
/*@globals rpmGlobalMacroContext@*/ | /*@globals rpmGlobalMacroContext, h_errno, internalState @*/ | |||
/*@modifies mc, rpmGlobalMacroContext @*/; | /*@modifies mc, rpmGlobalMacroContext, internalState @*/; | |||
/** | ||||
* Undefine macro in context. | ||||
* @param mc macro context (NULL uses global context). | ||||
* @param macro macro name | ||||
* @return @todo Document. | ||||
*/ | ||||
int rpmUndefineMacro(/*@null@*/ MacroContext mc, const char * macro) | ||||
/*@globals rpmGlobalMacroContext, internalState @*/ | ||||
/*@modifies mc, rpmGlobalMacroContext, internalState @*/; | ||||
/** | /** | |||
* Load macros from specific context into global context. | * Load macros from specific context into global context. | |||
* @param mc macro context (NULL does nothing). | * @param mc macro context (NULL does nothing). | |||
* @param level macro recursion level (0 is entry API) | * @param level macro recursion level (0 is entry API) | |||
*/ | */ | |||
void rpmLoadMacros (/*@null@*/ MacroContext mc, int level) | void rpmLoadMacros(/*@null@*/ MacroContext mc, int level) | |||
/*@globals rpmGlobalMacroContext@*/ | /*@globals rpmGlobalMacroContext, internalState @*/ | |||
/*@modifies rpmGlobalMacroContext @*/; | /*@modifies rpmGlobalMacroContext, internalState @*/; | |||
/** | /** | |||
* Initialize global macro context from set of macrofile(s). | * Load macro context from a macro file. | |||
* @param mc (unused) | * @param mc (unused) | |||
* @param fn macro file name | ||||
*/ | ||||
int rpmLoadMacroFile(/*@null@*/ MacroContext mc, const char * fn) | ||||
/*@globals rpmGlobalMacroContext, | ||||
h_errno, fileSystem, internalState @*/ | ||||
/*@modifies mc, rpmGlobalMacroContext, fileSystem, internalState @*/ | ||||
; | ||||
/** | ||||
* Initialize macro context from set of macrofile(s). | ||||
* @param mc macro context | ||||
* @param macrofiles colon separated list of macro files (NULL does nothi ng) | * @param macrofiles colon separated list of macro files (NULL does nothi ng) | |||
*/ | */ | |||
void rpmInitMacros (/*@null@*/ MacroContext mc, const char * macrofiles ) | void rpmInitMacros(/*@null@*/ MacroContext mc, const char * macrofiles) | |||
/*@globals rpmGlobalMacroContext, rpmCLIMacroContext, | /*@globals rpmGlobalMacroContext, rpmCLIMacroContext, | |||
fileSystem @*/ | h_errno, fileSystem, internalState @*/ | |||
/*@modifies rpmGlobalMacroContext, fileSystem @*/; | /*@modifies mc, rpmGlobalMacroContext, fileSystem, internalState @*/ | |||
; | ||||
/** | /** | |||
* Destroy macro context. | * Destroy macro context. | |||
* @param mc macro context (NULL uses global context). | * @param mc macro context (NULL uses global context). | |||
*/ | */ | |||
void rpmFreeMacros (/*@null@*/ MacroContext mc) | void rpmFreeMacros(/*@null@*/ MacroContext mc) | |||
/*@globals rpmGlobalMacroContext@*/ | /*@globals rpmGlobalMacroContext @*/ | |||
/*@modifies mc, rpmGlobalMacroContext @*/; | /*@modifies mc, rpmGlobalMacroContext @*/; | |||
typedef enum rpmCompressedMagic_e { | typedef enum rpmCompressedMagic_e { | |||
COMPRESSED_NOT = 0, /*!< not compressed */ | COMPRESSED_NOT = 0, /*!< not compressed */ | |||
COMPRESSED_OTHER = 1, /*!< gzip can handle */ | COMPRESSED_OTHER = 1, /*!< gzip can handle */ | |||
COMPRESSED_BZIP2 = 2, /*!< bzip2 can handle */ | COMPRESSED_BZIP2 = 2, /*!< bzip2 can handle */ | |||
COMPRESSED_ZIP = 3 /*!< unzip can handle */ | COMPRESSED_ZIP = 3, /*!< unzip can handle */ | |||
COMPRESSED_LZOP = 4, /*!< lzop can handle */ | ||||
COMPRESSED_LZMA = 5 /*!< lzma can handle */ | ||||
} rpmCompressedMagic; | } rpmCompressedMagic; | |||
/** | /** | |||
* Return type of compression used in file. | * Return type of compression used in file. | |||
* @param file name of file | * @param file name of file | |||
* @retval compressed address of compression type | * @retval compressed address of compression type | |||
* @return 0 on success, 1 on I/O error | * @return 0 on success, 1 on I/O error | |||
*/ | */ | |||
int isCompressed (const char * file, | int isCompressed(const char * file, /*@out@*/ rpmCompressedMagic * compress | |||
/*@out@*/ rpmCompressedMagic * compressed) | ed) | |||
/*@globals fileSystem@*/ | /*@globals h_errno, fileSystem, internalState @*/ | |||
/*@modifies *compressed, fileSystem @*/; | /*@modifies *compressed, fileSystem, internalState @*/; | |||
/** | /** | |||
* Return (malloc'ed) concatenated macro expansion(s). | * Return (malloc'ed) concatenated macro expansion(s). | |||
* @param arg macro(s) to expand (NULL terminates list) | * @param arg macro(s) to expand (NULL terminates list) | |||
* @return macro expansion (malloc'ed) | * @return macro expansion (malloc'ed) | |||
*/ | */ | |||
char * rpmExpand (/*@null@*/ const char * arg, ...) | char * rpmExpand(/*@null@*/ const char * arg, ...) | |||
/*@globals rpmGlobalMacroContext @*/ | #if defined(__GNUC__) && __GNUC__ >= 4 | |||
/*@modifies rpmGlobalMacroContext @*/; | /* issue a warning if the list is not NULL-terminated */ | |||
__attribute__((sentinel)) | ||||
#endif | ||||
/*@globals rpmGlobalMacroContext, h_errno, internalState @*/ | ||||
/*@modifies rpmGlobalMacroContext, internalState @*/; | ||||
/** | /** | |||
* Canonicalize file path. | * Canonicalize file path. | |||
* @param path path to canonicalize (in-place) | * @param path path to canonicalize (in-place) | |||
* @return canonicalized path (malloc'ed) | * @return pointer to path | |||
*/ | */ | |||
/*@null@*/ char * rpmCleanPath (/*@null@*/ char * path) | /*@null@*/ | |||
char * rpmCleanPath(/*@returned@*/ /*@null@*/ char * path) | ||||
/*@modifies *path @*/; | /*@modifies *path @*/; | |||
/** | /** | |||
* Return (malloc'ed) expanded, canonicalized, file path. | * Return (malloc'ed) expanded, canonicalized, file path. | |||
* @param path macro(s) to expand (NULL terminates list) | * @param path macro(s) to expand (NULL terminates list) | |||
* @return canonicalized path (malloc'ed) | * @return canonicalized path (malloc'ed) | |||
*/ | */ | |||
/*@-redecl@*/ /* LCL: shrug */ | /*@-redecl@*/ /* LCL: shrug */ | |||
const char * rpmGetPath (/*@null@*/ const char * path, ...) | const char * rpmGetPath(/*@null@*/ const char * path, ...) | |||
/*@globals rpmGlobalMacroContext @*/ | #if defined(__GNUC__) && __GNUC__ >= 4 | |||
/*@modifies rpmGlobalMacroContext @*/; | /* issue a warning if the list is not NULL-terminated */ | |||
__attribute__((sentinel)) | ||||
#endif | ||||
/*@globals rpmGlobalMacroContext, h_errno, internalState @*/ | ||||
/*@modifies rpmGlobalMacroContext, internalState @*/; | ||||
/*@=redecl@*/ | /*@=redecl@*/ | |||
/** | /** | |||
* Merge 3 args into path, any or all of which may be a url. | * Merge 3 args into path, any or all of which may be a url. | |||
* The leading part of the first URL encountered is used | * The leading part of the first URL encountered is used | |||
* for the result, other URL prefixes are discarded, permitting | * for the result, other URL prefixes are discarded, permitting | |||
* a primitive form of URL inheiritance. | * a primitive form of URL inheiritance. | |||
* @param urlroot root URL (often path to chroot, or NULL) | * @param urlroot root URL (often path to chroot, or NULL) | |||
* @param urlmdir directory URL (often a directory, or NULL) | * @param urlmdir directory URL (often a directory, or NULL) | |||
* @param urlfile file URL (often a file, or NULL) | * @param urlfile file URL (often a file, or NULL) | |||
* @return expanded, merged, canonicalized path (malloc'ed) | * @return expanded, merged, canonicalized path (malloc'ed) | |||
*/ | */ | |||
/*@-redecl@*/ /* LCL: shrug */ | /*@-redecl@*/ /* LCL: shrug */ | |||
const char * rpmGenPath (/*@null@*/ const char * urlroot, | const char * rpmGenPath(/*@null@*/ const char * urlroot, | |||
/*@null@*/ const char * urlmdir, | /*@null@*/ const char * urlmdir, | |||
/*@null@*/ const char * urlfile) | /*@null@*/ const char * urlfile) | |||
/*@globals rpmGlobalMacroContext @*/ | /*@globals rpmGlobalMacroContext, h_errno, internalState @*/ | |||
/*@modifies rpmGlobalMacroContext @*/; | /*@modifies rpmGlobalMacroContext, internalState @*/; | |||
/*@=redecl@*/ | /*@=redecl@*/ | |||
/** | /** | |||
* Return macro expansion as a numeric value. | * Return macro expansion as a numeric value. | |||
* Boolean values ('Y' or 'y' returns 1, 'N' or 'n' returns 0) | * Boolean values ('Y' or 'y' returns 1, 'N' or 'n' returns 0) | |||
* are permitted as well. An undefined macro returns 0. | * are permitted as well. An undefined macro returns 0. | |||
* @param arg macro to expand | * @param arg macro to expand | |||
* @return numeric value | * @return numeric value | |||
*/ | */ | |||
int rpmExpandNumeric (const char * arg) | int rpmExpandNumeric (const char * arg) | |||
/*@globals rpmGlobalMacroContext @*/ | /*@globals rpmGlobalMacroContext, h_errno, internalState @*/ | |||
/*@modifies rpmGlobalMacroContext @*/; | /*@modifies rpmGlobalMacroContext, internalState @*/; | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* _H_ MACRO_ */ | #endif /* _H_ MACRO_ */ | |||
End of changes. 29 change blocks. | ||||
68 lines changed or deleted | 138 lines changed or added | |||
rpmspec.h | rpmspec.h | |||
---|---|---|---|---|
#ifndef _H_SPEC_ | #ifndef _H_RPMSPEC_ | |||
#define _H_SPEC_ | #define _H_RPMSPEC_ | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* \file build/rpmspec.h | * \file build/rpmspec.h | |||
* The Spec and Package data structures used during build. | * The Spec and Package data structures used during build. | |||
*/ | */ | |||
#include <rpmevr.h> | ||||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
*/ | */ | |||
typedef struct SpecStruct *Spec; | typedef struct Package_s * Package; | |||
/** \ingroup rpmbuild | ||||
*/ | ||||
typedef struct Source * SpecSource; | ||||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
*/ | */ | |||
struct TriggerFileEntry { | struct TriggerFileEntry { | |||
int index; | int index; | |||
/*@only@*/ char * fileName; | /*@only@*/ | |||
/*@only@*/ char * script; | char * fileName; | |||
/*@only@*/ char * prog; | /*@only@*/ | |||
/*@owned@*/ struct TriggerFileEntry * next; | char * script; | |||
/*@only@*/ | ||||
char * prog; | ||||
/*@owned@*/ | ||||
struct TriggerFileEntry * next; | ||||
}; | }; | |||
#define RPMBUILD_ISSOURCE (1 << 0) | ||||
#define RPMBUILD_ISPATCH (1 << 1) | ||||
#define RPMBUILD_ISICON (1 << 2) | ||||
#define RPMBUILD_ISNO (1 << 3) | ||||
#define RPMBUILD_DEFAULT_LANG "C" | #define RPMBUILD_DEFAULT_LANG "C" | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
*/ | */ | |||
struct Source { | struct Source { | |||
/*@owned@*/ char * fullSource; | /*@owned@*/ | |||
/*@dependent@*/ char * source; /* Pointer into fullSource */ | const char * fullSource; | |||
/*@dependent@*/ | ||||
const char * source; /* Pointer into fullSource */ | ||||
int flags; | int flags; | |||
int num; | uint32_t num; | |||
/*@owned@*/ struct Source * next; | /*@owned@*/ | |||
struct Source * next; | ||||
}; | }; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
*/ | */ | |||
/*@-typeuse@*/ | /*@-typeuse@*/ | |||
typedef struct ReadLevelEntry { | typedef struct ReadLevelEntry { | |||
int reading; | int reading; | |||
/*@dependent@*/ | /*@dependent@*/ | |||
struct ReadLevelEntry * next; | struct ReadLevelEntry * next; | |||
} RLE_t; | } RLE_t; | |||
/*@=typeuse@*/ | /*@=typeuse@*/ | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
*/ | */ | |||
typedef struct OpenFileInfo { | typedef struct OpenFileInfo { | |||
/*@only@*/ const char * fileName; | /*@only@*/ | |||
const char * fileName; | ||||
FD_t fd; | FD_t fd; | |||
int lineNum; | int lineNum; | |||
char readBuf[BUFSIZ]; | char readBuf[BUFSIZ]; | |||
/*@dependent@*/ | /*@dependent@*/ | |||
char * readPtr; | char * readPtr; | |||
/*@owned@*/ | /*@owned@*/ | |||
struct OpenFileInfo * next; | struct OpenFileInfo * next; | |||
} OFI_t; | } OFI_t; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
*/ | */ | |||
typedef struct spectag_s { | typedef struct spectag_s { | |||
int t_tag; | int t_tag; | |||
int t_startx; | int t_startx; | |||
int t_nlines; | int t_nlines; | |||
/*@only@*/ const char * t_lang; | /*@only@*/ | |||
/*@only@*/ const char * t_msgid; | const char * t_lang; | |||
/*@only@*/ | ||||
const char * t_msgid; | ||||
} * spectag; | } * spectag; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
*/ | */ | |||
typedef struct spectags_s { | typedef struct spectags_s { | |||
/*@owned@*/ spectag st_t; | /*@owned@*/ | |||
spectag st_t; | ||||
int st_nalloc; | int st_nalloc; | |||
int st_ntags; | int st_ntags; | |||
} * spectags; | } * spectags; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
*/ | */ | |||
typedef struct speclines_s { | typedef struct speclines_s { | |||
/*@only@*/ char **sl_lines; | /*@only@*/ | |||
char **sl_lines; | ||||
int sl_nalloc; | int sl_nalloc; | |||
int sl_nlines; | int sl_nlines; | |||
} * speclines; | } * speclines; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* The structure used to store values parsed from a spec file. | * The structure used to store values parsed from a spec file. | |||
*/ | */ | |||
struct SpecStruct { | struct Spec_s { | |||
/*@only@*/ const char * specFile; /*!< Name of the spec file. */ | /*@only@*/ | |||
/*@only@*/ const char * sourceRpmName; | const char * specFile; /*!< Name of the spec file. */ | |||
/*@only@*/ const char * buildRootURL; | /*@only@*/ | |||
/*@only@*/ const char * buildSubdir; | const char * buildSubdir; | |||
/*@only@*/ const char * rootURL; | /*@only@*/ | |||
const char * rootURL; | ||||
/*@owned@*/ /*@null@*/ speclines sl; | /*@owned@*/ /*@null@*/ | |||
/*@owned@*/ /*@null@*/ spectags st; | speclines sl; | |||
/*@owned@*/ /*@null@*/ | ||||
spectags st; | ||||
/*@owned@*/ struct OpenFileInfo * fileStack; | /*@owned@*/ | |||
char lbuf[4*BUFSIZ]; | struct OpenFileInfo * fileStack; | |||
/*@owned@*/ | ||||
char *lbuf; | ||||
size_t lbuf_len; | ||||
/*@dependent@*/ | ||||
char *lbufPtr; | ||||
char nextpeekc; | char nextpeekc; | |||
/*@dependent@*/ char * nextline; | /*@dependent@*/ | |||
/*@dependent@*/ char * line; | char * nextline; | |||
/*@dependent@*/ | ||||
char * line; | ||||
int lineNum; | int lineNum; | |||
/*@owned@*/ struct ReadLevelEntry * readStack; | /*@owned@*/ | |||
struct ReadLevelEntry * readStack; | ||||
/*@refcounted@*/ Header buildRestrictions; | /*@owned@*/ /*@null@*/ | |||
/*@owned@*/ /*@null@*/ struct SpecStruct ** BASpecs; | Spec * BASpecs; | |||
/*@only@*/ /*@null@*/ const char ** BANames; | /*@only@*/ /*@null@*/ | |||
const char ** BANames; | ||||
int BACount; | int BACount; | |||
int recursing; /*!< parse is recursive? */ | int recursing; /*!< parse is recursive? */ | |||
int toplevel; | ||||
int force; | int force; | |||
int anyarch; | int anyarch; | |||
int gotBuildRootURL; | /*@null@*/ | |||
char * passPhrase; | ||||
/*@null@*/ char * passPhrase; | ||||
int timeCheck; | int timeCheck; | |||
/*@null@*/ const char * cookie; | /*@null@*/ | |||
const char * cookie; | ||||
/*@owned@*/ struct Source * sources; | /*@owned@*/ | |||
struct Source * sources; | ||||
int numSources; | int numSources; | |||
int noSource; | int noSource; | |||
/*@only@*/ | ||||
const char * sourceRpmName; | ||||
/*@only@*/ | ||||
unsigned char * sourcePkgId; | ||||
/*@refcounted@*/ | /*@refcounted@*/ | |||
Header sourceHeader; | Header sourceHeader; | |||
/*@owned@*/ | /*@refcounted@*/ | |||
void * sourceCpioList; | rpmfi sourceCpioList; | |||
int sourceHdrInit; | ||||
/*@dependent@*/ /*@null@*/ MacroContext macros; | /*@dependent@*/ /*@null@*/ | |||
MacroContext macros; | ||||
/*@only@*/ StringBuf prep; /*!< %prep scriptlet. */ | rpmRC (*_parseRCPOT) (Spec spec, Package pkg, const char *field, rpmTag | |||
/*@only@*/ StringBuf build; /*!< %build scriptlet. */ | tagN, | |||
/*@only@*/ StringBuf install; /*!< %install scriptlet. */ | uint32_t index, rpmsenseFlags tagflags); | |||
/*@only@*/ StringBuf clean; /*!< %clean scriptlet. */ | ||||
/*@owned@*/ struct PackageStruct * packages; /*!< Package list. */ | /*@only@*/ | |||
StringBuf prep; /*!< %prep scriptlet. */ | ||||
/*@only@*/ | ||||
StringBuf build; /*!< %build scriptlet. */ | ||||
/*@only@*/ | ||||
StringBuf install; /*!< %install scriptlet. */ | ||||
/*@only@*/ | ||||
StringBuf check; /*!< %check scriptlet. */ | ||||
/*@only@*/ | ||||
StringBuf clean; /*!< %clean scriptlet. */ | ||||
size_t nfoo; | ||||
/*@only@*/ /*@relnull@*/ | ||||
tagStore_t foo; | ||||
/*@owned@*/ | ||||
Package packages; /*!< Package list. */ | ||||
}; | }; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* The structure used to store values for a package. | * The structure used to store values for a package. | |||
*/ | */ | |||
struct PackageStruct { | struct Package_s { | |||
/*@refcounted@*/ | /*@refcounted@*/ | |||
Header header; | Header header; | |||
/*@refcounted@*/ | ||||
/*@owned@*/ | rpmds ds; /*!< Requires: N = EVR */ | |||
void * cpioList; | /*@refcounted@*/ | |||
rpmfi cpioList; | ||||
/*@owned@*/ struct Source * icon; | ||||
int autoReq; | int autoReq; | |||
int autoProv; | int autoProv; | |||
int noarch; | ||||
/*@only@*/ const char * preInFile; /*!< %pre scriptlet. */ | /*@only@*/ | |||
/*@only@*/ const char * postInFile; /*!< %post scriptlet. */ | const char * preInFile; /*!< %pre scriptlet. */ | |||
/*@only@*/ const char * preUnFile; /*!< %preun scriptlet. */ | /*@only@*/ | |||
/*@only@*/ const char * postUnFile; /*!< %postun scriptlet. */ | const char * postInFile; /*!< %post scriptlet. */ | |||
/*@only@*/ const char * verifyFile; /*!< %verifyscript scriptlet. */ | /*@only@*/ | |||
const char * preUnFile; /*!< %preun scriptlet. */ | ||||
/*@only@*/ | ||||
const char * postUnFile; /*!< %postun scriptlet. */ | ||||
/*@only@*/ | ||||
const char * preTransFile; /*!< %pretrans scriptlet. */ | ||||
/*@only@*/ | ||||
const char * postTransFile; /*!< %posttrans scriptlet. */ | ||||
/*@only@*/ | ||||
const char * verifyFile; /*!< %verifyscript scriptlet. */ | ||||
/*@only@*/ | ||||
const char * sanityCheckFile;/*!< %sanitycheck scriptlet. */ | ||||
/*@only@*/ StringBuf specialDoc; | /*@only@*/ | |||
StringBuf specialDoc; | ||||
/*@only@*/ struct TriggerFileEntry * triggerFiles; | /*@only@*/ | |||
struct TriggerFileEntry * triggerFiles; | ||||
/*@only@*/ const char * fileFile; | /*@only@*/ | |||
/*@only@*/ StringBuf fileList; /* If NULL, package will not be written */ | const char * fileFile; | |||
/*@only@*/ | ||||
StringBuf fileList; /* If NULL, package will not be writ | ||||
ten */ | ||||
/*@dependent@*/ struct PackageStruct * next; | /*@dependent@*/ | |||
Package next; | ||||
}; | }; | |||
/** \ingroup rpmbuild | ||||
*/ | ||||
typedef struct PackageStruct * Package; | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Create and initialize Spec structure. | * Create and initialize Spec structure. | |||
* @return spec spec file control structure | * @return spec spec file control structure | |||
*/ | */ | |||
/*@only@*/ Spec newSpec(void) | /*@only@*/ Spec newSpec(void) | |||
/*@globals rpmGlobalMacroContext @*/ | /*@globals rpmGlobalMacroContext, h_errno @*/ | |||
/*@modifies rpmGlobalMacroContext @*/; | /*@modifies rpmGlobalMacroContext @*/; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* Destroy Spec structure. | * Destroy Spec structure. | |||
* @param spec spec file control structure | * @param spec spec file control structure | |||
* @return NULL always | * @return NULL always | |||
*/ | */ | |||
/*@null@*/ Spec freeSpec(/*@only@*/ /*@null@*/ Spec spec) | /*@null@*/ Spec freeSpec(/*@only@*/ /*@null@*/ Spec spec) | |||
/*@globals fileSystem @*/ | /*@globals fileSystem, internalState @*/ | |||
/*@modifies spec, fileSystem @*/; | /*@modifies spec, fileSystem, internalState @*/; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* @param spec spec file control structure | * Function to query spec file(s). | |||
* @return NULL always | * @param ts transaction set | |||
* @param qva parsed query/verify options | ||||
* @param arg query argument | ||||
* @return 0 on success, else no. of failures | ||||
*/ | */ | |||
/*@-declundef@*/ | int rpmspecQuery(rpmts ts, QVA_t qva, const char * arg) | |||
extern /*@null@*/ Spec (*freeSpecVec) (Spec spec) /* XXX FIXME */ | /*@globals rpmCLIMacroContext, | |||
/*@globals fileSystem @*/ | rpmGlobalMacroContext, h_errno, fileSystem, internalState @* | |||
/*@modifies spec, fileSystem @*/; | / | |||
/*@=declundef@*/ | /*@modifies ts, qva, rpmCLIMacroContext, rpmGlobalMacroContext, | |||
fileSystem, internalState @*/; | ||||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
*/ | */ | |||
struct OpenFileInfo * newOpenFileInfo(void) /*@*/; | struct OpenFileInfo * newOpenFileInfo(void) | |||
/*@*/; | ||||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* stashSt. | ||||
* @param spec spec file control structure | * @param spec spec file control structure | |||
* @param h header | ||||
* @param tag tag | ||||
* @param lang locale | ||||
* @return ptr to saved entry | ||||
*/ | */ | |||
spectag stashSt(Spec spec, Header h, int tag, const char * lang) | spectag stashSt(Spec spec, Header h, rpmTag tag, const char * lang) | |||
/*@modifies spec->st @*/; | /*@modifies spec->st @*/; | |||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* addSource. | ||||
* @param spec spec file control structure | * @param spec spec file control structure | |||
* @param pkg package control | ||||
* @param field field to parse | ||||
* @param tag tag | ||||
* @return 0 on success | ||||
*/ | */ | |||
int addSource(Spec spec, Package pkg, const char * field, int tag) | int addSource(Spec spec, Package pkg, const char * field, rpmTag tag) | |||
/*@globals rpmGlobalMacroContext @*/ | /*@globals rpmGlobalMacroContext, h_errno, fileSystem @*/ | |||
/*@modifies spec->sources, spec->numSources, | /*@modifies spec->sources, spec->numSources, | |||
spec->st, spec->macros, | spec->st, spec->macros, | |||
pkg->icon, | rpmGlobalMacroContext, fileSystem @*/; | |||
rpmGlobalMacroContext @*/; | ||||
/** \ingroup rpmbuild | /** \ingroup rpmbuild | |||
* parseNoSource. | ||||
* @param spec spec file control structure | * @param spec spec file control structure | |||
* @param field field to parse | ||||
* @param tag tag | ||||
* @return 0 on success | ||||
*/ | */ | |||
int parseNoSource(Spec spec, const char * field, int tag) | int parseNoSource(Spec spec, const char * field, rpmTag tag) | |||
/*@modifies nothing @*/; | /*@*/; | |||
/** \ingroup rpmbuild | ||||
* Return the count of source set in specfile | ||||
* @param spec spec file control structure | ||||
* @return the count of source | ||||
*/ | ||||
int SpecSourceCount(Spec spec) | ||||
/*@*/; | ||||
/** \ingroup rpmbuild | ||||
* Return a source control structure | ||||
* @param spec spec file control structure | ||||
* @param num the number of the wanted source (starting from 0) | ||||
* @return a SpecSource structure, NULL if not found | ||||
*/ | ||||
SpecSource getSource(Spec spec, int num) | ||||
/*@*/; | ||||
/** \ingroup rpmbuild | ||||
* Return a ptr to the source file name | ||||
* @param source SpecSource control structure | ||||
* @return ptr to filename | ||||
*/ | ||||
/*@exposed@*/ | ||||
const char * specSourceName(SpecSource source) | ||||
/*@*/; | ||||
/** \ingroup rpmbuild | ||||
* Return a ptr to the full url of the source | ||||
* @param source SpecSource control structure | ||||
* @return ptr to url | ||||
*/ | ||||
/*@exposed@*/ | ||||
const char * specFullSourceName(SpecSource source) | ||||
/*@*/; | ||||
/** \ingroup rpmbuild | ||||
* Return the spec or source patch number | ||||
* @param source SpecSource control structure | ||||
* @return the number of the source | ||||
*/ | ||||
int specSourceNum(SpecSource source) | ||||
/*@*/; | ||||
/** \ingroup rpmbuild | ||||
* Return flags set for the source | ||||
* @param source SpecSource control structure | ||||
* @return flags | ||||
*/ | ||||
int specSourceFlags(SpecSource source) | ||||
/*@*/; | ||||
/** \ingroup rpmbuild | ||||
* Return the macro directory location from source file flags | ||||
* @param attr rpmfileAttrs from source | ||||
* @return string containings macros about location, NULL on failu | ||||
re | ||||
*/ | ||||
/*@null@*/ | ||||
#if defined(RPM_VENDOR_OPENPKG) /* splitted-source-directory */ | ||||
const char * getSourceDir(rpmfileAttrs attr, const char *filename) | ||||
#else | ||||
const char * getSourceDir(rpmfileAttrs attr) | ||||
#endif | ||||
/*@*/; | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* _H_SPEC_ */ | #endif /* _H_SPEC_ */ | |||
End of changes. 50 change blocks. | ||||
89 lines changed or deleted | 233 lines changed or added | |||
rpmurl.h | rpmurl.h | |||
---|---|---|---|---|
skipping to change at line 18 | skipping to change at line 18 | |||
#include <assert.h> | #include <assert.h> | |||
/** | /** | |||
* Supported URL types. | * Supported URL types. | |||
*/ | */ | |||
typedef enum urltype_e { | typedef enum urltype_e { | |||
URL_IS_UNKNOWN = 0, /*!< unknown (aka a file) */ | URL_IS_UNKNOWN = 0, /*!< unknown (aka a file) */ | |||
URL_IS_DASH = 1, /*!< stdin/stdout */ | URL_IS_DASH = 1, /*!< stdin/stdout */ | |||
URL_IS_PATH = 2, /*!< file://... */ | URL_IS_PATH = 2, /*!< file://... */ | |||
URL_IS_FTP = 3, /*!< ftp://... */ | URL_IS_FTP = 3, /*!< ftp://... */ | |||
URL_IS_HTTP = 4 /*!< http://... */ | URL_IS_HTTP = 4, /*!< http://... */ | |||
URL_IS_HTTPS = 5, /*!< https://... */ | ||||
URL_IS_HKP = 6 /*!< hkp://... */ | ||||
} urltype; | } urltype; | |||
#define URLMAGIC 0xd00b1ed0 | #define URLMAGIC 0xd00b1ed0U | |||
#define URLSANE(u) assert(u && u->magic == URLMAGIC) | #define URLSANE(u) assert(u && u->magic == URLMAGIC) | |||
typedef /*@abstract@*/ /*@refcounted@*/ struct urlinfo_s * urlinfo; | typedef /*@abstract@*/ /*@refcounted@*/ struct urlinfo_s * urlinfo; | |||
/** | /** | |||
* URL control structure. | * URL control structure. | |||
*/ | */ | |||
struct urlinfo_s { | struct urlinfo_s { | |||
/*@refs@*/ int nrefs; /*!< no. of references */ | /*@refs@*/ int nrefs; /*!< no. of references */ | |||
/*@owned@*/ /*@null@*/ | /*@owned@*/ /*@relnull@*/ | |||
const char * url; /*!< copy of original url */ | const char * url; /*!< copy of original url */ | |||
/*@owned@*/ /*@relnull@*/ | ||||
const char * scheme; /*!< URI scheme. */ | ||||
/*@owned@*/ /*@null@*/ | /*@owned@*/ /*@null@*/ | |||
const char * service; | const char * user; /*!< URI user. */ | |||
/*@owned@*/ /*@null@*/ | /*@owned@*/ /*@null@*/ | |||
const char * user; | const char * password; /*!< URI password. */ | |||
/*@owned@*/ /*@relnull@*/ | ||||
const char * host; /*!< URI host. */ | ||||
/*@owned@*/ /*@null@*/ | /*@owned@*/ /*@null@*/ | |||
const char * password; | const char * portstr; /*!< URI port string. */ | |||
/*@owned@*/ /*@null@*/ | /*@owned@*/ /*@null@*/ | |||
const char * host; | const char * query; /*!< URI ?query. */ | |||
/*@owned@*/ /*@null@*/ | /*@owned@*/ /*@null@*/ | |||
const char * portstr; | const char * fragment; /*!< URI #fragment. */ | |||
/*@owned@*/ /*@null@*/ | /*@owned@*/ /*@null@*/ | |||
const char * proxyu; /*!< FTP: proxy user */ | const char * proxyu; /*!< FTP: proxy user */ | |||
/*@owned@*/ /*@null@*/ | /*@owned@*/ /*@null@*/ | |||
const char * proxyh; /*!< FTP/HTTP: proxy host */ | const char * proxyh; /*!< FTP/HTTP: proxy host */ | |||
int proxyp; /*!< FTP/HTTP: proxy port */ | int proxyp; /*!< FTP/HTTP: proxy port */ | |||
int port; | int port; /*!< URI port. */ | |||
int urltype; | int urltype; /*!< URI type. */ | |||
/*@relnull@*/ | ||||
FD_t ctrl; /*!< control channel */ | FD_t ctrl; /*!< control channel */ | |||
/*@relnull@*/ | ||||
FD_t data; /*!< per-xfer data channel */ | FD_t data; /*!< per-xfer data channel */ | |||
/*@relnull@*/ | ||||
void * capabilities; /*!< neon: ne_server_capabilities ptr */ | ||||
/*@relnull@*/ | ||||
void * lockstore; /*!< neon: ne_lock_store ptr */ | ||||
/*@relnull@*/ | ||||
void * sess; /*!< neon: ne_session ptr */ | ||||
off_t current; /*!< neon: current body offset. */ | ||||
off_t total; /*!< neon: total body length. */ | ||||
int connstatus; /*!< neon: connection status. */ | ||||
#ifdef REFERENCE | ||||
typedef enum { | ||||
ne_conn_namelookup, /* lookup up hostname (info = hostname) */ | ||||
ne_conn_connecting, /* connecting to host (info = hostname) */ | ||||
ne_conn_connected, /* connected to host (info = hostname) */ | ||||
ne_conn_secure /* connection now secure (info = crypto level) */ | ||||
} ne_conn_status; | ||||
#endif | ||||
int bufAlloced; /*!< sizeof I/O buffer */ | int bufAlloced; /*!< sizeof I/O buffer */ | |||
/*@owned@*/ char * buf; /*!< I/O buffer */ | /*@owned@*/ | |||
char * buf; /*!< I/O buffer */ | ||||
int openError; /*!< Type of open failure */ | int openError; /*!< Type of open failure */ | |||
int httpVersion; | int httpVersion; | |||
int httpHasRange; | int allow; | |||
int magic; | #define RPMURL_SERVER_HASRANGE ( 1 << 0) | |||
#define RPMURL_SERVER_HASDAVCLASS1 ( 1 << 1) | ||||
#define RPMURL_SERVER_HASDAVCLASS2 ( 1 << 2) | ||||
#define RPMURL_SERVER_HASDAVEXEC ( 1 << 3) | ||||
#define RPMURL_SERVER_OPTIONSDONE ( 1 << 8) | ||||
#define RPMURL_SERVER_HASDAV (RPMURL_SERVER_HASDAVCLASS1|RPMURL_S | ||||
ERVER_HASDAVCLASS2|RPMURL_SERVER_HASDAVEXEC) | ||||
unsigned magic; | ||||
}; | }; | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
/*@unchecked@*/ | /*@unchecked@*/ | |||
extern int _url_count; /*!< No. of cached URL's. */ | extern int _url_count; /*!< No. of cached URL's. */ | |||
/*@unchecked@*/ | /*@unchecked@*/ | |||
skipping to change at line 111 | skipping to change at line 148 | |||
/*@modifies u @*/; | /*@modifies u @*/; | |||
#define urlLink(_u, _msg) XurlLink(_u, _msg, __FILE__, __LINE__) | #define urlLink(_u, _msg) XurlLink(_u, _msg, __FILE__, __LINE__) | |||
/** | /** | |||
* Dereference a URL control structure instance. | * Dereference a URL control structure instance. | |||
* @param u URL control structure | * @param u URL control structure | |||
* @param msg debugging identifier (unused) | * @param msg debugging identifier (unused) | |||
* @return dereferenced instance (NULL if freed) | * @return dereferenced instance (NULL if freed) | |||
*/ | */ | |||
/*@unused@*/ urlinfo urlFree( /*@killref@*/ urlinfo u, const char * msg) | /*@unused@*/ urlinfo urlFree( /*@killref@*/ urlinfo u, const char * msg) | |||
/*@modifies u @*/; | /*@globals fileSystem, internalState @*/ | |||
/*@modifies u, fileSystem, internalState @*/; | ||||
/** @todo Remove debugging entry from the ABI. */ | /** @todo Remove debugging entry from the ABI. */ | |||
urlinfo XurlFree( /*@killref@*/ urlinfo u, const char * msg, | urlinfo XurlFree( /*@killref@*/ urlinfo u, const char * msg, | |||
const char * file, unsigned line) | const char * file, unsigned line) | |||
/*@globals fileSystem@*/ | /*@globals fileSystem, internalState @*/ | |||
/*@modifies u, fileSystem @*/; | /*@modifies u, fileSystem, internalState @*/; | |||
#define urlFree(_u, _msg) XurlFree(_u, _msg, __FILE__, __LINE__) | #define urlFree(_u, _msg) XurlFree(_u, _msg, __FILE__, __LINE__) | |||
/** | /** | |||
* Free cached URL control structures. | * Free cached URL control structures. | |||
*/ | */ | |||
void urlFreeCache(void) | void urlFreeCache(void) | |||
/*@globals _url_cache, _url_count, fileSystem @*/ | /*@globals _url_cache, _url_count, fileSystem, internalState @*/ | |||
/*@modifies _url_cache, _url_count, fileSystem @*/; | /*@modifies _url_cache, _url_count, fileSystem, internalState @*/; | |||
/** | /** | |||
* Return type of URL. | * Return type of URL. | |||
* @param url url string | * @param url url string | |||
* @return type of url | * @return type of url | |||
*/ | */ | |||
urltype urlIsURL(const char * url) | urltype urlIsURL(const char * url) | |||
/*@*/; | /*@*/; | |||
/** | /** | |||
* Return path component of URL. | * Return path component of URL. | |||
* @param url url string | * @param url url string | |||
* @retval pathp pointer to path component of url | * @retval pathp pointer to path component of url | |||
* @return type of url | * @return type of url | |||
*/ | */ | |||
/*@-incondefs@*/ | ||||
urltype urlPath(const char * url, /*@out@*/ const char ** pathp) | urltype urlPath(const char * url, /*@out@*/ const char ** pathp) | |||
/*@ensures maxSet(*pathp) == 0 /\ maxRead(*pathp) == 0 @*/ | ||||
/*@modifies *pathp @*/; | /*@modifies *pathp @*/; | |||
/*@=incondefs@*/ | ||||
/** | /** | |||
* Parse URL string into a control structure. | * Parse URL string into a control structure. | |||
* @param url url string | * @param url url string | |||
* @retval uret address of new control instance pointer | * @retval uret address of new control instance pointer | |||
* @return 0 on success, -1 on error | * @return 0 on success, -1 on error | |||
*/ | */ | |||
int urlSplit(const char * url, /*@out@*/ urlinfo * uret) | int urlSplit(const char * url, /*@out@*/ urlinfo * uret) | |||
/*@modifies *uret @*/; | /*@globals h_errno, internalState @*/ | |||
/*@modifies *uret, internalState @*/; | ||||
/** | /** | |||
* Copy data from URL to local file. | * Copy data from URL to local file. | |||
* @param url url string of source | * @param url url string of source | |||
* @param dest file name of destination | * @param dest file name of destination | |||
* @return 0 on success, otherwise FTPERR_* code | * @return 0 on success, otherwise FTPERR_* code | |||
*/ | */ | |||
int urlGetFile(const char * url, /*@null@*/ const char * dest) | int urlGetFile(const char * url, /*@null@*/ const char * dest) | |||
/*@globals fileSystem @*/ | /*@globals h_errno, fileSystem, internalState @*/ | |||
/*@modifies fileSystem @*/; | /*@modifies fileSystem, internalState @*/; | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* H_RPMURL */ | #endif /* H_RPMURL */ | |||
End of changes. 23 change blocks. | ||||
21 lines changed or deleted | 64 lines changed or added | |||
stringbuf.h | stringbuf.h | |||
---|---|---|---|---|
#ifndef _STRINGBUF_H_ | #ifndef _STRINGBUF_H_ | |||
#define _STRINGBUF_H_ | #define _STRINGBUF_H_ | |||
/** \file lib/stringbuf.h | /** \file rpmio/stringbuf.h | |||
* | * | |||
*/ | */ | |||
/** | /** | |||
*/ | */ | |||
typedef /*@abstract@*/ struct StringBufRec *StringBuf; | typedef /*@abstract@*/ struct StringBufRec *StringBuf; | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
skipping to change at line 52 | skipping to change at line 52 | |||
/** | /** | |||
*/ | */ | |||
#define appendStringBuf(sb, s) appendStringBufAux(sb, s, 0) | #define appendStringBuf(sb, s) appendStringBufAux(sb, s, 0) | |||
/** | /** | |||
*/ | */ | |||
#define appendLineStringBuf(sb, s) appendStringBufAux(sb, s, 1) | #define appendLineStringBuf(sb, s) appendStringBufAux(sb, s, 1) | |||
/** | /** | |||
*/ | */ | |||
void appendStringBufAux(StringBuf sb, const char * s, int nl) | void appendStringBufAux(StringBuf sb, const char * s, size_t nl) | |||
/*@modifies sb @*/; | /*@modifies sb @*/; | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* _STRINGBUF_H_ */ | #endif /* _STRINGBUF_H_ */ | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
ugid.h | ugid.h | |||
---|---|---|---|---|
skipping to change at line 24 | skipping to change at line 24 | |||
* -1 if the user can't be found. | * -1 if the user can't be found. | |||
*/ | */ | |||
int unameToUid(const char * thisUname, /*@out@*/ uid_t * uid) | int unameToUid(const char * thisUname, /*@out@*/ uid_t * uid) | |||
/*@modifies *uid @*/; | /*@modifies *uid @*/; | |||
int gnameToGid(const char * thisGname, /*@out@*/ gid_t * gid) | int gnameToGid(const char * thisGname, /*@out@*/ gid_t * gid) | |||
/*@modifies *gid @*/; | /*@modifies *gid @*/; | |||
/* | /* | |||
* Call w/ -1 to flush the cache, returns NULL if the user can't be found. | * Call w/ -1 to flush the cache, returns NULL if the user can't be found. | |||
*/ | */ | |||
/*@observer@*/ /*@null@*/ char * uidToUname(uid_t uid) | /*@observer@*/ /*@null@*/ | |||
char * uidToUname(uid_t uid) | ||||
/*@*/; | /*@*/; | |||
/*@unused@*/ | /*@observer@*/ /*@null@*/ | |||
/*@observer@*/ /*@null@*/ char * gidToGname(gid_t gid) | char * gidToGname(gid_t gid) | |||
/*@*/; | /*@*/; | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* H_UGID */ | #endif /* H_UGID */ | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 4 lines changed or added | |||