diff options
author | jbj <devnull@localhost> | 2001-06-12 17:06:47 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2001-06-12 17:06:47 +0000 |
commit | 7233e3ad7373eec14ca47dc292806deb986519b1 (patch) | |
tree | 833c57e8e16b984435a66eb4a16cc5510dd3d0a3 | |
parent | 1b87bd9ef75810794edede55d94c25c5d1e94d41 (diff) | |
download | librpm-tizen-7233e3ad7373eec14ca47dc292806deb986519b1.tar.gz librpm-tizen-7233e3ad7373eec14ca47dc292806deb986519b1.tar.bz2 librpm-tizen-7233e3ad7373eec14ca47dc292806deb986519b1.zip |
- remove rpmrc Provides: Yet Again, use virtual packages.
- dump cursor debugging wrappers.
- rpm --verify can disable rpmFileAttr checks.
CVS patchset: 4856
CVS date: 2001/06/12 17:06:47
-rw-r--r-- | CHANGES | 3 | ||||
-rw-r--r-- | build.c | 1 | ||||
-rw-r--r-- | build/pack.c | 1 | ||||
-rw-r--r-- | lib/depends.c | 79 | ||||
-rw-r--r-- | lib/header.c | 13 | ||||
-rw-r--r-- | lib/poptBT.c | 1 | ||||
-rw-r--r-- | lib/poptI.c | 1 | ||||
-rw-r--r-- | lib/poptK.c | 1 | ||||
-rw-r--r-- | lib/poptQV.c | 67 | ||||
-rw-r--r-- | lib/query.c | 1 | ||||
-rw-r--r-- | lib/rpmcli.h | 77 | ||||
-rw-r--r-- | lib/rpminstall.c | 2 | ||||
-rw-r--r-- | lib/rpmlib.h | 30 | ||||
-rw-r--r-- | lib/verify.c | 66 | ||||
-rw-r--r-- | python/rpmmodule.c | 1 | ||||
-rwxr-xr-x | rpm.c | 1 | ||||
-rw-r--r-- | rpmdb/poptDB.c | 1 | ||||
-rw-r--r-- | rpmdb/rpmdb.c | 41 | ||||
-rw-r--r-- | rpmdb/rpmdb.h | 12 | ||||
-rwxr-xr-x | rpmqv.c | 1 |
20 files changed, 202 insertions, 198 deletions
@@ -95,6 +95,9 @@ - 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. + - remove rpmrc Provides: Yet Again, use virtual packages. + - dump cursor debugging wrappers. + - rpm --verify can disable rpmFileAttr checks. 4.0 -> 4.0.[12] - add doxygen and lclint annotations most everywhere. @@ -6,7 +6,6 @@ #include <rpmcli.h> #include <rpmbuild.h> -#include <rpmurl.h> #include "build.h" #include "debug.h" diff --git a/build/pack.c b/build/pack.c index cb14e398e..181706839 100644 --- a/build/pack.c +++ b/build/pack.c @@ -261,7 +261,6 @@ int readRPM(const char *fileName, Spec *specp, struct rpmlead *lead, FD_t fdi; Spec spec; rpmRC rc; - int ec; fdi = (fileName != NULL) ? Fopen(fileName, "r.ufdio") diff --git a/lib/depends.c b/lib/depends.c index b03e9f167..dd4917be7 100644 --- a/lib/depends.c +++ b/lib/depends.c @@ -1220,7 +1220,7 @@ static int unsatisfiedDepend(rpmTransactionSet ts, } } -#ifndef DYING +#ifdef DYING { static /*@observer@*/ const char noProvidesString[] = "nada"; static /*@observer@*/ const char * rcProvidesString = noProvidesString; const char * start; @@ -1402,7 +1402,8 @@ static int checkPackageDeps(rpmTransactionSet ts, problemsSet psp, if (multiLib && !isDependsMULTILIB(requireFlags[i])) continue; - keyDepend = printDepend("R", requires[i], requiresEVR[i], requireFlags[i]); + keyDepend = printDepend("R", + requires[i], requiresEVR[i], requireFlags[i]); rc = unsatisfiedDepend(ts, " Requires", keyDepend, requires[i], requiresEVR[i], requireFlags[i], &suggestion); @@ -1419,33 +1420,29 @@ static int checkPackageDeps(rpmTransactionSet ts, problemsSet psp, psp->problems = xrealloc(psp->problems, sizeof(*psp->problems) * psp->alloced); } - psp->problems[psp->num].byHeader = headerLink(h); - psp->problems[psp->num].byName = xstrdup(name); - psp->problems[psp->num].byVersion = xstrdup(version); - psp->problems[psp->num].byRelease = xstrdup(release); - psp->problems[psp->num].needsName = xstrdup(requires[i]); - psp->problems[psp->num].needsVersion = xstrdup(requiresEVR[i]); - psp->problems[psp->num].needsFlags = requireFlags[i]; - psp->problems[psp->num].sense = RPMDEP_SENSE_REQUIRES; - - if (suggestion) { - int j; - for (j = 0; suggestion[j]; j++) - {}; - psp->problems[psp->num].suggestedPackages = - xmalloc( (j + 1) * sizeof(void *) ); - for (j = 0; suggestion[j]; j++) - psp->problems[psp->num].suggestedPackages[j] - = suggestion[j]->key; - psp->problems[psp->num].suggestedPackages[j] = NULL; -#ifdef DYING - psp->problems[psp->num].suggestedPackage = suggestion[0]->key; -#endif - } else { - psp->problems[psp->num].suggestedPackages = NULL; -#ifdef DYING - psp->problems[psp->num].suggestedPackage = NULL; -#endif + + { rpmDependencyConflict pp = psp->problems + psp->num; + pp->byHeader = headerLink(h); + pp->byName = xstrdup(name); + pp->byVersion = xstrdup(version); + pp->byRelease = xstrdup(release); + pp->needsName = xstrdup(requires[i]); + pp->needsVersion = xstrdup(requiresEVR[i]); + pp->needsFlags = requireFlags[i]; + pp->sense = RPMDEP_SENSE_REQUIRES; + + if (suggestion) { + int j; + for (j = 0; suggestion[j]; j++) + {}; + pp->suggestedPackages = + xmalloc( (j + 1) * sizeof(*pp->suggestedPackages) ); + for (j = 0; suggestion[j]; j++) + pp->suggestedPackages[j] = suggestion[j]->key; + pp->suggestedPackages[j] = NULL; + } else { + pp->suggestedPackages = NULL; + } } psp->num++; @@ -1502,18 +1499,18 @@ static int checkPackageDeps(rpmTransactionSet ts, problemsSet psp, psp->problems = xrealloc(psp->problems, sizeof(*psp->problems) * psp->alloced); } - psp->problems[psp->num].byHeader = headerLink(h); - psp->problems[psp->num].byName = xstrdup(name); - psp->problems[psp->num].byVersion = xstrdup(version); - psp->problems[psp->num].byRelease = xstrdup(release); - psp->problems[psp->num].needsName = xstrdup(conflicts[i]); - psp->problems[psp->num].needsVersion = xstrdup(conflictsEVR[i]); - psp->problems[psp->num].needsFlags = conflictFlags[i]; - psp->problems[psp->num].sense = RPMDEP_SENSE_CONFLICTS; - psp->problems[psp->num].suggestedPackages = NULL; -#ifdef DYING - psp->problems[psp->num].suggestedPackage = NULL; -#endif + + { rpmDependencyConflict pp = psp->problems + psp->num; + pp->byHeader = headerLink(h); + pp->byName = xstrdup(name); + pp->byVersion = xstrdup(version); + pp->byRelease = xstrdup(release); + pp->needsName = xstrdup(conflicts[i]); + pp->needsVersion = xstrdup(conflictsEVR[i]); + pp->needsFlags = conflictFlags[i]; + pp->sense = RPMDEP_SENSE_CONFLICTS; + pp->suggestedPackages = NULL; + } psp->num++; break; diff --git a/lib/header.c b/lib/header.c index c6dd176b9..ef98e20bc 100644 --- a/lib/header.c +++ b/lib/header.c @@ -1618,21 +1618,14 @@ int headerAddEntry(Header h, int_32 tag, int_32 type, const void *p, int_32 c) { struct indexEntry *entry; - if (c <= 0) { -#ifdef DYING - fprintf(stderr, _("Bad count for headerAddEntry(): %d\n"), (int) c); - exit(EXIT_FAILURE); -#else + /* Count must always be >= 1 for headerAddEntry. */ + if (c <= 0) return 0; -#endif - /*@notreached@*/ - } /* Allocate more index space if necessary */ if (h->indexUsed == h->indexAlloced) { h->indexAlloced += INDEX_MALLOC_SIZE; - h->index = xrealloc(h->index, - h->indexAlloced * sizeof(struct indexEntry)); + h->index = xrealloc(h->index, h->indexAlloced * sizeof(*h->index)); } /* Fill in the index */ diff --git a/lib/poptBT.c b/lib/poptBT.c index 2a41dfa51..743b7eaf8 100644 --- a/lib/poptBT.c +++ b/lib/poptBT.c @@ -7,7 +7,6 @@ #include <rpmcli.h> #include <rpmbuild.h> -#include <rpmurl.h> #include "build.h" #include "debug.h" diff --git a/lib/poptI.c b/lib/poptI.c index 05f9799ee..1b411a65e 100644 --- a/lib/poptI.c +++ b/lib/poptI.c @@ -6,7 +6,6 @@ #include "system.h" #include <rpmcli.h> -#include <rpmurl.h> #include "debug.h" diff --git a/lib/poptK.c b/lib/poptK.c index 938d308f2..c459b0a8a 100644 --- a/lib/poptK.c +++ b/lib/poptK.c @@ -6,7 +6,6 @@ #include "system.h" #include <rpmcli.h> -#include <rpmurl.h> #include "debug.h" diff --git a/lib/poptQV.c b/lib/poptQV.c index 76f60e41d..704555764 100644 --- a/lib/poptQV.c +++ b/lib/poptQV.c @@ -7,13 +7,12 @@ #include <rpmcli.h> #include <rpmbuild.h> -#include <rpmurl.h> + #include "debug.h" struct rpmQVArguments_s rpmQVArgs; int specedit = 0; -/* ======================================================================== */ #define POPT_QUERYFORMAT 1000 #define POPT_WHATREQUIRES 1001 #define POPT_WHATPROVIDES 1002 @@ -24,9 +23,10 @@ int specedit = 0; /* ========== Query/Verify source popt args */ static void rpmQVSourceArgCallback( /*@unused@*/ poptContext con, - /*@unused@*/ enum poptCallbackReason reason, - const struct poptOption * opt, /*@unused@*/ const char * arg, - /*@unused@*/ const void * data) + /*@unused@*/ enum poptCallbackReason reason, + const struct poptOption * opt, /*@unused@*/ const char * arg, + /*@unused@*/ const void * data) + /*@modifies rpmQVArgs @*/ { QVA_t qva = &rpmQVArgs; @@ -62,6 +62,9 @@ static void rpmQVSourceArgCallback( /*@unused@*/ poptContext con, } } +/** + * Common query/verify mode options. + */ struct poptOption rpmQVSourcePoptTable[] = { { NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA, rpmQVSourceArgCallback, 0, NULL, NULL }, @@ -131,6 +134,9 @@ static void queryArgCallback(/*@unused@*/poptContext con, } } +/** + * Query mode options. + */ struct poptOption rpmQueryPoptTable[] = { { NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA, queryArgCallback, 0, NULL, NULL }, @@ -157,4 +163,53 @@ struct poptOption rpmQueryPoptTable[] = { POPT_TABLEEND }; -/* ======================================================================== */ +/** + * 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 }, + + { "nomd5", '\0', POPT_BIT_SET, &rpmQVArgs.qva_flags, VERIFY_MD5, + N_("don't verify MD5 digest of files"), NULL }, + { "nosize", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, + &rpmQVArgs.qva_flags, VERIFY_SIZE, + N_("don't verify size of files"), NULL }, + { "nolinkto", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, + &rpmQVArgs.qva_flags, VERIFY_LINKTO, + N_("don't verify symlink path of files"), NULL }, + { "nouser", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, + &rpmQVArgs.qva_flags, VERIFY_USER, + N_("don't verify owner of files"), NULL }, + { "nogroup", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, + &rpmQVArgs.qva_flags, VERIFY_GROUP, + N_("don't verify group of files"), NULL }, + { "nomtime", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, + &rpmQVArgs.qva_flags, VERIFY_MTIME, + N_("don't verify modification time of files"), NULL }, + { "nomode", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, + &rpmQVArgs.qva_flags, VERIFY_MODE, + N_("don't verify mode of files"), NULL }, + { "nordev", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, + &rpmQVArgs.qva_flags, VERIFY_RDEV, + N_("don't verify mode of files"), NULL }, + + { "nofiles", '\0', POPT_BIT_SET, &rpmQVArgs.qva_flags, VERIFY_FILES, + N_("don't verify files in package"), NULL}, + { "nodeps", '\0', POPT_BIT_SET, &rpmQVArgs.qva_flags, VERIFY_DEPS, + N_("don't verify package dependencies"), NULL }, + { "noscript", '\0', POPT_BIT_SET,&rpmQVArgs.qva_flags, VERIFY_SCRIPT, + N_("don't execute %verifyscript (if any)"), NULL }, + { "noscripts", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, + &rpmQVArgs.qva_flags, VERIFY_SCRIPT, + N_("don't execute %verifyscript (if any)"), NULL }, + { "nodigest", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, + &rpmQVArgs.qva_flags, VERIFY_DIGEST, + N_("don't verify header SHA1 digest"), NULL }, + + POPT_TABLEEND +}; diff --git a/lib/query.c b/lib/query.c index 327f6a95d..309a55654 100644 --- a/lib/query.c +++ b/lib/query.c @@ -11,7 +11,6 @@ #include <rpmcli.h> #include <rpmbuild.h> -#include <rpmurl.h> #include "manifest.h" #include "debug.h" diff --git a/lib/rpmcli.h b/lib/rpmcli.h index a966c4e6e..a4f334b5f 100644 --- a/lib/rpmcli.h +++ b/lib/rpmcli.h @@ -6,6 +6,8 @@ */ #include <rpmlib.h> +#include <rpmurl.h> +#include <rpmmacro.h> /** \ingroup rpmcli * Should version 3 packages be produced? @@ -58,45 +60,70 @@ extern struct poptOption rpmBuildPoptTable[]; /** \ingroup rpmcli * Bit(s) to control rpmQuery() operation, stored in qva_flags. + * @todo Merge rpmQueryFlags, rpmVerifyFlags, and rpmVerifyAttrs?. */ typedef enum rpmQueryFlags_e { - 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 */ + QUERY_FOR_DEFAULT = 0, /*!< */ /*@-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 */ + QUERY_MD5 = (1 << 0), /*!< from --nomd5 */ + QUERY_SIZE = (1 << 1), /*!< from --nosize */ + QUERY_LINKTO = (1 << 2), /*!< from --nolink */ + QUERY_USER = (1 << 3), /*!< from --nouser) */ + QUERY_GROUP = (1 << 4), /*!< from --nogroup) */ + QUERY_MTIME = (1 << 5), /*!< from --nomtime) */ + QUERY_MODE = (1 << 6), /*!< from --nomode) */ + QUERY_RDEV = (1 << 7), /*!< from --nodev */ + /* bits 8-15 unused, reserved for rpmVerifyAttrs */ + QUERY_FILES = (1 << 16), /*!< verify: from --nofiles */ + QUERY_DEPS = (1 << 17), /*!< verify: from --nodeps */ + QUERY_SCRIPT = (1 << 18), /*!< verify: from --noscripts */ + QUERY_DIGEST = (1 << 19), /*!< verify: from --nodigest */ /*@=enummemuse@*/ + /* bits 20-22 unused */ + QUERY_FOR_LIST = (1 << 23), /*!< query: from --list */ + QUERY_FOR_STATE = (1 << 24), /*!< query: from --state */ + QUERY_FOR_DOCS = (1 << 25), /*!< query: from --docfiles */ + QUERY_FOR_CONFIG = (1 << 26), /*!< query: from --configfiles */ + QUERY_FOR_DUMPFILES = (1 << 27), /*!< query: from --dump */ } rpmQueryFlags; /** \ingroup rpmcli * Bit(s) to control rpmVerify() operation, stored in qva_flags. + * @todo Merge rpmQueryFlags, rpmVerifyFlags, and rpmVerifyAttrs values?. */ -/*@-typeuse@*/ typedef enum rpmVerifyFlags_e { /*@-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 */ + VERIFY_DEFAULT = 0, /*!< */ /*@=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 */ + VERIFY_MD5 = (1 << 0), /*!< from --nomd5 */ + VERIFY_SIZE = (1 << 1), /*!< from --nosize */ + VERIFY_LINKTO = (1 << 2), /*!< from --nolinkto */ + VERIFY_USER = (1 << 3), /*!< from --nouser */ + VERIFY_GROUP = (1 << 4), /*!< from --nogroup */ + VERIFY_MTIME = (1 << 5), /*!< from --nomtime */ + VERIFY_MODE = (1 << 6), /*!< from --nomode */ + VERIFY_RDEV = (1 << 7), /*!< from --nodev */ + /* bits 8-15 unused, reserved for rpmVerifyAttrs */ + VERIFY_FILES = (1 << 16), /*!< verify: from --nofiles */ + VERIFY_DEPS = (1 << 17), /*!< verify: from --nodeps */ + VERIFY_SCRIPT = (1 << 18), /*!< verify: from --noscripts */ + VERIFY_DIGEST = (1 << 19), /*!< verify: from --nodigest */ + /* bits 20-22 unused */ +/*@-enummemuse@*/ + VERIFY_FOR_LIST = (1 << 23), /*!< query: from --list */ + VERIFY_FOR_STATE = (1 << 24), /*!< query: from --state */ + VERIFY_FOR_DOCS = (1 << 25), /*!< query: from --docfiles */ + VERIFY_FOR_CONFIG = (1 << 26), /*!< query: from --configfiles */ + VERIFY_FOR_DUMPFILES= (1 << 27), /*!< query: from --dump */ +/*@=enummemuse@*/ + /* bits 28-30 used in rpmVerifyAttrs */ } rpmVerifyFlags; + +#define VERIFY_ATTRS \ + ( VERIFY_MD5 | VERIFY_SIZE | VERIFY_LINKTO | VERIFY_USER | VERIFY_GROUP | \ + VERIFY_MTIME | VERIFY_MODE | VERIFY_RDEV ) #define VERIFY_ALL \ - (VERIFY_FILES|VERIFY_DEPS|VERIFY_SCRIPT|VERIFY_MD5|VERIFY_DIGEST) -/*@=typeuse@*/ + ( VERIFY_ATTRS | VERIFY_FILES | VERIFY_DEPS | VERIFY_SCRIPT | VERIFY_DIGEST ) /** \ingroup rpmcli * @param qva parsed query/verify options diff --git a/lib/rpminstall.c b/lib/rpminstall.c index be5fe6f47..01ca59a59 100644 --- a/lib/rpminstall.c +++ b/lib/rpminstall.c @@ -5,8 +5,6 @@ #include "system.h" #include <rpmcli.h> -#include <rpmmacro.h> -#include <rpmurl.h> #include "manifest.h" #include "misc.h" diff --git a/lib/rpmlib.h b/lib/rpmlib.h index a28dfeb88..d1f7657aa 100644 --- a/lib/rpmlib.h +++ b/lib/rpmlib.h @@ -808,11 +808,6 @@ int rpmdbSetIteratorModified(/*@null@*/ rpmdbMatchIterator mi, int modified) */ /*@null@*/ Header rpmdbNextIterator(/*@null@*/ rpmdbMatchIterator mi) /*@modifies mi @*/; -#define rpmdbNextIterator(_a) \ - XrpmdbNextIterator(_a, __FILE__, __LINE__) -/*@null@*/ Header XrpmdbNextIterator(/*@null@*/ rpmdbMatchIterator mi, - const char * f, unsigned int l) - /*@modifies mi @*/; /** \ingroup rpmdb * Return database iterator. @@ -1521,17 +1516,22 @@ typedef enum rpmQVSources_e { */ typedef enum rpmVerifyAttrs_e { RPMVERIFY_NONE = 0, /*!< */ - RPMVERIFY_MD5 = (1 << 0), /*!< */ - RPMVERIFY_FILESIZE = (1 << 1), /*!< */ - RPMVERIFY_LINKTO = (1 << 2), /*!< */ - RPMVERIFY_USER = (1 << 3), /*!< */ - RPMVERIFY_GROUP = (1 << 4), /*!< */ - RPMVERIFY_MTIME = (1 << 5), /*!< */ - RPMVERIFY_MODE = (1 << 6), /*!< */ - RPMVERIFY_RDEV = (1 << 7), /*!< */ + RPMVERIFY_MD5 = (1 << 0), /*!< from %verify(md5) */ + RPMVERIFY_FILESIZE = (1 << 1), /*!< from %verify(size) */ + RPMVERIFY_LINKTO = (1 << 2), /*!< from %verify(link) */ + RPMVERIFY_USER = (1 << 3), /*!< from %verify(user) */ + RPMVERIFY_GROUP = (1 << 4), /*!< from %verify(group) */ + RPMVERIFY_MTIME = (1 << 5), /*!< from %verify(mtime) */ + RPMVERIFY_MODE = (1 << 6), /*!< from %verify(mode) */ + RPMVERIFY_RDEV = (1 << 7), /*!< from %verify(rdev) */ + /* bits 8-15 unused, reserved for rpmVerifyAttrs */ + /* bits 16-19 used in rpmVerifyFlags */ + /* bits 20-22 unused */ + /* bits 23-27 used in rpmQueryFlags */ RPMVERIFY_READLINKFAIL= (1 << 28), /*!< */ RPMVERIFY_READFAIL = (1 << 29), /*!< */ RPMVERIFY_LSTATFAIL = (1 << 30) /*!< */ + /* bit 31 unused */ } rpmVerifyAttrs; #define RPMVERIFY_ALL ~(RPMVERIFY_NONE) @@ -1602,6 +1602,7 @@ typedef enum rpmEraseInterfaceFlags_e { /** \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 */ @@ -1612,7 +1613,6 @@ enum rpmtagSignature { 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. */ @@ -1633,8 +1633,8 @@ enum rpmtagSignature { 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@*/ }; +/*@=enummemuse@*/ /** * Return codes from verifySignature(). diff --git a/lib/verify.c b/lib/verify.c index 86a590dd3..f897f56a8 100644 --- a/lib/verify.c +++ b/lib/verify.c @@ -6,7 +6,6 @@ #include "system.h" #include <rpmcli.h> -#include <rpmurl.h> #include "psm.h" #include "md5.h" @@ -28,57 +27,6 @@ static union _vendian { #define S_ISDEV(m) (S_ISBLK((m)) || S_ISCHR((m))) -#ifdef DYING -#define POPT_NODEPS 1000 -#define POPT_NOFILES 1001 -#define POPT_NOMD5 1002 -#define POPT_NOSCRIPTS 1003 - -/* ========== Verify specific popt args */ -static void verifyArgCallback(/*@unused@*/poptContext con, - /*@unused@*/enum poptCallbackReason reason, - const struct poptOption * opt, /*@unused@*/const char * arg, - /*@unused@*/ const void * data) - /*@*/ -{ - QVA_t qva = &rpmQVArgs; - switch (opt->val) { - case POPT_NODEPS: qva->qva_flags |= VERIFY_DEPS; break; - case POPT_NOFILES: qva->qva_flags |= VERIFY_FILES; break; - case POPT_NOMD5: qva->qva_flags |= VERIFY_MD5; break; - case POPT_NOSCRIPTS: qva->qva_flags |= VERIFY_SCRIPT; break; - } -} - -static int noDeps = 0; -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', 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, rpmVerifyAttrs * result, rpmVerifyAttrs omitMask) { @@ -167,7 +115,12 @@ int rpmVerifyFile(const char * root, Header h, int filenum, } } - if (filespec == NULL || Lstat(filespec, &sb) != 0) { + if (filespec == NULL) { + *result |= RPMVERIFY_LSTATFAIL; + return 1; + } + + if (Lstat(filespec, &sb) != 0) { *result |= RPMVERIFY_LSTATFAIL; return 1; } @@ -202,7 +155,7 @@ int rpmVerifyFile(const char * root, Header h, int filenum, */ if (fileAttrs & RPMFILE_GHOST) { flags &= ~(RPMVERIFY_MD5 | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME | - RPMVERIFY_LINKTO); + RPMVERIFY_LINKTO | RPMVERIFY_MODE); } /* @@ -403,7 +356,7 @@ static int verifyDigest(Header h) if (digest) { /* XXX can't happen */ const char *n, *v, *r; - headerNVR(h, &n, &v, &r); + (void) headerNVR(h, &n, &v, &r); if (strcmp(hdigest, digest)) { rpmMessage(RPMMESS_NORMAL, _("%s-%s-%s: immutable header region digest check failed\n"), @@ -436,8 +389,7 @@ static int verifyHeader(QVA_t qva, Header h) int count; int_32 * fileFlags = NULL; rpmVerifyAttrs verifyResult = 0; - rpmVerifyAttrs omitMask = !(qva->qva_flags & VERIFY_MD5) - ? RPMVERIFY_MD5 : RPMVERIFY_NONE; + rpmVerifyAttrs omitMask = ((qva->qva_flags & VERIFY_ATTRS) ^ VERIFY_ATTRS); int ec = 0; /* assume no problems */ int i; diff --git a/python/rpmmodule.c b/python/rpmmodule.c index c190dff5f..03a56095a 100644 --- a/python/rpmmodule.c +++ b/python/rpmmodule.c @@ -16,7 +16,6 @@ #include "Python.h" #include "rpmcli.h" /* XXX for rpmCheckSig */ #include "misc.h" -#include "rpmmacro.h" #include "rpmio_internal.h" #include "upgrade.h" @@ -2,7 +2,6 @@ #include <rpmcli.h> #include <rpmbuild.h> -#include <rpmurl.h> #include "build.h" #include "signature.h" diff --git a/rpmdb/poptDB.c b/rpmdb/poptDB.c index 0d9ee1fe9..ef6cc2c8a 100644 --- a/rpmdb/poptDB.c +++ b/rpmdb/poptDB.c @@ -6,7 +6,6 @@ #include "system.h" #include <rpmcli.h> -#include <rpmurl.h> #include "debug.h" diff --git a/rpmdb/rpmdb.c b/rpmdb/rpmdb.c index e3d7669e3..015ebe056 100644 --- a/rpmdb/rpmdb.c +++ b/rpmdb/rpmdb.c @@ -11,8 +11,7 @@ static int _debug = 0; #include <signal.h> #include <sys/signal.h> -#include <rpmlib.h> -#include <rpmmacro.h> /* XXX for rpmGetPath/rpmGenPath */ +#include <rpmcli.h> #include "rpmdb.h" #include "fprint.h" @@ -28,11 +27,7 @@ static int _debug = 0; extern int _noDirTokens; /*@=redecl@*/ static int _rebuildinprogress = 0; -static int _db_filter_dups = 1; - -/*@-exportlocal -exportheadervar@*/ -int _filterDbDups = 0; /* Filter duplicate entries ? (bug in pre rpm-3.0.4) */ -/*@=exportlocal =exportheadervar@*/ +static int _db_filter_dups = 0; #define _DBI_FLAGS 0 #define _DBI_PERMS 0644 @@ -145,29 +140,29 @@ static struct _dbiVec *mydbvecs[] = { }; /*@=nullassign@*/ -INLINE int dbiSync(dbiIndex dbi, unsigned int flags) { +INLINE int dbiSync(dbiIndex dbi, unsigned int flags) +{ if (_debug < 0 || dbi->dbi_debug) fprintf(stderr, " Sync %s\n", tagName(dbi->dbi_rpmtag)); return (*dbi->dbi_vec->sync) (dbi, flags); } -INLINE int dbiByteSwapped(dbiIndex dbi) { +INLINE int dbiByteSwapped(dbiIndex dbi) +{ return (*dbi->dbi_vec->byteswapped) (dbi); } -INLINE int XdbiCopen(dbiIndex dbi, /*@out@*/ DBC ** dbcp, unsigned int flags, - const char * f, unsigned int l) +INLINE int dbiCopen(dbiIndex dbi, /*@out@*/ DBC ** dbcp, unsigned int flags) { if (_debug < 0 || dbi->dbi_debug) -fprintf(stderr, "+++ RMW %s %s (%s:%u)\n", tagName(dbi->dbi_rpmtag), ((flags & DBI_WRITECURSOR) ? "WRITECURSOR" : ""), f, l); +fprintf(stderr, "+++ RMW %s %s\n", tagName(dbi->dbi_rpmtag), ((flags & DBI_WRITECURSOR) ? "WRITECURSOR" : "")); return (*dbi->dbi_vec->copen) (dbi, dbcp, flags); } -INLINE int XdbiCclose(dbiIndex dbi, /*@only@*/ DBC * dbcursor, unsigned int flags, - const char * f, unsigned int l) +INLINE int dbiCclose(dbiIndex dbi, /*@only@*/DBC * dbcursor, unsigned int flags) { if (_debug < 0 || dbi->dbi_debug) -fprintf(stderr, "--- RMW %s (%s:%u)\n", tagName(dbi->dbi_rpmtag), f, l); +fprintf(stderr, "--- RMW %s\n", tagName(dbi->dbi_rpmtag)); return (*dbi->dbi_vec->cclose) (dbi, dbcursor, flags); } @@ -180,7 +175,8 @@ static int printable(const void * ptr, size_t len) /*@*/ return 1; } -INLINE int dbiDel(dbiIndex dbi, DBC * dbcursor, const void * keyp, size_t keylen, unsigned int flags) +INLINE int dbiDel(dbiIndex dbi, DBC * dbcursor, + const void * keyp, size_t keylen, unsigned int flags) { int NULkey; int rc; @@ -239,7 +235,8 @@ if (_debug < 0 || dbi->dbi_debug) { return rc; } -INLINE int dbiPut(dbiIndex dbi, DBC * dbcursor, const void * keyp, size_t keylen, +INLINE int dbiPut(dbiIndex dbi, DBC * dbcursor, + const void * keyp, size_t keylen, const void * datap, size_t datalen, unsigned int flags) { int NULkey; @@ -827,14 +824,14 @@ static /*@only@*/ /*@null@*/ rpmdb newRpmdb(/*@kept@*/ /*@null@*/ const char * root, /*@kept@*/ /*@null@*/ const char * home, int mode, int perms, int flags) - /*@modifies _filterDbDups @*/ + /*@modifies _db_filter_dups @*/ { rpmdb db = xcalloc(sizeof(*db), 1); const char * epfx = _DB_ERRPFX; static int _initialized = 0; if (!_initialized) { - _filterDbDups = rpmExpandNumeric("%{_filterdbdups}"); + _db_filter_dups = rpmExpandNumeric("%{_filterdbdups}"); _initialized = 1; } @@ -861,7 +858,7 @@ rpmdb newRpmdb(/*@kept@*/ /*@null@*/ const char * root, db->db_errpfx = rpmExpand( (epfx && *epfx ? epfx : _DB_ERRPFX), NULL); /*@=nullpass@*/ db->db_remove_env = 0; - db->db_filter_dups = _filterDbDups; + db->db_filter_dups = _db_filter_dups; db->db_ndbi = dbiTagsMax; db->_dbi = xcalloc(db->db_ndbi, sizeof(*db->_dbi)); /*@-globstate@*/ return db; /*@=globstate@*/ @@ -1492,7 +1489,7 @@ int rpmdbSetIteratorModified(rpmdbMatchIterator mi, int modified) { return rc; } -Header XrpmdbNextIterator(rpmdbMatchIterator mi, const char * f, unsigned l) +Header rpmdbNextIterator(rpmdbMatchIterator mi) { dbiIndex dbi; void * uh = NULL; @@ -1517,7 +1514,7 @@ Header XrpmdbNextIterator(rpmdbMatchIterator mi, const char * f, unsigned l) * marked with DB_WRITECURSOR as well. */ if (mi->mi_dbc == NULL) - xx = XdbiCopen(dbi, &mi->mi_dbc, (mi->mi_cflags | DBI_ITERATOR), f, l); + xx = dbiCopen(dbi, &mi->mi_dbc, (mi->mi_cflags | DBI_ITERATOR)); dbi->dbi_lastoffset = mi->mi_prevoffset; top: diff --git a/rpmdb/rpmdb.h b/rpmdb/rpmdb.h index c5d2728ed..2d28d9f6a 100644 --- a/rpmdb/rpmdb.h +++ b/rpmdb/rpmdb.h @@ -31,6 +31,7 @@ struct _dbiIndexItem { unsigned int dbNum; /*!< database index */ }; +#ifdef DYING /** \ingroup dbi * A single item in an index database (i.e. the "data saved"). */ @@ -41,6 +42,7 @@ struct _dbiIR { /*@-typeuse@*/ typedef struct _dbiIR * DBIR_t; /*@=typeuse@*/ +#endif /* DYING */ /** \ingroup dbi * Items retrieved from the index database. @@ -387,11 +389,6 @@ extern "C" { */ int dbiCopen(dbiIndex dbi, /*@out@*/ DBC ** dbcp, unsigned int dbiflags) /*@modifies dbi, *dbcp @*/; -int XdbiCopen(dbiIndex dbi, /*@out@*/ DBC ** dbcp, unsigned int dbiflags, - const char *f, unsigned int l) - /*@modifies dbi, *dbcp @*/; -#define dbiCopen(_a,_b,_c) \ - XdbiCopen(_a, _b, _c, __FILE__, __LINE__) #define DBI_WRITECURSOR (1 << 0) #define DBI_ITERATOR (1 << 1) @@ -401,12 +398,7 @@ int XdbiCopen(dbiIndex dbi, /*@out@*/ DBC ** dbcp, unsigned int dbiflags, * @param flags (unused) */ int dbiCclose(dbiIndex dbi, /*@only@*/ DBC * dbcursor, unsigned int flags) - /*@modifies dbi @*/; -int XdbiCclose(dbiIndex dbi, /*@only@*/ DBC * dbcursor, unsigned int flags, - const char *f, unsigned int l) /*@modifies dbi, *dbcursor @*/; -#define dbiCclose(_a,_b,_c) \ - XdbiCclose(_a, _b, _c, __FILE__, __LINE__) /** \ingroup dbi * Delete (key,data) pair(s) from index database. @@ -12,7 +12,6 @@ #include <rpmcli.h> #include <rpmbuild.h> -#include <rpmurl.h> #ifdef IAM_RPMBT #include "build.h" |