- more CLI typedefs/prototypes moved from rpmlib.h to rpmcli.h.
- rpm --verify skips files in non-installed states.
- rpm --verify skips content checks for %ghost files.
- rpm --verify displays config/doc/gnost/license/readme atrrs for files.
- rpm --verify checks immutable header region digest if available.
- rpmbuild adds header region digest (SHA1 as string).
- use rpmTag* typedefs in new hge/hae/hme/hre header vectors.
CVS patchset: 4854
CVS date: 2001/06/12 04:10:21
- autogen.sh checks for latest libtool-1.4 and automake-1.4-p2.
- rpm --verify reports failure(s) if corresponding tag is not in header.
- rpm --verify honors %config(missingok), add -v for legacy behavior.
+ - remove dead code frpm popt table reorg.
+ - more CLI typedefs/prototypes moved from rpmlib.h to rpmcli.h.
+ - rpm --verify skips files in non-installed states.
+ - rpm --verify skips content checks for %ghost files.
+ - rpm --verify displays config/doc/gnost/license/readme atrrs for files.
+ - rpm --verify checks immutable header region digest if available.
+ - rpmbuild adds header region digest (SHA1 as string).
+ - use rpmTag* typedefs in new hge/hae/hme/hre header vectors.
4.0 -> 4.0.[12]
- add doxygen and lclint annotations most everywhere.
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
- int *mtime;
+ int * mtime;
const char ** files;
- int fnt;
+ rpmTagType fnt;
int count, x;
time_t currentTime = time(NULL);
typedef struct {
/*@observer@*/ /*@null@*/ const char * msg;
/*@observer@*/ const char * argv[4];
- int ntag;
- int vtag;
- int ftag;
+ rpmTag ntag;
+ rpmTag vtag;
+ rpmTag ftag;
int mask;
int xor;
} DepMsg_t;
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
const char ** names = NULL;
- int dnt = -1;
+ rpmTagType dnt = -1;
const char ** versions = NULL;
- int dvt = -1;
+ rpmTagType dvt = -1;
int * flags = NULL;
DepMsg_t * dm;
int count;
return 0;
}
-int readRPM(const char *fileName, Spec *specp, struct rpmlead *lead, Header *sigs,
- CSA_t csa)
+int readRPM(const char *fileName, Spec *specp, struct rpmlead *lead,
+ Header *sigs, CSA_t csa)
{
FD_t fdi;
Spec spec;
rpmRC rc;
+ int ec;
+
+ fdi = (fileName != NULL)
+ ? Fopen(fileName, "r.ufdio")
+ : fdDup(STDIN_FILENO);
- fdi = (fileName != NULL) ? Fopen(fileName, "r.ufdio") : fdDup(STDIN_FILENO);
if (fdi == NULL || Ferror(fdi)) {
rpmError(RPMERR_BADMAGIC, _("readRPM: open %s: %s\n"),
(fileName ? fileName : "<stdin>"),
return RPMERR_BADMAGIC;
}
- (void)Fseek(fdi, 0, SEEK_SET); /* XXX FIXME: EPIPE */
+ /* XXX FIXME: EPIPE on <stdin> */
+ if (Fseek(fdi, 0, SEEK_SET) == -1) {
+ rpmError(RPMERR_FSEEK, _("%s: Fseek failed: %s\n"),
+ (fileName ? fileName : "<stdin>"), Fstrerror(fdi));
+ return RPMERR_FSEEK;
+ }
/* Reallocate build data structures */
spec = newSpec();
/* XXX the header just allocated will be allocated again */
spec->packages->header = headerFree(spec->packages->header);
- /* Read the rpm lead and header */
+ /* Read the rpm lead, signatures, and header */
rc = rpmReadPackageInfo(fdi, sigs, &spec->packages->header);
switch (rc) {
case RPMRC_BADMAGIC:
return 0;
}
+static unsigned char header_magic[8] = {
+ 0x8e, 0xad, 0xe8, 0x01, 0x00, 0x00, 0x00, 0x00
+};
+
int writeRPM(Header *hdrp, const char *fileName, int type,
CSA_t csa, char *passPhrase, const char **cookie)
{
FD_t fd = NULL;
FD_t ifd = NULL;
int rc, count, sigtype;
- const char *sigtarget;
+ const char * sigtarget;
const char * rpmio_flags = NULL;
+ const char * sha1 = NULL;
char *s;
char buf[BUFSIZ];
- Header h = *hdrp;
+ Header h;
Header sig = NULL;
+ /* Transfer header reference form *hdrp to h. */
+ h = headerLink(*hdrp);
+ *hdrp = headerFree(*hdrp);
+
if (Fileno(csa->cpioFdIn) < 0) {
csa->cpioArchiveSize = 0;
/* Add a bogus archive size to the Header */
&csa->cpioArchiveSize, 1);
}
-#ifdef DYING
- /* Choose how filenames are represented. */
- if (_noDirTokens)
- expandFilelist(h);
- else {
- compressFilelist(h);
- /* Binary packages with dirNames cannot be installed by legacy rpm. */
- if (type == RPMLEAD_BINARY)
- rpmlibNeedsFeature(h, "CompressedFileNames", "3.0.4-1");
- }
-#endif
-
/* Binary packages now have explicit Provides: name = version-release. */
if (type == RPMLEAD_BINARY)
providePackageNVR(h);
}
/* Reallocate the header into one contiguous region. */
- /*@-refcounttrans -usereleased@*/
- *hdrp = h = headerReload(h, RPMTAG_HEADERIMMUTABLE);
+ h = headerReload(h, RPMTAG_HEADERIMMUTABLE);
if (h == NULL) { /* XXX can't happen */
rc = RPMERR_RELOAD;
goto exit;
}
- /*@=refcounttrans =usereleased@*/
+ /* Re-reference reallocated header. */
+ *hdrp = headerLink(h);
/*
* Write the header+archive into a temp file so that the size of
* archive (after compression) can be added to the header.
*/
if (makeTempFile(NULL, &sigtarget, &fd)) {
- rpmError(RPMERR_CREATE, _("Unable to open temp file.\n"));
rc = RPMERR_CREATE;
+ rpmError(RPMERR_CREATE, _("Unable to open temp file.\n"));
goto exit;
}
* This used to be done using headerModifyEntry(), but now that headers
* have regions, the value is scribbled directly into the header data
* area. Some new scheme for adding the final archive size will have
- * to be devised if headerGetEntry() ever changes to return a pointer
- * to memory not in the region. <shrug>
+ * to be devised if headerGetEntryMinMemory() ever changes to return
+ * a pointer to memory not in the region, probably by appending
+ * the archive size to the header region rather than including the
+ * archive size within the header region.
*/
if (Fileno(csa->cpioFdIn) < 0) {
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
*archiveSize = csa->cpioArchiveSize;
}
- (void)Fseek(fd, 0, SEEK_SET);
+ (void) Fflush(fd);
+ if (Fseek(fd, sizeof(header_magic), SEEK_SET) == -1) {
+ rc = RPMERR_FSEEK;
+ rpmError(RPMERR_FSEEK, _("%s: Fseek failed: %s\n"),
+ sigtarget, Fstrerror(fd));
+ }
- if (headerWrite(fd, h, HEADER_MAGIC_YES))
+ fdInitSHA1(fd);
+ if (headerWrite(fd, h, HEADER_MAGIC_NO))
rc = RPMERR_NOSPACE;
+ (void) Fflush(fd);
+ fdFiniSHA1(fd, (void **)&sha1, NULL, 1);
(void) Fclose(fd);
fd = NULL;
rpmMessage(RPMMESS_NORMAL, _("Generating signature: %d\n"), sigtype);
(void) rpmAddSignature(sig, sigtarget, sigtype, passPhrase);
}
+
+ if (sha1) {
+ (void) headerAddEntry(sig, RPMTAG_SHA1HEADER, RPM_STRING_TYPE, sha1, 1);
+ sha1 = _free(sha1);
+ }
/* Reallocate the signature into one contiguous region. */
sig = headerReload(sig, RPMTAG_HEADERSIGNATURES);
rc = 0;
exit:
+ sha1 = _free(sha1);
+ h = headerFree(h);
sig = rpmFreeSignature(sig);
if (ifd) {
(void) Fclose(ifd);
else
(void) Unlink(fileName);
- /*@-nullstate@*/ /* FIX: *hdrp may be NULL */
return rc;
- /*@=nullstate@*/
}
static int_32 copyTags[] = {
/**
*/
-/*@observer@*/ static int_32 copyTagsDuringParse[] = {
+/*@observer@*/ static rpmTag copyTagsDuringParse[] = {
RPMTAG_EPOCH,
RPMTAG_VERSION,
RPMTAG_RELEASE,
/**
*/
-/*@observer@*/ static int requiredTags[] = {
+/*@observer@*/ static rpmTag requiredTags[] = {
RPMTAG_NAME,
RPMTAG_VERSION,
RPMTAG_RELEASE,
/**
*/
-static int isMemberInEntry(Header h, const char *name, int tag)
+static int isMemberInEntry(Header h, const char *name, rpmTag tag)
/*@*/
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
const char ** names;
- int type, count;
+ rpmTagType type;
+ int count;
if (!hge(h, tag, &type, (void **)&names, &count))
return -1;
}
/**
+ * Check that required tags are present in header.
+ * @param h header
+ * @param NVR package name-version-release
+ * @return 0 if OK
*/
-static int checkForRequired(Header h, const char *name)
+static int checkForRequired(Header h, const char * NVR)
/*@*/
{
int res = 0;
- int *p;
+ rpmTag * p;
for (p = requiredTags; *p != 0; p++) {
if (!headerIsEntry(h, *p)) {
rpmError(RPMERR_BADSPEC,
_("%s field must be present in package: %s\n"),
- tagName(*p), name);
+ tagName(*p), NVR);
res = 1;
}
}
}
/**
+ * Check that no duplicate tags are present in header.
+ * @param h header
+ * @param NVR package name-version-release
+ * @return 0 if OK
*/
-static int checkForDuplicates(Header h, const char *name)
+static int checkForDuplicates(Header h, const char * NVR)
/*@modifies h @*/
{
int res = 0;
if (tag != lastTag)
continue;
rpmError(RPMERR_BADSPEC, _("Duplicate %s entries in package: %s\n"),
- tagName(tag), name);
+ tagName(tag), NVR);
res = 1;
}
headerFreeIterator(hi);
/**
*/
static struct optionalTag {
- int ot_tag;
+ rpmTag ot_tag;
/*@observer@*/ /*@null@*/ const char * ot_mac;
} optionalTags[] = {
{ RPMTAG_VENDOR, "%{vendor}" },
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
- char *field = spec->line;
- char *end;
- char **array;
+ char * field = spec->line;
+ char * end;
+ char ** array;
int multiToken = 0;
rpmsenseFlags tagflags;
- int type;
+ rpmTagType type;
int len;
int num;
int rc;
/**
*/
typedef struct PreambleRec_s {
- int tag;
+ rpmTag tag;
int len;
int multiLang;
/*@observer@*/ /*@null@*/ const char * token;
char *name, *linep;
int flag;
Package pkg;
- char fullName[BUFSIZ];
+ char NVR[BUFSIZ];
char lang[BUFSIZ];
- strcpy(fullName, "(main package)");
+ strcpy(NVR, "(main package)");
pkg = newPackage(spec);
if (flag == PART_SUBNAME) {
const char * mainName;
(void) headerNVR(spec->packages->header, &mainName, NULL, NULL);
- sprintf(fullName, "%s-%s", mainName, name);
+ sprintf(NVR, "%s-%s", mainName, name);
} else
- strcpy(fullName, name);
- (void) headerAddEntry(pkg->header, RPMTAG_NAME, RPM_STRING_TYPE, fullName, 1);
+ strcpy(NVR, name);
+ (void) headerAddEntry(pkg->header, RPMTAG_NAME, RPM_STRING_TYPE, NVR, 1);
}
if ((rc = readLine(spec, STRIP_TRAILINGSPACE | STRIP_COMMENTS)) > 0) {
if (pkg == spec->packages)
fillOutMainPackage(pkg->header);
- if (checkForDuplicates(pkg->header, fullName))
+ if (checkForDuplicates(pkg->header, NVR))
return RPMERR_BADSPEC;
if (pkg != spec->packages)
- headerCopyTags(spec->packages->header, pkg->header, copyTagsDuringParse);
+ headerCopyTags(spec->packages->header, pkg->header,
+ (int_32 *)copyTagsDuringParse);
- if (checkForRequired(pkg->header, fullName))
+ if (checkForRequired(pkg->header, NVR))
return RPMERR_BADSPEC;
return nextPart;
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
const char ** names;
- int dnt;
- int nametag = 0;
- int versiontag = 0;
- int flagtag = 0;
- int indextag = 0;
+ rpmTagType dnt;
+ rpmTag nametag = 0;
+ rpmTag versiontag = 0;
+ rpmTag flagtag = 0;
+ rpmTag indextag = 0;
int len;
rpmsenseFlags extra = RPMSENSE_ANY;
/* Check for duplicate dependencies. */
if (hge(h, nametag, &dnt, (void **) &names, &len)) {
const char ** versions = NULL;
- int dvt = RPM_STRING_ARRAY_TYPE;
+ rpmTagType dvt = RPM_STRING_ARRAY_TYPE;
int *flags = NULL;
int *indexes = NULL;
int duplicate = 0;
int headerNVR(Header h, const char **np, const char **vp, const char **rp)
{
- int type, count;
+ int type;
+ int count;
+
if (np) {
if (!(headerGetEntry(h, RPMTAG_NAME, &type, (void **) np, &count)
&& type == RPM_STRING_TYPE && count == 1))
const char * keyEVR, int keyFlags)
/*@*/
{
- char *tbuf, *t;
+ char * tbuf, * t;
size_t nb;
nb = 0;
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
- int dnt, bnt;
+ rpmTagType dnt, bnt;
struct availablePackage * p;
rpmRelocation * r;
int i;
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
- int pnt, pvt;
+ rpmTagType pnt, pvt;
const char ** provides;
const char ** providesEVR;
int_32 * provideFlags;
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
- int ont, ovt;
+ rpmTagType ont, ovt;
/* this is an install followed by uninstalls */
const char * name;
int count;
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
- int rnt, rvt;
- int cnt, cvt;
+ rpmTagType rnt, rvt;
+ rpmTagType cnt, cvt;
const char * name, * version, * release;
const char ** requires;
const char ** requiresEVR = NULL;
const char ** conflictsEVR = NULL;
int_32 * conflictFlags = NULL;
int conflictsCount = 0;
- int type;
+ rpmTagType type;
int i, rc;
int ourrc = 0;
struct availablePackage ** suggestion;
{ const char ** provides;
int providesCount;
- int pnt;
+ rpmTagType pnt;
if (hge(h, RPMTAG_PROVIDENAME, &pnt, (void **) &provides,
&providesCount))
}
{ const char ** baseNames, ** dirNames;
- int_32 * dirIndexes, dnt, bnt;
+ int_32 * dirIndexes;
+ rpmTagType dnt, bnt;
int fileCount;
char * fileName = NULL;
int fileAlloced = 0;
* @retval freedata address of data-was-malloc'ed indicator
* @return 0 on success
*/
-static int instprefixTag(Header h, /*@null@*/ /*@out@*/ int_32 * type,
+static int instprefixTag(Header h, /*@null@*/ /*@out@*/ rpmTagType * type,
/*@null@*/ /*@out@*/ const void ** data,
/*@null@*/ /*@out@*/ int_32 * count,
/*@null@*/ /*@out@*/ int * freeData)
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
- int ipt;
+ rpmTagType ipt;
char ** array;
if (hge(h, RPMTAG_INSTALLPREFIX, type, (void **)data, count)) {
* @retval freedata address of data-was-malloc'ed indicator
* @return 0 on success
*/
-static int fssizesTag(Header h, /*@out@*/ int_32 * type,
+static int fssizesTag(Header h, /*@out@*/ rpmTagType * type,
/*@out@*/ const void ** data, /*@out@*/ int_32 * count,
/*@out@*/ int * freeData)
/*@modifies *type, *data, *count, *freeData @*/
* @retval freedata address of data-was-malloc'ed indicator
* @return 0 on success
*/
-static int triggercondsTag(Header h, /*@out@*/ int_32 * type,
+static int triggercondsTag(Header h, /*@out@*/ rpmTagType * type,
/*@out@*/ const void ** data, /*@out@*/ int_32 * count,
/*@out@*/ int * freeData)
/*@modifies *type, *data, *count, *freeData @*/
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
- int tnt, tvt, tst;
+ rpmTagType tnt, tvt, tst;
int_32 * indices, * flags;
char ** names, ** versions;
int numNames, numScripts;
* @retval freedata address of data-was-malloc'ed indicator
* @return 0 on success
*/
-static int triggertypeTag(Header h, /*@out@*/ int_32 * type,
+static int triggertypeTag(Header h, /*@out@*/ rpmTagType * type,
/*@out@*/ const void ** data, /*@out@*/ int_32 * count,
/*@out@*/ int * freeData)
/*@modifies *type, *data, *count, *freeData @*/
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
- int tst;
+ rpmTagType tst;
int_32 * indices, * flags;
const char ** conds;
const char ** s;
* @retval freedata address of data-was-malloc'ed indicator
* @return 0 on success
*/
-static int filenamesTag(Header h, /*@out@*/ int_32 * type,
+static int filenamesTag(Header h, /*@out@*/ rpmTagType * type,
/*@out@*/ const void ** data, /*@out@*/ int_32 * count,
/*@out@*/ int * freeData)
/*@modifies *type, *data, *count, *freeData @*/
* @retval freedata address of data-was-malloc'ed indicator
* @return 0 on success
*/
-static int i18nTag(Header h, int_32 tag, /*@out@*/ int_32 * type,
+static int i18nTag(Header h, int_32 tag, /*@out@*/ rpmTagType * type,
/*@out@*/ const void ** data, /*@out@*/ int_32 * count,
/*@out@*/ int * freeData)
/*@modifies *type, *data, *count, *freeData @*/
* @retval freedata address of data-was-malloc'ed indicator
* @return 0 on success
*/
-static int summaryTag(Header h, /*@out@*/ int_32 * type,
+static int summaryTag(Header h, /*@out@*/ rpmTagType * type,
/*@out@*/ const void ** data, /*@out@*/ int_32 * count,
/*@out@*/ int * freeData)
/*@modifies *type, *data, *count, *freeData @*/
* @retval freedata address of data-was-malloc'ed indicator
* @return 0 on success
*/
-static int descriptionTag(Header h, /*@out@*/ int_32 * type,
+static int descriptionTag(Header h, /*@out@*/ rpmTagType * type,
/*@out@*/ const void ** data, /*@out@*/ int_32 * count,
/*@out@*/ int * freeData)
/*@modifies *type, *data, *count, *freeData @*/
* @retval freedata address of data-was-malloc'ed indicator
* @return 0 on success
*/
-static int groupTag(Header h, /*@out@*/ int_32 * type,
+static int groupTag(Header h, /*@out@*/ rpmTagType * type,
/*@out@*/ const void ** data, /*@out@*/ int_32 * count,
/*@out@*/ int * freeData)
/*@modifies *type, *data, *count, *freeData @*/
/*@-onlytrans@*/
void * uh = doHeaderUnload(h, &length);
- if (uh == NULL)
- return NULL;
h = headerFree(h);
/*@=onlytrans@*/
+ if (uh == NULL)
+ return NULL;
nh = headerLoad(uh);
if (nh == NULL) {
uh = _free(uh);
" OFSET COUNT\n");
for (i = 0; i < h->indexUsed; i++) {
switch (p->info.type) {
- case RPM_NULL_TYPE: type = "NULL_TYPE"; break;
- case RPM_CHAR_TYPE: type = "CHAR_TYPE"; break;
- case RPM_BIN_TYPE: type = "BIN_TYPE"; break;
- case RPM_INT8_TYPE: type = "INT8_TYPE"; break;
- case RPM_INT16_TYPE: type = "INT16_TYPE"; break;
- case RPM_INT32_TYPE: type = "INT32_TYPE"; break;
- /*case RPM_INT64_TYPE: type = "INT64_TYPE"; break;*/
- case RPM_STRING_TYPE: type = "STRING_TYPE"; break;
- case RPM_STRING_ARRAY_TYPE: type = "STRING_ARRAY_TYPE"; break;
- case RPM_I18NSTRING_TYPE: type = "I18N_STRING_TYPE"; break;
+ case RPM_NULL_TYPE: type = "NULL"; break;
+ case RPM_CHAR_TYPE: type = "CHAR"; break;
+ case RPM_BIN_TYPE: type = "BIN"; break;
+ case RPM_INT8_TYPE: type = "INT8"; break;
+ case RPM_INT16_TYPE: type = "INT16"; break;
+ case RPM_INT32_TYPE: type = "INT32"; break;
+ /*case RPM_INT64_TYPE: type = "INT64"; break;*/
+ case RPM_STRING_TYPE: type = "STRING"; break;
+ case RPM_STRING_ARRAY_TYPE: type = "STRING_ARRAY"; break;
+ case RPM_I18NSTRING_TYPE: type = "I18N_STRING"; break;
default: type = "(unknown)"; break;
}
else
tag = tage->name;
- fprintf(f, "Entry : %.3d (%d)%-14s %-18s 0x%.8x %.8d\n", i,
- p->info.tag, tag, type, (unsigned) p->info.offset, (int)
- p->info.count);
+ fprintf(f, "Entry : %3.3d (%d)%-14s %-18s 0x%.8x %.8d\n", i,
+ p->info.tag, tag, type, (unsigned) p->info.offset,
+ (int) p->info.count);
if (flags & HEADER_DUMP_INLINE) {
char *dp = p->data;
return 0;
}
-/* if there are multiple entries with this tag, the first one gets replaced */
-int headerModifyEntry(Header h, int_32 tag, int_32 type, void *p, int_32 c)
+int headerModifyEntry(Header h, int_32 tag, int_32 type,
+ const void * p, int_32 c)
{
struct indexEntry *entry;
void * oldData;
}
int headerAddOrAppendEntry(Header h, int_32 tag, int_32 type,
- void * p, int_32 c)
+ const void * p, int_32 c)
{
return (findEntry(h, tag, type)
? headerAppendEntry(h, tag, type, p, c)
: headerAddEntry(h, tag, type, p, c));
}
-int headerAppendEntry(Header h, int_32 tag, int_32 type, void * p, int_32 c)
+int headerAppendEntry(Header h, int_32 tag, int_32 type,
+ const void * p, int_32 c)
{
struct indexEntry *entry;
int length;
{ HEADER_EXT_LAST, NULL, { NULL } }
};
-void headerCopyTags(Header headerFrom, Header headerTo, int *tagstocopy)
+void headerCopyTags(Header headerFrom, Header headerTo, int_32 * tagstocopy)
{
- int *p;
+ int * p;
if (headerFrom == headerTo)
return;
for (p = tagstocopy; *p != 0; p++) {
char *s;
- int type, count;
+ int_32 type;
+ int_32 count;
if (headerIsEntry(headerTo, *p))
continue;
if (!headerGetEntryMinMemory(headerFrom, *p, &type,
* @param c number of values
* @return 1 on success, 0 on failure
*/
-int headerModifyEntry(Header h, int_32 tag, int_32 type, void *p, int_32 c)
+int headerModifyEntry(Header h, int_32 tag, int_32 type,
+ const void * p, int_32 c)
/*@modifies h @*/;
/** \ingroup header
* @return 1 on success, 0 on failure
*/
int headerAddI18NString(Header h, int_32 tag, const char * string,
- const char * lang)
- /*@modifies h @*/;
+ const char * lang)
+ /*@modifies h @*/;
/** \ingroup header
* Append element to tag array in header.
* @param c number of values
* @return 1 on success, 0 on failure
*/
-int headerAppendEntry(Header h, int_32 tag, int_32 type, void * p, int_32 c)
+int headerAppendEntry(Header h, int_32 tag, int_32 type,
+ const void * p, int_32 c)
/*@modifies h @*/;
/** \ingroup header
* @param c number of values
* @return 1 on success, 0 on failure
*/
-int headerAddOrAppendEntry(Header h, int_32 tag, int_32 type, void * p, int_32 c)
- /*@modifies h @*/;
+int headerAddOrAppendEntry(Header h, int_32 tag, int_32 type,
+ const void * p, int_32 c)
+ /*@modifies h @*/;
/** \ingroup header
* Retrieve tag value.
* @return 1 on success, 0 on failure
*/
int headerGetEntry(Header h, int_32 tag,
- /*@null@*/ /*@out@*/ int_32 * type,
- /*@null@*/ /*@out@*/ void ** p,
- /*@null@*/ /*@out@*/int_32 *c)
- /*@modifies *type, *p, *c @*/;
+ /*@null@*/ /*@out@*/ int_32 * type,
+ /*@null@*/ /*@out@*/ void ** p,
+ /*@null@*/ /*@out@*/int_32 *c)
+ /*@modifies *type, *p, *c @*/;
/** \ingroup header
* Retrieve tag value using header internal array.
* @return 1 on success, 0 on failure
*/
int headerGetEntryMinMemory(Header h, int_32 tag,
- /*@null@*/ /*@out@*/ int_32 * type,
- /*@null@*/ /*@out@*/ const void ** p,
- /*@null@*/ /*@out@*/ int_32 * c)
- /*@modifies *type, *p, *c @*/;
+ /*@null@*/ /*@out@*/ int_32 * type,
+ /*@null@*/ /*@out@*/ const void ** p,
+ /*@null@*/ /*@out@*/ int_32 * c)
+ /*@modifies *type, *p, *c @*/;
/** \ingroup header
* Retrieve tag value with type match.
*/
/*@-exportlocal@*/
int headerGetRawEntry(Header h, int_32 tag,
- /*@null@*/ /*@out@*/ int_32 * type,
- /*@null@*/ /*@out@*/ const void ** p,
- /*@null@*/ /*@out@*/ int_32 * c)
- /*@modifies *type, *p, *c @*/;
+ /*@null@*/ /*@out@*/ int_32 * type,
+ /*@null@*/ /*@out@*/ const void ** p,
+ /*@null@*/ /*@out@*/ int_32 * c)
+ /*@modifies *type, *p, *c @*/;
/*@=exportlocal@*/
/** \ingroup header
* @return 1 on success, 0 on failure
*/
int headerNextIterator(HeaderIterator hi,
- /*@null@*/ /*@out@*/ int_32 * tag, /*@null@*/ /*@out@*/ int_32 * type,
- /*@null@*/ /*@out@*/ const void ** p, /*@null@*/ /*@out@*/ int_32 * c)
- /*@modifies hi, *tag, *type, *p, *c @*/;
+ /*@null@*/ /*@out@*/ int_32 * tag,
+ /*@null@*/ /*@out@*/ int_32 * type,
+ /*@null@*/ /*@out@*/ const void ** p,
+ /*@null@*/ /*@out@*/ int_32 * c)
+ /*@modifies hi, *tag, *type, *p, *c @*/;
/** \ingroup header
* Destroy header tag iterator.
* @param headerTo destination header
* @param tagstocopy array of tags that are copied
*/
-void headerCopyTags(Header headerFrom, Header headerTo, int_32 *tagstocopy)
+void headerCopyTags(Header headerFrom, Header headerTo, int_32 * tagstocopy)
/*@modifies headerFrom, headerTo @*/;
/** \ingroup header
void compressFilelist(Header h)
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
+ HAE_t hae = (HAE_t)headerAddEntry;
+ HRE_t hre = (HRE_t)headerRemoveEntry;
+ HFD_t hfd = headerFreeData;
char ** fileNames;
const char ** dirNames;
const char ** baseNames;
int_32 * dirIndexes;
- int fnt;
+ rpmTagType fnt;
int count;
int i;
int dirIndex = -1;
*/
if (headerIsEntry(h, RPMTAG_DIRNAMES)) {
- (void) headerRemoveEntry(h, RPMTAG_OLDFILENAMES);
+ (void) hre(h, RPMTAG_OLDFILENAMES);
return; /* Already converted. */
}
exit:
if (count > 0) {
- (void) headerAddEntry(h, RPMTAG_DIRINDEXES, RPM_INT32_TYPE,
- dirIndexes, count);
- (void) headerAddEntry(h, RPMTAG_BASENAMES, RPM_STRING_ARRAY_TYPE,
+ (void) hae(h, RPMTAG_DIRINDEXES, RPM_INT32_TYPE, dirIndexes, count);
+ (void) hae(h, RPMTAG_BASENAMES, RPM_STRING_ARRAY_TYPE,
baseNames, count);
- (void) headerAddEntry(h, RPMTAG_DIRNAMES, RPM_STRING_ARRAY_TYPE,
+ (void) hae(h, RPMTAG_DIRNAMES, RPM_STRING_ARRAY_TYPE,
dirNames, dirIndex + 1);
}
- fileNames = headerFreeData(fileNames, fnt);
+ fileNames = hfd(fileNames, fnt);
- (void) headerRemoveEntry(h, RPMTAG_OLDFILENAMES);
+ (void) hre(h, RPMTAG_OLDFILENAMES);
}
/*
* is getting all of this into a single xmalloc'd block.
*/
static void doBuildFileList(Header h, /*@out@*/ const char *** fileListPtr,
- /*@out@*/ int * fileCountPtr, int baseNameTag,
- int dirNameTag, int dirIndexesTag)
+ /*@out@*/ int * fileCountPtr, rpmTag baseNameTag,
+ rpmTag dirNameTag, rpmTag dirIndexesTag)
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
int count;
const char ** fileNames;
int size;
- int bnt, dnt;
+ rpmTagType bnt, dnt;
char * data;
int i;
void expandFilelist(Header h)
{
+ HAE_t hae = (HAE_t)headerAddEntry;
+ HRE_t hre = (HRE_t)headerRemoveEntry;
const char ** fileNames = NULL;
int count = 0;
RPMTAG_DIRNAMES, RPMTAG_DIRINDEXES);
if (fileNames == NULL || count <= 0)
return;
- (void) headerAddEntry(h, RPMTAG_OLDFILENAMES, RPM_STRING_ARRAY_TYPE,
+ (void) hae(h, RPMTAG_OLDFILENAMES, RPM_STRING_ARRAY_TYPE,
fileNames, count);
fileNames = _free(fileNames);
}
- (void) headerRemoveEntry(h, RPMTAG_DIRNAMES);
- (void) headerRemoveEntry(h, RPMTAG_BASENAMES);
- (void) headerRemoveEntry(h, RPMTAG_DIRINDEXES);
+ (void) hre(h, RPMTAG_DIRNAMES);
+ (void) hre(h, RPMTAG_BASENAMES);
+ (void) hre(h, RPMTAG_DIRINDEXES);
}
int_32 pFlags = RPMSENSE_EQUAL;
const char ** provides = NULL;
const char ** providesEVR = NULL;
- int pnt, pvt;
+ rpmTagType pnt, pvt;
int_32 * provideFlags = NULL;
int providesCount;
int i;
/*@modifies fileSystem @*/;
/**
+ * 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(const char * prefix,
+int makeTempFile(/*@null@*/ const char * prefix,
/*@null@*/ /*@out@*/ const char ** fnptr,
/*@out@*/ FD_t * fdptr)
/*@modifies *fnptr, *fdptr, fileSystem @*/;
/*@-mods@*/
void headerMergeLegacySigs(Header h, const Header sig)
{
+ HFD_t hfd = (HFD_t) headerFreeData;
+ HAE_t hae = (HAE_t) headerAddEntry;
HeaderIterator hi;
int_32 tag, type, count;
const void * ptr;
for (hi = headerInitIterator(sig);
headerNextIterator(hi, &tag, &type, &ptr, &count);
- ptr = headerFreeData(ptr, type))
+ ptr = hfd(ptr, type))
{
switch (tag) {
case RPMSIGTAG_SIZE: tag = RPMTAG_SIGSIZE; break;
case RPMSIGTAG_GPG: tag = RPMTAG_SIGGPG; break;
case RPMSIGTAG_PGP5: tag = RPMTAG_SIGPGP5; break;
default:
- continue;
- /*@notreached@*/ break;
+ if (!(tag >= HEADER_SIGBASE && tag < HEADER_TAGBASE))
+ continue;
+ break;
}
if (ptr == NULL) continue; /* XXX can't happen */
if (!headerIsEntry(h, tag))
- (void) headerAddEntry(h, tag, type, ptr, count);
+ (void) hae(h, tag, type, ptr, count);
}
headerFreeIterator(hi);
}
Header headerRegenSigHeader(const Header h)
{
+ HFD_t hfd = (HFD_t) headerFreeData;
Header sig = rpmNewSignature();
HeaderIterator hi;
int_32 tag, stag, type, count;
for (hi = headerInitIterator(h);
headerNextIterator(hi, &tag, &type, &ptr, &count);
- ptr = headerFreeData(ptr, type))
+ ptr = hfd(ptr, type))
{
switch (tag) {
case RPMTAG_SIGSIZE: stag = RPMSIGTAG_SIZE; break;
case RPMTAG_SIGGPG: stag = RPMSIGTAG_GPG; break;
case RPMTAG_SIGPGP5: stag = RPMSIGTAG_PGP5; break;
default:
- continue;
- /*@notreached@*/ break;
+ if (!(tag >= HEADER_SIGBASE && tag < HEADER_TAGBASE))
+ continue;
+ stag = tag;
+ break;
}
if (ptr == NULL) continue; /* XXX can't happen */
if (!headerIsEntry(sig, stag))
* which is quite handy.
*/
if (headerGetEntry(*hdr, RPMTAG_DEFAULTPREFIX, NULL,
- (void **) &defaultPrefix, NULL)) {
+ (void **) &defaultPrefix, NULL))
+ {
defaultPrefix =
stripTrailingChar(alloca_strdup(defaultPrefix), '/');
(void) headerAddEntry(*hdr, RPMTAG_PREFIXES, RPM_STRING_ARRAY_TYPE,
hge = (fi->type == TR_ADDED)
? (HGE_t) headerGetEntryMinMemory : (HGE_t) headerGetEntry;
fi->hge = hge;
-
+ fi->hae = (HAE_t) headerAddEntry;
+ fi->hme = (HME_t) headerModifyEntry;
+ fi->hre = (HRE_t) headerRemoveEntry;
fi->hfd = hfd = headerFreeData;
if (h && fi->h == NULL) fi->h = headerLink(h);
*/
static struct tagMacro {
/*@observer@*/ /*@null@*/ const char * macroname; /*!< Macro name to define. */
- int tag; /*!< Header tag to use for value. */
+ rpmTag tag; /*!< Header tag to use for value. */
} tagMacros[] = {
{ "name", RPMTAG_NAME },
{ "version", RPMTAG_VERSION },
{ "release", RPMTAG_RELEASE },
-#if 0
{ "epoch", RPMTAG_EPOCH },
-#endif
{ NULL, 0 }
};
/**
* Define per-header macros.
+ * @param fi transaction element file info
* @param h header
* @return 0 always
*/
static int rpmInstallLoadMacros(TFI_t fi, Header h)
/*@modifies internalState @*/
{
- HGE_t hge = (HGE_t)fi->hge;
- struct tagMacro *tagm;
+ HGE_t hge = (HGE_t) fi->hge;
+ struct tagMacro * tagm;
union {
- const char * ptr;
+/*@unused@*/ void * ptr;
+/*@unused@*/ const char ** argv;
+ const char * str;
int_32 * i32p;
} body;
char numbuf[32];
- int_32 type;
+ rpmTagType type;
for (tagm = tagMacros; tagm->macroname != NULL; tagm++) {
if (!hge(h, tagm->tag, &type, (void **) &body, NULL))
addMacro(NULL, tagm->macroname, NULL, numbuf, -1);
break;
case RPM_STRING_TYPE:
- addMacro(NULL, tagm->macroname, NULL, body.ptr, -1);
+ addMacro(NULL, tagm->macroname, NULL, body.str, -1);
+ break;
+ case RPM_NULL_TYPE:
+ case RPM_CHAR_TYPE:
+ case RPM_INT8_TYPE:
+ case RPM_INT16_TYPE:
+ case RPM_BIN_TYPE:
+ case RPM_STRING_ARRAY_TYPE:
+ case RPM_I18NSTRING_TYPE:
+ default:
break;
}
}
/*@modifies h @*/
{
HGE_t hge = (HGE_t)fi->hge;
+ HME_t hme = (HME_t)fi->hme;
HFD_t hfd = (fi->hfd ? fi->hfd : headerFreeData);
fileAction * actions = fi->actions;
int i, j, k, fc;
- int_32 type = 0;
+ rpmTagType type = 0;
int_32 count = 0;
int_32 dirNamesCount, dirCount;
void * data, * newdata;
uint_32 * fileSizes, fileSize;
const char ** dirNames;
const char ** newDirNames;
- static int_32 mergeTags[] = {
+ static rpmTag mergeTags[] = {
RPMTAG_FILESIZES,
RPMTAG_FILESTATES,
RPMTAG_FILEMODES,
RPMTAG_BASENAMES,
0,
};
- static int_32 requireTags[] = {
+ static rpmTag requireTags[] = {
RPMTAG_REQUIRENAME, RPMTAG_REQUIREVERSION, RPMTAG_REQUIREFLAGS,
RPMTAG_PROVIDENAME, RPMTAG_PROVIDEVERSION, RPMTAG_PROVIDEFLAGS,
RPMTAG_CONFLICTNAME, RPMTAG_CONFLICTVERSION, RPMTAG_CONFLICTFLAGS
fc++;
fileSize += fileSizes[i];
}
- (void) headerModifyEntry(h, RPMTAG_SIZE, RPM_INT32_TYPE, &fileSize, 1);
+ (void) hme(h, RPMTAG_SIZE, RPM_INT32_TYPE, &fileSize, 1);
for (i = 0; mergeTags[i]; i++) {
if (!hge(newH, mergeTags[i], &type, (void **) &data, &count))
for (i = 0; i < 9; i += 3) {
const char **Names, **EVR, **newNames, **newEVR;
- int nnt, nvt, rnt;
+ rpmTagType nnt, nvt, rnt;
uint_32 *Flags, *newFlags;
int Count = 0, newCount = 0;
}
/**
+ * Create directory if it does not exist, make sure path is writable.
+ * @note This will only create last component of directory path.
+ * @param dpath directory path
+ * @param dname directory use
+ * @return rpmRC return code
*/
static rpmRC chkdir (const char * dpath, const char * dname)
/*@modifies fileSystem @*/
/*@fallthrough@*/
case URL_IS_FTP:
case URL_IS_HTTP:
- /* XXX this will only create last component of directory path */
rc = Mkdir(dpath, 0755);
break;
case URL_IS_DASH:
break;
}
if (rc < 0) {
- rpmError(RPMERR_CREATE, _("cannot create %s %s\n"),
+ rpmError(RPMERR_CREATE, _("cannot create %%%s %s\n"),
dname, dpath);
return RPMRC_FAIL;
}
}
if ((rc = Access(dpath, W_OK))) {
- rpmError(RPMERR_CREATE, _("cannot write to %s\n"), dpath);
+ rpmError(RPMERR_CREATE, _("cannot write to %%%s %s\n"), dname, dpath);
return RPMRC_FAIL;
}
return RPMRC_OK;
int argc = 0;
const char ** prefixes = NULL;
int numPrefixes;
- int_32 ipt;
+ rpmTagType ipt;
const char * oldPrefix;
int maxPrefixLength;
int len;
void ** programArgv;
int programArgc;
const char ** argv;
- int_32 ptt, stt;
+ rpmTagType ptt, stt;
const char * script;
rpmRC rc = RPMRC_OK;
const char ** triggerProgs;
int_32 * triggerFlags;
int_32 * triggerIndices;
- int_32 tnt, tvt, tft;
+ rpmTagType tnt, tvt, tft;
const char * triggerPackageName;
const char * sourceName;
int numTriggers;
(void) headerNVR(sourceH, &sourceName, NULL, NULL);
for (i = 0; i < numTriggers; i++) {
- int_32 tit, tst, tpt;
+ rpmTagType tit, tst, tpt;
if (!(triggerFlags[i] & psm->sense)) continue;
if (strcmp(triggerNames[i], sourceName)) continue;
const char ** triggerNames;
int numTriggers;
int_32 * triggerIndices;
- int_32 tnt, tit;
+ rpmTagType tnt, tit;
int numTriggerIndices;
unsigned char * triggersRun;
rpmRC rc = RPMRC_OK;
const rpmTransactionSet ts = psm->ts;
TFI_t fi = psm->fi;
HGE_t hge = fi->hge;
+ HME_t hme = fi->hme;
HFD_t hfd = (fi->hfd ? fi->hfd : headerFreeData);
rpmRC rc = psm->rc;
int saveerrno;
{
multiLib = *p;
multiLib |= *newMultiLib;
- (void) headerModifyEntry(psm->oh, RPMTAG_MULTILIBS, RPM_INT32_TYPE,
+ (void) hme(psm->oh, RPMTAG_MULTILIBS, RPM_INT32_TYPE,
&multiLib, 1);
}
rc = mergeFiles(fi, psm->oh, fi->h);
/*@owned@*/ fileAction * actions; /*!< File disposition(s) */
/*@owned@*/ struct fingerPrint_s * fps; /*!< File fingerprint(s) */
HGE_t hge; /*!< Vector to headerGetEntry() */
+ HAE_t hae; /*!< Vector to headerAddEntry() */
+ HME_t hme; /*!< Vector to headerModifyEntry() */
+ HRE_t hre; /*!< Vector to headerRemoveEntry() */
HFD_t hfd; /*!< Vector to headerFreeData() */
Header h; /*!< Package header */
/*@owned@*/ const char * name;
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
char * t, * te;
-
rpmQueryFlags queryFlags = qva->qva_flags;
const char * queryFormat = qva->qva_queryFormat;
-
- int_32 count, type;
+ rpmTagType type;
+ int_32 count;
char * prefix = NULL;
const char ** dirNames = NULL;
const char ** baseNames = NULL;
- int bnt, dnt;
+ rpmTagType bnt, dnt;
const char ** fileMD5List = NULL;
const char ** fileOwnerList = NULL;
const char ** fileGroupList = NULL;
const char ** fileLinktoList = NULL;
- int m5t, fot, fgt, ltt;
+ rpmTagType m5t, fot, fgt, ltt;
const char * fileStatesList;
int_32 * fileFlagsList, * fileMTimeList, * fileSizeList;
int_32 * fileUIDList = NULL;
fileGroupList = NULL;
for (i = 0; i < count; i++) {
+
/* If querying only docs, skip non-doc files. */
if ((queryFlags & QUERY_FOR_DOCS)
&& !(fileFlagsList[i] & RPMFILE_DOC))
continue;
+
/* If querying only configs, skip non-config files. */
if ((queryFlags & QUERY_FOR_CONFIG)
&& !(fileFlagsList[i] & RPMFILE_CONFIG))
if (queryFlags & QUERY_FOR_STATE) {
if (fileStatesList) {
- switch (fileStatesList[i]) {
+ rpmfileState fstate = fileStatesList[i];
+ switch (fstate) {
case RPMFILE_STATE_NORMAL:
te = stpcpy(te, _("normal ")); break;
case RPMFILE_STATE_REPLACED:
int rc;
int isSource;
int retcode = 0;
- char *end = NULL;
+ char * end = NULL;
switch (source) {
case RPMQV_RPM:
rc = parseSpecVec(&spec, arg, "/", buildRoot, recursing, passPhrase,
cookie, anyarch, force);
if (rc || spec == NULL) {
-
rpmError(RPMERR_QUERY,
_("query of specfile %s failed, can't parse\n"), arg);
spec = freeSpecVec(spec);
/** \ingroup rpmcli
* Bit(s) to control rpmQuery() operation, stored in qva_flags.
*/
-/*@-typeuse@*/
typedef enum rpmQueryFlags_e {
- QUERY_FOR_LIST = (1 << 1), /*!< from --list */
- QUERY_FOR_STATE = (1 << 2), /*!< from --state */
- QUERY_FOR_DOCS = (1 << 3), /*!< from --docfiles */
- QUERY_FOR_CONFIG = (1 << 4), /*!< from --configfiles */
- QUERY_FOR_DUMPFILES = (1 << 8) /*!< from --dump */
+ QUERY_FOR_DEFAULT = 0,
+ QUERY_FOR_LIST = (1 << 1), /*!< query: from --list */
+ QUERY_FOR_STATE = (1 << 2), /*!< query: from --state */
+ QUERY_FOR_DOCS = (1 << 3), /*!< query: from --docfiles */
+ QUERY_FOR_CONFIG = (1 << 4), /*!< query: from --configfiles */
+ QUERY_FOR_DUMPFILES = (1 << 8), /*!< query: from --dump */
+/*@-enummemuse@*/
+ QUERY_FILES = (1 << 9), /*!< verify: from --nofiles */
+ QUERY_DEPS = (1 << 10), /*!< verify: from --nodeps */
+ QUERY_SCRIPT = (1 << 11), /*!< verify: from --noscripts */
+ QUERY_MD5 = (1 << 12), /*!< verify: from --nomd5 */
+ QUERY_DIGEST = (1 << 13) /*!< verify: from --nodigest */
+/*@=enummemuse@*/
} rpmQueryFlags;
-/*@=typeuse@*/
/** \ingroup rpmcli
* Bit(s) to control rpmVerify() operation, stored in qva_flags.
*/
/*@-typeuse@*/
typedef enum rpmVerifyFlags_e {
- VERIFY_FILES = (1 << 9), /*!< from --nofiles */
- VERIFY_DEPS = (1 << 10), /*!< from --nodeps */
- VERIFY_SCRIPT = (1 << 11), /*!< from --noscripts */
- VERIFY_MD5 = (1 << 12) /*!< from --nomd5 */
+/*@-enummemuse@*/
+ VERIFY_FOR_DEFAULT = 0,
+ VERIFY_FOR_LIST = (1 << 1), /*!< query: from --list */
+ VERIFY_FOR_STATE = (1 << 2), /*!< query: from --state */
+ VERIFY_FOR_DOCS = (1 << 3), /*!< query: from --docfiles */
+ VERIFY_FOR_CONFIG = (1 << 4), /*!< query: from --configfiles */
+ VERIFY_FOR_DUMPFILES= (1 << 8), /*!< query: from --dump */
+/*@=enummemuse@*/
+ VERIFY_FILES = (1 << 9), /*!< verify: from --nofiles */
+ VERIFY_DEPS = (1 << 10), /*!< verify: from --nodeps */
+ VERIFY_SCRIPT = (1 << 11), /*!< verify: from --noscripts */
+ VERIFY_MD5 = (1 << 12), /*!< verify: from --nomd5 */
+ VERIFY_DIGEST = (1 << 13) /*!< verify: from --nodigest */
} rpmVerifyFlags;
+#define VERIFY_ALL \
+ (VERIFY_FILES|VERIFY_DEPS|VERIFY_SCRIPT|VERIFY_MD5|VERIFY_DIGEST)
/*@=typeuse@*/
/** \ingroup rpmcli
+ * @param qva parsed query/verify options
+ * @param db rpm database
+ * @param h header to use for query/verify
+ */
+typedef int (*QVF_t) (QVA_t qva, rpmdb db, Header h)
+ /*@modifies db, fileSystem @*/;
+
+/** \ingroup rpmcli
+ * Display query/verify information for each header in iterator.
+ * @param qva parsed query/verify options
+ * @param mi rpm database iterator
+ * @param showPackage query/verify display routine
+ * @return result of last non-zero showPackage() return
+ */
+int showMatches(QVA_t qva, /*@only@*/ /*@null@*/ rpmdbMatchIterator mi,
+ QVF_t showPackage)
+ /*@modifies mi @*/;
+
+/** \ingroup rpmcli
+ * Display list of tags that can be used in --queryformat.
+ * @param fp file handle to use for display
+ */
+void rpmDisplayQueryTags(FILE * fp)
+ /*@modifies *fp, fileSystem @*/;
+
+/** \ingroup rpmcli
+ * Common query/verify source interface, called once for each CLI arg.
+ * @param qva parsed query/verify options
+ * @param source type 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 NULL
+ */
+int rpmQueryVerify(QVA_t qva, rpmQVSources source, const char * arg,
+ rpmdb db, QVF_t showPackage)
+ /*@modifies db, fileSystem @*/;
+
+/** \ingroup rpmcli
+ * Display results of package query.
+ * @todo Devise a meaningful return code.
+ * @param qva parsed query/verify options
+ * @param db rpm database (unused for queries)
+ * @param h header to use for query
+ * @return 0 always
+ */
+int showQueryPackage(QVA_t qva, rpmdb db, Header h)
+ /*@modifies db, fileSystem @*/;
+
+/** \ingroup rpmcli
+ * Display package information.
+ * @param qva parsed query/verify options
+ * @param source type of source to query
+ * @param arg name of source to query
+ * @return rpmQueryVerify() result, or 1 on rpmdbOpen() failure
+ */
+int rpmQuery(QVA_t qva, rpmQVSources source, const char * arg)
+ /*@modifies fileSystem @*/;
+
+/** \ingroup rpmcli
+ * Display results of package verify.
+ * @param qva parsed query/verify options
+ * @param db rpm database
+ * @param h header to use for verify
+ * @return result of last non-zero verify return
+ */
+int showVerifyPackage(QVA_t qva, /*@only@*/ rpmdb db, Header h)
+ /*@modifies db, h, fileSystem @*/;
+
+/** \ingroup rpmcli
+ * Verify package install.
+ * @param qva parsed query/verify options
+ * @param source type of source to verify
+ * @param arg name of source to verify
+ * @return rpmQueryVerify() result, or 1 on rpmdbOpen() failure
+ */
+int rpmVerify(QVA_t qva, rpmQVSources source, const char *arg)
+ /*@modifies fileSystem @*/;
+
+/** \ingroup rpmcli
* Describe query/verify command line request.
*/
struct rpmQVArguments_s {
rpmQVSources qva_source; /*!< Identify CLI arg type. */
int qva_sourceCount;/*!< Exclusive check (>1 is error). */
- int qva_flags; /*!< Bit(s) to control operation. */
+ rpmQueryFlags qva_flags; /*!< Bit(s) to control operation. */
/*@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. */
/* --- install/upgrade/erase modes */
/** \ingroup rpmcli
+ * Install/upgrade/freshen binary rpm package.
+ * @param rootdir path to top of install tree
+ * @param fileArgv array of package file names (NULL terminated)
+ * @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,
+ /*@null@*/ const char ** fileArgv,
+ rpmtransFlags transFlags,
+ rpmInstallInterfaceFlags interfaceFlags,
+ rpmprobFilterFlags probFilter,
+ /*@null@*/ rpmRelocation * relocations)
+ /*@modifies *relocations, fileSystem @*/;
+
+/** \ingroup rpmcli
+ * Install source rpm package.
+ * @param rootdir path to top of install tree
+ * @param arg source rpm file name
+ * @retval specFile address of (installed) spec file name
+ * @retval cookie
+ * @return 0 on success
+ */
+int rpmInstallSource(const char * rootdir, const char * arg,
+ /*@null@*/ /*@out@*/ const char ** specFile,
+ /*@null@*/ /*@out@*/ char ** cookie)
+ /*@modifies *specFile, *cookie, fileSystem @*/;
+
+/** \ingroup rpmcli
+ * Erase binary rpm package.
+ * @param rootdir path to top of install tree
+ * @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
+ */
+int rpmErase(/*@null@*/ const char * rootdir, /*@null@*/ const char ** argv,
+ rpmtransFlags transFlags,
+ rpmEraseInterfaceFlags interfaceFlags)
+ /*@modifies fileSystem @*/;
+
+/** \ingroup rpmcli
* Describe database command line requests.
*/
struct rpmInstallArguments_s {
/*@only@*/ rpmRelocation * relocations;
int numRelocations;
int noDeps;
- int force;
int incldocs;
const char * prefix;
};
/*@{*/
/** \ingroup rpmcli
+ * Bit(s) to control rpmCheckSig() operation.
+ */
+typedef enum rpmCheckSigFlags_e {
+/*@-enummemuse@*/
+ CHECKSIG_NONE = 0, /*!< Don't check any signatures. */
+/*@=enummemuse@*/
+ CHECKSIG_PGP = (1 << 0), /*!< if not --nopgp */
+ CHECKSIG_MD5 = (1 << 1), /*!< if not --nomd5 */
+ CHECKSIG_GPG = (1 << 2) /*!< if not --nogpg */
+} rpmCheckSigFlags;
+#define CHECKSIG_ALL (CHECKSIG_PGP|CHECKSIG_MD5|CHECKSIG_GPG)
+
+/** \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)
+ /*@modifies fileSystem @*/;
+
+/** \ingroup rpmcli
+ * Bit(s) to control rpmReSign() operation.
+ */
+typedef enum rpmResignFlags_e {
+ RESIGN_CHK_SIGNATURE = 0, /*!< from --checksig */
+ RESIGN_NEW_SIGNATURE, /*!< from --resign */
+ RESIGN_ADD_SIGNATURE /*!< from --addsign */
+} rpmResignFlags;
+
+/** \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,
+ /*@null@*/ const char ** argv)
+ /*@modifies fileSystem @*/;
+
+/** \ingroup rpmcli
* Describe signature command line request.
*/
struct rpmSignArguments_s {
int_32 tag, int_32 *type, void **p, int_32 *c)
/*@modifies *type, *p, *c @*/;
-/*@-redecl@*/
/**
* Automatically generated table of tag name/value pairs.
*/
+/*@-redecl@*/
extern const struct headerTagTableEntry rpmTagTable[];
+/*@=redecl@*/
/**
* Number of entries in rpmTagTable.
*/
+/*@-redecl@*/
extern const int rpmTagTableSize;
+/*@=redecl@*/
/**
* Table of query format extensions.
* @note Chains to headerDefaultFormats[].
*/
+/*@-redecl@*/
extern const struct headerSprintfExtension rpmHeaderFormats[];
/*@=redecl@*/
* Tags identify data in package headers.
* @note tags should not have value 0!
*/
-/*@-enummemuse -typeuse@*/
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 */
RPMTAG_SIGGPG = RPMTAG_SIG_BASE+6,
RPMTAG_SIGPGP5 = RPMTAG_SIG_BASE+7, /*!< internal */
+ RPMTAG_SHA1HEADER = RPMTAG_SIG_BASE+8,
+
RPMTAG_NAME = 1000,
RPMTAG_VERSION = 1001,
RPMTAG_RELEASE = 1002,
#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_FILEMD5S = 1035,
RPMTAG_FILELINKTOS = 1036,
RPMTAG_FILEFLAGS = 1037,
- RPMTAG_ROOT = 1038, /*!< obsolete */
+/*@-enummemuse@*/
+ RPMTAG_ROOT = 1038, /*!< internal - obsolete */
+/*@=enummemuse@*/
RPMTAG_FILEUSERNAME = 1039,
RPMTAG_FILEGROUPNAME = 1040,
- RPMTAG_EXCLUDE = 1041, /*!< internal - deprecated */
- RPMTAG_EXCLUSIVE = 1042, /*!< internal - deprecated */
+/*@-enummemuse@*/
+ RPMTAG_EXCLUDE = 1041, /*!< internal - obsolete */
+ RPMTAG_EXCLUSIVE = 1042, /*!< internal - obsolete */
+/*@=enummemuse@*/
RPMTAG_ICON = 1043,
RPMTAG_SOURCERPM = 1044,
RPMTAG_FILEVERIFYFLAGS = 1045,
RPMTAG_TRIGGERPOSTUN = 1102, /*!< internal */
RPMTAG_AUTOREQ = 1103, /*!< internal */
RPMTAG_AUTOPROV = 1104, /*!< internal */
+/*@-enummemuse@*/
RPMTAG_CAPABILITY = 1105, /*!< internal obsolete */
+/*@=enummemuse@*/
RPMTAG_SOURCEPACKAGE = 1106, /*!< internal */
- RPMTAG_OLDORIGFILENAMES = 1107, /*!< obsolete */
+/*@-enummemuse@*/
+ RPMTAG_OLDORIGFILENAMES = 1107, /*!< internal - obsolete */
+/*@=enummemuse@*/
RPMTAG_BUILDPREREQ = 1108, /*!< internal */
RPMTAG_BUILDREQUIRES = 1109, /*!< internal */
RPMTAG_BUILDCONFLICTS = 1110, /*!< internal */
- RPMTAG_BUILDMACROS = 1111,
+/*@-enummemuse@*/
+ RPMTAG_BUILDMACROS = 1111, /*!< internal */
+/*@=enummemuse@*/
RPMTAG_PROVIDEFLAGS = 1112,
RPMTAG_PROVIDEVERSION = 1113,
RPMTAG_OBSOLETEFLAGS = 1114,
RPMTAG_MULTILIBS = 1127,
RPMTAG_INSTALLTID = 1128,
RPMTAG_REMOVETID = 1129,
+/*@-enummemuse@*/
RPMTAG_FIRSTFREE_TAG /*!< internal */
+/*@=enummemuse@*/
} rpmTag;
-/*@=enummemuse =typeuse@*/
#define RPMTAG_EXTERNAL_TAG 1000000
/**
* File States (when installed).
*/
-/*@-typeuse@*/
-typedef enum rpmfileStates_e {
+typedef enum rpmfileState_e {
RPMFILE_STATE_NORMAL = 0,
RPMFILE_STATE_REPLACED = 1,
RPMFILE_STATE_NOTINSTALLED = 2,
RPMFILE_STATE_NETSHARED = 3
-} rpmfileStates;
-/*@=typeuse@*/
+} rpmfileState;
/**
* File Attributes.
*/
-/*@-typeuse@*/
typedef enum rpmfileAttrs_e {
+/*@-enummemuse@*/
+ RPMFILE_NONE = 0,
+/*@=enummemuse@*/
RPMFILE_CONFIG = (1 << 0), /*!< from %%config */
RPMFILE_DOC = (1 << 1), /*!< from %%doc */
/*@-enummemuse@*/
RPMFILE_README = (1 << 8), /*!< from %%readme */
RPMFILE_EXCLUDE = (1 << 9) /*!< from %%exclude */
} rpmfileAttrs;
-/*@=typeuse@*/
#define RPMFILE_MULTILIB_SHIFT 9
#define RPMFILE_MULTILIB(N) ((N) << RPMFILE_MULTILIB_SHIFT)
#define RPMFILE_MULTILIB_MASK RPMFILE_MULTILIB(7)
* @param prob rpm problem
* @return formatted string
*/
-/*@-redecl@*/
-/*@only@*/ extern const char * rpmProblemString(const rpmProblem prob) /*@*/;
+/*@-redecl@*/ /* LCL: is confused. */
+/*@only@*/ extern const char * rpmProblemString(const rpmProblem prob)
+ /*@*/;
/*@=redecl@*/
/**
/*@{*/
/**
* 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 type)
/**
* Prototype for headerGetEntry() vector.
+ * Will never return RPM_I18NSTRING_TYPE! RPM_STRING_TYPE elements with
+ * RPM_I18NSTRING_TYPE equivalent entries are translated (if HEADER_I18NTABLE
+ * 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, int_32 tag,
- /*@null@*/ /*@out@*/ int_32 * type,
+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.
*/
typedef struct rpmRelocation_s {
/** \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. */
/** \ingroup rpmcli
* Bit(s) for rpmVerifyFile() attributes and result.
+ * @todo Move to rpmcli.h.
*/
typedef enum rpmVerifyAttrs_e {
RPMVERIFY_NONE = 0, /*!< */
#define RPMVERIFY_ALL ~(RPMVERIFY_NONE)
/** \ingroup rpmcli
- * Verify file attributes and MD5 sum.
+ * Verify file attributes (including MD5 sum).
* @todo gnorpm and python bindings prevent this from being static.
- * @todo add rpmVerifyAttrs to prototype.
* @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 failure flags
+ * @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@*/ int * result, int omitMask);
+ /*@out@*/ rpmVerifyAttrs * result, rpmVerifyAttrs omitMask)
+ /*@modifies h, *result, fileSystem @*/;
/**
- * Return exit code from running verify script in header.
+ * Return exit code from running verify script from header.
* @todo gnorpm/kpackage prevents static, should be using VERIFY_SCRIPT flag.
* @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 scriptFd);
-
-/** \ingroup rpmcli
- * @param qva parsed query/verify options
- * @param db rpm database
- * @param h header to use for query/verify
- */
-typedef int (*QVF_t) (QVA_t qva, rpmdb db, Header h)
- /*@modifies db, fileSystem @*/;
-
-/** \ingroup rpmcli
- * Display query/verify information for each header in iterator.
- * @param qva parsed query/verify options
- * @param mi rpm database iterator
- * @param showPackage query/verify display routine
- * @return result of last non-zero showPackage() return
- */
-int showMatches(QVA_t qva, /*@only@*/ /*@null@*/ rpmdbMatchIterator mi,
- QVF_t showPackage)
- /*@modifies mi @*/;
-
-/** \ingroup rpmcli
- * Display list of tags that can be used in --queryformat.
- * @param fp file handle to use for display
- */
-void rpmDisplayQueryTags(FILE * fp)
- /*@modifies *fp, fileSystem @*/;
-
-/** \ingroup rpmcli
- * Common query/verify source interface, called once for each CLI arg.
- * @param qva parsed query/verify options
- * @param source type 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 NULL
- */
-int rpmQueryVerify(QVA_t qva, rpmQVSources source, const char * arg,
- rpmdb db, QVF_t showPackage)
- /*@modifies db, fileSystem @*/;
-
-/** \ingroup rpmcli
- * Display results of package query.
- * @todo Devise a meaningful return code.
- * @param qva parsed query/verify options
- * @param db rpm database (unused for queries)
- * @param h header to use for query
- * @return 0 always
- */
-int showQueryPackage(QVA_t qva, rpmdb db, Header h)
- /*@modifies db, fileSystem @*/;
-
-/** \ingroup rpmcli
- * Display package information.
- * @param qva parsed query/verify options
- * @param source type of source to query
- * @param arg name of source to query
- * @return rpmQueryVerify() result, or 1 on rpmdbOpen() failure
- */
-int rpmQuery(QVA_t qva, rpmQVSources source, const char * arg)
- /*@modifies fileSystem @*/;
-
-/** \ingroup rpmcli
- * Display results of package verify.
- * @param qva parsed query/verify options
- * @param db rpm database
- * @param h header to use for verify
- * @return result of last non-zero verify return
- */
-int showVerifyPackage(QVA_t qva, /*@only@*/ rpmdb db, Header h)
- /*@modifies db, h, fileSystem @*/;
-
-/** \ingroup rpmcli
- * Verify package install.
- * @param qva parsed query/verify options
- * @param source type of source to verify
- * @param arg name of source to verify
- * @return rpmQueryVerify() result, or 1 on rpmdbOpen() failure
- */
-int rpmVerify(QVA_t qva, rpmQVSources source, const char *arg)
- /*@modifies fileSystem @*/;
+int rpmVerifyScript(const char * rootDir, Header h, /*@null@*/ FD_t scriptFd)
+ /*@modifies h, scriptFd, fileSystem @*/;
/*@}*/
/* ==================================================================== */
/** \ingroup rpmcli
* Bit(s) to control rpmInstall() operation.
+ * @todo Move to rpmcli.h
*/
typedef enum rpmInstallInterfaceFlags_e {
INSTALL_NONE = 0,
} rpmInstallInterfaceFlags;
/** \ingroup rpmcli
- * Install/upgrade/freshen binary rpm package.
- * @param rootdir path to top of install tree
- * @param fileArgv array of package file names (NULL terminated)
- * @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,
- /*@null@*/ const char ** fileArgv,
- rpmtransFlags transFlags,
- rpmInstallInterfaceFlags interfaceFlags,
- rpmprobFilterFlags probFilter,
- /*@null@*/ rpmRelocation * relocations)
- /*@modifies *relocations, fileSystem @*/;
-
-/** \ingroup rpmcli
- * Install source rpm package.
- * @param rootdir path to top of install tree
- * @param arg source rpm file name
- * @retval specFile address of (installed) spec file name
- * @retval cookie
- * @return 0 on success
- */
-int rpmInstallSource(const char * rootdir, const char * arg,
- /*@null@*/ /*@out@*/ const char ** specFile,
- /*@null@*/ /*@out@*/ char ** cookie)
- /*@modifies *specFile, *cookie, fileSystem @*/;
-
-/** \ingroup rpmcli
* Bit(s) to control rpmErase() operation.
*/
typedef enum rpmEraseInterfaceFlags_e {
UNINSTALL_ALLMATCHES= (1 << 1) /*!< from --allmatches */
} rpmEraseInterfaceFlags;
-/** \ingroup rpmcli
- * Erase binary rpm package.
- * @param rootdir path to top of install tree
- * @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
- */
-int rpmErase(/*@null@*/ const char * rootdir, /*@null@*/ const char ** argv,
- rpmtransFlags transFlags,
- rpmEraseInterfaceFlags interfaceFlags)
- /*@modifies fileSystem @*/;
-
/*@}*/
/* ==================================================================== */
/** \name RPMK */
/** \ingroup signature
* Tags found in signature header from package.
*/
-/*@-enummemuse@*/
enum rpmtagSignature {
RPMSIGTAG_SIZE = 1000, /*!< Size in bytes. */
/* the md5 sum was broken *twice* on big endian machines */
RPMSIGTAG_GPG = 1005, /*!< GnuPG signature. */
RPMSIGTAG_PGP5 = 1006, /*!< PGP5 signature @deprecated legacy. */
+/*@-enummemuse@*/
/* Signature tags by Public Key Algorithm (RFC 2440) */
/* N.B.: These tags are tenative, the values may change */
RPMTAG_PK_BASE = 512, /*!< @todo Implement. */
RPMTAG_HASH_MD2 = RPMTAG_HASH_BASE+5, /*!< (unused) */
RPMTAG_HASH_TIGER192= RPMTAG_HASH_BASE+6, /*!< (unused) */
RPMTAG_HASH_HAVAL_5_160= RPMTAG_HASH_BASE+7 /*!< (unused) */
-};
/*@=enummemuse@*/
+};
/**
* Return codes from verifySignature().
/*@null@*/ Header rpmFreeSignature(/*@null@*/ /*@killref@*/ Header h)
/*@modifies h @*/;
-/* --- checksig/resign */
-
-/** \ingroup rpmcli
- * Bit(s) to control rpmCheckSig() operation.
- */
-typedef enum rpmCheckSigFlags_e {
-/*@-enummemuse@*/
- CHECKSIG_NONE = 0, /*!< Don't check any signatures. */
-/*@=enummemuse@*/
- CHECKSIG_PGP = (1 << 0), /*!< if not --nopgp */
- CHECKSIG_MD5 = (1 << 1), /*!< if not --nomd5 */
- CHECKSIG_GPG = (1 << 2) /*!< if not --nogpg */
-} rpmCheckSigFlags;
-#define CHECKSIG_ALL (CHECKSIG_PGP|CHECKSIG_MD5|CHECKSIG_GPG)
-
-/** \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)
- /*@modifies fileSystem @*/;
-
-/** \ingroup rpmcli
- * Bit(s) to control rpmReSign() operation.
- */
-typedef enum rpmResignFlags_e {
- RESIGN_CHK_SIGNATURE = 0, /*!< from --checksig */
- RESIGN_NEW_SIGNATURE, /*!< from --resign */
- RESIGN_ADD_SIGNATURE /*!< from --addsign */
-} rpmResignFlags;
-
-/** \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,
- /*@null@*/ const char ** argv)
- /*@modifies fileSystem @*/;
-
/*@}*/
#ifdef __cplusplus
/*@modifies ts, fi, alp, origH, actions @*/
{
HGE_t hge = fi->hge;
+ HAE_t hae = fi->hae;
+ HME_t hme = fi->hme;
HFD_t hfd = (fi->hfd ? fi->hfd : headerFreeData);
static int _printed = 0;
rpmProblemSet probs = ts->probs;
rpmRelocation * relocations = NULL;
int numRelocations;
const char ** validRelocations;
- int_32 validType;
+ rpmTagType validType;
int numValid;
const char ** baseNames;
const char ** dirNames;
if (rawRelocations == NULL || numRelocations == 0) {
if (numValid) {
if (!headerIsEntry(origH, RPMTAG_INSTPREFIXES))
- (void) headerAddEntry(origH, RPMTAG_INSTPREFIXES,
+ (void) hae(origH, RPMTAG_INSTPREFIXES,
validType, validRelocations, numValid);
validRelocations = hfd(validRelocations, validType);
}
}
if (numActual)
- (void) headerAddEntry(h, RPMTAG_INSTPREFIXES, RPM_STRING_ARRAY_TYPE,
+ (void) hae(h, RPMTAG_INSTPREFIXES, RPM_STRING_ARRAY_TYPE,
(void **) actualRelocations, numActual);
actualRelocations = _free(actualRelocations);
if (nrelocated) {
int c;
void * p;
- int t;
+ rpmTagType t;
p = NULL;
(void) hge(h, RPMTAG_BASENAMES, &t, &p, &c);
- (void) headerAddEntry(h, RPMTAG_ORIGBASENAMES, t, p, c);
+ (void) hae(h, RPMTAG_ORIGBASENAMES, t, p, c);
p = hfd(p, t);
p = NULL;
(void) hge(h, RPMTAG_DIRNAMES, &t, &p, &c);
- (void) headerAddEntry(h, RPMTAG_ORIGDIRNAMES, t, p, c);
+ (void) hae(h, RPMTAG_ORIGDIRNAMES, t, p, c);
p = hfd(p, t);
p = NULL;
(void) hge(h, RPMTAG_DIRINDEXES, &t, &p, &c);
- (void) headerAddEntry(h, RPMTAG_ORIGDIRINDEXES, t, p, c);
+ (void) hae(h, RPMTAG_ORIGDIRINDEXES, t, p, c);
p = hfd(p, t);
- (void) headerModifyEntry(h, RPMTAG_BASENAMES, RPM_STRING_ARRAY_TYPE,
+ (void) hme(h, RPMTAG_BASENAMES, RPM_STRING_ARRAY_TYPE,
baseNames, fileCount);
fi->bnl = hfd(fi->bnl, RPM_STRING_ARRAY_TYPE);
(void) hge(h, RPMTAG_BASENAMES, NULL, (void **) &fi->bnl, &fi->fc);
- (void) headerModifyEntry(h, RPMTAG_DIRNAMES, RPM_STRING_ARRAY_TYPE,
+ (void) hme(h, RPMTAG_DIRNAMES, RPM_STRING_ARRAY_TYPE,
dirNames, dirCount);
fi->dnl = hfd(fi->dnl, RPM_STRING_ARRAY_TYPE);
(void) hge(h, RPMTAG_DIRNAMES, NULL, (void **) &fi->dnl, &fi->dc);
- (void) headerModifyEntry(h, RPMTAG_DIRINDEXES, RPM_INT32_TYPE,
+ (void) hme(h, RPMTAG_DIRINDEXES, RPM_INT32_TYPE,
dirIndexes, fileCount);
(void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &fi->dil, NULL);
}
{
HGE_t hge = fi->hge;
HFD_t hfd = (fi->hfd ? fi->hfd : headerFreeData);
- int oltype, omtype;
+ rpmTagType oltype, omtype;
Header h;
int i;
const char ** otherMd5s;
#define S_ISDEV(m) (S_ISBLK((m)) || S_ISCHR((m)))
+#ifdef DYING
#define POPT_NODEPS 1000
#define POPT_NOFILES 1001
#define POPT_NOMD5 1002
static int noFiles = 0;
static int noMd5 = 0;
static int noScripts = 0;
+#endif /* DYING */
-/** */
+/**
+ * Verify mode options.
+ */
struct poptOption rpmVerifyPoptTable[] = {
+#ifdef DYING
{ NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA,
verifyArgCallback, 0, NULL, NULL },
+#endif /* DYING */
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmQVSourcePoptTable, 0,
NULL, NULL },
- { "nodeps", '\0', 0, &noDeps, POPT_NODEPS,
- N_("do not verify package dependencies"),
- NULL },
- { "nofiles", '\0', 0, &noFiles, POPT_NOFILES,
- N_("don't verify files in package"),
- NULL},
- { "nomd5", '\0', 0, &noMd5, POPT_NOMD5,
- N_("do not verify file md5 checksums"),
- NULL },
- { "noscripts", '\0', 0, &noScripts, POPT_NOSCRIPTS,
- N_("do not execute %verifyscript (if any)"),
- NULL },
+ { "nodeps", '\0', POPT_BIT_SET, &rpmQVArgs.qva_flags, VERIFY_DEPS,
+ N_("do not verify package dependencies"), NULL },
+ { "nofiles", '\0', POPT_BIT_SET, &rpmQVArgs.qva_flags, VERIFY_FILES,
+ N_("don't verify files in package"), NULL},
+ { "nomd5", '\0', POPT_BIT_SET, &rpmQVArgs.qva_flags, VERIFY_MD5,
+ N_("do not verify file md5 checksums"), NULL },
+ { "noscripts", '\0', POPT_BIT_SET, &rpmQVArgs.qva_flags, VERIFY_SCRIPT,
+ N_("do not execute %verifyscript (if any)"), NULL },
+ { "nodigest", '\0', POPT_BIT_SET, &rpmQVArgs.qva_flags, VERIFY_DIGEST,
+ N_("do not execute %verifyscript (if any)"), NULL },
POPT_TABLEEND
};
-/* ======================================================================== */
int rpmVerifyFile(const char * root, Header h, int filenum,
- int * result, int omitMask)
+ rpmVerifyAttrs * result, rpmVerifyAttrs omitMask)
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
+ int_32 * fileFlags;
+ rpmfileAttrs fileAttrs = RPMFILE_NONE;
int_32 * verifyFlags;
- rpmVerifyAttrs flags;
+ rpmVerifyAttrs flags = RPMVERIFY_ALL;
unsigned short * modeList;
const char * fileStatesList;
- char * filespec;
+ const char * filespec = NULL;
int count;
int rc;
struct stat sb;
if (IS_BIG_ENDIAN()) { /* XXX was ifdef WORDS_BIGENDIAN */
int_32 * brokenPtr;
if (!hge(h, RPMTAG_BROKENMD5, NULL, (void **) &brokenPtr, NULL)) {
+ HAE_t hae = (HAE_t)headerAddEntry;
const char * rpmVersion;
if (hge(h, RPMTAG_RPMVERSION, NULL, (void **) &rpmVersion, NULL)) {
} else {
useBrokenMd5 = 1;
}
- (void) headerAddEntry(h, RPMTAG_BROKENMD5, RPM_INT32_TYPE,
- &useBrokenMd5, 1);
+ (void) hae(h, RPMTAG_BROKENMD5, RPM_INT32_TYPE, &useBrokenMd5, 1);
} else {
useBrokenMd5 = *brokenPtr;
}
}
(void) hge(h, RPMTAG_FILEMODES, NULL, (void **) &modeList, &count);
+ if (hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &fileFlags, NULL))
+ fileAttrs = fileFlags[filenum];
- if (hge(h, RPMTAG_FILEVERIFYFLAGS, NULL, (void **) &verifyFlags, NULL)) {
+ if (hge(h, RPMTAG_FILEVERIFYFLAGS, NULL, (void **) &verifyFlags, NULL))
flags = verifyFlags[filenum];
- } else {
- flags = RPMVERIFY_ALL;
- }
- {
+ {
const char ** baseNames;
const char ** dirNames;
int_32 * dirIndexes;
- int bnt, dnt;
+ rpmTagType bnt, dnt;
- (void) hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, NULL);
- (void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
- (void) hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL);
-
- filespec = alloca(strlen(dirNames[dirIndexes[filenum]]) +
+ if (hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, NULL)
+ && hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL)
+ && hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL))
+ {
+ int nb = (strlen(dirNames[dirIndexes[filenum]]) +
strlen(baseNames[filenum]) + strlen(root) + 5);
- sprintf(filespec, "%s/%s%s", root, dirNames[dirIndexes[filenum]],
- baseNames[filenum]);
+ char * t = alloca(nb);
+ filespec = t;
+ *t = '\0';
+ t = stpcpy(t, root);
+ *t++ = '/';
+ t = stpcpy(t, dirNames[dirIndexes[filenum]]);
+ t = stpcpy(t, baseNames[filenum]);
+ }
baseNames = hfd(baseNames, bnt);
dirNames = hfd(dirNames, dnt);
}
-
- *result = 0;
- /* Check to see if the file was installed - if not pretend all is OK */
+ *result = RPMVERIFY_NONE;
+
+ /*
+ * Check to see if the file was installed - if not pretend all is OK.
+ */
if (hge(h, RPMTAG_FILESTATES, NULL, (void **) &fileStatesList, NULL) &&
fileStatesList != NULL)
{
- if (fileStatesList[filenum] == RPMFILE_STATE_NOTINSTALLED)
+ rpmfileState fstate = fileStatesList[filenum];
+ switch (fstate) {
+ case RPMFILE_STATE_NETSHARED:
+ case RPMFILE_STATE_REPLACED:
+ case RPMFILE_STATE_NOTINSTALLED:
return 0;
+ /*@notreached@*/ break;
+ case RPMFILE_STATE_NORMAL:
+ break;
+ }
}
- if (lstat(filespec, &sb)) {
+ if (filespec == NULL || Lstat(filespec, &sb) != 0) {
*result |= RPMVERIFY_LSTATFAIL;
return 1;
}
+ /*
+ * Not all attributes of non-regular files can be verified.
+ */
if (S_ISDIR(sb.st_mode))
flags &= ~(RPMVERIFY_MD5 | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME |
RPMVERIFY_LINKTO);
else if (S_ISLNK(sb.st_mode)) {
flags &= ~(RPMVERIFY_MD5 | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME |
RPMVERIFY_MODE);
-# if CHOWN_FOLLOWS_SYMLINK
+#if CHOWN_FOLLOWS_SYMLINK
flags &= ~(RPMVERIFY_USER | RPMVERIFY_GROUP);
-# endif
+#endif
}
else if (S_ISFIFO(sb.st_mode))
flags &= ~(RPMVERIFY_MD5 | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME |
else
flags &= ~(RPMVERIFY_LINKTO);
- /* Don't verify any features in omitMask */
+ /*
+ * Content checks of %ghost files are meaningless.
+ */
+ if (fileAttrs & RPMFILE_GHOST) {
+ flags &= ~(RPMVERIFY_MD5 | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME |
+ RPMVERIFY_LINKTO);
+ }
+
+ /*
+ * Don't verify any features in omitMask.
+ */
flags &= ~(omitMask | RPMVERIFY_LSTATFAIL|RPMVERIFY_READFAIL|RPMVERIFY_READLINKFAIL);
if (flags & RPMVERIFY_MD5) {
unsigned char md5sum[40];
const char ** md5List;
- int mdt;
+ rpmTagType mdt;
if (!hge(h, RPMTAG_FILEMD5S, &mdt, (void **) &md5List, NULL))
*result |= RPMVERIFY_MD5;
char linkto[1024];
int size = 0;
const char ** linktoList;
- int ltt;
+ rpmTagType ltt;
if (!hge(h, RPMTAG_FILELINKTOS, <t, (void **) &linktoList, NULL)
- || (size = readlink(filespec, linkto, sizeof(linkto)-1) == -1))
+ || (size = Readlink(filespec, linkto, sizeof(linkto)-1)) == -1)
*result |= (RPMVERIFY_READLINKFAIL|RPMVERIFY_LINKTO);
- else {
+ else {
linkto[size] = '\0';
if (strcmp(linkto, linktoList[filenum]))
*result |= RPMVERIFY_LINKTO;
const char * name;
const char ** unameList;
int_32 * uidList;
- int unt;
+ rpmTagType unt;
if (hge(h, RPMTAG_FILEUSERNAME, &unt, (void **) &unameList, NULL)) {
name = uidToUname(sb.st_uid);
if (flags & RPMVERIFY_GROUP) {
const char ** gnameList;
int_32 * gidList;
- int gnt;
+ rpmTagType gnt;
gid_t gid;
if (hge(h, RPMTAG_FILEGROUPNAME, &gnt, (void **) &gnameList, NULL)) {
return rc;
}
-/* ======================================================================== */
+/**
+ * Check original header digest.
+ * @todo Make digest check part of rpmdb iterator.
+ * @param h header
+ * @return 0 on succes, 1 digest mismatch
+ */
+static int verifyDigest(Header h)
+ /*@modifies nothing @*/
+{
+ HGE_t hge = (HGE_t)headerGetEntry; /* XXX headerGetEntryMinMemory? */
+ HFD_t hfd = headerFreeData;
+ void * uh = NULL;
+ rpmTagType uht;
+ int_32 uhc;
+ const char * hdigest;
+ rpmTagType hdt;
+ int ec = 0; /* assume no problems */
+
+ /* Retrieve header digest. */
+ if (!hge(h, RPMTAG_SHA1HEADER, &hdt, (void **) &hdigest, NULL))
+ return 0;
+ if (hdigest == NULL)
+ return 0;
+
+ /* Regenerate original header. */
+ if (!hge(h, RPMTAG_HEADERIMMUTABLE, &uht, &uh, &uhc))
+ return 0;
+
+ /* Compute header digest. */
+ { const char * digest;
+ size_t digestlen;
+ int flags = RPMDIGEST_SHA1;
+ DIGEST_CTX ctx = rpmDigestInit(flags);
+
+ rpmDigestUpdate(ctx, uh, uhc);
+ rpmDigestFinal(ctx, (void **)&digest, &digestlen, 1);
+
+ if (digest) { /* XXX can't happen */
+ const char *n, *v, *r;
+ headerNVR(h, &n, &v, &r);
+ if (strcmp(hdigest, digest)) {
+ rpmMessage(RPMMESS_NORMAL,
+ _("%s-%s-%s: immutable header region digest check failed\n"),
+ n, v, r);
+ ec = 1;
+ }
+ }
+ digest = _free(digest);
+ }
+
+ uh = hfd(uh, uht);
+ hdigest = hfd(hdigest, hdt);
+
+ return ec;
+}
+
/**
* Check file info from header against what's actually installed.
* @param h header
* @return 0 no problems, 1 problems found
*/
static int verifyHeader(QVA_t qva, Header h)
- /*@*/
+ /*@modifies h @*/
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
char buf[BUFSIZ];
rpmBuildFileList(h, &fileNames, &count);
for (i = 0; i < count; i++) {
+ rpmfileAttrs fileAttrs;
int rc;
+ fileAttrs = fileFlags[i];
rc = rpmVerifyFile(prefix, h, i, &verifyResult, omitMask);
if (rc) {
- if (!(fileFlags[i] & RPMFILE_MISSINGOK) || rpmIsVerbose()) {
+ if (!(fileAttrs & RPMFILE_MISSINGOK) || rpmIsVerbose()) {
sprintf(te, _("missing %s"), fileNames[i]);
te += strlen(te);
ec = rc;
#undef _verifyfile
sprintf(te, "%s%s%s%s%s%s%s%s %c %s",
- size, mode, md5, rdev, link, user, group, mtime,
- fileFlags[i] & RPMFILE_CONFIG ? 'c' : ' ',
- fileNames[i]);
+ size, mode, md5, rdev, link, user, group, mtime,
+ ((fileAttrs & RPMFILE_CONFIG) ? 'c' :
+ (fileAttrs & RPMFILE_DOC) ? 'd' :
+ (fileAttrs & RPMFILE_GHOST) ? 'g' :
+ (fileAttrs & RPMFILE_LICENSE) ? 'l' :
+ (fileAttrs & RPMFILE_README) ? 'r' : ' '),
+ fileNames[i]);
te += strlen(te);
}
rpmtransFree(rpmdep);
if (numConflicts) {
- const char * name, * version, * release;
+ const char *n, *v, *r;
char * t, * te;
int nb = 512;
- (void) headerNVR(h, &name, &version, &release);
+ (void) headerNVR(h, &n, &v, &r);
for (i = 0; i < numConflicts; i++) {
nb += strlen(conflicts[i].needsName) + sizeof(", ") - 1;
}
te = t = alloca(nb);
*te = '\0';
- sprintf(te, _("Unsatisfied dependencies for %s-%s-%s: "),
- name, version, release);
+ sprintf(te, _("Unsatisfied dependencies for %s-%s-%s: "), n, v, r);
te += strlen(te);
for (i = 0; i < numConflicts; i++) {
if (i) te = stpcpy(te, ", ");
int showVerifyPackage(QVA_t qva, rpmdb rpmdb, Header h)
{
const char * prefix = (qva->qva_prefix ? qva->qva_prefix : "");
- FD_t fdo;
int ec = 0;
int rc;
- if ((qva->qva_flags & VERIFY_DEPS) &&
- (rc = verifyDependencies(rpmdb, h)) != 0)
+ if (qva->qva_flags & VERIFY_DIGEST) {
+ if ((rc = verifyDigest(h)) != 0)
+ ec = rc;
+ }
+ if (qva->qva_flags & VERIFY_DEPS) {
+ if ((rc = verifyDependencies(rpmdb, h)) != 0)
ec = rc;
- if ((qva->qva_flags & VERIFY_FILES) &&
- (rc = verifyHeader(qva, h)) != 0)
- ec = rc;;
- fdo = fdDup(STDOUT_FILENO);
- if ((qva->qva_flags & VERIFY_SCRIPT) &&
- (rc = rpmVerifyScript(prefix, h, fdo)) != 0)
+ }
+ if (qva->qva_flags & VERIFY_FILES) {
+ if ((rc = verifyHeader(qva, h)) != 0)
ec = rc;
- if (fdo)
- rc = Fclose(fdo);
+ }
+ if (qva->qva_flags & VERIFY_SCRIPT) {
+ FD_t fdo = fdDup(STDOUT_FILENO);
+ if ((rc = rpmVerifyScript(prefix, h, fdo)) != 0)
+ ec = rc;
+ if (fdo)
+ rc = Fclose(fdo);
+ }
return ec;
}
-int rpmVerify(QVA_t qva, rpmQVSources source, const char *arg)
+int rpmVerify(QVA_t qva, rpmQVSources source, const char * arg)
{
rpmdb rpmdb = NULL;
int rc;
#include <locale.h>
#include "Python.h"
-#include "rpmlib.h"
+#include "rpmcli.h" /* XXX for rpmCheckSig */
#include "misc.h"
#include "rpmmacro.h"
#include "rpmio_internal.h"
break;
case MODE_VERIFY:
- verifyFlags = (VERIFY_FILES|VERIFY_DEPS|VERIFY_SCRIPT|VERIFY_MD5);
+ verifyFlags = VERIFY_ALL;
verifyFlags &= ~qva->qva_flags;
if (noDeps) verifyFlags &= ~VERIFY_DEPS;
if (noScripts) verifyFlags &= ~VERIFY_SCRIPT;
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
const char ** baseNames, ** dirNames;
- int bnt, dnt;
+ rpmTagType bnt, dnt;
int_32 * dirIndexes;
int fileCount;
HFD_t hfd = headerFreeData;
const char * dirName;
const char * baseName;
- int bnt, dnt;
+ rpmTagType bnt, dnt;
fingerPrintCache fpc;
fingerPrint fp1;
dbiIndex dbi = NULL;
DBC * dbcursor = NULL;
const char *av[1];
const char ** rpmvals = NULL;
- int rpmtype = 0;
+ rpmTagType rpmtype = 0;
int rpmcnt = 0;
int rpmtag;
int xx;
HFD_t hfd = headerFreeData;
sigset_t signalMask;
const char ** baseNames;
- int bnt;
+ rpmTagType bnt;
int count = 0;
dbiIndex dbi;
int dbix;
DBC * dbcursor = NULL;
const char *av[1];
const char **rpmvals = NULL;
- int rpmtype = 0;
+ rpmTagType rpmtype = 0;
int rpmcnt = 0;
int rpmtag;
int_32 * requireFlags;
const char ** dirNames;
const char ** baseNames;
const char ** fullBaseNames;
- int bnt, dnt;
+ rpmTagType bnt, dnt;
int_32 * dirIndexes;
int_32 * fullDirIndexes;
fingerPrint * fps;
/**
* Tokens used by rpmError().
*/
-/*@-enummemuse -typeuse @*/
+/*@-typeuse @*/
typedef enum rpmerrCode_e {
+/*@-enummemuse@*/
RPMERR_GDBMOPEN = _em(2), /*!< gdbm open failed */
RPMERR_GDBMREAD = _em(3), /*!< gdbm read failed */
RPMERR_GDBMWRITE = _em(4), /*!< gdbm write failed */
+/*@=enummemuse@*/
RPMERR_INTERNAL = _em(5), /*!< internal RPM error */
RPMERR_DBCORRUPT = _em(6), /*!< rpm database is corrupt */
+/*@-enummemuse@*/
RPMERR_OLDDBCORRUPT = _em(7), /*!< old style rpm database is corrupt */
RPMERR_OLDDBMISSING = _em(8), /*!< old style rpm database is missing */
RPMERR_NOCREATEDB = _em(9), /*!< cannot create new database */
+/*@=enummemuse@*/
RPMERR_DBOPEN = _em(10), /*!< database open failed */
RPMERR_DBGETINDEX = _em(11), /*!< database get from index failed */
RPMERR_DBPUTINDEX = _em(12), /*!< database get from index failed */
RPMERR_RENAME = _em(15), /*!< rename(2) failed */
RPMERR_UNLINK = _em(16), /*!< unlink(2) failed */
RPMERR_RMDIR = _em(17), /*!< rmdir(2) failed */
+/*@-enummemuse@*/
RPMERR_PKGINSTALLED = _em(18), /*!< package already installed */
RPMERR_CHOWN = _em(19), /*!< chown() call failed */
RPMERR_NOUSER = _em(20), /*!< user does not exist */
RPMERR_NOGROUP = _em(21), /*!< group does not exist */
+/*@=enummemuse@*/
RPMERR_MKDIR = _em(22), /*!< mkdir() call failed */
+/*@-enummemuse@*/
RPMERR_FILECONFLICT = _em(23), /*!< file being installed exists */
+/*@=enummemuse@*/
RPMERR_RPMRC = _em(24), /*!< bad line in rpmrc */
RPMERR_NOSPEC = _em(25), /*!< .spec file is missing */
RPMERR_NOTSRPM = _em(26), /*!< a source rpm was expected */
RPMERR_FLOCK = _em(27), /*!< locking the database failed */
+/*@-enummemuse@*/
RPMERR_OLDPACKAGE = _em(28), /*!< trying upgrading to old version */
/* RPMERR_BADARCH = _em(29), bad architecture or arch mismatch */
+/*@=enummemuse@*/
RPMERR_CREATE = _em(30), /*!< failed to create a file */
RPMERR_NOSPACE = _em(31), /*!< out of disk space */
+/*@-enummemuse@*/
RPMERR_NORELOCATE = _em(32), /*!< tried to do improper relocatation */
/* RPMERR_BADOS = _em(33), bad architecture or arch mismatch */
RPMMESS_BACKUP = _em(34), /*!< backup made during [un]install */
+/*@=enummemuse@*/
RPMERR_MTAB = _em(35), /*!< failed to read mount table */
RPMERR_STAT = _em(36), /*!< failed to stat something */
RPMERR_BADDEV = _em(37), /*!< file on device not listed in mtab */
+/*@-enummemuse@*/
RPMMESS_ALTNAME = _em(38), /*!< file written as .rpmnew */
RPMMESS_PREREQLOOP = _em(39), /*!< loop in prerequisites */
RPMERR_BADRELOCATE = _em(40), /*!< bad relocation was specified */
+/*@=enummemuse@*/
RPMERR_OLDDB = _em(41), /*!< old format database */
RPMERR_UNMATCHEDIF = _em(107), /*!< unclosed %ifarch or %ifos */
RPMERR_BADARG = _em(109), /*!< */
RPMERR_SCRIPT = _em(110), /*!< errors related to script exec */
RPMERR_READ = _em(111), /*!< */
+/*@-enummemuse@*/
RPMERR_UNKNOWNOS = _em(112), /*!< */
RPMERR_UNKNOWNARCH = _em(113), /*!< */
+/*@=enummemuse@*/
RPMERR_EXEC = _em(114), /*!< */
RPMERR_FORK = _em(115), /*!< */
RPMERR_CPIO = _em(116), /*!< */
+/*@-enummemuse@*/
RPMERR_GZIP = _em(117), /*!< */
+/*@=enummemuse@*/
RPMERR_BADSPEC = _em(118), /*!< */
+/*@-enummemuse@*/
RPMERR_LDD = _em(119), /*!< couldn't understand ldd output */
+/*@=enummemuse@*/
RPMERR_BADFILENAME = _em(120), /*!< */
RPMERR_OPEN = _em(121), /*!< */
RPMERR_POPEN = _em(122), /*!< */
RPMERR_QFMT = _em(125), /*!< */
RPMERR_DBCONFIG = _em(126), /*!< */
RPMERR_DBERR = _em(127), /*!< */
+/*@-enummemuse@*/
RPMERR_BADPACKAGE = _em(128), /*!< getNextHeader: %s */
+/*@=enummemuse@*/
RPMERR_FREELIST = _em(129), /*!< free list corrupt (%u)- please ... */
RPMERR_DATATYPE = _em(130), /*!< Data type %d not supported */
RPMERR_BUILDROOT = _em(131), /*!< */
RPMERR_QUERYINFO = _nm(137), /*!< */
RPMERR_MANIFEST = _nm(138), /*!< %s: read manifest failed: %s */
RPMERR_BADHEADER = _em(139), /*!< */
+ RPMERR_FSEEK = _em(140), /*!< %s: Fseek failed: %s */
RPMERR_BADSIGTYPE = _em(200), /*!< Unknown signature type */
RPMERR_SIGGEN = _em(201), /*!< Error generating signature */
RPMWARN_RMDIR = _wm(512u+17), /*!< rmdir(2) failed */
RPMWARN_FLOCK = _wm(512u+27) /*!< locking the database failed */
} rpmerrCode;
-/*@=enummemuse =typeuse @*/
+/*@=typeuse @*/
/**
* Retrofit rpmError() onto rpmlog sub-system.
#define GETOPT_RECOMPILE 1004
#endif
-#ifdef DYING
-#ifdef IAM_RPMDB
-#define GETOPT_REBUILDDB 1013
-#define GETOPT_VERIFYDB 1023
-static int initdb = 0;
-#endif
-#endif
-
-#ifdef DYING
-#ifdef IAM_RPMEIU
-#define GETOPT_INSTALL 1014
-#define GETOPT_RELOCATE 1016
-#define GETOPT_EXCLUDEPATH 1019
-static int incldocs = 0;
-/*@null@*/ static const char * prefix = NULL;
-#endif /* IAM_RPMEIU */
-#endif
-
-#ifdef DYING
-#ifdef IAM_RPMK
-#define GETOPT_ADDSIGN 1005
-#define GETOPT_RESIGN 1006
-static int noGpg = 0;
-static int noPgp = 0;
-#endif /* IAM_RPMK */
-#endif
-
#if defined(IAM_RPMBT) || defined(IAM_RPMK)
#include "signature.h"
#endif
extern int noLibio;
extern int _rpmio_debug;
extern int _url_debug;
-#ifdef DYING
-extern int _noDirTokens;
-#endif
/*@-varuse@*/
/*@observer@*/ extern const char * rpmNAME;
static int showrc = 0;
static int showVersion = 0;
-#ifdef DYING
-#if defined(IAM_RPMQV) || defined(IAM_RPMK)
-static int noMd5 = 0;
-#endif
-#endif
-
-#ifdef DYING
-#if defined(IAM_RPMEIU)
-static int noDeps = 0;
-static int force = 0;
-#endif
-#endif
-
static struct poptOption rpmAllPoptTable[] = {
{ "version", '\0', 0, &showVersion, 0,
N_("print the version of rpm being used"),
POPT_TABLEEND
};
-#ifdef DYING
-#ifdef IAM_RPMDB
-static struct poptOption rpmDatabasePoptTable[] = {
- { "initdb", '\0', 0, &initdb, 0,
- N_("initialize database"), NULL},
- { "rebuilddb", '\0', 0, 0, GETOPT_REBUILDDB,
- N_("rebuild database inverted lists from installed package headers"),
- NULL},
- { "verifydb", '\0', POPT_ARGFLAG_DOC_HIDDEN, 0, GETOPT_VERIFYDB,
- N_("verify database files"),
- NULL},
- { "nodirtokens", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_noDirTokens, 1,
- N_("generate headers compatible with (legacy) rpm[23] packaging"),
- NULL},
- { "dirtokens", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_noDirTokens, 0,
- N_("generate headers compatible with rpm4 packaging"), NULL},
-
- POPT_TABLEEND
-};
-#endif /* IAM_RPMDB */
-#endif
-
-#ifdef DYING
-#ifdef IAM_RPMK
-static struct poptOption rpmSignPoptTable[] = {
- { "addsign", '\0', 0, 0, GETOPT_ADDSIGN,
- N_("add a signature to a package"), NULL },
- { "resign", '\0', 0, 0, GETOPT_RESIGN,
- N_("sign a package (discard current signature)"), NULL },
- { "sign", '\0', 0, &signIt, 0,
- N_("generate GPG/PGP signature"), NULL },
- { "checksig", 'K', 0, 0, 'K',
- N_("verify package signature"), NULL },
- { "nogpg", '\0', 0, &noGpg, 0,
- N_("skip any GPG signatures"), NULL },
- { "nopgp", '\0', POPT_ARGFLAG_DOC_HIDDEN, &noPgp, 0,
- N_("skip any PGP signatures"), NULL },
- { "nomd5", '\0', 0, &noMd5, 0,
- N_("do not verify file md5 checksums"), NULL },
-
- POPT_TABLEEND
-};
-#endif /* IAM_RPMK */
-#endif
-
-#ifdef DYING
-#ifdef IAM_RPMEIU
-static rpmtransFlags transFlags = RPMTRANS_FLAG_NONE;
-static rpmprobFilterFlags probFilter = RPMPROB_FILTER_NONE;
-static rpmInstallInterfaceFlags installInterfaceFlags = INSTALL_NONE;
-static rpmEraseInterfaceFlags eraseInterfaceFlags = UNINSTALL_NONE;
-
-static struct poptOption rpmInstallPoptTable[] = {
- { "allfiles", '\0', POPT_BIT_SET, &transFlags, RPMTRANS_FLAG_ALLFILES,
- N_("install all files, even configurations which might otherwise be skipped"),
- NULL},
- { "allmatches", '\0', POPT_BIT_SET, &eraseInterfaceFlags, UNINSTALL_ALLMATCHES,
- N_("remove all packages which match <package> (normally an error is generated if <package> specified multiple packages)"),
- NULL},
-
- { "apply", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &transFlags,
- (_noTransScripts|_noTransTriggers|
- RPMTRANS_FLAG_APPLYONLY|RPMTRANS_FLAG_PKGCOMMIT),
- N_("do not execute package scriptlet(s)"), NULL },
-
- { "badreloc", '\0', POPT_BIT_SET, &probFilter, RPMPROB_FILTER_FORCERELOCATE,
- N_("relocate files in non-relocateable package"), NULL},
- { "dirstash", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &transFlags,
- RPMTRANS_FLAG_DIRSTASH,
- N_("save erased package files by renaming into sub-directory"), NULL},
- { "erase", 'e', 0, 0, 'e',
- N_("erase (uninstall) package"), N_("<package>+") },
- { "excludedocs", '\0', POPT_BIT_SET, &transFlags, RPMTRANS_FLAG_NODOCS,
- N_("do not install documentation"), NULL},
- { "excludepath", '\0', POPT_ARG_STRING, 0, GETOPT_EXCLUDEPATH,
- N_("skip files with leading component <path> "),
- N_("<path>") },
- { "force", '\0', 0, &force, 0,
- N_("short hand for --replacepkgs --replacefiles"), NULL},
- { "freshen", 'F', POPT_BIT_SET, &installInterfaceFlags,
- (INSTALL_UPGRADE|INSTALL_FRESHEN),
- N_("upgrade package(s) if already installed"),
- N_("<packagefile>+") },
- { "hash", 'h', POPT_BIT_SET, &installInterfaceFlags, INSTALL_HASH,
- N_("print hash marks as package installs (good with -v)"), NULL},
- { "ignorearch", '\0', POPT_BIT_SET, &probFilter, RPMPROB_FILTER_IGNOREARCH,
- N_("don't verify package architecture"), NULL},
- { "ignoreos", '\0', POPT_BIT_SET, &probFilter, RPMPROB_FILTER_IGNOREOS,
- N_("don't verify package operating system"), NULL},
- { "ignoresize", '\0', POPT_BIT_SET, &probFilter,
- (RPMPROB_FILTER_DISKSPACE|RPMPROB_FILTER_DISKNODES),
- N_("don't check disk space before installing"), NULL},
- { "includedocs", '\0', 0, &incldocs, 0,
- N_("install documentation"), NULL},
- { "install", '\0', 0, 0, GETOPT_INSTALL,
- N_("install package"), N_("<packagefile>+") },
- { "justdb", '\0', POPT_BIT_SET, &transFlags, RPMTRANS_FLAG_JUSTDB,
- N_("update the database, but do not modify the filesystem"), NULL},
- { "nodeps", '\0', 0, &noDeps, 0,
- N_("do not verify package dependencies"), NULL },
- { "noorder", '\0', POPT_BIT_SET, &installInterfaceFlags, INSTALL_NOORDER,
- N_("do not reorder package installation to satisfy dependencies"),
- NULL},
-
- { "noscripts", '\0', POPT_BIT_SET, &transFlags,
- (_noTransScripts|_noTransTriggers),
- N_("do not execute package scriptlet(s)"), NULL },
- { "nopre", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &transFlags,
- RPMTRANS_FLAG_NOPRE,
- N_("do not execute %%pre scriptlet (if any)"), NULL },
- { "nopost", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &transFlags,
- RPMTRANS_FLAG_NOPOST,
- N_("do not execute %%post scriptlet (if any)"), NULL },
- { "nopreun", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &transFlags,
- RPMTRANS_FLAG_NOPREUN,
- N_("do not execute %%preun scriptlet (if any)"), NULL },
- { "nopostun", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &transFlags,
- RPMTRANS_FLAG_NOPOSTUN,
- N_("do not execute %%postun scriptlet (if any)"), NULL },
-
- { "notriggers", '\0', POPT_BIT_SET, &transFlags,
- _noTransTriggers,
- N_("do not execute any scriptlet(s) triggered by this package"), NULL},
- { "notriggerprein", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &transFlags,
- RPMTRANS_FLAG_NOTRIGGERPREIN,
- N_("do not execute any %%triggerprein scriptlet(s)"), NULL},
- { "notriggerin", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &transFlags,
- RPMTRANS_FLAG_NOTRIGGERIN,
- N_("do not execute any %%triggerin scriptlet(s)"), NULL},
- { "notriggerun", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &transFlags,
- RPMTRANS_FLAG_NOTRIGGERUN,
- N_("do not execute any %%triggerun scriptlet(s)"), NULL},
- { "notriggerpostun", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &transFlags,
- RPMTRANS_FLAG_NOTRIGGERPOSTUN,
- N_("do not execute any %%triggerpostun scriptlet(s)"), NULL},
-
- { "oldpackage", '\0', POPT_BIT_SET, &probFilter, RPMPROB_FILTER_OLDPACKAGE,
- N_("upgrade to an old version of the package (--force on upgrades does this automatically)"),
- NULL},
- { "percent", '\0', POPT_BIT_SET, &installInterfaceFlags, INSTALL_PERCENT,
- N_("print percentages as package installs"), NULL},
- { "prefix", '\0', POPT_ARG_STRING, &prefix, 0,
- N_("relocate the package to <dir>, if relocatable"),
- N_("<dir>") },
- { "relocate", '\0', POPT_ARG_STRING, 0, GETOPT_RELOCATE,
- N_("relocate files from path <old> to <new>"),
- N_("<old>=<new>") },
- { "repackage", '\0', POPT_BIT_SET, &transFlags, RPMTRANS_FLAG_REPACKAGE,
- N_("save erased package files by repackaging"), NULL},
- { "replacefiles", '\0', POPT_BIT_SET, &probFilter,
- (RPMPROB_FILTER_REPLACEOLDFILES | RPMPROB_FILTER_REPLACENEWFILES),
- N_("install even if the package replaces installed files"), NULL},
- { "replacepkgs", '\0', POPT_BIT_SET, &probFilter, RPMPROB_FILTER_REPLACEPKG,
- N_("reinstall if the package is already present"), NULL},
- { "test", '\0', POPT_BIT_SET, &transFlags, RPMTRANS_FLAG_TEST,
- N_("don't install, but tell if it would work or not"), NULL},
- { "upgrade", 'U', POPT_BIT_SET, &installInterfaceFlags, INSTALL_UPGRADE,
- N_("upgrade package(s)"),
- N_("<packagefile>+") },
-
- POPT_TABLEEND
-};
-#endif /* IAM_RPMEIU */
-#endif /* DYING */
-
/* the structure describing the options we take and the defaults */
static struct poptOption optionsTable[] = {
#if !defined(_AUTOHELP)
static void printUsage(void)
/*@modifies fileSystem @*/
{
- FILE * fp;
+ FILE * fp = stdout;
printVersion();
printBanner();
(void) puts("");
- fp = stdout;
-
fprintf(fp, _("Usage: %s {--help}\n"), __progname);
fprintf(fp, (" %s {--version}\n"), __progname);
--force alias for --replacepkgs --replacefiles
--includedocs handle as option in table
--erase forbids many options
-#endif
+#endif /* DYING */
#endif /* IAM_RPMEIU */
#ifdef IAM_RPMQV
}
-#ifdef DYING
-static void printHelpLine(char * prefix, char * help)
- /*@modifies fileSystem @*/
-{
- int indentLength = strlen(prefix) + 3;
- int lineLength = 79 - indentLength;
- int helpLength = strlen(help);
- char * ch;
- char format[10];
-
- fprintf(stdout, "%s - ", prefix);
-
- while (helpLength > lineLength) {
- ch = help + lineLength - 1;
- while (ch > help && !isspace(*ch)) ch--;
- if (ch == help) break; /* give up */
- while (ch > (help + 1) && isspace(*ch)) ch--;
- ch++;
-
- sprintf(format, "%%.%ds\n%%%ds", (int) (ch - help), indentLength);
- fprintf(stdout, format, help, " ");
- help = ch;
- while (isspace(*help) && *help) help++;
- helpLength = strlen(help);
- }
-
- if (helpLength) puts(help);
-}
-
-static void printHelp(void) {
- printVersion();
- printBanner();
- puts("");
-
- puts( _("Usage:"));
- printHelpLine( " --help ",
- _("print this message"));
- printHelpLine( " --version ",
- _("print the version of rpm being used"));
-
- puts("");
- puts( _(" All modes support the following options:"));
- printHelpLine(_(" --define '<name> <body>'"),
- _("define macro <name> with value <body>"));
- printHelpLine(_(" --eval '<expr>+' "),
- _("print the expansion of macro <expr> to stdout"));
- printHelpLine(_(" --pipe <cmd> "),
- _("send stdout to <cmd>"));
- printHelpLine(_(" --rcfile <file:...> "),
- _("use <file:...> instead of default list of macro files"));
- printHelpLine( " --showrc ",
- _("display final rpmrc and macro configuration"));
-#if defined(IAM_RPMBT) || defined(IAM_RPMDB) || defined(IAM_RPMEIU) || defined(IAM_RPMQV)
- printHelpLine(_(" --dbpath <dir> "),
- _("use <dir> as the directory for the database"));
- printHelpLine(_(" --root <dir> "),
- _("use <dir> as the top level directory"));
-#endif /* IAM_RPMBT || IAM_RPMDB || IAM_RPMEIU || IAM_RPMQV */
- printHelpLine( " -v ",
- _("be a little more verbose"));
- printHelpLine( " -vv ",
- _("be incredibly verbose (for debugging)"));
-
-#if defined(IAM_RPMEIU) || defined(IAM_RPMQV)
- puts("");
- puts( _(" Install, upgrade and query (with -p) modes allow URL's to be used in place"));
- puts( _(" of file names as well as the following options:"));
- printHelpLine(_(" --ftpproxy <host> "),
- _("hostname or IP of ftp proxy"));
- printHelpLine(_(" --ftpport <port> "),
- _("port number of ftp server (or proxy)"));
- printHelpLine(_(" --httpproxy <host> "),
- _("hostname or IP of http proxy"));
- printHelpLine(_(" --httpport <port> "),
- _("port number of http server (or proxy)"));
-#endif /* IAM_RPMEIU || IAM_RPMQV */
-
-#ifdef IAM_RPMQV
- puts("");
- puts( _(" Package specification options:"));
- printHelpLine( " -a, --all ",
- _("query/verify all packages"));
- printHelpLine(_(" -f <file>+ "),
- _("query/verify package owning <file>"));
- printHelpLine(_(" -p <packagefile>+ "),
- _("query/verify (uninstalled) package <packagefile>"));
- printHelpLine(_(" --triggeredby <pkg> "),
- _("query/verify packages triggered by <pkg>"));
- printHelpLine(_(" --whatprovides <cap> "),
- _("query/verify packages which provide <cap> capability"));
- printHelpLine(_(" --whatrequires <cap> "),
- _("query/verify packages which require <cap> capability"));
- puts("");
- printHelpLine( " -q, --query ",
- _("query mode"));
- printHelpLine(_(" --queryformat <qfmt> "),
- _("use <qfmt> as the header format (implies --info)"));
- puts("");
- puts( _(" Information selection options:"));
- printHelpLine( " -i, --info ",
- _("display package information"));
- printHelpLine( " --changelog ",
- _("display the package's change log"));
- printHelpLine( " -l ",
- _("display package file list"));
- printHelpLine( " -s ",
- _("show file states (implies -l)"));
- printHelpLine( " -d ",
- _("list only documentation files (implies -l)"));
- printHelpLine( " -c ",
- _("list only configuration files (implies -l)"));
- printHelpLine( " --dump ",
- _("show all verifiable information for each file (must be used with -l, -c, or -d)"));
- printHelpLine( " --provides ",
- _("list capabilities provided by package"));
- printHelpLine( " -R, --requires ",
- _("list capabilities required by package"));
- printHelpLine( " --scripts ",
- _("print the various [un]install scriptlets"));
- printHelpLine( " --triggers ",
- _("show the trigger scriptlets contained in the package"));
- puts("");
- printHelpLine( " -V, -y, --verify ",
- _("verify a package installation using the same same package specification options as -q"));
- printHelpLine( " --nodeps ",
- _("do not verify package dependencies"));
- printHelpLine( " --nofiles ",
- _("do not verify file attributes"));
- printHelpLine( " --nomd5 ",
- _("do not verify file md5 checksums"));
- printHelpLine( " --noscripts ",
- _("do not execute scripts (if any)"));
- puts("");
- printHelpLine( " --querytags ",
- _("list the tags that can be used in a query format"));
- printHelpLine( " --setperms ",
- _("set the file permissions to those in the package database"
- " using the same package specification options as -q"));
- printHelpLine( " --setugids ",
- _("set the file owner and group to those in the package "
- "database using the same package specification options as "
- "-q"));
-#endif /* IAM_RPMQV */
-
-#ifdef IAM_RPMEIU
- puts("");
- puts( _(" --install <packagefile>"));
- printHelpLine(_(" -i <packagefile> "),
- _("install package"));
- printHelpLine( " --allfiles ",
- _("install all files, even configurations which might "
- "otherwise be skipped"));
- printHelpLine( " --badreloc ",
- _("relocate files in non-relocateable package"));
- printHelpLine( " --excludedocs ",
- _("do not install documentation"));
- printHelpLine(_(" --excludepath <path> "),
- _("skip files with leading component <path> "));
- printHelpLine( " --force ",
- _("short hand for --replacepkgs --replacefiles"));
- printHelpLine( " -h, --hash ",
- _("print hash marks as package installs (good with -v)"));
- printHelpLine( " --ignorearch ",
- _("don't verify package architecture"));
- printHelpLine( " --ignoresize ",
- _("don't check disk space before installing"));
- printHelpLine( " --ignoreos ",
- _("don't verify package operating system"));
- printHelpLine( " --includedocs ",
- _("install documentation"));
- printHelpLine( " --justdb ",
- _("update the database, but do not modify the filesystem"));
- printHelpLine( " --nodeps ",
- _("do not verify package dependencies"));
- printHelpLine( " --noorder ",
- _("do not reorder package installation to satisfy dependencies"));
- printHelpLine( " --noscripts ",
- _("don't execute any installation scriptlets"));
- printHelpLine( " --notriggers ",
- _("don't execute any scriptlets triggered by this package"));
- printHelpLine( " --percent ",
- _("print percentages as package installs"));
- printHelpLine(_(" --prefix <dir> "),
- _("relocate the package to <dir>, if relocatable"));
- printHelpLine(_(" --relocate <oldpath>=<newpath>"),
- _("relocate files from <oldpath> to <newpath>"));
- printHelpLine( " --replacefiles ",
- _("install even if the package replaces installed files"));
- printHelpLine( " --replacepkgs ",
- _("reinstall if the package is already present"));
- printHelpLine( " --test ",
- _("don't install, but tell if it would work or not"));
- puts("");
- puts( _(" --upgrade <packagefile>"));
- printHelpLine(_(" -U <packagefile> "),
- _("upgrade package (same options as --install, plus)"));
- printHelpLine( " --oldpackage ",
- _("upgrade to an old version of the package (--force on upgrades does this automatically)"));
- puts("");
- puts( _(" --erase <package>"));
- printHelpLine(_(" -e <package> "),
- _("erase (uninstall) package"));
- printHelpLine( " --allmatches ",
- _("remove all packages which match <package> (normally an error is generated if <package> specified multiple packages)"));
- printHelpLine( " --justdb ",
- _("update the database, but do not modify the filesystem"));
- printHelpLine( " --nodeps ",
- _("do not verify package dependencies"));
- printHelpLine( " --noorder ",
- _("do not reorder package installation to satisfy dependencies"));
- printHelpLine( " --noscripts ",
- _("do not execute any package specific scripts"));
- printHelpLine( " --notriggers ",
- _("don't execute any scripts triggered by this package"));
-#endif /* IAM_RPMEIU */
-
-#ifdef IAM_RPMK
- puts("");
- printHelpLine(_(" --resign <pkg>+ "),
- _("sign a package (discard current signature)"));
- printHelpLine(_(" --addsign <pkg>+ "),
- _("add a signature to a package"));
-
- puts( _(" --checksig <pkg>+"));
- printHelpLine(_(" -K <pkg>+ "),
- _("verify package signature"));
- printHelpLine( " --nopgp ",
- _("skip any PGP signatures"));
- printHelpLine( " --nogpg ",
- _("skip any GPG signatures"));
- printHelpLine( " --nomd5 ",
- _("skip any MD5 signatures"));
-#endif /* IAM_RPMK */
-
-#ifdef IAM_RPMDB
- puts("");
- printHelpLine( " --initdb ",
- _("initalize database (unnecessary, legacy use)"));
- printHelpLine( " --rebuilddb ",
- _("rebuild database indices from existing database headers"));
-#endif
-
-}
-#endif
-
int main(int argc, const char ** argv)
{
enum modes bigMode = MODE_UNKNOWN;
#endif
#ifdef IAM_RPMEIU
-#ifdef DYING
-/*@only@*/ rpmRelocation * relocations = NULL;
- int numRelocations = 0;
-#else
struct rpmInstallArguments_s * ia = &rpmIArgs;
#endif
-#endif
#if defined(IAM_RPMDB)
struct rpmDatabaseArguments_s * da = &rpmDBArgs;
#endif
#if defined(IAM_RPMK)
-#ifdef DYING
- rpmResignFlags addSign = RESIGN_NEW_SIGNATURE;
- rpmCheckSigFlags checksigFlags = CHECKSIG_NONE;
-#else
struct rpmSignArguments_s * ka = &rpmKArgs;
#endif
-#endif
#if defined(IAM_RPMBT) || defined(IAM_RPMK)
char * passPhrase = "";
#endif
#ifdef IAM_RPMEIU
-#ifdef DYING
- transFlags = RPMTRANS_FLAG_NONE;
- probFilter = RPMPROB_FILTER_NONE;
- installInterfaceFlags = INSTALL_NONE;
- eraseInterfaceFlags = UNINSTALL_NONE;
-#else
ia->relocations = _free(ia->relocations);
memset(ia, 0, sizeof(*ia));
ia->transFlags = RPMTRANS_FLAG_NONE;
ia->installInterfaceFlags = INSTALL_NONE;
ia->eraseInterfaceFlags = UNINSTALL_NONE;
#endif
-#endif
while ((arg = poptGetNextOpt(optCon)) > 0) {
optArg = poptGetOptArg(optCon);
break;
#endif /* IAM_RPMQV || IAM_RPMEIU || IAM_RPMBT */
-#ifdef DYING
-#ifdef IAM_RPMEIU
-
- case 'e':
- if (bigMode != MODE_UNKNOWN && bigMode != MODE_ERASE)
- argerror(_("only one major mode may be specified"));
- bigMode = MODE_ERASE;
- break;
-
- case GETOPT_INSTALL:
- if (bigMode != MODE_UNKNOWN && bigMode != MODE_INSTALL)
- argerror(_("only one major mode may be specified"));
- bigMode = MODE_INSTALL;
- break;
-
-#ifdef DYING /* XXX handled by popt */
- case 'U':
- if (bigMode != MODE_UNKNOWN && bigMode != MODE_INSTALL)
- argerror(_("only one major mode may be specified"));
- bigMode = MODE_INSTALL;
- break;
-
- case 'F':
- if (bigMode != MODE_UNKNOWN && bigMode != MODE_INSTALL)
- argerror(_("only one major mode may be specified"));
- bigMode = MODE_INSTALL;
- break;
-#endif
-
- case GETOPT_EXCLUDEPATH:
- if (optArg == NULL || *optArg != '/')
- argerror(_("exclude paths must begin with a /"));
-
- ia->relocations = xrealloc(ia->relocations,
- sizeof(*ia->relocations) * (ia->numRelocations + 1));
- /*@-observertrans -dependenttrans@*/ /* FIX: W2DO? */
- ia->relocations[ia->numRelocations].oldPath = optArg;
- ia->relocations[ia->numRelocations++].newPath = NULL;
- /*@=observertrans =dependenttrans@*/
- break;
-
- case GETOPT_RELOCATE:
- { char * newPath = NULL;
- if (optArg == NULL || *optArg != '/')
- argerror(_("relocations must begin with a /"));
- if (!(newPath = strchr(optArg, '=')))
- argerror(_("relocations must contain a ="));
- *newPath++ = '\0';
- if (*newPath != '/')
- argerror(_("relocations must have a / following the ="));
- ia->relocations = xrealloc(ia->relocations,
- sizeof(*ia->relocations) * (ia->numRelocations + 1));
- /*@-observertrans -kepttrans@*/ /* FIX: W2DO? */
- ia->relocations[ia->numRelocations].oldPath = optArg;
- ia->relocations[ia->numRelocations++].newPath = newPath;
- /*@=observertrans =kepttrans@*/
- } break;
-#endif /* IAM_RPMEIU */
-#endif /* DYING */
-
-#ifdef DYING
-#ifdef IAM_RPMDB
- case GETOPT_REBUILDDB:
- if (bigMode != MODE_UNKNOWN && bigMode != MODE_REBUILDDB)
- argerror(_("only one major mode may be specified"));
- bigMode = MODE_REBUILDDB;
- break;
- case GETOPT_VERIFYDB:
- if (bigMode != MODE_UNKNOWN && bigMode != MODE_VERIFYDB)
- argerror(_("only one major mode may be specified"));
- bigMode = MODE_VERIFYDB;
- break;
-#endif /* IAM_RPMDB */
-#endif /* DYING */
-
-#ifdef DYING
-#ifdef IAM_RPMK
- case 'K':
- if (bigMode != MODE_UNKNOWN && bigMode != MODE_CHECKSIG)
- argerror(_("only one major mode may be specified"));
- bigMode = MODE_CHECKSIG;
- break;
-
- case GETOPT_RESIGN:
- if (bigMode != MODE_UNKNOWN && bigMode != MODE_RESIGN)
- argerror(_("only one major mode may be specified"));
- bigMode = MODE_RESIGN;
- addSign = RESIGN_NEW_SIGNATURE;
- signIt = 1;
- break;
-
- case GETOPT_ADDSIGN:
- if (bigMode != MODE_UNKNOWN && bigMode != MODE_RESIGN)
- argerror(_("only one major mode may be specified"));
- bigMode = MODE_RESIGN;
- addSign = RESIGN_ADD_SIGNATURE;
- signIt = 1;
- break;
-#endif /* IAM_RPMK */
-#endif /* DYING */
-
case GETOPT_DEFINEMACRO:
if (optArg) {
(void) rpmDefineMacro(NULL, optArg, RMIL_CMDLINE);
}
#endif /* IAM_RPMQV */
+ /* XXX TODO: never happens. */
if (gotDbpath && (bigMode & ~MODES_FOR_DBPATH))
argerror(_("--dbpath given for operation that does not use a "
"database"));
}
}
-#ifdef DYING
-#ifdef IAM_RPMK
- if (!(ka->checksigFlags & CHECKSIG_PGP) && bigMode != MODE_CHECKSIG)
- argerror(_("--nopgp may only be used during signature checking"));
-
- if (!(ka->checksigFlags & CHECKSIG_GPG) && bigMode != MODE_CHECKSIG)
- argerror(_("--nogpg may only be used during signature checking"));
-#endif
-
-#if defined(IAM_RPMK) || defined(IAM_RPMQV)
- if ((!(ka->checksigFlags & CHECKSIG_MD5) || noMd5) && bigMode != MODE_CHECKSIG && bigMode != MODE_VERIFY)
- argerror(_("--nomd5 may only be used during signature checking and "
- "package verification"));
-#endif
-#endif /* DYING */
-
#if defined(IAM_RPMBT) || defined(IAM_RPMK)
if (0
#if defined(IAM_RPMBT)
break;
case MODE_INSTALL:
-#ifdef DYING
- if (force) {
- ia->probFilter |= RPMPROB_FILTER_REPLACEPKG |
- RPMPROB_FILTER_REPLACEOLDFILES |
- RPMPROB_FILTER_REPLACENEWFILES |
- RPMPROB_FILTER_OLDPACKAGE;
- }
-#endif
/* RPMTRANS_FLAG_BUILD_PROBS */
/* RPMTRANS_FLAG_KEEPOBSOLETE */
case MODE_VERIFY:
{ const char * pkg;
- int verifyFlags;
+ rpmVerifyFlags verifyFlags = VERIFY_ALL;
- verifyFlags = (VERIFY_FILES|VERIFY_DEPS|VERIFY_SCRIPT|VERIFY_MD5);
verifyFlags &= ~qva->qva_flags;
-
+ qva->qva_flags = (rpmQueryFlags) verifyFlags;
qva->qva_prefix = rootdir;
- qva->qva_flags = verifyFlags;
+
if (qva->qva_source == RPMQV_ALL) {
if (poptPeekArg(optCon))
argerror(_("extra arguments given for verify of all packages"));
case MODE_CHECKSIG:
if (!poptPeekArg(optCon))
argerror(_("no packages given for signature check"));
-#ifdef DYING
- if (!noPgp) checksigFlags |= CHECKSIG_PGP;
- if (!noGpg) checksigFlags |= CHECKSIG_GPG;
- if (!noMd5) checksigFlags |= CHECKSIG_MD5;
-#endif
ec = rpmCheckSig(ka->checksigFlags,
(const char **)poptGetArgs(optCon));
/* XXX don't overflow single byte exit status */