- fix: QUERY_FOR_LIST file count clobbered.

- create top level rpmcli API, factor top level modes into popt tables.
- popt: add POPT_BIT_SET/POPT_BIT_CLR to API.
- 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.

CVS patchset: 4852
CVS date: 2001/06/08 20:45:59
This commit is contained in:
jbj 2001-06-08 20:45:59 +00:00
parent 7bf9296288
commit 03f5273901
28 changed files with 3993 additions and 528 deletions

View File

@ -81,6 +81,12 @@
- permit duplicates for btree indices.
- document build modes in rpmbuild.8, rpmbuild is born.
- default to dbenv with mpool, --rebuilddb with nofsync is much faster.
- fix: QUERY_FOR_LIST file count clobbered.
- create top level rpmcli API, factor top level modes into popt tables.
- popt: add POPT_BIT_SET/POPT_BIT_CLR to API.
- 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.
4.0 -> 4.0.[12]
- add doxygen and lclint annotations most everywhere.

View File

@ -370,12 +370,15 @@ INPUT = \
./lib/misc.h \
./lib/package.c \
./lib/poptBT.c \
./lib/poptI.c \
./lib/poptK.c \
./lib/poptQV.c \
./lib/problems.c \
./lib/psm.c \
./lib/psm.h \
./lib/query.c \
./lib/rpmchecksig.c \
./lib/rpmcli.h \
./lib/rpminstall.c \
./lib/rpmlead.c \
./lib/rpmlead.h \
@ -397,6 +400,7 @@ INPUT = \
./rpmdb/falloc.h \
./rpmdb/fprint.c \
./rpmdb/fprint.h \
./rpmdb/poptDB.c \
./rpmdb/rpmhash.c \
./rpmdb/rpmhash.h \
./rpmdb/rpmdb.c \

3122
aclocal.m4 vendored

File diff suppressed because it is too large Load Diff

View File

@ -3,14 +3,15 @@
export CFLAGS
export LDFLAGS
LTV="libtoolize (GNU libtool) 1.3.5"
LTV="libtoolize (GNU libtool) 1.4"
ACV="Autoconf version 2.13"
AMV="automake (GNU automake) 1.4"
AMV="automake (GNU automake) 1.4-p2"
USAGE="
You need to install:
libtool-1.3.5
libtool-1.4
autoconf-2.13
automake-1.4
automake-1.4-p2
Or edit this script to change the libtool/autoconf/automake versions checked ...
"
[ "`libtoolize --version`" != "$LTV" ] && echo "$USAGE" && exit 1

View File

@ -4,6 +4,7 @@
#include "system.h"
#include <rpmcli.h>
#include <rpmbuild.h>
#include <rpmurl.h>

View File

@ -14,7 +14,7 @@ EXTRA_DIST = getdate.y
pkgincdir = $(pkgincludedir)
pkginc_HEADERS = \
header.h misc.h rpmlib.h stringbuf.h
header.h misc.h rpmcli.h rpmlib.h stringbuf.h
noinst_HEADERS = \
cpio.h depends.h fsm.h \
manifest.h md5.h psm.h \
@ -33,9 +33,10 @@ lib_LTLIBRARIES = librpm.la
librpm_la_SOURCES = \
cpio.c depends.c formats.c fs.c fsm.c getdate.c \
header.c manifest.c md5.c md5sum.c misc.c package.c \
problems.c poptBT.c poptQV.c psm.c query.c rpmchecksig.c \
rpminstall.c rpmlead.c rpmlibprov.c rpmrc.c signature.c \
stringbuf.c tagName.c tagtable.c transaction.c verify.c
problems.c poptBT.c poptI.c poptK.c poptQV.c psm.c query.c \
rpmchecksig.c rpminstall.c rpmlead.c rpmlibprov.c rpmrc.c \
signature.c stringbuf.c tagName.c tagtable.c transaction.c \
verify.c
# XXX Add internal libtool dependence
install-data-local:

View File

@ -5,6 +5,7 @@
#include "system.h"
#include <rpmcli.h>
#include <rpmbuild.h>
#include <rpmurl.h>

197
lib/poptI.c Normal file
View File

@ -0,0 +1,197 @@
/** \ingroup rpmcli
* \file lib/poptI.c
* Popt tables for install modes.
*/
#include "system.h"
#include <rpmcli.h>
#include <rpmurl.h>
#include "debug.h"
struct rpmInstallArguments_s rpmIArgs;
#define POPT_RELOCATE 1016
#define POPT_EXCLUDEPATH 1019
/*@exits@*/ static void argerror(const char * desc)
/*@modifies fileSystem @*/
{
fprintf(stderr, _("%s: %s\n"), __progname, desc);
exit(EXIT_FAILURE);
}
/**
*/
static void installArgCallback( /*@unused@*/ poptContext con,
/*@unused@*/ enum poptCallbackReason reason,
const struct poptOption * opt, const char * arg,
/*@unused@*/ const void * data)
/*@modifies rpmIArgs */
{
struct rpmInstallArguments_s * ia = &rpmIArgs;
switch (opt->val) {
case POPT_EXCLUDEPATH:
if (arg == NULL || *arg != '/')
argerror(_("exclude paths must begin with a /"));
ia->relocations = xrealloc(ia->relocations,
sizeof(*ia->relocations) * (ia->numRelocations + 1));
/*@-temptrans@*/
ia->relocations[ia->numRelocations].oldPath = arg;
/*@=temptrans@*/
ia->relocations[ia->numRelocations].newPath = NULL;
ia->numRelocations++;
break;
case POPT_RELOCATE:
{ char * newPath = NULL;
if (arg == NULL || *arg != '/')
argerror(_("relocations must begin with a /"));
if (!(newPath = strchr(arg, '=')))
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));
/*@-temptrans@*/
ia->relocations[ia->numRelocations].oldPath = arg;
/*@=temptrans@*/
/*@-kepttrans@*/
ia->relocations[ia->numRelocations].newPath = newPath;
/*@=kepttrans@*/
ia->numRelocations++;
} break;
}
}
/**
*/
struct poptOption rpmInstallPoptTable[] = {
{ NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA,
installArgCallback, 0, NULL, NULL },
{ "allfiles", '\0', POPT_BIT_SET,
&rpmIArgs.transFlags, RPMTRANS_FLAG_ALLFILES,
N_("install all files, even configurations which might otherwise be skipped"),
NULL},
{ "allmatches", '\0', POPT_BIT_SET,
&rpmIArgs.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, &rpmIArgs.transFlags,
(_noTransScripts|_noTransTriggers|
RPMTRANS_FLAG_APPLYONLY|RPMTRANS_FLAG_PKGCOMMIT),
N_("do not execute package scriptlet(s)"), NULL },
{ "badreloc", '\0', POPT_BIT_SET,
&rpmIArgs.probFilter, RPMPROB_FILTER_FORCERELOCATE,
N_("relocate files in non-relocateable package"), NULL},
{ "dirstash", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
&rpmIArgs.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,
&rpmIArgs.transFlags, RPMTRANS_FLAG_NODOCS,
N_("do not install documentation"), NULL},
{ "excludepath", '\0', POPT_ARG_STRING, 0, POPT_EXCLUDEPATH,
N_("skip files with leading component <path> "),
N_("<path>") },
{ "force", '\0', POPT_BIT_SET, &rpmIArgs.probFilter,
(RPMPROB_FILTER_REPLACEPKG | RPMPROB_FILTER_REPLACEOLDFILES | RPMPROB_FILTER_REPLACENEWFILES | RPMPROB_FILTER_OLDPACKAGE),
N_("short hand for --replacepkgs --replacefiles"), NULL},
{ "freshen", 'F', POPT_BIT_SET, &rpmIArgs.installInterfaceFlags,
(INSTALL_UPGRADE|INSTALL_FRESHEN|INSTALL_NOERASE),
N_("upgrade package(s) if already installed"),
N_("<packagefile>+") },
{ "hash", 'h', POPT_BIT_SET, &rpmIArgs.installInterfaceFlags, INSTALL_HASH,
N_("print hash marks as package installs (good with -v)"), NULL},
{ "ignorearch", '\0', POPT_BIT_SET,
&rpmIArgs.probFilter, RPMPROB_FILTER_IGNOREARCH,
N_("don't verify package architecture"), NULL},
{ "ignoreos", '\0', POPT_BIT_SET,
&rpmIArgs.probFilter, RPMPROB_FILTER_IGNOREOS,
N_("don't verify package operating system"), NULL},
{ "ignoresize", '\0', POPT_BIT_SET, &rpmIArgs.probFilter,
(RPMPROB_FILTER_DISKSPACE|RPMPROB_FILTER_DISKNODES),
N_("don't check disk space before installing"), NULL},
{ "includedocs", '\0', 0, &rpmIArgs.incldocs, 0,
N_("install documentation"), NULL},
{ "install", '\0', POPT_BIT_SET,
&rpmIArgs.installInterfaceFlags, INSTALL_NOERASE,
N_("install package"), N_("<packagefile>+") },
{ "justdb", '\0', POPT_BIT_SET, &rpmIArgs.transFlags, RPMTRANS_FLAG_JUSTDB,
N_("update the database, but do not modify the filesystem"), NULL},
{ "nodeps", '\0', 0, &rpmIArgs.noDeps, 0,
N_("do not verify package dependencies"), NULL },
{ "noorder", '\0', POPT_BIT_SET,
&rpmIArgs.installInterfaceFlags, INSTALL_NOORDER,
N_("do not reorder package installation to satisfy dependencies"),
NULL},
{ "noscripts", '\0', POPT_BIT_SET, &rpmIArgs.transFlags,
(_noTransScripts|_noTransTriggers),
N_("do not execute package scriptlet(s)"), NULL },
{ "nopre", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.transFlags,
RPMTRANS_FLAG_NOPRE,
N_("do not execute %%pre scriptlet (if any)"), NULL },
{ "nopost", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.transFlags,
RPMTRANS_FLAG_NOPOST,
N_("do not execute %%post scriptlet (if any)"), NULL },
{ "nopreun", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.transFlags,
RPMTRANS_FLAG_NOPREUN,
N_("do not execute %%preun scriptlet (if any)"), NULL },
{ "nopostun", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.transFlags,
RPMTRANS_FLAG_NOPOSTUN,
N_("do not execute %%postun scriptlet (if any)"), NULL },
{ "notriggers", '\0', POPT_BIT_SET, &rpmIArgs.transFlags,
_noTransTriggers,
N_("do not execute any scriptlet(s) triggered by this package"), NULL},
{ "notriggerprein", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
&rpmIArgs.transFlags, RPMTRANS_FLAG_NOTRIGGERPREIN,
N_("do not execute any %%triggerprein scriptlet(s)"), NULL},
{ "notriggerin", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
&rpmIArgs.transFlags, RPMTRANS_FLAG_NOTRIGGERIN,
N_("do not execute any %%triggerin scriptlet(s)"), NULL},
{ "notriggerun", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
&rpmIArgs.transFlags, RPMTRANS_FLAG_NOTRIGGERUN,
N_("do not execute any %%triggerun scriptlet(s)"), NULL},
{ "notriggerpostun", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
&rpmIArgs.transFlags, RPMTRANS_FLAG_NOTRIGGERPOSTUN,
N_("do not execute any %%triggerpostun scriptlet(s)"), NULL},
{ "oldpackage", '\0', POPT_BIT_SET,
&rpmIArgs.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,
&rpmIArgs.installInterfaceFlags, INSTALL_PERCENT,
N_("print percentages as package installs"), NULL},
{ "prefix", '\0', POPT_ARG_STRING, &rpmIArgs.prefix, 0,
N_("relocate the package to <dir>, if relocatable"),
N_("<dir>") },
{ "relocate", '\0', POPT_ARG_STRING, 0, POPT_RELOCATE,
N_("relocate files from path <old> to <new>"),
N_("<old>=<new>") },
{ "repackage", '\0', POPT_BIT_SET,
&rpmIArgs.transFlags, RPMTRANS_FLAG_REPACKAGE,
N_("save erased package files by repackaging"), NULL},
{ "replacefiles", '\0', POPT_BIT_SET, &rpmIArgs.probFilter,
(RPMPROB_FILTER_REPLACEOLDFILES | RPMPROB_FILTER_REPLACENEWFILES),
N_("install even if the package replaces installed files"), NULL},
{ "replacepkgs", '\0', POPT_BIT_SET,
&rpmIArgs.probFilter, RPMPROB_FILTER_REPLACEPKG,
N_("reinstall if the package is already present"), NULL},
{ "test", '\0', POPT_BIT_SET, &rpmIArgs.transFlags, RPMTRANS_FLAG_TEST,
N_("don't install, but tell if it would work or not"), NULL},
{ "upgrade", 'U', POPT_BIT_SET,
&rpmIArgs.installInterfaceFlags, (INSTALL_UPGRADE|INSTALL_NOERASE),
N_("upgrade package(s)"),
N_("<packagefile>+") },
POPT_TABLEEND
};

