- Add btree indexes for Dirnames, Requireversion, Provideversion, Insttaltid,

and Removetid.
- Add per-script and per-trigger control options and flags.
- Add --apply option and flags.

CVS patchset: 4605
CVS date: 2001/03/04 15:34:53
This commit is contained in:
jbj 2001-03-04 15:34:53 +00:00
parent 1a93da4acc
commit a77bec0d7e
8 changed files with 611 additions and 402 deletions

View File

@ -1407,6 +1407,11 @@ assert(psm->mi == NULL);
psm->scriptTag = RPMTAG_PREIN;
psm->progTag = RPMTAG_PREINPROG;
if (!(ts->transFlags & RPMTRANS_FLAG_NOTRIGGERPREIN)) {
/* XXX FIXME: implement %triggerprein. */
}
if (!(ts->transFlags & RPMTRANS_FLAG_NOPRE)) {
rc = psmStage(psm, PSM_SCRIPT);
if (rc) {
rpmError(RPMERR_SCRIPT,
@ -1416,6 +1421,7 @@ assert(psm->mi == NULL);
break;
}
}
}
if (psm->goal == PSM_PKGERASE) {
psm->scriptTag = RPMTAG_PREUN;
@ -1423,6 +1429,7 @@ assert(psm->mi == NULL);
psm->sense = RPMSENSE_TRIGGERUN;
psm->countCorrection = -1;
if (!(ts->transFlags & RPMTRANS_FLAG_NOTRIGGERUN)) {
/* Run triggers in other package(s) this package sets off. */
rc = psmStage(psm, PSM_TRIGGERS);
if (rc) break;
@ -1430,7 +1437,9 @@ assert(psm->mi == NULL);
/* Run triggers in this package other package(s) set off. */
rc = psmStage(psm, PSM_IMMED_TRIGGERS);
if (rc) break;
}
if (!(ts->transFlags & RPMTRANS_FLAG_NOPREUN))
rc = psmStage(psm, PSM_SCRIPT);
}
if (psm->goal == PSM_PKGSAVE) {
@ -1540,6 +1549,7 @@ assert(psm->mi == NULL);
if (fi->fc <= 0) break;
if (ts->transFlags & RPMTRANS_FLAG_JUSTDB) break;
if (ts->transFlags & RPMTRANS_FLAG_APPLYONLY) break;
psm->what = RPMCALLBACK_UNINST_START;
psm->amount = fi->fc; /* XXX W2DO? looks wrong. */
@ -1592,15 +1602,6 @@ assert(psm->mi == NULL);
headerAddEntry(fi->h, RPMTAG_INSTALLTIME, RPM_INT32_TYPE,
&installTime, 1);
/*
* If this package has already been installed, remove it from
* the database before adding the new one.
*/
if (fi->record) {
rc = psmStage(psm, PSM_RPMDB_REMOVE);
if (rc) break;
}
if (ts->transFlags & RPMTRANS_FLAG_MULTILIB) {
uint_32 multiLib, * newMultiLib, * p;
@ -1615,17 +1616,29 @@ assert(psm->mi == NULL);
if (rc) break;
}
/*
* If this package has already been installed, remove it from
* the database before adding the new one.
*/
if (fi->record && !(ts->transFlags & RPMTRANS_FLAG_APPLYONLY)) {
rc = psmStage(psm, PSM_RPMDB_REMOVE);
if (rc) break;
}
rc = psmStage(psm, PSM_RPMDB_ADD);
if (rc) break;
psm->scriptTag = RPMTAG_POSTIN;
psm->progTag = RPMTAG_POSTINPROG;
psm->sense = RPMSENSE_TRIGGERIN;
psm->countCorrection = 0;
rc = psmStage(psm, PSM_RPMDB_ADD);
if (rc) break;
if (!(ts->transFlags & RPMTRANS_FLAG_NOPOST)) {
rc = psmStage(psm, PSM_SCRIPT);
if (rc) break;
}
if (!(ts->transFlags & RPMTRANS_FLAG_NOTRIGGERIN)) {
/* Run triggers in other package(s) this package sets off. */
rc = psmStage(psm, PSM_TRIGGERS);
if (rc) break;
@ -1633,23 +1646,31 @@ assert(psm->mi == NULL);
/* Run triggers in this package other package(s) set off. */
rc = psmStage(psm, PSM_IMMED_TRIGGERS);
if (rc) break;
}
if (!(ts->transFlags & RPMTRANS_FLAG_APPLYONLY))
rc = markReplacedFiles(psm);
}
if (psm->goal == PSM_PKGERASE) {
psm->scriptTag = RPMTAG_POSTUN;
psm->progTag = RPMTAG_POSTUNPROG;
psm->sense = RPMSENSE_TRIGGERPOSTUN;
psm->countCorrection = -1;
if (!(ts->transFlags & RPMTRANS_FLAG_NOPOSTUN)) {
rc = psmStage(psm, PSM_SCRIPT);
/* XXX WTFO? postun failures are not cause for erasure failure. */
/* XXX WTFO? postun failures don't cause erasure failure. */
}
if (!(ts->transFlags & RPMTRANS_FLAG_NOTRIGGERPOSTUN)) {
/* Run triggers in other package(s) this package sets off. */
rc = psmStage(psm, PSM_TRIGGERS);
if (rc) break;
}
if (!(ts->transFlags & RPMTRANS_FLAG_APPLYONLY))
rc = psmStage(psm, PSM_RPMDB_REMOVE);
}
if (psm->goal == PSM_PKGSAVE) {
@ -1724,6 +1745,8 @@ assert(psm->mi == NULL);
break;
case PSM_COMMIT:
if (!(ts->transFlags & RPMTRANS_FLAG_PKGCOMMIT)) break;
if (ts->transFlags & RPMTRANS_FLAG_APPLYONLY) break;
rc = fsmSetup(fi->fsm, FSM_PKGCOMMIT, ts, fi,
NULL, NULL, &psm->failedFile);
(void) fsmTeardown(fi->fsm);
@ -1762,18 +1785,15 @@ assert(psm->mi == NULL);
}
break;
case PSM_SCRIPT:
if (ts->transFlags & RPMTRANS_FLAG_NOSCRIPTS) break;
rpmMessage(RPMMESS_DEBUG, _("%s: running %s script(s) (if any)\n"),
psm->stepName, tag2sln(psm->scriptTag));
rc = runInstScript(psm);
break;
case PSM_TRIGGERS:
if (ts->transFlags & RPMTRANS_FLAG_NOTRIGGERS) break;
/* Run triggers in other package(s) this package sets off. */
rc = runTriggers(psm);
break;
case PSM_IMMED_TRIGGERS:
if (ts->transFlags & RPMTRANS_FLAG_NOTRIGGERS) break;
/* Run triggers in this package other package(s) set off. */
rc = runImmedTriggers(psm);
break;

View File

@ -61,7 +61,7 @@ static int dbiTagToDbix(int rpmtag)
static void dbiTagsInit(void)
{
/*@observer@*/ static const char * const _dbiTagStr_default =
"Packages:Name:Basenames:Group:Requirename:Providename:Conflictname:Triggername";
"Packages:Name:Basenames:Group:Requirename:Providename:Conflictname:Triggername:Dirnames:Requireversion:Provideversion:Installtid:Removetid";
char * dbiTagStr = NULL;
char * o, * oe;
int rpmtag;

View File

@ -1078,13 +1078,39 @@ typedef enum rpmtransFlags_e {
RPMTRANS_FLAG_MULTILIB = (1 << 8), /*!< @todo Document. */
RPMTRANS_FLAG_DIRSTASH = (1 << 9), /*!< from --dirstash */
RPMTRANS_FLAG_REPACKAGE = (1 << 10), /*!< from --repackage */
RPMTRANS_FLAG_PKGCOMMIT = (1 << 11),
RPMTRANS_FLAG_PKGUNDO = (1 << 12),
RPMTRANS_FLAG_COMMIT = (1 << 13),
RPMTRANS_FLAG_UNDO = (1 << 14),
RPMTRANS_FLAG_REVERSE = (1 << 15),
RPMTRANS_FLAG_NOTRIGGERPREIN= (1 << 16),
RPMTRANS_FLAG_NOPRE = (1 << 17),
RPMTRANS_FLAG_NOPOST = (1 << 18),
RPMTRANS_FLAG_NOTRIGGERIN = (1 << 19),
RPMTRANS_FLAG_NOTRIGGERUN = (1 << 20),
RPMTRANS_FLAG_NOPREUN = (1 << 21),
RPMTRANS_FLAG_NOPOSTUN = (1 << 22),
RPMTRANS_FLAG_NOTRIGGERPOSTUN = (1 << 23),
RPMTRANS_FLAG_NOPAYLOAD = (1 << 24),
RPMTRANS_FLAG_APPLYONLY = (1 << 25),
} rpmtransFlags;
#define _noTransScripts \
( RPMTRANS_FLAG_NOPRE | \
RPMTRANS_FLAG_NOPOST | \
RPMTRANS_FLAG_NOPREUN | \
RPMTRANS_FLAG_NOPOSTUN \
)
#define _noTransTriggers \
( RPMTRANS_FLAG_NOTRIGGERPREIN | \
RPMTRANS_FLAG_NOTRIGGERIN | \
RPMTRANS_FLAG_NOTRIGGERUN | \
RPMTRANS_FLAG_NOTRIGGERPOSTUN \
)
/** \ingroup rpmtrans
* Return copy of rpmlib internal provides.
* @retval address of array of rpmlib internal provide names

View File

@ -1385,10 +1385,14 @@ int rpmRunTransactions( rpmTransactionSet ts,
/* FIXME: what if the same package is included in ts twice? */
ts->transFlags = transFlags;
if (ts->transFlags & RPMTRANS_FLAG_NOSCRIPTS)
ts->transFlags |= (_noTransScripts | _noTransTriggers);
if (ts->transFlags & RPMTRANS_FLAG_NOTRIGGERS)
ts->transFlags |= _noTransTriggers;
/* XXX MULTILIB is broken, as packages can and do execute /sbin/ldconfig. */
if (ts->transFlags & (RPMTRANS_FLAG_JUSTDB | RPMTRANS_FLAG_MULTILIB))
ts->transFlags |= (RPMTRANS_FLAG_NOSCRIPTS|RPMTRANS_FLAG_NOTRIGGERS);
ts->transFlags |= (_noTransScripts | _noTransTriggers);
ts->notify = notify;
ts->notifyData = notifyData;

View File

@ -1,4 +1,4 @@
# $Id: macros.in,v 1.71 2001/02/11 22:02:29 jbj Exp $
# $Id: macros.in,v 1.72 2001/03/04 15:34:53 jbj Exp $
#
# This is a global RPM configuration file. All changes made here will
# be lost when the rpm package is upgraded. Any per-system configuration
@ -299,7 +299,7 @@
%{nil}
# The list of tags for which indices will be built.
%_dbi_tags Packages:Name:Basenames:Group:Requirename:Providename:Conflictname:Triggername:Depends
%_dbi_tags Packages:Name:Basenames:Group:Requirename:Providename:Conflictname:Triggername:Dirnames:Requireversion:Provideversion:Installtid:Removetid:Depends
# "Packages" needs fcntl shared/exclusive lock.
%_dbi_config_Packages %{_dbi_config}:lockdbfd
@ -307,6 +307,12 @@
# "Depends" is a per-transaction cache of known dependency resolutions.
%_dbi_config_Depends %{_dbi_config}:temporary
%_dbi_config_Dirnames btree bt_dup bt_dupsort usecursors perms=0644
%_dbi_config_Requireversion btree bt_dup bt_dupsort usecursors perms=0644
%_dbi_config_Provideversion btree bt_dup bt_dupsort usecursors perms=0644
%_dbi_config_Installtid btree bt_dup bt_dupsort usecursors perms=0644
%_dbi_config_Removetid btree bt_dup bt_dupsort usecursors perms=0644
#==============================================================================
# ---- transaction macros.
# Macro(s) used to parameterize

File diff suppressed because it is too large Load Diff

86
rpm.c
View File

@ -50,6 +50,7 @@ enum modes {
/* the flags for the various options */
static int allFiles;
static int allMatches;
static int applyOnly;
static int badReloc;
static int dirStash;
static int excldocs;
@ -70,8 +71,19 @@ extern int noLibio;
static int noMd5;
static int noOrder;
static int noPgp;
static int noScripts;
static int noPre;
static int noPost;
static int noPreun;
static int noPostun;
static int noTriggers;
static int noTPrein;
static int noTIn;
static int noTUn;
static int noTPostun;
static int noUsageMsg;
static int oldPackage;
static char * pipeOutput;
@ -111,6 +123,7 @@ static struct poptOption optionsTable[] = {
{ "addsign", '\0', 0, 0, GETOPT_ADDSIGN, NULL, NULL},
{ "allfiles", '\0', 0, &allFiles, 0, NULL, NULL},
{ "allmatches", '\0', 0, &allMatches, 0, NULL, NULL},
{ "apply", '\0', 0, &applyOnly, 0, NULL, NULL},
{ "badreloc", '\0', 0, &badReloc, 0, NULL, NULL},
{ "checksig", 'K', 0, 0, 'K', NULL, NULL},
{ "define", '\0', POPT_ARG_STRING, 0, GETOPT_DEFINEMACRO,NULL, NULL},
@ -145,8 +158,19 @@ static struct poptOption optionsTable[] = {
{ "nomd5", '\0', 0, &noMd5, 0, NULL, NULL},
{ "noorder", '\0', 0, &noOrder, 0, NULL, NULL},
{ "nopgp", '\0', 0, &noPgp, 0, NULL, NULL},
{ "noscripts", '\0', 0, &noScripts, 0, NULL, NULL},
{ "nopre", '\0', 0, &noPre, 0, NULL, NULL},
{ "nopost", '\0', 0, &noPost, 0, NULL, NULL},
{ "nopreun", '\0', 0, &noPreun, 0, NULL, NULL},
{ "nopostun", '\0', 0, &noPostun, 0, NULL, NULL},
{ "notriggers", '\0', 0, &noTriggers, 0, NULL, NULL},
{ "notriggerprein", '\0', 0, &noTPrein, 0, NULL, NULL},
{ "notriggerin", '\0', 0, &noTIn, 0, NULL, NULL},
{ "notriggerun", '\0', 0, &noTUn, 0, NULL, NULL},
{ "notriggerpostun", '\0', 0, &noTPostun, 0, NULL, NULL},
{ "oldpackage", '\0', 0, &oldPackage, 0, NULL, NULL},
{ "percent", '\0', 0, &showPercents, 0, NULL, NULL},
{ "pipe", '\0', POPT_ARG_STRING, &pipeOutput, 0, NULL, NULL},
@ -585,6 +609,7 @@ int main(int argc, const char ** argv)
/* set the defaults for the various command line options */
allFiles = 0;
allMatches = 0;
applyOnly = 0;
badReloc = 0;
excldocs = 0;
force = 0;
@ -607,8 +632,19 @@ int main(int argc, const char ** argv)
noMd5 = 0;
noOrder = 0;
noPgp = 0;
noScripts = 0;
noPre = 0;
noPost = 0;
noPreun = 0;
noPostun = 0;
noTriggers = 0;
noTPrein = 0;
noTIn = 0;
noTUn = 0;
noTPostun = 0;
noUsageMsg = 0;
oldPackage = 0;
showPercents = 0;
@ -926,13 +962,20 @@ int main(int argc, const char ** argv)
"installation and erasure"));
if (bigMode != MODE_INSTALL && bigMode != MODE_UNINSTALL &&
bigMode != MODE_VERIFY && noScripts)
argerror(_("--noscripts may only be specified during package "
bigMode != MODE_VERIFY &&
(noScripts | noPre | noPost | noPreun | noPostun |
noTriggers | noTPrein | noTIn | noTUn | noTPostun))
argerror(_("script disabling options may only be specified during package "
"installation, erasure, and verification"));
if (bigMode != MODE_INSTALL && bigMode != MODE_UNINSTALL && noTriggers)
argerror(_("--notriggers may only be specified during package "
"installation, erasure, and verification"));
if (bigMode != MODE_INSTALL && applyOnly)
argerror(_("--apply may only be specified during package "
"installation"));
if (bigMode != MODE_INSTALL && bigMode != MODE_UNINSTALL &&
(noTriggers | noTPrein | noTIn | noTUn | noTPostun))
argerror(_("trigger disabling options may only be specified during package "
"installation and erasure"));
if (noDeps & (bigMode & ~MODES_FOR_NODEPS))
argerror(_("--nodeps may only be specified during package "
@ -1096,8 +1139,18 @@ int main(int argc, const char ** argv)
if (!poptPeekArg(optCon))
argerror(_("no packages given for uninstall"));
if (noScripts) transFlags |= RPMTRANS_FLAG_NOSCRIPTS;
if (noTriggers) transFlags |= RPMTRANS_FLAG_NOTRIGGERS;
if (noScripts) transFlags |= (_noTransScripts | _noTransTriggers);
if (noPre) transFlags |= RPMTRANS_FLAG_NOPRE;
if (noPost) transFlags |= RPMTRANS_FLAG_NOPOST;
if (noPreun) transFlags |= RPMTRANS_FLAG_NOPREUN;
if (noPostun) transFlags |= RPMTRANS_FLAG_NOPOSTUN;
if (noTriggers) transFlags |= _noTransTriggers;
if (noTPrein) transFlags |= RPMTRANS_FLAG_NOTRIGGERPREIN;
if (noTIn) transFlags |= RPMTRANS_FLAG_NOTRIGGERIN;
if (noTUn) transFlags |= RPMTRANS_FLAG_NOTRIGGERUN;
if (noTPostun) transFlags |= RPMTRANS_FLAG_NOTRIGGERPOSTUN;
if (test) transFlags |= RPMTRANS_FLAG_TEST;
if (justdb) transFlags |= RPMTRANS_FLAG_JUSTDB;
if (dirStash) transFlags |= RPMTRANS_FLAG_DIRSTASH;
@ -1130,11 +1183,26 @@ int main(int argc, const char ** argv)
if (ignoreOs) probFilter |= RPMPROB_FILTER_IGNOREOS;
if (ignoreSize) probFilter |= RPMPROB_FILTER_DISKSPACE;
if (applyOnly)
transFlags = (_noTransScripts | _noTransTriggers |
RPMTRANS_FLAG_APPLYONLY | RPMTRANS_FLAG_PKGCOMMIT);
if (test) transFlags |= RPMTRANS_FLAG_TEST;
/* RPMTRANS_FLAG_BUILD_PROBS */
if (noScripts) transFlags |= RPMTRANS_FLAG_NOSCRIPTS;
if (justdb) transFlags |= RPMTRANS_FLAG_JUSTDB;
if (noScripts) transFlags |= (_noTransScripts | _noTransTriggers);
if (noPre) transFlags |= RPMTRANS_FLAG_NOPRE;
if (noPost) transFlags |= RPMTRANS_FLAG_NOPOST;
if (noPreun) transFlags |= RPMTRANS_FLAG_NOPREUN;
if (noPostun) transFlags |= RPMTRANS_FLAG_NOPOSTUN;
if (noTriggers) transFlags |= RPMTRANS_FLAG_NOTRIGGERS;
if (noTPrein) transFlags |= RPMTRANS_FLAG_NOTRIGGERPREIN;
if (noTIn) transFlags |= RPMTRANS_FLAG_NOTRIGGERIN;
if (noTUn) transFlags |= RPMTRANS_FLAG_NOTRIGGERUN;
if (noTPostun) transFlags |= RPMTRANS_FLAG_NOTRIGGERPOSTUN;
if (justdb) transFlags |= RPMTRANS_FLAG_JUSTDB;
if (!incldocs) {
if (excldocs)
transFlags |= RPMTRANS_FLAG_NODOCS;

54
rpmqv.c
View File

@ -226,6 +226,12 @@ static struct poptOption rpmInstallPoptTable[] = {
{ "allmatches", '\0', _POPT_SET_BIT, &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, &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,
N_("relocate files in non-relocateable package"), NULL},
{ "dirstash", '\0', _POPT_SET_BIT, &transFlags, RPMTRANS_FLAG_DIRSTASH,
@ -263,10 +269,39 @@ static struct poptOption rpmInstallPoptTable[] = {
{ "noorder", '\0', _POPT_SET_BIT, &installInterfaceFlags, INSTALL_NOORDER,
N_("do not reorder package installation to satisfy dependencies"),
NULL},
{ "noscripts", '\0', _POPT_SET_BIT, &transFlags, RPMTRANS_FLAG_NOSCRIPTS,
N_("do not execute scripts (if any)"), NULL },
{ "notriggers", '\0', _POPT_SET_BIT, &transFlags, RPMTRANS_FLAG_NOTRIGGERS,
N_("don't execute any scriptlets triggered by this package"), NULL},
{ "noscripts", '\0', _POPT_SET_BIT, &transFlags,
(_noTransScripts|_noTransTriggers),
N_("do not execute package scriptlet(s)"), NULL },
{ "nopre", '\0', _POPT_SET_BIT|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,
RPMTRANS_FLAG_NOPOST,
N_("do not execute %%post scriptlet (if any)"), NULL },
{ "nopreun", '\0', _POPT_SET_BIT|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,
RPMTRANS_FLAG_NOPOSTUN,
N_("do not execute %%postun scriptlet (if any)"), NULL },
{ "notriggers", '\0', _POPT_SET_BIT, &transFlags,
_noTransTriggers,
N_("do not execute any scriptlet(s) triggered by this package"), NULL},
{ "notriggerprein", '\0', _POPT_SET_BIT|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,
RPMTRANS_FLAG_NOTRIGGERIN,
N_("do not execute any %%triggerin scriptlet(s)"), NULL},
{ "notriggerun", '\0', _POPT_SET_BIT|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,
RPMTRANS_FLAG_NOTRIGGERPOSTUN,
N_("do not execute any %%triggerpostun scriptlet(s)"), NULL},
{ "oldpackage", '\0', _POPT_SET_BIT, &probFilter, RPMPROB_FILTER_OLDPACKAGE,
N_("upgrade to an old version of the package (--force on upgrades does this automatically)"),
NULL},
@ -1082,9 +1117,14 @@ int main(int argc, const char ** argv)
#if defined(IAM_RPMEIU)
if (bigMode != MODE_INSTALL && bigMode != MODE_UNINSTALL &&
(transFlags & RPMTRANS_FLAG_NOTRIGGERS))
argerror(_("--notriggers may only be specified during package "
"installation and erasure"));
(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)))
argerror(_("trigger disabling options may only be specified during "
"package installation and erasure"));
if (noDeps & (bigMode & ~MODES_FOR_NODEPS))
argerror(_("--nodeps may only be specified during package "