71
lib/poptK.c Normal file
View File

@ -0,0 +1,71 @@
/** \ingroup rpmcli
* \file lib/poptK.c
* Popt tables for signature modes.
*/
#include "system.h"
#include <rpmcli.h>
#include <rpmurl.h>
#include "debug.h"
struct rpmSignArguments_s rpmKArgs =
{ RESIGN_CHK_SIGNATURE, CHECKSIG_ALL, 0, NULL };
#define POPT_ADDSIGN 1005
#define POPT_RESIGN 1006
/**
*/
static void signArgCallback( /*@unused@*/ poptContext con,
/*@unused@*/ enum poptCallbackReason reason,
const struct poptOption * opt, /*@unused@*/ const char * arg,
/*@unused@*/ const void * data)
/*@modifies rpmKArgs @*/
{
struct rpmSignArguments_s * rka = &rpmKArgs;
switch (opt->val) {
case 'K':
rka->addSign = RESIGN_CHK_SIGNATURE;
rka->sign = 0;
break;
case POPT_RESIGN:
rka->addSign = RESIGN_NEW_SIGNATURE;
rka->sign = 1;
break;
case POPT_ADDSIGN:
rka->addSign = RESIGN_ADD_SIGNATURE;
rka->sign = 1;
break;
}
}
/**
*/
struct poptOption rpmSignPoptTable[] = {
{ NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA,
signArgCallback, 0, NULL, NULL },
{ "addsign", '\0', 0, 0, POPT_ADDSIGN,
N_("add a signature to a package"), NULL },
{ "resign", '\0', 0, 0, POPT_RESIGN,
N_("sign a package (discard current signature)"), NULL },
{ "sign", '\0', 0, &rpmKArgs.sign, 0,
N_("generate GPG/PGP signature"), NULL },
{ "checksig", 'K', 0, 0, 'K',
N_("verify package signature"), NULL },
{ "nogpg", '\0', POPT_BIT_CLR,
&rpmKArgs.checksigFlags, CHECKSIG_GPG,
N_("skip any GPG signatures"), NULL },
{ "nopgp", '\0', POPT_BIT_CLR|POPT_ARGFLAG_DOC_HIDDEN,
&rpmKArgs.checksigFlags, CHECKSIG_PGP,
N_("skip any PGP signatures"), NULL },
{ "nomd5", '\0', POPT_BIT_CLR,
&rpmKArgs.checksigFlags, CHECKSIG_MD5,
N_("do not verify file md5 checksums"), NULL },
POPT_TABLEEND
};

View File

@ -5,7 +5,8 @@
#include "system.h"
#include "rpmbuild.h"
#include <rpmcli.h>
#include <rpmbuild.h>
#include <rpmurl.h>
#include "debug.h"
@ -95,9 +96,11 @@ struct poptOption rpmQVSourcePoptTable[] = {
/* ========== Query specific popt args */
static void queryArgCallback(/*@unused@*/poptContext con, /*@unused@*/enum poptCallbackReason reason,
const struct poptOption * opt, const char * arg,
/*@unused@*/ const void * data)
static void queryArgCallback(/*@unused@*/poptContext con,
/*@unused@*/enum poptCallbackReason reason,
const struct poptOption * opt, const char * arg,
/*@unused@*/ const void * data)
/*@modifies rpmQVArgs @*/
{
QVA_t qva = &rpmQVArgs;
@ -107,21 +110,24 @@ static void queryArgCallback(/*@unused@*/poptContext con, /*@unused@*/enum poptC
case 'l': qva->qva_flags |= QUERY_FOR_LIST; break;
case 's': qva->qva_flags |= QUERY_FOR_STATE | QUERY_FOR_LIST;
break;
case POPT_DUMP: qva->qva_flags |= QUERY_FOR_DUMPFILES | QUERY_FOR_LIST; break;
case POPT_DUMP: qva->qva_flags |= QUERY_FOR_DUMPFILES | QUERY_FOR_LIST;
break;
case 'v': rpmIncreaseVerbosity(); break;
case POPT_QUERYFORMAT:
{ char *qf = (char *)qva->qva_queryFormat;
if (qf) {
int len = strlen(qf) + strlen(arg) + 1;
qf = xrealloc(qf, len);
strcat(qf, arg);
} else {
qf = xmalloc(strlen(arg) + 1);
strcpy(qf, arg);
if (arg) {
char * qf = (char *)qva->qva_queryFormat;
if (qf) {
int len = strlen(qf) + strlen(arg) + 1;
qf = xrealloc(qf, len);
strcat(qf, arg);
} else {
qf = xmalloc(strlen(arg) + 1);
strcpy(qf, arg);
}
qva->qva_queryFormat = qf;
}
qva->qva_queryFormat = qf;
} break;
break;
}
}

View File

@ -9,6 +9,7 @@
# define PATH_MAX 255
#endif
#include <rpmcli.h>
#include <rpmbuild.h>
#include <rpmurl.h>
#include "manifest.h"
@ -142,8 +143,8 @@ int showQueryPackage(QVA_t qva, /*@unused@*/rpmdb rpmdb, Header h)
HFD_t hfd = headerFreeData;
char * t, * te;
int queryFlags = qva->qva_flags;
const char *queryFormat = qva->qva_queryFormat;
rpmQueryFlags queryFlags = qva->qva_flags;
const char * queryFormat = qva->qva_queryFormat;
int_32 count, type;
char * prefix = NULL;
@ -170,7 +171,7 @@ int showQueryPackage(QVA_t qva, /*@unused@*/rpmdb rpmdb, Header h)
te = t = xmalloc(BUFSIZ);
*te = '\0';
if (!queryFormat && !queryFlags) {
if (queryFormat == NULL && queryFlags == QUERY_FOR_DEFAULT) {
const char * name, * version, * release;
(void) headerNVR(h, &name, &version, &release);
te = stpcpy(te, name);
@ -204,31 +205,31 @@ int showQueryPackage(QVA_t qva, /*@unused@*/rpmdb rpmdb, Header h)
te = stpcpy(te, _("(contains no files)"));
goto exit;
}
if (!hge(h, RPMTAG_FILESTATES, &type, (void **) &fileStatesList, &count))
if (!hge(h, RPMTAG_FILESTATES, &type, (void **) &fileStatesList, NULL))
fileStatesList = NULL;
if (!hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL))
dirNames = NULL;
if (!hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL))
dirIndexes = NULL;
if (!hge(h, RPMTAG_FILEFLAGS, &type, (void **) &fileFlagsList, &count))
if (!hge(h, RPMTAG_FILEFLAGS, &type, (void **) &fileFlagsList, NULL))
fileFlagsList = NULL;
if (!hge(h, RPMTAG_FILESIZES, &type, (void **) &fileSizeList, &count))
if (!hge(h, RPMTAG_FILESIZES, &type, (void **) &fileSizeList, NULL))
fileSizeList = NULL;
if (!hge(h, RPMTAG_FILEMODES, &type, (void **) &fileModeList, &count))
if (!hge(h, RPMTAG_FILEMODES, &type, (void **) &fileModeList, NULL))
fileModeList = NULL;
if (!hge(h, RPMTAG_FILEMTIMES, &type, (void **) &fileMTimeList, &count))
if (!hge(h, RPMTAG_FILEMTIMES, &type, (void **) &fileMTimeList, NULL))
fileMTimeList = NULL;
if (!hge(h, RPMTAG_FILERDEVS, &type, (void **) &fileRdevList, &count))
if (!hge(h, RPMTAG_FILERDEVS, &type, (void **) &fileRdevList, NULL))
fileRdevList = NULL;
if (!hge(h, RPMTAG_FILEINODES, &type, (void **) &fileInodeList, &count))
if (!hge(h, RPMTAG_FILEINODES, &type, (void **) &fileInodeList, NULL))
fileInodeList = NULL;
if (!hge(h, RPMTAG_FILELINKTOS, &ltt, (void **) &fileLinktoList, NULL))
fileLinktoList = NULL;
if (!hge(h, RPMTAG_FILEMD5S, &m5t, (void **) &fileMD5List, NULL))
fileMD5List = NULL;
if (!hge(h, RPMTAG_FILEUIDS, &type, (void **) &fileUIDList, &count))
if (!hge(h, RPMTAG_FILEUIDS, &type, (void **) &fileUIDList, NULL))
fileUIDList = NULL;
if (!hge(h, RPMTAG_FILEGIDS, &type, (void **) &fileGIDList, &count))
if (!hge(h, RPMTAG_FILEGIDS, &type, (void **) &fileGIDList, NULL))
fileGIDList = NULL;
if (!hge(h, RPMTAG_FILEUSERNAME, &fot, (void **) &fileOwnerList, NULL))
fileOwnerList = NULL;

View File

@ -5,7 +5,7 @@
#include "system.h"
#include <rpmlib.h>
#include <rpmcli.h>
#include "rpmlead.h"
#include "signature.h"

200
lib/rpmcli.h Normal file
View File

@ -0,0 +1,200 @@
#ifndef H_RPMCLI
#define H_RPMCLI
/** \ingroup rpmcli rpmbuild
* \file lib/rpmcli.h
*/
#include <rpmlib.h>
/** \ingroup rpmcli
* Should version 3 packages be produced?
*/
extern int _noDirTokens;
#ifdef __cplusplus
extern "C" {
#endif
/* ==================================================================== */
/** \name RPMBT */
/*@{*/
/** \ingroup rpmcli
* Describe build command line request.
*/
struct rpmBuildArguments_s {
int buildAmount; /*!< Bit(s) to control operation. */
/*@null@*/ const char * buildRootOverride; /*!< from --buildroot */
/*@null@*/ char * targets; /*!< Target platform(s), comma separated. */
int force; /*!< from --force */
int noBuild; /*!< from --nobuild */
int noDeps; /*!< from --nodeps */
int noLang; /*!< from --nolang */
int shortCircuit; /*!< from --short-circuit */
int sign; /*!< from --sign */
int useCatalog; /*!< from --usecatalog */
char buildMode; /*!< Build mode (one of "btBC") */
char buildChar; /*!< Build stage (one of "abcilps ") */
/*@observer@*/ /*@null@*/ const char * rootdir;
};
/** \ingroup rpmcli
*/
typedef struct rpmBuildArguments_s * BTA_t;
/** \ingroup rpmcli
*/
extern struct rpmBuildArguments_s rpmBTArgs;
/** \ingroup rpmcli
*/
extern struct poptOption rpmBuildPoptTable[];
/*@}*/
/* ==================================================================== */
/** \name RPMQV */
/*@{*/
/** \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 */
} 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 */
} rpmVerifyFlags;
/*@=typeuse@*/
/** \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. */
/*@unused@*/ int qva_verbose; /*!< (unused) */
/*@only@*/ /*@null@*/ const char * qva_queryFormat; /*!< Format for headerSprintf(). */
/*@observer@*/ /*@null@*/ const char * qva_prefix; /*!< Path to top of install tree. */
char qva_mode; /*!< 'q' is query, 'v' is verify mode. */
char qva_char; /*!< (unused) always ' ' */
};
/** \ingroup rpmcli
*/
extern struct rpmQVArguments_s rpmQVArgs;
/** \ingroup rpmcli
*/
extern struct poptOption rpmQVSourcePoptTable[];
/** \ingroup rpmcli
*/
extern int specedit;
/** \ingroup rpmcli
*/
extern struct poptOption rpmQueryPoptTable[];
/** \ingroup rpmcli
*/
extern struct poptOption rpmVerifyPoptTable[];
/*@}*/
/* ==================================================================== */
/** \name RPMEIU */
/*@{*/
/* --- install/upgrade/erase modes */
/** \ingroup rpmcli
* Describe database command line requests.
*/
struct rpmInstallArguments_s {
rpmtransFlags transFlags;
rpmprobFilterFlags probFilter;
rpmInstallInterfaceFlags installInterfaceFlags;
rpmEraseInterfaceFlags eraseInterfaceFlags;
/*@only@*/ rpmRelocation * relocations;
int numRelocations;
int noDeps;
int force;
int incldocs;
const char * prefix;
};
/** \ingroup rpmcli
*/
extern struct rpmInstallArguments_s rpmIArgs;
/** \ingroup rpmcli
*/
extern struct poptOption rpmInstallPoptTable[];
/*@}*/
/* ==================================================================== */
/** \name RPMDB */
/*@{*/
/* --- database modes */
/** \ingroup rpmcli
* Describe database command line requests.
*/
struct rpmDatabaseArguments_s {
int init; /*!< from --initdb */
int rebuild; /*!< from --rebuilddb */
int verify; /*!< from --verifydb */
};
/** \ingroup rpmcli
*/
extern struct rpmDatabaseArguments_s rpmDBArgs;
/** \ingroup rpmcli
*/
extern struct poptOption rpmDatabasePoptTable[];
/*@}*/
/* ==================================================================== */
/** \name RPMK */
/*@{*/
/** \ingroup rpmcli
* Describe signature command line request.
*/
struct rpmSignArguments_s {
rpmResignFlags addSign; /*!< from --checksig/--resign/--addsign */
rpmCheckSigFlags checksigFlags; /*!< bits to control --checksig */
int sign; /*!< Is a passphrase needed? */
/*@unused@*/ char * passPhrase;
};
/** \ingroup rpmcli
*/
extern struct rpmSignArguments_s rpmKArgs;
/** \ingroup rpmcli
*/
extern struct poptOption rpmSignPoptTable[];
/*@}*/
#ifdef __cplusplus
}
#endif
#endif /* H_RPMCLI */

View File

@ -4,7 +4,7 @@
#include "system.h"
#include <rpmlib.h>
#include <rpmcli.h>
#include <rpmmacro.h>
#include <rpmurl.h>

View File

@ -610,6 +610,7 @@ void rpmFreeRpmrc(void)
/* ==================================================================== */
/** \name RPMDB */
/*@{*/
/** \ingroup rpmdb
*/
typedef /*@abstract@*/ struct rpmdb_s * rpmdb;
@ -1411,45 +1412,30 @@ int rpmGetFilesystemUsage(const char ** fileList, int_32 * fssizes,
int flags)
/*@modifies *usagesPtr @*/;
/* ==================================================================== */
/** \name RPMBT */
/*@{*/
/** \ingroup rpmcli
* Describe build command line request.
*/
struct rpmBuildArguments_s {
int buildAmount; /*!< Bit(s) to control operation. */
/*@null@*/ const char * buildRootOverride; /*!< from --buildroot */
/*@null@*/ char * targets; /*!< Target platform(s), comma separated. */
int force; /*!< from --force */
int noBuild; /*!< from --nobuild */
int noDeps; /*!< from --nodeps */
int noLang; /*!< from --nolang */
int shortCircuit; /*!< from --short-circuit */
int sign; /*!< from --sign */
int useCatalog; /*!< from --usecatalog */
char buildMode; /*!< Build mode (one of "btBC") */
char buildChar; /*!< Build stage (one of "abcilps ") */
/*@observer@*/ /*@null@*/ const char * rootdir;
};
/** \ingroup rpmcli
*/
typedef struct rpmBuildArguments_s * BTA_t;
/** \ingroup rpmcli
*/
extern struct rpmBuildArguments_s rpmBTArgs;
/** \ingroup rpmcli
*/
extern struct poptOption rpmBuildPoptTable[];
/*@}*/
/* ==================================================================== */
/** \name RPMQV */
/*@{*/
/** \ingroup rpmcli
*/
typedef struct rpmQVArguments_s * QVA_t;
/** \ingroup rpmcli
* The command line argument will be used to retrieve header(s) ...
*/
typedef enum rpmQVSources_e {
RPMQV_PACKAGE = 0, /*!< ... from package name db search. */
RPMQV_PATH, /*!< ... from file path db search. */
RPMQV_ALL, /*!< ... from each installed package. */
RPMQV_RPM, /*!< ... from reading binary rpm package. */
RPMQV_GROUP, /*!< ... from group db search. */
RPMQV_WHATPROVIDES, /*!< ... from provides db search. */
RPMQV_WHATREQUIRES, /*!< ... from requires db search. */
RPMQV_TRIGGEREDBY, /*!< ... from trigger db search. */
RPMQV_DBOFFSET, /*!< ... from database header instance. */
RPMQV_SPECFILE /*!< ... from spec file parse (query only). */
} rpmQVSources;
/** \ingroup rpmcli
* Bit(s) for rpmVerifyFile() attributes and result.
*/
@ -1493,69 +1479,6 @@ int rpmVerifyFile(const char * root, Header h, int filenum,
*/
int rpmVerifyScript(const char * rootDir, Header h, /*@null@*/ FD_t scriptFd);
/** \ingroup rpmcli
* The command line argument will be used to retrieve header(s) ...
*/
typedef enum rpmQVSources_e {
RPMQV_PACKAGE = 0, /*!< ... from package name db search. */
RPMQV_PATH, /*!< ... from file path db search. */
RPMQV_ALL, /*!< ... from each installed package. */
RPMQV_RPM, /*!< ... from reading binary rpm package. */
RPMQV_GROUP, /*!< ... from group db search. */
RPMQV_WHATPROVIDES, /*!< ... from provides db search. */
RPMQV_WHATREQUIRES, /*!< ... from requires db search. */
RPMQV_TRIGGEREDBY, /*!< ... from trigger db search. */
RPMQV_DBOFFSET, /*!< ... from database header instance. */
RPMQV_SPECFILE /*!< ... from spec file parse (query only). */
} rpmQVSources;
/** \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 */
} 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 */
} rpmVerifyFlags;
/*@=typeuse@*/
/** \ingroup rpmcli
* Describe query/verify command line request.
*/
typedef 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. */
/*@unused@*/ int qva_verbose; /*!< (unused) */
/*@only@*/ /*@null@*/ const char * qva_queryFormat; /*!< Format for headerSprintf(). */
/*@observer@*/ /*@null@*/ const char * qva_prefix; /*!< Path to top of install tree. */
char qva_mode; /*!< 'q' is query, 'v' is verify mode. */
char qva_char; /*!< (unused) always ' ' */
} * QVA_t;
/** \ingroup rpmcli
*/
extern struct rpmQVArguments_s rpmQVArgs;
/** \ingroup rpmcli
*/
extern struct poptOption rpmQVSourcePoptTable[];
/** \ingroup rpmcli
* @param qva parsed query/verify options
* @param db rpm database
@ -1575,14 +1498,6 @@ int showMatches(QVA_t qva, /*@only@*/ /*@null@*/ rpmdbMatchIterator mi,
QVF_t showPackage)
/*@modifies mi @*/;
/** \ingroup rpmcli
*/
extern int specedit;
/** \ingroup rpmcli
*/
extern struct poptOption rpmQueryPoptTable[];
/** \ingroup rpmcli
* Display list of tags that can be used in --queryformat.
* @param fp file handle to use for display
@ -1624,10 +1539,6 @@ int showQueryPackage(QVA_t qva, rpmdb db, Header h)
int rpmQuery(QVA_t qva, rpmQVSources source, const char * arg)
/*@modifies fileSystem @*/;
/** \ingroup rpmcli
*/
extern struct poptOption rpmVerifyPoptTable[];
/** \ingroup rpmcli
* Display results of package verify.
* @param qva parsed query/verify options
@ -1665,7 +1576,11 @@ typedef enum rpmInstallInterfaceFlags_e {
INSTALL_NOORDER = (1 << 3), /*!< from --noorder */
INSTALL_LABEL = (1 << 4), /*!< from --verbose (notify) */
INSTALL_UPGRADE = (1 << 5), /*!< from --upgrade */
INSTALL_FRESHEN = (1 << 6) /*!< from --freshen */
INSTALL_FRESHEN = (1 << 6), /*!< from --freshen */
INSTALL_NOERASE = (1 << 7), /*!< from --install */
/*@-enummemuse@*/
INSTALL_ERASE = (1 << 8) /*!< from --erase */
/*@=enummemuse@*/
} rpmInstallInterfaceFlags;
/** \ingroup rpmcli
@ -1801,11 +1716,14 @@ rpmVerifySignatureReturn rpmVerifySignature(const char *file,
* Bit(s) to control rpmCheckSig() operation.
*/
typedef enum rpmCheckSigFlags_e {
CHECKSIG_NONE = 0, /*!< Don't check any signatures. */
/*@-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.
@ -1820,7 +1738,8 @@ int rpmCheckSig(rpmCheckSigFlags flags, /*@null@*/ const char ** argv)
* Bit(s) to control rpmReSign() operation.
*/
typedef enum rpmResignFlags_e {
RESIGN_NEW_SIGNATURE = 0, /*!< from --resign */
RESIGN_CHK_SIGNATURE = 0, /*!< from --checksig */
RESIGN_NEW_SIGNATURE, /*!< from --resign */
RESIGN_ADD_SIGNATURE /*!< from --addsign */
} rpmResignFlags;

View File

@ -5,7 +5,7 @@
#include "system.h"
#include <rpmlib.h>
#include <rpmcli.h>
#include <rpmurl.h>
#include "psm.h"
@ -182,29 +182,30 @@ int rpmVerifyFile(const char * root, Header h, int filenum,
const char ** md5List;
int mdt;
(void) hge(h, RPMTAG_FILEMD5S, &mdt, (void **) &md5List, NULL);
if (useBrokenMd5) {
rc = mdfileBroken(filespec, md5sum);
} else {
rc = mdfile(filespec, md5sum);
}
if (rc)
*result |= (RPMVERIFY_READFAIL|RPMVERIFY_MD5);
else if (strcmp(md5sum, md5List[filenum]))
if (!hge(h, RPMTAG_FILEMD5S, &mdt, (void **) &md5List, NULL))
*result |= RPMVERIFY_MD5;
else {
if (useBrokenMd5)
rc = mdfileBroken(filespec, md5sum);
else
rc = mdfile(filespec, md5sum);
if (rc)
*result |= (RPMVERIFY_READFAIL|RPMVERIFY_MD5);
else if (strcmp(md5sum, md5List[filenum]))
*result |= RPMVERIFY_MD5;
}
md5List = hfd(md5List, mdt);
}
if (flags & RPMVERIFY_LINKTO) {
char linkto[1024];
int size;
int size = 0;
const char ** linktoList;
int ltt;
(void) hge(h, RPMTAG_FILELINKTOS, &ltt, (void **) &linktoList, NULL);
size = readlink(filespec, linkto, sizeof(linkto)-1);
if (size == -1)
if (!hge(h, RPMTAG_FILELINKTOS, &ltt, (void **) &linktoList, NULL)
|| (size = readlink(filespec, linkto, sizeof(linkto)-1) == -1))
*result |= (RPMVERIFY_READLINKFAIL|RPMVERIFY_LINKTO);
else {
linkto[size] = '\0';
@ -217,8 +218,8 @@ int rpmVerifyFile(const char * root, Header h, int filenum,
if (flags & RPMVERIFY_FILESIZE) {
int_32 * sizeList;
(void) hge(h, RPMTAG_FILESIZES, NULL, (void **) &sizeList, NULL);
if (sizeList[filenum] != sb.st_size)
if (!hge(h, RPMTAG_FILESIZES, NULL, (void **) &sizeList, NULL)
|| sizeList[filenum] != sb.st_size)
*result |= RPMVERIFY_FILESIZE;
}
@ -233,12 +234,13 @@ int rpmVerifyFile(const char * root, Header h, int filenum,
if (flags & RPMVERIFY_RDEV) {
if (S_ISCHR(modeList[filenum]) != S_ISCHR(sb.st_mode) ||
S_ISBLK(modeList[filenum]) != S_ISBLK(sb.st_mode)) {
S_ISBLK(modeList[filenum]) != S_ISBLK(sb.st_mode))
{
*result |= RPMVERIFY_RDEV;
} else if (S_ISDEV(modeList[filenum]) && S_ISDEV(sb.st_mode)) {
unsigned short * rdevList;
(void) hge(h, RPMTAG_FILERDEVS, NULL, (void **) &rdevList, NULL);
if (rdevList[filenum] != sb.st_rdev)
if (!hge(h, RPMTAG_FILERDEVS, NULL, (void **) &rdevList, NULL)
|| rdevList[filenum] != sb.st_rdev)
*result |= RPMVERIFY_RDEV;
}
}
@ -246,8 +248,8 @@ int rpmVerifyFile(const char * root, Header h, int filenum,
if (flags & RPMVERIFY_MTIME) {
int_32 * mtimeList;
(void) hge(h, RPMTAG_FILEMTIMES, NULL, (void **) &mtimeList, NULL);
if (mtimeList[filenum] != sb.st_mtime)
if (!hge(h, RPMTAG_FILEMTIMES, NULL, (void **) &mtimeList, NULL)
|| mtimeList[filenum] != sb.st_mtime)
*result |= RPMVERIFY_MTIME;
}
@ -344,7 +346,7 @@ static int verifyHeader(QVA_t qva, Header h)
const char * prefix = (qva->qva_prefix ? qva->qva_prefix : "");
const char ** fileNames = NULL;
int count;
int_32 * fileFlagsList = NULL;
int_32 * fileFlags = NULL;
rpmVerifyAttrs verifyResult = 0;
rpmVerifyAttrs omitMask = !(qva->qva_flags & VERIFY_MD5)
? RPMVERIFY_MD5 : RPMVERIFY_NONE;
@ -354,7 +356,7 @@ static int verifyHeader(QVA_t qva, Header h)
te = t = buf;
*te = '\0';
if (!hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &fileFlagsList, NULL))
if (!hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &fileFlags, NULL))
goto exit;
if (!headerIsEntry(h, RPMTAG_BASENAMES))
@ -367,9 +369,11 @@ static int verifyHeader(QVA_t qva, Header h)
rc = rpmVerifyFile(prefix, h, i, &verifyResult, omitMask);
if (rc) {
sprintf(te, _("missing %s"), fileNames[i]);
te += strlen(te);
ec = rc;
if (!(fileFlags[i] & RPMFILE_MISSINGOK) || rpmIsVerbose()) {
sprintf(te, _("missing %s"), fileNames[i]);
te += strlen(te);
ec = rc;
}
} else if (verifyResult) {
const char * size, * md5, * link, * mtime, * mode;
const char * group, * user, * rdev;
@ -402,7 +406,7 @@ static int verifyHeader(QVA_t qva, Header h)
sprintf(te, "%s%s%s%s%s%s%s%s %c %s",
size, mode, md5, rdev, link, user, group, mtime,
fileFlagsList[i] & RPMFILE_CONFIG ? 'c' : ' ',
fileFlags[i] & RPMFILE_CONFIG ? 'c' : ' ',
fileNames[i]);
te += strlen(te);
}

View File

@ -1,4 +1,4 @@
# Makefile.in generated automatically by automake 1.4 from Makefile.am
# Makefile.in generated automatically by automake 1.4-p2 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
@ -80,6 +80,8 @@ DATADIRNAME = @DATADIRNAME@
DBLIBOBJS = @DBLIBOBJS@
DBLIBSRCS = @DBLIBSRCS@
DLLTOOL = @DLLTOOL@
ECHO = @ECHO@
EXEEXT = @EXEEXT@
FINDPROVIDES = @FINDPROVIDES@
FINDREQUIRES = @FINDREQUIRES@
FIXPERMS = @FIXPERMS@
@ -112,6 +114,7 @@ MKDIR_P = @MKDIR_P@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PGPBIN = @PGPBIN@
POFILES = @POFILES@
@ -127,6 +130,7 @@ RPMGID = @RPMGID@
RPMGROUP = @RPMGROUP@
RPMUID = @RPMUID@
RPMUSER = @RPMUSER@
STRIP = @STRIP@
SYSCONFIGDIR = @SYSCONFIGDIR@
U = @U@
UNZIPBIN = @UNZIPBIN@

View File

@ -36,6 +36,8 @@ lib/md5sum.c
lib/misc.c
lib/package.c
lib/poptBT.c
lib/poptI.c
lib/poptK.c
lib/poptQV.c
lib/problems.c
lib/psm.c
@ -53,6 +55,7 @@ rpmdb/db3.c
rpmdb/dbconfig.c
rpmdb/falloc.c
rpmdb/fprint.c
rpmdb/poptDB.c
rpmdb/rpmhash.c
rpmdb/rpmdb.c
rpmio/base64.c

View File

@ -1,4 +1,4 @@
# Makefile.in generated automatically by automake 1.4 from Makefile.am
# Makefile.in generated automatically by automake 1.4-p2 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
@ -80,6 +80,8 @@ DATADIRNAME = @DATADIRNAME@
DBLIBOBJS = @DBLIBOBJS@
DBLIBSRCS = @DBLIBSRCS@
DLLTOOL = @DLLTOOL@
ECHO = @ECHO@
EXEEXT = @EXEEXT@
FINDPROVIDES = @FINDPROVIDES@
FINDREQUIRES = @FINDREQUIRES@
FIXPERMS = @FIXPERMS@
@ -112,6 +114,7 @@ MKDIR_P = @MKDIR_P@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PGPBIN = @PGPBIN@
POFILES = @POFILES@
@ -127,6 +130,7 @@ RPMGID = @RPMGID@
RPMGROUP = @RPMGROUP@
RPMUID = @RPMUID@
RPMUSER = @RPMUSER@
STRIP = @STRIP@
SYSCONFIGDIR = @SYSCONFIGDIR@
U = @U@
UNZIPBIN = @UNZIPBIN@
@ -206,6 +210,7 @@ LDFLAGS = @LDFLAGS@
librpmmodule_la_LDFLAGS =
librpmmodule_la_LIBADD =
librpmmodule_la_OBJECTS = rpmmodule.lo hash.lo upgrade.lo
python_PROGRAMS = rpmmodule.so
PROGRAMS = $(python_PROGRAMS)
rpmmodule_so_OBJECTS =
@ -229,7 +234,7 @@ OBJECTS = $(librpmmodule_la_OBJECTS) $(rpmmodule_so_OBJECTS)
all: all-redirect
.SUFFIXES:
.SUFFIXES: .S .c .lo .o .s
.SUFFIXES: .S .c .lo .o .obj .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --foreign python/Makefile
@ -247,6 +252,11 @@ distclean-noinstLTLIBRARIES:
maintainer-clean-noinstLTLIBRARIES:
# FIXME: We should only use cygpath when building on Windows,
# and only if it is available.
.c.obj:
$(COMPILE) -c `cygpath -w $<`
.s.o:
$(COMPILE) -c $<
@ -255,6 +265,7 @@ maintainer-clean-noinstLTLIBRARIES:
mostlyclean-compile:
-rm -f *.o core *.core
-rm -f *.$(OBJEXT)
clean-compile:

23
rpm.c
View File

@ -1,5 +1,6 @@
#include "system.h"
#include <rpmcli.h>
#include <rpmbuild.h>
#include <rpmurl.h>
@ -24,7 +25,7 @@ enum modes {
MODE_UNKNOWN = 0,
MODE_QUERY = (1 << 0),
MODE_INSTALL = (1 << 1),
MODE_UNINSTALL = (1 << 2),
MODE_ERASE = (1 << 2),
MODE_VERIFY = (1 << 3),
MODE_BUILD = (1 << 4),
MODE_REBUILD = (1 << 5),
@ -40,7 +41,7 @@ enum modes {
#define MODES_QV (MODE_QUERY | MODE_VERIFY)
#define MODES_BT (MODE_BUILD | MODE_TARBUILD | MODE_REBUILD | MODE_RECOMPILE)
#define MODES_IE (MODE_INSTALL | MODE_UNINSTALL)
#define MODES_IE (MODE_INSTALL | MODE_ERASE)
#define MODES_DB (MODE_INITDB | MODE_REBUILDDB | MODE_VERIFYDB)
#define MODES_K (MODE_CHECKSIG | MODES_RESIGN)
@ -730,18 +731,18 @@ int main(int argc, const char ** argv)
break;
case 'u':
if (bigMode != MODE_UNKNOWN && bigMode != MODE_UNINSTALL)
if (bigMode != MODE_UNKNOWN && bigMode != MODE_ERASE)
argerror(_("only one major mode may be specified"));
bigMode = MODE_UNINSTALL;
bigMode = MODE_ERASE;
rpmMessage(RPMMESS_ERROR, _("-u and --uninstall are deprecated and no"
" longer work.\n"));
rpmMessage(RPMMESS_ERROR, _("Use -e or --erase instead.\n"));
exit(EXIT_FAILURE);
case 'e':
if (bigMode != MODE_UNKNOWN && bigMode != MODE_UNINSTALL)
if (bigMode != MODE_UNKNOWN && bigMode != MODE_ERASE)
argerror(_("only one major mode may be specified"));
bigMode = MODE_UNINSTALL;
bigMode = MODE_ERASE;
break;
case 'v':
@ -959,7 +960,7 @@ int main(int argc, const char ** argv)
argerror(_("--ignoresize may only be specified during package "
"installation"));
if (allMatches && bigMode != MODE_UNINSTALL)
if (allMatches && bigMode != MODE_ERASE)
argerror(_("--allmatches may only be specified during package "
"erasure"));
@ -967,11 +968,11 @@ int main(int argc, const char ** argv)
argerror(_("--allfiles may only be specified during package "
"installation"));
if (justdb && bigMode != MODE_INSTALL && bigMode != MODE_UNINSTALL)
if (justdb && bigMode != MODE_INSTALL && bigMode != MODE_ERASE)
argerror(_("--justdb may only be specified during package "
"installation and erasure"));
if (bigMode != MODE_INSTALL && bigMode != MODE_UNINSTALL &&
if (bigMode != MODE_INSTALL && bigMode != MODE_ERASE &&
bigMode != MODE_VERIFY &&
(noScripts | noPre | noPost | noPreun | noPostun |
noTriggers | noTPrein | noTIn | noTUn | noTPostun))
@ -982,7 +983,7 @@ int main(int argc, const char ** argv)
argerror(_("--apply may only be specified during package "
"installation"));
if (bigMode != MODE_INSTALL && bigMode != MODE_UNINSTALL &&
if (bigMode != MODE_INSTALL && bigMode != MODE_ERASE &&
(noTriggers | noTPrein | noTIn | noTUn | noTPostun))
argerror(_("trigger disabling options may only be specified during package "
"installation and erasure"));
@ -1149,7 +1150,7 @@ int main(int argc, const char ** argv)
case MODE_TARBUILD:
break;
case MODE_UNINSTALL:
case MODE_ERASE:
if (!poptPeekArg(optCon))
argerror(_("no packages given for uninstall"));

View File

@ -221,6 +221,9 @@ fi
%postun python -p /sbin/ldconfig
%endif
%define rpmattr %attr(0755, @RPMUSER@, @RPMGROUP@)
%define rpmdbattr %rpmattr %verify(not md5 size mtime) %ghost
%files
%defattr(-,root,root)
%doc RPM-PGP-KEY RPM-GPG-KEY CHANGES GROUPS doc/manual/[a-z]*
@ -232,42 +235,42 @@ fi
%dir /etc/rpm
%config(noreplace,missingok) /etc/rpm/macros.db1
%attr(0755, @RPMUSER@, @RPMGROUP@) %dir /var/lib/rpm
%attr(0755, @RPMUSER@, @RPMGROUP@) %ghost /var/lib/rpm/Basenames
%attr(0755, @RPMUSER@, @RPMGROUP@) %ghost /var/lib/rpm/Conflictname
#%attr(0755, @RPMUSER@, @RPMGROUP@) %ghost /var/lib/rpm/__db.001
%attr(0755, @RPMUSER@, @RPMGROUP@) %ghost /var/lib/rpm/Dirnames
%attr(0755, @RPMUSER@, @RPMGROUP@) %ghost /var/lib/rpm/Group
%attr(0755, @RPMUSER@, @RPMGROUP@) %ghost /var/lib/rpm/Installtid
%attr(0755, @RPMUSER@, @RPMGROUP@) %ghost /var/lib/rpm/Name
#%attr(0755, @RPMUSER@, @RPMGROUP@) %ghost /var/lib/rpm/Packages
%attr(0755, @RPMUSER@, @RPMGROUP@) %ghost /var/lib/rpm/Providename
%attr(0755, @RPMUSER@, @RPMGROUP@) %ghost /var/lib/rpm/Provideversion
%attr(0755, @RPMUSER@, @RPMGROUP@) %ghost /var/lib/rpm/Removetid
%attr(0755, @RPMUSER@, @RPMGROUP@) %ghost /var/lib/rpm/Requirename
%attr(0755, @RPMUSER@, @RPMGROUP@) %ghost /var/lib/rpm/Requireversion
%attr(0755, @RPMUSER@, @RPMGROUP@) %ghost /var/lib/rpm/Triggername
%rpmdbattr /var/lib/rpm/Basenames
%rpmdbattr /var/lib/rpm/Conflictname
#%rpmdbattr /var/lib/rpm/__db.001
%rpmdbattr /var/lib/rpm/Dirnames
%rpmdbattr /var/lib/rpm/Group
%rpmdbattr /var/lib/rpm/Installtid
%rpmdbattr /var/lib/rpm/Name
#%rpmdbattr /var/lib/rpm/Packages
%rpmdbattr /var/lib/rpm/Providename
%rpmdbattr /var/lib/rpm/Provideversion
%rpmdbattr /var/lib/rpm/Removetid
%rpmdbattr /var/lib/rpm/Requirename
%rpmdbattr /var/lib/rpm/Requireversion
%rpmdbattr /var/lib/rpm/Triggername
%endif
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/bin/rpm2cpio
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/bin/gendiff
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/bin/rpmdb
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/bin/rpm[eiukqv]
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/bin/rpmsign
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/bin/rpmquery
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/bin/rpmverify
%rpmattr %{__prefix}/bin/rpm2cpio
%rpmattr %{__prefix}/bin/gendiff
%rpmattr %{__prefix}/bin/rpmdb
%rpmattr %{__prefix}/bin/rpm[eiukqv]
%rpmattr %{__prefix}/bin/rpmsign
%rpmattr %{__prefix}/bin/rpmquery
%rpmattr %{__prefix}/bin/rpmverify
%{__prefix}/lib/librpm.so.*
%{__prefix}/lib/librpmdb.so.*
%{__prefix}/lib/librpmio.so.*
%{__prefix}/lib/librpmbuild.so.*
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/config.guess
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/config.sub
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/convertrpmrc.sh
%rpmattr %{__prefix}/lib/rpm/config.guess
%rpmattr %{__prefix}/lib/rpm/config.sub
%rpmattr %{__prefix}/lib/rpm/convertrpmrc.sh
%attr(0644, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/macros
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/mkinstalldirs
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/rpm.*
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/rpm[deiukqv]
%rpmattr %{__prefix}/lib/rpm/mkinstalldirs
%rpmattr %{__prefix}/lib/rpm/rpm.*
%rpmattr %{__prefix}/lib/rpm/rpm[deiukqv]
%attr(0644, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/rpmpopt*
%attr(0644, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/rpmrc
@ -328,31 +331,31 @@ fi
%dir %{__prefix}/src/redhat/SRPMS
%dir %{__prefix}/src/redhat/RPMS
%{__prefix}/src/redhat/RPMS/*
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/bin/rpmbuild
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/brp-*
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/check-prereqs
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/cpanflute
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/find-lang.sh
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/find-prov.pl
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/find-provides
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/find-provides.perl
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/find-req.pl
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/find-requires
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/find-requires.perl
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/get_magic.pl
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/getpo.sh
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/http.req
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/javadeps
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/magic.prov
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/magic.req
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/perl.prov
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/perl.req
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/rpm[bt]
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/rpmdiff
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/rpmdiff.cgi
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/u_pkg.sh
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/vpkg-provides.sh
%attr(0755, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/vpkg-provides2.sh
%rpmattr %{__prefix}/bin/rpmbuild
%rpmattr %{__prefix}/lib/rpm/brp-*
%rpmattr %{__prefix}/lib/rpm/check-prereqs
%rpmattr %{__prefix}/lib/rpm/cpanflute
%rpmattr %{__prefix}/lib/rpm/find-lang.sh
%rpmattr %{__prefix}/lib/rpm/find-prov.pl
%rpmattr %{__prefix}/lib/rpm/find-provides
%rpmattr %{__prefix}/lib/rpm/find-provides.perl
%rpmattr %{__prefix}/lib/rpm/find-req.pl
%rpmattr %{__prefix}/lib/rpm/find-requires
%rpmattr %{__prefix}/lib/rpm/find-requires.perl
%rpmattr %{__prefix}/lib/rpm/get_magic.pl
%rpmattr %{__prefix}/lib/rpm/getpo.sh
%rpmattr %{__prefix}/lib/rpm/http.req
%rpmattr %{__prefix}/lib/rpm/javadeps
%rpmattr %{__prefix}/lib/rpm/magic.prov
%rpmattr %{__prefix}/lib/rpm/magic.req
%rpmattr %{__prefix}/lib/rpm/perl.prov
%rpmattr %{__prefix}/lib/rpm/perl.req
%rpmattr %{__prefix}/lib/rpm/rpm[bt]
%rpmattr %{__prefix}/lib/rpm/rpmdiff
%rpmattr %{__prefix}/lib/rpm/rpmdiff.cgi
%rpmattr %{__prefix}/lib/rpm/u_pkg.sh
%rpmattr %{__prefix}/lib/rpm/vpkg-provides.sh
%rpmattr %{__prefix}/lib/rpm/vpkg-provides2.sh
%{__prefix}%{__share}/man/man8/rpmbuild.8*

View File

@ -27,7 +27,8 @@ LIBS =
DB3LOBJS = $(shell cat $(top_builddir)/$(WITH_DB_SUBDIR)/db3lobjs)
lib_LTLIBRARIES = librpmdb.la
librpmdb_la_SOURCES = $(DBLIBSRCS) dbconfig.c fprint.c rpmhash.c rpmdb.c
librpmdb_la_SOURCES = $(DBLIBSRCS) \
dbconfig.c fprint.c poptDB.c rpmhash.c rpmdb.c
librpmdb_la_LDFLAGS = @libdb3@
librpmdb_la_LIBADD = $(DBLIBOBJS) $(DB3LOBJS)
librpmdb_la_DEPENDENCIES = $(DBLIBOBJS) .created

View File

@ -163,7 +163,7 @@ static int db_init(dbiIndex dbi, const char * dbhome,
if (eflags & DB_JOINENV) eflags &= DB_JOINENV;
if (dbfile)
rpmMessage(RPMMESS_DEBUG, _("opening db environment %s/%s %s\n"),
rpmMessage(RPMMESS_DEBUG, _("opening db environment %s/%s %s\n"),
dbhome, dbfile, prDbiOpenFlags(eflags, 1));
/* XXX Can't do RPC w/o host. */
@ -834,6 +834,12 @@ static int db3open(/*@keep@*/ rpmdb rpmdb, int rpmtag, dbiIndex * dbip)
dbf = _free(dbf);
}
/*
* Turn off verify-on-close if opening read-only.
*/
if (oflags & DB_RDONLY)
dbi->dbi_verify_on_close = 0;
dbi->dbi_dbinfo = NULL;
if (dbi->dbi_use_dbenv)

View File

@ -36,70 +36,67 @@ struct dbOption {
/*@observer@*/ /*@null@*/ const char * argDescrip; /*!< argument description for autohelp */
};
#define _POPT_SET_BIT (POPT_ARG_VAL|POPT_ARGFLAG_OR)
#define _POPT_UNSET_BIT (POPT_ARG_VAL|POPT_ARGFLAG_NAND)
/*@-immediatetrans -exportlocal -exportheadervar@*/
/** \ingroup db3
*/
struct dbOption rdbOptions[] = {
/* XXX DB_CXX_NO_EXCEPTIONS */
{ "client", 0,_POPT_SET_BIT, &db3dbi.dbi_ecflags, DB_CLIENT,
{ "client", 0,POPT_BIT_SET, &db3dbi.dbi_ecflags, DB_CLIENT,
NULL, NULL },
{ "xa_create", 0,_POPT_SET_BIT, &db3dbi.dbi_cflags, DB_XA_CREATE,
{ "xa_create", 0,POPT_BIT_SET, &db3dbi.dbi_cflags, DB_XA_CREATE,
NULL, NULL },
{ "create", 0,_POPT_SET_BIT, &db3dbi.dbi_oeflags, DB_CREATE,
{ "create", 0,POPT_BIT_SET, &db3dbi.dbi_oeflags, DB_CREATE,
NULL, NULL },
{ "thread", 0,_POPT_SET_BIT, &db3dbi.dbi_oeflags, DB_THREAD,
{ "thread", 0,POPT_BIT_SET, &db3dbi.dbi_oeflags, DB_THREAD,
NULL, NULL },
{ "force", 0,_POPT_SET_BIT, &db3dbi.dbi_eflags, DB_FORCE,
{ "force", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_FORCE,
NULL, NULL },
{ "cdb", 0,_POPT_SET_BIT, &db3dbi.dbi_eflags, DB_INIT_CDB,
{ "cdb", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_INIT_CDB,
NULL, NULL },
{ "lock", 0,_POPT_SET_BIT, &db3dbi.dbi_eflags, DB_INIT_LOCK,
{ "lock", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_INIT_LOCK,
NULL, NULL },
{ "log", 0,_POPT_SET_BIT, &db3dbi.dbi_eflags, DB_INIT_LOG,
{ "log", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_INIT_LOG,
NULL, NULL },
{ "mpool", 0,_POPT_SET_BIT, &db3dbi.dbi_eflags, DB_INIT_MPOOL,
{ "mpool", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_INIT_MPOOL,
NULL, NULL },
{ "txn", 0,_POPT_SET_BIT, &db3dbi.dbi_eflags, DB_INIT_TXN,
{ "txn", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_INIT_TXN,
NULL, NULL },
{ "joinenv", 0,_POPT_SET_BIT, &db3dbi.dbi_eflags, DB_JOINENV,
{ "joinenv", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_JOINENV,
NULL, NULL },
{ "recover", 0,_POPT_SET_BIT, &db3dbi.dbi_eflags, DB_RECOVER,
{ "recover", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_RECOVER,
NULL, NULL },
{ "recover_fatal", 0,_POPT_SET_BIT, &db3dbi.dbi_eflags, DB_RECOVER_FATAL,
{ "recover_fatal", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_RECOVER_FATAL,
NULL, NULL },
{ "shared", 0,_POPT_SET_BIT, &db3dbi.dbi_eflags, DB_SYSTEM_MEM,
{ "shared", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_SYSTEM_MEM,
NULL, NULL },
{ "txn_nosync", 0,_POPT_SET_BIT, &db3dbi.dbi_eflags, DB_TXN_NOSYNC,
{ "txn_nosync", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_TXN_NOSYNC,
NULL, NULL },
{ "use_environ_root", 0,_POPT_SET_BIT, &db3dbi.dbi_eflags, DB_USE_ENVIRON_ROOT,
{ "use_environ_root", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_USE_ENVIRON_ROOT,
NULL, NULL },
{ "use_environ", 0,_POPT_SET_BIT, &db3dbi.dbi_eflags, DB_USE_ENVIRON,
{ "use_environ", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_USE_ENVIRON,
NULL, NULL },
{ "lockdown", 0,_POPT_SET_BIT, &db3dbi.dbi_eflags, DB_LOCKDOWN,
{ "lockdown", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_LOCKDOWN,
NULL, NULL },
{ "private", 0,_POPT_SET_BIT, &db3dbi.dbi_eflags, DB_PRIVATE,
{ "private", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_PRIVATE,
NULL, NULL },
{ "txn_sync", 0,_POPT_SET_BIT, &db3dbi.dbi_tflags, DB_TXN_SYNC,
{ "txn_sync", 0,POPT_BIT_SET, &db3dbi.dbi_tflags, DB_TXN_SYNC,
NULL, NULL },
{ "txn_nowait",0,_POPT_SET_BIT, &db3dbi.dbi_tflags, DB_TXN_NOWAIT,
{ "txn_nowait",0,POPT_BIT_SET, &db3dbi.dbi_tflags, DB_TXN_NOWAIT,
NULL, NULL },
{ "excl", 0,_POPT_SET_BIT, &db3dbi.dbi_oflags, DB_EXCL,
{ "excl", 0,POPT_BIT_SET, &db3dbi.dbi_oflags, DB_EXCL,
NULL, NULL },
{ "nommap", 0,_POPT_SET_BIT, &db3dbi.dbi_oflags, DB_NOMMAP,
{ "nommap", 0,POPT_BIT_SET, &db3dbi.dbi_oflags, DB_NOMMAP,
NULL, NULL },
{ "rdonly", 0,_POPT_SET_BIT, &db3dbi.dbi_oflags, DB_RDONLY,
{ "rdonly", 0,POPT_BIT_SET, &db3dbi.dbi_oflags, DB_RDONLY,
NULL, NULL },
{ "truncate", 0,_POPT_SET_BIT, &db3dbi.dbi_oflags, DB_TRUNCATE,
{ "truncate", 0,POPT_BIT_SET, &db3dbi.dbi_oflags, DB_TRUNCATE,
NULL, NULL },
{ "fcntl_locking",0,_POPT_SET_BIT, &db3dbi.dbi_oflags, DB_FCNTL_LOCKING,
{ "fcntl_locking",0,POPT_BIT_SET, &db3dbi.dbi_oflags, DB_FCNTL_LOCKING,
NULL, NULL },
{ "btree", 0,POPT_ARG_VAL, &db3dbi.dbi_type, DB_BTREE,
@ -167,13 +164,13 @@ struct dbOption rdbOptions[] = {
{ "tas_spins", 0,POPT_ARG_INT, &db3dbi.dbi_tas_spins, 0,
NULL, NULL },
{ "chkpoint", 0,_POPT_SET_BIT, &db3dbi.dbi_verbose, DB_VERB_CHKPOINT,
{ "chkpoint", 0,POPT_BIT_SET, &db3dbi.dbi_verbose, DB_VERB_CHKPOINT,
NULL, NULL },
{ "deadlock", 0,_POPT_SET_BIT, &db3dbi.dbi_verbose, DB_VERB_DEADLOCK,
{ "deadlock", 0,POPT_BIT_SET, &db3dbi.dbi_verbose, DB_VERB_DEADLOCK,
NULL, NULL },
{ "recovery", 0,_POPT_SET_BIT, &db3dbi.dbi_verbose, DB_VERB_RECOVERY,
{ "recovery", 0,POPT_BIT_SET, &db3dbi.dbi_verbose, DB_VERB_RECOVERY,
NULL, NULL },
{ "waitsfor", 0,_POPT_SET_BIT, &db3dbi.dbi_verbose, DB_VERB_WAITSFOR,
{ "waitsfor", 0,POPT_BIT_SET, &db3dbi.dbi_verbose, DB_VERB_WAITSFOR,
NULL, NULL },
{ "verbose", 0,POPT_ARG_VAL, &db3dbi.dbi_verbose, -1,
NULL, NULL },
@ -211,27 +208,27 @@ struct dbOption rdbOptions[] = {
/* XXX bt_compare */
/* XXX bt_dup_compare */
/* XXX bt_prefix */
{ "bt_dup", 0,_POPT_SET_BIT, &db3dbi.dbi_bt_flags, DB_DUP,
{ "bt_dup", 0,POPT_BIT_SET, &db3dbi.dbi_bt_flags, DB_DUP,
NULL, NULL },
{ "bt_dupsort",0,_POPT_SET_BIT, &db3dbi.dbi_bt_flags, DB_DUPSORT,
{ "bt_dupsort",0,POPT_BIT_SET, &db3dbi.dbi_bt_flags, DB_DUPSORT,
NULL, NULL },
{ "bt_recnum", 0,_POPT_SET_BIT, &db3dbi.dbi_bt_flags, DB_RECNUM,
{ "bt_recnum", 0,POPT_BIT_SET, &db3dbi.dbi_bt_flags, DB_RECNUM,
NULL, NULL },
{ "bt_revsplitoff", 0,_POPT_SET_BIT, &db3dbi.dbi_bt_flags, DB_REVSPLITOFF,
{ "bt_revsplitoff", 0,POPT_BIT_SET, &db3dbi.dbi_bt_flags, DB_REVSPLITOFF,
NULL, NULL },
{ "h_dup", 0,_POPT_SET_BIT, &db3dbi.dbi_h_flags, DB_DUP,
{ "h_dup", 0,POPT_BIT_SET, &db3dbi.dbi_h_flags, DB_DUP,
NULL, NULL },
{ "h_dupsort", 0,_POPT_SET_BIT, &db3dbi.dbi_h_flags, DB_DUPSORT,
{ "h_dupsort", 0,POPT_BIT_SET, &db3dbi.dbi_h_flags, DB_DUPSORT,
NULL, NULL },
{ "h_ffactor", 0,POPT_ARG_INT, &db3dbi.dbi_h_ffactor, 0,
NULL, NULL },
{ "h_nelem", 0,POPT_ARG_INT, &db3dbi.dbi_h_nelem, 0,
NULL, NULL },
{ "re_renumber", 0,_POPT_SET_BIT, &db3dbi.dbi_re_flags, DB_RENUMBER,
{ "re_renumber", 0,POPT_BIT_SET, &db3dbi.dbi_re_flags, DB_RENUMBER,
NULL, NULL },
{ "re_snapshot",0,_POPT_SET_BIT, &db3dbi.dbi_re_flags, DB_SNAPSHOT,
{ "re_snapshot",0,POPT_BIT_SET, &db3dbi.dbi_re_flags, DB_SNAPSHOT,
NULL, NULL },
{ "re_delim", 0,POPT_ARG_INT, &db3dbi.dbi_re_delim, 0,
NULL, NULL },
@ -395,8 +392,8 @@ dbiIndex db3New(rpmdb rpmdb, int rpmtag)
/* Toggle the flags for negated tokens, if necessary. */
argInfo = opt->argInfo;
if (argInfo == _POPT_SET_BIT && *o == '!' && ((tok - o) % 2))
argInfo = _POPT_UNSET_BIT;
if (argInfo == POPT_BIT_SET && *o == '!' && ((tok - o) % 2))
argInfo = POPT_BIT_CLR;
/* Save value in template as appropriate. */
switch (argInfo & POPT_ARG_MASK) {
@ -495,10 +492,8 @@ dbiIndex db3New(rpmdb rpmdb, int rpmtag)
dbi->dbi_tear_down = 1;
}
#ifdef NOTYET
if ((dbi->dbi_bt_flags | dbi->dbi_h_flags) & DB_DUP)
dbi->dbi_permit_dups = 1;
#endif
return dbi;
}
@ -512,7 +507,7 @@ const char *const prDbiOpenFlags(int dbflags, int print_dbenv_flags)
oe = buf;
*oe = '\0';
for (opt = rdbOptions; opt->longName != NULL; opt++) {
if (opt->argInfo != _POPT_SET_BIT)
if (opt->argInfo != POPT_BIT_SET)
continue;
if (print_dbenv_flags) {
if (!(opt->arg == &db3dbi.dbi_oeflags ||

36
rpmdb/poptDB.c Normal file
View File

@ -0,0 +1,36 @@
/** \ingroup rpmcli
* \file rpmdb/poptDB.c
* Popt tables for database modes.
*/
#include "system.h"
#include <rpmcli.h>
#include <rpmurl.h>
#include "debug.h"
struct rpmDatabaseArguments_s rpmDBArgs;
/*@-redecl@*/
extern int _noDirTokens;
/*@=redecl@*/
/**
*/
struct poptOption rpmDatabasePoptTable[] = {
{ "initdb", '\0', POPT_ARG_VAL, &rpmDBArgs.init, 1,
N_("initialize database"), NULL},
{ "rebuilddb", '\0', POPT_ARG_VAL, &rpmDBArgs.rebuild, 1,
N_("rebuild database inverted lists from installed package headers"),
NULL},
{ "verifydb", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &rpmDBArgs.verify, 1,
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
};

View File

@ -10,7 +10,12 @@
#include "fprint.h"
/**
*/
typedef /*@abstract@*/ struct _dbiIndexItem * dbiIndexItem;
/**
*/
typedef /*@abstract@*/ struct _dbiIndex * dbiIndex;
/* this will break if sizeof(int) != 4 */

View File

@ -6,12 +6,10 @@
static rpmDigestFlags flags = RPMDIGEST_MD5;
extern int _rpmio_debug;
#define _POPT_SET_BIT (POPT_ARG_VAL|POPT_ARGFLAG_OR)
static struct poptOption optionsTable[] = {
{ "md5", '\0', _POPT_SET_BIT, &flags, RPMDIGEST_MD5, NULL, NULL },
{ "sha1",'\0', _POPT_SET_BIT, &flags, RPMDIGEST_SHA1, NULL, NULL },
{ "native",'\0', _POPT_SET_BIT, &flags, RPMDIGEST_NATIVE, NULL, NULL },
{ "md5", '\0', POPT_BIT_SET, &flags, RPMDIGEST_MD5, NULL, NULL },
{ "sha1",'\0', POPT_BIT_SET, &flags, RPMDIGEST_SHA1, NULL, NULL },
{ "native",'\0', POPT_BIT_SET, &flags, RPMDIGEST_NATIVE, NULL, NULL },
{ "debug",'d', POPT_ARG_VAL, &_rpmio_debug, -1, NULL, NULL },
{ NULL, '\0', 0, NULL, 0, NULL, NULL }
};

330
rpmqv.c
View File

@ -10,6 +10,7 @@
#define IAM_RPMK
#endif
#include <rpmcli.h>
#include <rpmbuild.h>
#include <rpmurl.h>
@ -19,12 +20,15 @@
#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
@ -32,13 +36,16 @@ static int initdb = 0;
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"
@ -62,8 +69,8 @@ enum modes {
#define MODES_QV (MODE_QUERY | MODE_VERIFY)
MODE_INSTALL = (1 << 1),
MODE_UNINSTALL = (1 << 2),
#define MODES_IE (MODE_INSTALL | MODE_UNINSTALL)
MODE_ERASE = (1 << 2),
#define MODES_IE (MODE_INSTALL | MODE_ERASE)
MODE_BUILD = (1 << 4),
MODE_REBUILD = (1 << 5),
@ -93,7 +100,9 @@ extern int _ftp_debug;
extern int noLibio;
extern int _rpmio_debug;
extern int _url_debug;
#ifdef DYING
extern int _noDirTokens;
#endif
/*@-varuse@*/
/*@observer@*/ extern const char * rpmNAME;
@ -117,21 +126,18 @@ static int quiet = 0;
static int showrc = 0;
static int showVersion = 0;
#if defined(IAM_RPMBT) || defined(IAM_RPMK)
static int signIt = 0;
#endif /* IAM_RPMBT || IAM_RPMK */
#ifdef DYING
#if defined(IAM_RPMQV) || defined(IAM_RPMK)
static int noMd5 = 0;
#endif
#if defined(IAM_RPMEIU)
static int noDeps = 0;
#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,
@ -183,6 +189,7 @@ static struct poptOption rpmAllPoptTable[] = {
POPT_TABLEEND
};
#ifdef DYING
#ifdef IAM_RPMDB
static struct poptOption rpmDatabasePoptTable[] = {
{ "initdb", '\0', 0, &initdb, 0,
@ -190,10 +197,10 @@ static struct poptOption rpmDatabasePoptTable[] = {
{ "rebuilddb", '\0', 0, 0, GETOPT_REBUILDDB,
N_("rebuild database inverted lists from installed package headers"),
NULL},
{ "verifydb", '\0', 0, 0, GETOPT_VERIFYDB,
{ "verifydb", '\0', POPT_ARGFLAG_DOC_HIDDEN, 0, GETOPT_VERIFYDB,
N_("verify database files"),
NULL},
{ "nodirtokens", '\0', POPT_ARG_VAL, &_noDirTokens, 1,
{ "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,
@ -202,7 +209,9 @@ static struct poptOption rpmDatabasePoptTable[] = {
POPT_TABLEEND
};
#endif /* IAM_RPMDB */
#endif
#ifdef DYING
#ifdef IAM_RPMK
static struct poptOption rpmSignPoptTable[] = {
{ "addsign", '\0', 0, 0, GETOPT_ADDSIGN,
@ -210,7 +219,7 @@ static struct poptOption rpmSignPoptTable[] = {
{ "resign", '\0', 0, 0, GETOPT_RESIGN,
N_("sign a package (discard current signature)"), NULL },
{ "sign", '\0', 0, &signIt, 0,
N_("generate PGP/GPG signature"), NULL },
N_("generate GPG/PGP signature"), NULL },
{ "checksig", 'K', 0, 0, 'K',
N_("verify package signature"), NULL },
{ "nogpg", '\0', 0, &noGpg, 0,
@ -223,103 +232,103 @@ static struct poptOption rpmSignPoptTable[] = {
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;
#define _POPT_SET_BIT (POPT_ARG_VAL|POPT_ARGFLAG_OR)
static struct poptOption rpmInstallPoptTable[] = {
{ "allfiles", '\0', _POPT_SET_BIT, &transFlags, RPMTRANS_FLAG_ALLFILES,
{ "allfiles", '\0', POPT_BIT_SET, &transFlags, RPMTRANS_FLAG_ALLFILES,
N_("install all files, even configurations which might otherwise be skipped"),
NULL},
{ "allmatches", '\0', _POPT_SET_BIT, &eraseInterfaceFlags, UNINSTALL_ALLMATCHES,
{ "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_SET_BIT|POPT_ARGFLAG_DOC_HIDDEN, &transFlags,
{ "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_SET_BIT, &probFilter, RPMPROB_FILTER_FORCERELOCATE,
{ "badreloc", '\0', POPT_BIT_SET, &probFilter, RPMPROB_FILTER_FORCERELOCATE,
N_("relocate files in non-relocateable package"), NULL},
{ "dirstash", '\0', _POPT_SET_BIT|POPT_ARGFLAG_DOC_HIDDEN, &transFlags,
{ "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_SET_BIT, &transFlags, RPMTRANS_FLAG_NODOCS,
{ "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_SET_BIT, &installInterfaceFlags,
{ "freshen", 'F', POPT_BIT_SET, &installInterfaceFlags,
(INSTALL_UPGRADE|INSTALL_FRESHEN),
N_("upgrade package(s) if already installed"),
N_("<packagefile>+") },
{ "hash", 'h', _POPT_SET_BIT, &installInterfaceFlags, INSTALL_HASH,
{ "hash", 'h', POPT_BIT_SET, &installInterfaceFlags, INSTALL_HASH,
N_("print hash marks as package installs (good with -v)"), NULL},
{ "ignorearch", '\0', _POPT_SET_BIT, &probFilter, RPMPROB_FILTER_IGNOREARCH,
{ "ignorearch", '\0', POPT_BIT_SET, &probFilter, RPMPROB_FILTER_IGNOREARCH,
N_("don't verify package architecture"), NULL},
{ "ignoreos", '\0', _POPT_SET_BIT, &probFilter, RPMPROB_FILTER_IGNOREOS,
{ "ignoreos", '\0', POPT_BIT_SET, &probFilter, RPMPROB_FILTER_IGNOREOS,
N_("don't verify package operating system"), NULL},
{ "ignoresize", '\0', _POPT_SET_BIT, &probFilter,
{ "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_SET_BIT, &transFlags, RPMTRANS_FLAG_JUSTDB,
{ "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_SET_BIT, &installInterfaceFlags, INSTALL_NOORDER,
{ "noorder", '\0', POPT_BIT_SET, &installInterfaceFlags, INSTALL_NOORDER,
N_("do not reorder package installation to satisfy dependencies"),
NULL},
{ "noscripts", '\0', _POPT_SET_BIT, &transFlags,
{ "noscripts", '\0', POPT_BIT_SET, &transFlags,
(_noTransScripts|_noTransTriggers),
N_("do not execute package scriptlet(s)"), NULL },
{ "nopre", '\0', _POPT_SET_BIT|POPT_ARGFLAG_DOC_HIDDEN, &transFlags,
{ "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_SET_BIT|POPT_ARGFLAG_DOC_HIDDEN, &transFlags,
{ "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_SET_BIT|POPT_ARGFLAG_DOC_HIDDEN, &transFlags,
{ "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_SET_BIT|POPT_ARGFLAG_DOC_HIDDEN, &transFlags,
{ "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_SET_BIT, &transFlags,
{ "notriggers", '\0', POPT_BIT_SET, &transFlags,
_noTransTriggers,
N_("do not execute any scriptlet(s) triggered by this package"), NULL},
{ "notriggerprein", '\0', _POPT_SET_BIT|POPT_ARGFLAG_DOC_HIDDEN, &transFlags,
{ "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_SET_BIT|POPT_ARGFLAG_DOC_HIDDEN, &transFlags,
{ "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_SET_BIT|POPT_ARGFLAG_DOC_HIDDEN, &transFlags,
{ "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_SET_BIT|POPT_ARGFLAG_DOC_HIDDEN, &transFlags,
{ "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_SET_BIT, &probFilter, RPMPROB_FILTER_OLDPACKAGE,
{ "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_SET_BIT, &installInterfaceFlags, INSTALL_PERCENT,
{ "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"),
@ -327,22 +336,23 @@ static struct poptOption rpmInstallPoptTable[] = {
{ "relocate", '\0', POPT_ARG_STRING, 0, GETOPT_RELOCATE,
N_("relocate files from path <old> to <new>"),
N_("<old>=<new>") },
{ "repackage", '\0', _POPT_SET_BIT, &transFlags, RPMTRANS_FLAG_REPACKAGE,
{ "repackage", '\0', POPT_BIT_SET, &transFlags, RPMTRANS_FLAG_REPACKAGE,
N_("save erased package files by repackaging"), NULL},
{ "replacefiles", '\0', _POPT_SET_BIT, &probFilter,
{ "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_SET_BIT, &probFilter, RPMPROB_FILTER_REPLACEPKG,
{ "replacepkgs", '\0', POPT_BIT_SET, &probFilter, RPMPROB_FILTER_REPLACEPKG,
N_("reinstall if the package is already present"), NULL},
{ "test", '\0', _POPT_SET_BIT, &transFlags, RPMTRANS_FLAG_TEST,
{ "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_SET_BIT, &installInterfaceFlags, INSTALL_UPGRADE,
{ "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[] = {
@ -404,7 +414,7 @@ long _stksize = 64 * 1024L;
/*@exits@*/ static void argerror(const char * desc)
/*@modifies fileSystem @*/
{
fprintf(stderr, _("rpm: %s\n"), desc);
fprintf(stderr, _("%s: %s\n"), __progname, desc);
exit(EXIT_FAILURE);
}
@ -721,13 +731,25 @@ int main(int argc, const char ** argv)
#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)
@ -769,7 +791,7 @@ int main(int argc, const char ** argv)
if (!strcmp(__progname, "rpmverify")) bigMode = MODE_VERIFY;
#endif
#ifdef RPMEIU
if (!strcmp(__progname, "rpme")) bigMode = MODE_UNINSTALL;
if (!strcmp(__progname, "rpme")) bigMode = MODE_ERASE;
if (!strcmp(__progname, "rpmi")) bigMode = MODE_INSTALL;
if (!strcmp(__progname, "rpmu")) bigMode = MODE_INSTALL;
#endif
@ -837,7 +859,7 @@ int main(int argc, const char ** argv)
poptResetContext(optCon);
#ifdef IAM_RPMQV
if (qva->qva_queryFormat) free((void *)qva->qva_queryFormat);
qva->qva_queryFormat = _free(qva->qva_queryFormat);
memset(qva, 0, sizeof(*qva));
qva->qva_source = RPMQV_PACKAGE;
qva->qva_mode = ' ';
@ -845,18 +867,37 @@ int main(int argc, const char ** argv)
#endif
#ifdef IAM_RPMBT
if (ba->buildRootOverride) free((void *)ba->buildRootOverride);
if (ba->targets) free(ba->targets);
ba->buildRootOverride = _free(ba->buildRootOverride);
ba->targets = _free(ba->targets);
memset(ba, 0, sizeof(*ba));
ba->buildMode = ' ';
ba->buildChar = ' ';
#endif
#ifdef IAM_RPMDB
memset(da, 0, sizeof(*da));
#endif
#ifdef IAM_RPMK
memset(ka, 0, sizeof(*ka));
ka->addSign = RESIGN_CHK_SIGNATURE;
ka->checksigFlags = CHECKSIG_ALL;
#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->probFilter = RPMPROB_FILTER_NONE;
ia->installInterfaceFlags = INSTALL_NONE;
ia->eraseInterfaceFlags = UNINSTALL_NONE;
#endif
#endif
while ((arg = poptGetNextOpt(optCon)) > 0) {
@ -891,12 +932,13 @@ int main(int argc, const char ** argv)
break;
#endif /* IAM_RPMQV || IAM_RPMEIU || IAM_RPMBT */
#ifdef DYING
#ifdef IAM_RPMEIU
case 'e':
if (bigMode != MODE_UNKNOWN && bigMode != MODE_UNINSTALL)
if (bigMode != MODE_UNKNOWN && bigMode != MODE_ERASE)
argerror(_("only one major mode may be specified"));
bigMode = MODE_UNINSTALL;
bigMode = MODE_ERASE;
break;
case GETOPT_INSTALL:
@ -923,11 +965,11 @@ int main(int argc, const char ** argv)
if (optArg == NULL || *optArg != '/')
argerror(_("exclude paths must begin with a /"));
relocations = xrealloc(relocations,
sizeof(*relocations) * (numRelocations + 1));
ia->relocations = xrealloc(ia->relocations,
sizeof(*ia->relocations) * (ia->numRelocations + 1));
/*@-observertrans -dependenttrans@*/ /* FIX: W2DO? */
relocations[numRelocations].oldPath = optArg;
relocations[numRelocations++].newPath = NULL;
ia->relocations[ia->numRelocations].oldPath = optArg;
ia->relocations[ia->numRelocations++].newPath = NULL;
/*@=observertrans =dependenttrans@*/
break;
@ -940,15 +982,17 @@ int main(int argc, const char ** argv)
*newPath++ = '\0';
if (*newPath != '/')
argerror(_("relocations must have a / following the ="));
relocations = xrealloc(relocations,
sizeof(*relocations) * (numRelocations + 1));
ia->relocations = xrealloc(ia->relocations,
sizeof(*ia->relocations) * (ia->numRelocations + 1));
/*@-observertrans -kepttrans@*/ /* FIX: W2DO? */
relocations[numRelocations].oldPath = optArg;
relocations[numRelocations++].newPath = newPath;
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)
@ -960,8 +1004,10 @@ int main(int argc, const char ** argv)
argerror(_("only one major mode may be specified"));
bigMode = MODE_VERIFYDB;
break;
#endif
#endif /* IAM_RPMDB */
#endif /* DYING */
#ifdef DYING
#ifdef IAM_RPMK
case 'K':
if (bigMode != MODE_UNKNOWN && bigMode != MODE_CHECKSIG)
@ -985,6 +1031,7 @@ int main(int argc, const char ** argv)
signIt = 1;
break;
#endif /* IAM_RPMK */
#endif /* DYING */
case GETOPT_DEFINEMACRO:
if (optArg) {
@ -1050,11 +1097,23 @@ int main(int argc, const char ** argv)
#endif /* IAM_RPMBT */
#ifdef IAM_RPMDB
if (initdb) {
if (da->init) {
if (bigMode != MODE_UNKNOWN)
argerror(_("only one major mode may be specified"));
else
bigMode = MODE_INITDB;
} else
if (da->rebuild) {
if (bigMode != MODE_UNKNOWN)
argerror(_("only one major mode may be specified"));
else
bigMode = MODE_REBUILDDB;
} else
if (da->verify) {
if (bigMode != MODE_UNKNOWN)
argerror(_("only one major mode may be specified"));
else
bigMode = MODE_VERIFYDB;
}
#endif /* IAM_RPMDB */
@ -1078,107 +1137,116 @@ int main(int argc, const char ** argv)
if (qva->qva_source != RPMQV_PACKAGE && (bigMode & ~MODES_QV))
argerror(_("unexpected query source"));
#endif
#endif /* IAM_RPMQV */
#ifdef IAM_RPMEIU
{ int iflags = (ia->installInterfaceFlags &
(INSTALL_UPGRADE|INSTALL_FRESHEN|INSTALL_NOERASE));
int eflags = (ia->installInterfaceFlags & INSTALL_UPGRADE);
if (iflags & eflags)
argerror(_("only one major mode may be specified"));
else if (iflags)
bigMode = MODE_INSTALL;
else if (eflags)
bigMode = MODE_ERASE;
}
#endif /* IAM_RPMQV */
if (gotDbpath && (bigMode & ~MODES_FOR_DBPATH))
argerror(_("--dbpath given for operation that does not use a "
"database"));
#if defined(IAM_RPMEIU)
if (!( bigMode == MODE_INSTALL ) && force)
if (!( bigMode == MODE_INSTALL ) &&
(ia->probFilter & (RPMPROB_FILTER_REPLACEPKG | RPMPROB_FILTER_REPLACEOLDFILES | RPMPROB_FILTER_REPLACENEWFILES | RPMPROB_FILTER_OLDPACKAGE)))
argerror(_("only installation, upgrading, rmsource and rmspec may be forced"));
#endif /* IAM_RPMEIU */
#ifdef IAM_RPMEIU
if (bigMode != MODE_INSTALL && (probFilter & RPMPROB_FILTER_FORCERELOCATE))
if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_FORCERELOCATE))
argerror(_("files may only be relocated during package installation"));
if (relocations && prefix)
if (ia->relocations && ia->prefix)
argerror(_("only one of --prefix or --relocate may be used"));
if (bigMode != MODE_INSTALL && relocations)
if (bigMode != MODE_INSTALL && ia->relocations)
argerror(_("--relocate and --excludepath may only be used when installing new packages"));
if (bigMode != MODE_INSTALL && prefix)
if (bigMode != MODE_INSTALL && ia->prefix)
argerror(_("--prefix may only be used when installing new packages"));
if (prefix && prefix[0] != '/')
if (ia->prefix && ia->prefix[0] != '/')
argerror(_("arguments to --prefix must begin with a /"));
if (bigMode != MODE_INSTALL && (installInterfaceFlags & INSTALL_HASH))
if (bigMode != MODE_INSTALL && (ia->installInterfaceFlags & INSTALL_HASH))
argerror(_("--hash (-h) may only be specified during package "
"installation"));
if (bigMode != MODE_INSTALL && (installInterfaceFlags & INSTALL_PERCENT))
if (bigMode != MODE_INSTALL && (ia->installInterfaceFlags & INSTALL_PERCENT))
argerror(_("--percent may only be specified during package "
"installation"));
if (bigMode != MODE_INSTALL &&
(probFilter & (RPMPROB_FILTER_REPLACEOLDFILES|RPMPROB_FILTER_REPLACENEWFILES)))
(ia->probFilter & (RPMPROB_FILTER_REPLACEOLDFILES|RPMPROB_FILTER_REPLACENEWFILES)))
argerror(_("--replacefiles may only be specified during package "
"installation"));
if (bigMode != MODE_INSTALL && (probFilter & RPMPROB_FILTER_REPLACEPKG))
if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_REPLACEPKG))
argerror(_("--replacepkgs may only be specified during package "
"installation"));
if (bigMode != MODE_INSTALL && (transFlags & RPMTRANS_FLAG_NODOCS))
if (bigMode != MODE_INSTALL && (ia->transFlags & RPMTRANS_FLAG_NODOCS))
argerror(_("--excludedocs may only be specified during package "
"installation"));
if (bigMode != MODE_INSTALL && incldocs)
if (bigMode != MODE_INSTALL && ia->incldocs)
argerror(_("--includedocs may only be specified during package "
"installation"));
if (incldocs && (transFlags & RPMTRANS_FLAG_NODOCS))
if (ia->incldocs && (ia->transFlags & RPMTRANS_FLAG_NODOCS))
argerror(_("only one of --excludedocs and --includedocs may be "
"specified"));
if (bigMode != MODE_INSTALL && (probFilter & RPMPROB_FILTER_IGNOREARCH))
if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_IGNOREARCH))
argerror(_("--ignorearch may only be specified during package "
"installation"));
if (bigMode != MODE_INSTALL && (probFilter & RPMPROB_FILTER_IGNOREOS))
if (bigMode != MODE_INSTALL && (ia->probFilter & RPMPROB_FILTER_IGNOREOS))
argerror(_("--ignoreos may only be specified during package "
"installation"));
if (bigMode != MODE_INSTALL &&
(probFilter & (RPMPROB_FILTER_DISKSPACE|RPMPROB_FILTER_DISKNODES)))
(ia->probFilter & (RPMPROB_FILTER_DISKSPACE|RPMPROB_FILTER_DISKNODES)))
argerror(_("--ignoresize may only be specified during package "
"installation"));
if ((eraseInterfaceFlags & UNINSTALL_ALLMATCHES) && bigMode != MODE_UNINSTALL)
if ((ia->eraseInterfaceFlags & UNINSTALL_ALLMATCHES) && bigMode != MODE_ERASE)
argerror(_("--allmatches may only be specified during package "
"erasure"));
if ((transFlags & RPMTRANS_FLAG_ALLFILES) && bigMode != MODE_INSTALL)
if ((ia->transFlags & RPMTRANS_FLAG_ALLFILES) && bigMode != MODE_INSTALL)
argerror(_("--allfiles may only be specified during package "
"installation"));
if ((transFlags & RPMTRANS_FLAG_JUSTDB) &&
bigMode != MODE_INSTALL && bigMode != MODE_UNINSTALL)
if ((ia->transFlags & RPMTRANS_FLAG_JUSTDB) &&
bigMode != MODE_INSTALL && bigMode != MODE_ERASE)
argerror(_("--justdb may only be specified during package "
"installation and erasure"));
#endif /* IAM_RPMEIU */
#if defined(IAM_RPMEIU)
if (bigMode != MODE_INSTALL && bigMode != MODE_UNINSTALL &&
(transFlags & (RPMTRANS_FLAG_NOSCRIPTS | _noTransScripts | _noTransTriggers)))
if (bigMode != MODE_INSTALL && bigMode != MODE_ERASE &&
(ia->transFlags & (RPMTRANS_FLAG_NOSCRIPTS | _noTransScripts | _noTransTriggers)))
argerror(_("script disabling options may only be specified during "
"package installation and erasure"));
if (bigMode != MODE_INSTALL && bigMode != MODE_UNINSTALL &&
(transFlags & (RPMTRANS_FLAG_NOTRIGGERS | _noTransTriggers)))
if (bigMode != MODE_INSTALL && bigMode != MODE_ERASE &&
(ia->transFlags & (RPMTRANS_FLAG_NOTRIGGERS | _noTransTriggers)))
argerror(_("trigger disabling options may only be specified during "
"package installation and erasure"));
if (noDeps & (bigMode & ~MODES_FOR_NODEPS))
if (ia->noDeps & (bigMode & ~MODES_FOR_NODEPS))
argerror(_("--nodeps may only be specified during package "
"building, rebuilding, recompilation, installation,"
"erasure, and verification"));
if ((transFlags & RPMTRANS_FLAG_TEST) && (bigMode & ~MODES_FOR_TEST))
if ((ia->transFlags & RPMTRANS_FLAG_TEST) && (bigMode & ~MODES_FOR_TEST))
argerror(_("--test may only be specified during package installation, "
"erasure, and building"));
#endif /* IAM_RPMEIU */
@ -1201,25 +1269,31 @@ int main(int argc, const char ** argv)
}
}
#ifdef DYING
#ifdef IAM_RPMK
if (noPgp && bigMode != MODE_CHECKSIG)
if (!(ka->checksigFlags & CHECKSIG_PGP) && bigMode != MODE_CHECKSIG)
argerror(_("--nopgp may only be used during signature checking"));
if (noGpg && bigMode != MODE_CHECKSIG)
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 (noMd5 && bigMode != MODE_CHECKSIG && bigMode != MODE_VERIFY)
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)
signIt = ba->sign;
|| ba->sign
#endif
if (signIt) {
#if defined(IAM_RPMK)
|| ka->sign
#endif
) {
if (bigMode == MODE_REBUILD || bigMode == MODE_BUILD ||
bigMode == MODE_RESIGN || bigMode == MODE_TARBUILD) {
const char ** av;
@ -1406,55 +1480,57 @@ int main(int argc, const char ** argv)
#endif /* IAM_RPMBT */
#ifdef IAM_RPMEIU
case MODE_UNINSTALL:
case MODE_ERASE:
if (!poptPeekArg(optCon))
argerror(_("no packages given for uninstall"));
if (noDeps) eraseInterfaceFlags |= UNINSTALL_NODEPS;
if (ia->noDeps) ia->eraseInterfaceFlags |= UNINSTALL_NODEPS;
ec = rpmErase(rootdir, (const char **)poptGetArgs(optCon),
transFlags, eraseInterfaceFlags);
ia->transFlags, ia->eraseInterfaceFlags);
break;
case MODE_INSTALL:
#ifdef DYING
if (force) {
probFilter |= RPMPROB_FILTER_REPLACEPKG |
ia->probFilter |= RPMPROB_FILTER_REPLACEPKG |
RPMPROB_FILTER_REPLACEOLDFILES |
RPMPROB_FILTER_REPLACENEWFILES |
RPMPROB_FILTER_OLDPACKAGE;
}
#endif
/* RPMTRANS_FLAG_BUILD_PROBS */
/* RPMTRANS_FLAG_KEEPOBSOLETE */
if (!incldocs) {
if (transFlags & RPMTRANS_FLAG_NODOCS)
if (!ia->incldocs) {
if (ia->transFlags & RPMTRANS_FLAG_NODOCS)
;
else if (rpmExpandNumeric("%{_excludedocs}"))
transFlags |= RPMTRANS_FLAG_NODOCS;
ia->transFlags |= RPMTRANS_FLAG_NODOCS;
}
if (noDeps) installInterfaceFlags |= INSTALL_NODEPS;
if (ia->noDeps) ia->installInterfaceFlags |= INSTALL_NODEPS;
if (!poptPeekArg(optCon))
argerror(_("no packages given for install"));
/* we've already ensured !(!prefix && !relocations) */
if (prefix) {
relocations = alloca(2 * sizeof(*relocations));
relocations[0].oldPath = NULL; /* special case magic */
relocations[0].newPath = prefix;
relocations[1].oldPath = relocations[1].newPath = NULL;
} else if (relocations) {
relocations = xrealloc(relocations,
sizeof(*relocations) * (numRelocations + 1));
relocations[numRelocations].oldPath = NULL;
relocations[numRelocations].newPath = NULL;
/* we've already ensured !(!ia->prefix && !ia->relocations) */
if (ia->prefix) {
ia->relocations = xmalloc(2 * sizeof(*ia->relocations));
ia->relocations[0].oldPath = NULL; /* special case magic */
ia->relocations[0].newPath = ia->prefix;
ia->relocations[1].oldPath = ia->relocations[1].newPath = NULL;
} else if (ia->relocations) {
ia->relocations = xrealloc(ia->relocations,
sizeof(*ia->relocations) * (ia->numRelocations + 1));
ia->relocations[ia->numRelocations].oldPath = NULL;
ia->relocations[ia->numRelocations].newPath = NULL;
}
ec += rpmInstall(rootdir, (const char **)poptGetArgs(optCon),
transFlags, installInterfaceFlags, probFilter,
relocations);
ia->transFlags, ia->installInterfaceFlags, ia->probFilter,
ia->relocations);
break;
#endif /* IAM_RPMEIU */
@ -1509,10 +1585,13 @@ int main(int argc, const char ** argv)
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;
ec = rpmCheckSig(checksigFlags, (const char **)poptGetArgs(optCon));
#endif
ec = rpmCheckSig(ka->checksigFlags,
(const char **)poptGetArgs(optCon));
/* XXX don't overflow single byte exit status */
if (ec > 255) ec = 255;
break;
@ -1520,7 +1599,8 @@ int main(int argc, const char ** argv)
case MODE_RESIGN:
if (!poptPeekArg(optCon))
argerror(_("no packages given for signing"));
ec = rpmReSign(addSign, passPhrase, (const char **)poptGetArgs(optCon));
ec = rpmReSign(ka->addSign, passPhrase,
(const char **)poptGetArgs(optCon));
/* XXX don't overflow single byte exit status */
if (ec > 255) ec = 255;
break;
@ -1548,7 +1628,7 @@ int main(int argc, const char ** argv)
#endif
#if !defined(IAM_RPMEIU)
case MODE_INSTALL:
case MODE_UNINSTALL:
case MODE_ERASE:
#endif
case MODE_UNKNOWN:
if (!showVersion && !help && !noUsageMsg) printUsage();
@ -1582,6 +1662,10 @@ exit:
ba->targets = _free(ba->targets);
#endif
#ifdef IAM_RPMEIU
ia->relocations = _free(ia->relocations);
#endif
#if HAVE_MCHECK_H && HAVE_MTRACE
muntrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */
#endif