Rip headers out of addedPackages.

CVS patchset: 5170
CVS date: 2001/11/11 01:46:43
This commit is contained in:
jbj 2001-11-11 01:46:43 +00:00
parent 0abf36fd4d
commit 8d08d4a43b
9 changed files with 97 additions and 176 deletions

View File

@ -2,7 +2,7 @@
* \file lib/depends.c
*/
#define _DS_SCAREMEM 1
#define _DS_SCAREMEM 0
#include "system.h"
@ -15,7 +15,6 @@
#define _NEED_TEITERATOR 1
#include "depends.h"
#include "rpmal.h"
#include "rpmdb.h" /* XXX response cache needs dbiOpen et al. */
#include "debug.h"
@ -172,6 +171,9 @@ static void delTE(transactionElement p)
p->epoch = _free(p->epoch);
p->name = _free(p->name);
p->NEVR = _free(p->NEVR);
p->h = headerFree(p->h, "delTE");
memset(p, 0, sizeof(*p)); /* XXX trash and burn */
/*@-nullstate@*/ /* FIX: p->{NEVR,name} annotations */
return;
@ -438,13 +440,14 @@ int rpmtransAddPackage(rpmTransactionSet ts, Header h, FD_t fd,
addTE(p, h, fd, key, relocs);
p->type = TR_ADDED;
pkgKey = alAddPackage(ts->addedPackages, pkgKey, p->key, h,
pkgKey = alAddPackage(ts->addedPackages, pkgKey, p->key,
p->provides, p->fns);
if (pkgKey == RPMAL_NOMATCH) {
ec = 1;
goto exit;
}
p->u.addedKey = pkgKey;
p->h = headerLink(h, "rpmtransAddPackage");
p->multiLib = 0;
@ -565,7 +568,7 @@ void rpmtransAvailablePackage(rpmTransactionSet ts, Header h, fnpyKey key)
rpmFNSet fns = fnsNew(h, RPMTAG_BASENAMES, scareMem);
/* XXX FIXME: return code RPMAL_NOMATCH is error */
(void) alAddPackage(ts->availablePackages, RPMAL_NOMATCH, key, h,
(void) alAddPackage(ts->availablePackages, RPMAL_NOMATCH, key,
provides, fns);
fns = fnsFree(fns);
provides = dsFree(provides);

View File

@ -9,13 +9,13 @@
#include <header.h>
#include <rpmhash.h>
#include "rpmal.h"
typedef /*@abstract@*/ struct tsortInfo_s * tsortInfo;
typedef /*@abstract@*/ struct transactionElement_s * transactionElement;
typedef /*@abstract@*/ struct teIterator_s * teIterator;
typedef /*@abstract@*/ struct availableList_s * availableList;
/*@unchecked@*/
/*@-exportlocal@*/
extern int _cacheDependsRC;
@ -71,6 +71,8 @@ struct transactionElement_s {
TR_REMOVED /*!< Package will be removed. */
} type; /*!< Package disposition (installed/removed). */
/*@refcounted@*/ /*@null@*/
Header h; /*!< Package header. */
/*@only@*/
const char * NEVR; /*!< Package name-version-release. */
/*@owned@*/

View File

@ -6,7 +6,6 @@
#include "system.h"
#include "psm.h"
#include "rpmal.h"
#include <rpmmacro.h>
#include <rpmurl.h>
@ -1180,7 +1179,6 @@ rpmRC rpmInstallSourcePackage(rpmTransactionSet ts,
int isSource;
rpmRC rc;
int i;
alKey pkgKey = (alKey)0;
/*@-mods -temptrans -assignexpose@*/
ts->notify = notify;
@ -1207,12 +1205,7 @@ rpmRC rpmInstallSourcePackage(rpmTransactionSet ts,
fi->type = TR_ADDED;
fi->h = alGetHeader(ts->addedPackages, pkgKey, 1);
/* XXX can't happen */
if (fi->h == NULL) {
rc = RPMRC_FAIL;
goto exit;
}
fi->h = headerLink(h, "InstallSourcePackage");
fi->multiLib = 0; /* MULTILIB for src.rpm's? */

View File

@ -12,22 +12,11 @@
#include "debug.h"
/*@access Header@*/ /* XXX compared with NULL */
/*@access FD_t@*/ /* XXX compared with NULL */
typedef /*@abstract@*/ struct fileIndexEntry_s * fileIndexEntry;
typedef /*@abstract@*/ struct dirInfo_s * dirInfo;
typedef /*@abstract@*/ struct availableIndexEntry_s * availableIndexEntry;
typedef /*@abstract@*/ struct availableIndex_s * availableIndex;
/*@access availableIndexEntry@*/
/*@access availableIndex@*/
/*@access fileIndexEntry@*/
/*@access dirInfo@*/
/*@access availableList@*/
/*@access availablePackage@*/
#ifdef DYING
/*@access tsortInfo@*/
#endif
/*@access alKey@*/
/*@access alNum@*/
@ -35,21 +24,13 @@ typedef /*@abstract@*/ struct availableIndex_s * availableIndex;
/*@access rpmFNSet@*/
typedef /*@abstract@*/ struct availablePackage_s * availablePackage;
/*@access availablePackage@*/
/** \ingroup rpmdep
* Info about a single package to be installed.
*/
struct availablePackage_s {
/*@refcounted@*/
Header h; /*!< Package header. */
/*@dependent@*/
const char * name; /*!< Header name. */
/*@dependent@*/
const char * version; /*!< Header version. */
/*@dependent@*/
const char * release; /*!< Header release. */
/*@dependent@*//*@null@*/
int_32 * epoch; /*!< Header epoch (if any). */
/*@refcounted@*/ /*@null@*/
rpmDepSet provides; /*!< Provides: dependencies. */
/*@refcounted@*/ /*@null@*/
@ -63,6 +44,9 @@ struct availablePackage_s {
};
typedef /*@abstract@*/ struct availableIndexEntry_s * availableIndexEntry;
/*@access availableIndexEntry@*/
/** \ingroup rpmdep
* A single available item (e.g. a Provides: dependency).
*/
@ -78,6 +62,9 @@ struct availableIndexEntry_s {
} type; /*!< Type of available item. */
};
typedef /*@abstract@*/ struct availableIndex_s * availableIndex;
/*@access availableIndex@*/
/** \ingroup rpmdep
* Index of all available items.
*/
@ -88,6 +75,9 @@ struct availableIndex_s {
int k; /*!< Current index. */
};
typedef /*@abstract@*/ struct fileIndexEntry_s * fileIndexEntry;
/*@access fileIndexEntry@*/
/** \ingroup rpmdep
* A file to be installed/removed.
*/
@ -99,6 +89,9 @@ struct fileIndexEntry_s {
int fileFlags; /* MULTILIB */
};
typedef /*@abstract@*/ struct dirInfo_s * dirInfo;
/*@access dirInfo@*/
/** \ingroup rpmdep
* A directory to be installed/removed.
*/
@ -172,6 +165,7 @@ static inline alKey alNum2Key(/*@unused@*/ /*@null@*/ const availableList al,
/*@=nullret =temptrans =retalias @*/
}
#ifdef DYING
/**
* Return available package.
* @param al available list
@ -196,21 +190,7 @@ fprintf(stderr, "*** alp[%d] %p\n", pkgNum, alp);
/*@=modfilesys@*/
return alp;
}
Header alGetHeader(availableList al, alKey pkgKey, int unlink)
{
availablePackage alp = alGetPkg(al, pkgKey);
Header h = NULL;
if (alp != NULL && alp->h != NULL) {
h = headerLink(alp->h, "alGetHeader");
if (unlink) {
alp->h = headerFree(alp->h, "alGetHeader unlink");
alp->h = NULL;
}
}
return h;
}
#endif
availableList alCreate(int delta)
{
@ -243,8 +223,6 @@ availableList alFree(availableList al)
for (i = 0; i < al->size; i++, alp++) {
alp->provides = dsFree(alp->provides);
alp->fns = fnsFree(alp->fns);
alp->h = headerFree(alp->h, "alFree");
}
if ((die = al->dirs) != NULL)
@ -317,7 +295,7 @@ void alDelPackage(availableList al, alKey pkgKey)
/*@-modfilesys@*/
if (_al_debug)
fprintf(stderr, "*** del %p[%d] %s-%s-%s\n", al->list, pkgNum, alp->name, alp->version, alp->release);
fprintf(stderr, "*** del %p[%d]\n", al->list, pkgNum);
/*@=modfilesys@*/
/* Delete directory/file info entries from added package list. */
@ -381,7 +359,6 @@ fprintf(stderr, "*** del %p[%d] %s-%s-%s\n", al->list, pkgNum, alp->name, alp->v
alp->provides = dsFree(alp->provides);
alp->fns = fnsFree(alp->fns);
alp->h = headerFree(alp->h, "alDelPackage");
memset(alp, 0, sizeof(*alp)); /* XXX trash and burn */
/*@-nullstate@*/ /* FIX: al->list->h may be NULL */
@ -389,14 +366,11 @@ fprintf(stderr, "*** del %p[%d] %s-%s-%s\n", al->list, pkgNum, alp->name, alp->v
/*@=nullstate@*/
}
alKey alAddPackage(availableList al, alKey pkgKey, fnpyKey key, Header h,
alKey alAddPackage(availableList al, alKey pkgKey, fnpyKey key,
rpmDepSet provides, rpmFNSet fns)
/*@modifies al, h @*/
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
availablePackage alp;
alNum pkgNum = alKey2Num(al, pkgKey);
int xx;
if (pkgNum >= 0 && pkgNum < al->size) {
alDelPackage(al, pkgKey);
@ -412,19 +386,13 @@ alKey alAddPackage(availableList al, alKey pkgKey, fnpyKey key, Header h,
alp = al->list + pkgNum;
/*@=nullptrarith@*/
alp->h = headerLink(h, "alAddPackage");
/*@-assignexpose -temptrans @*/
alp->key = key;
/*@=assignexpose =temptrans @*/
xx = headerNVR(alp->h, &alp->name, &alp->version, &alp->release);
if (!hge(h, RPMTAG_EPOCH, NULL, (void **) &alp->epoch, NULL))
alp->epoch = NULL;
/*@-modfilesys@*/
if (_al_debug)
fprintf(stderr, "*** add %p[%d] %s-%s-%s\n", al->list, pkgNum, alp->name, alp->version, alp->release);
fprintf(stderr, "*** add %p[%d]\n", al->list, pkgNum);
/*@=modfilesys@*/
/*@-assignexpose -temptrans@*/

View File

@ -6,21 +6,7 @@
* Structures used for managing added/available package lists.
*/
/**
* A package from an availableList.
*/
typedef /*@abstract@*/ struct availablePackage_s * availablePackage;
/**
* Return available package header.
* @param al available list
* @param pkgKey available package key
* @param unlink Should alp->h be unlinked?
* @return available package header
*/
Header alGetHeader(/*@null@*/ availableList al, /*@null@*/ alKey pkgKey,
int unlink)
/*@modifies al @*/;
typedef /*@abstract@*/ struct availableList_s * availableList;
/**
* Initialize available packckages, items, and directory list.
@ -55,14 +41,13 @@ void alDelPackage(availableList al, /*@null@*/ alKey pkgKey)
* @param al available list
* @param pkgKey package key, RPMAL_NOMATCH to force an append
* @param key associated file name/python object
* @param h package header
* @param provides provides dependency set
* @param fns file info set
* @return available package index
*/
alKey alAddPackage(availableList al, /*@null@*/ alKey pkgKey,
fnpyKey key, Header h, rpmDepSet provides, rpmFNSet fns)
/*@modifies al, h, provides, fns @*/;
fnpyKey key, rpmDepSet provides, rpmFNSet fns)
/*@modifies al, provides, fns @*/;
/**
* Add package provides to available list index.

View File

@ -795,7 +795,7 @@ exit:
return result;
}
int headerMatchesDepFlags(Header h, const rpmDepSet req)
int headerMatchesDepFlags(const Header h, const rpmDepSet req)
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
const char * pkgN, * v, * r;

View File

@ -352,7 +352,7 @@ int rangeMatchesDepFlags (Header h, const rpmDepSet req)
* @param req dependency
* @return 1 if dependency overlaps, 0 otherwise
*/
int headerMatchesDepFlags(Header h, const rpmDepSet req)
int headerMatchesDepFlags(const Header h, const rpmDepSet req)
/*@*/;
#ifdef __cplusplus

View File

@ -4,12 +4,13 @@
#include "system.h"
#include <rpmmacro.h> /* XXX for rpmExpand */
#define _NEED_TEITERATOR 1
#include "psm.h"
#include "rpmds.h"
#include "rpmal.h"
#include <rpmmacro.h> /* XXX for rpmExpand */
#include "rpmds.h"
#include "fprint.h"
#include "legacy.h" /* XXX mdfile */
@ -665,38 +666,8 @@ static void handleOverlappedFiles(const rpmTransactionSet ts, TFI_t fi)
* @param h installed header
* @return 0 if not newer, 1 if okay
*/
#ifdef DYING
static int ensureOlder(rpmTransactionSet ts,
const Header h, /*@null@*/ const Header old,
/*@dependent@*/ /*@null@*/ const void * key)
/*@modifies ts @*/
{
int result, rc = 0;
if (old == NULL) return 1;
result = rpmVersionCompare(old, h);
if (result <= 0)
rc = 0;
else if (result > 0) {
const char * pkgNEVR = hGetNEVR(h, NULL);
const char * altNEVR = hGetNEVR(old, NULL);
/*@-evalorder@*/ /* LCL: is confused */
rpmProblemSetAppend(ts->probs, RPMPROB_OLDPACKAGE,
pkgNEVR, key,
NULL, NULL,
altNEVR,
0);
/*@=evalorder@*/
pkgNEVR = _free(pkgNEVR);
altNEVR = _free(altNEVR);
rc = 1;
}
return rc;
}
#else
static int ensureOlder(rpmTransactionSet ts, transactionElement p, Header h)
const transactionElement p, const Header h)
/*@modifies ts @*/
{
int_32 reqFlags = (RPMSENSE_LESS | RPMSENSE_EQUAL);
@ -736,7 +707,6 @@ static int ensureOlder(rpmTransactionSet ts, transactionElement p, Header h)
return rc;
}
#endif
/**
*/
@ -958,7 +928,7 @@ int rpmRunTransactions( rpmTransactionSet ts,
teIterator tei;
int xx;
int keep_header = 1; /* XXX rpmProblemSetAppend prevents dumping headers. */
int keep_header = 0;
/* FIXME: what if the same package is included in ts twice? */
@ -1058,8 +1028,6 @@ int keep_header = 1; /* XXX rpmProblemSetAppend prevents dumping headers. */
while ((p = teNext(tei, TR_ADDED)) != NULL) {
rpmdbMatchIterator mi;
pkgKey = p->u.addedKey;
/*@-branchstate@*/ /* FIX: p->key ??? */
if (!archOkay(p->arch) && !(ts->ignoreSet & RPMPROB_FILTER_IGNOREARCH))
rpmProblemSetAppend(ts->probs, RPMPROB_BADARCH,
@ -1151,9 +1119,9 @@ int keep_header = 1; /* XXX rpmProblemSetAppend prevents dumping headers. */
case TR_ADDED:
fi->record = 0;
pkgKey = ts->order[oc].u.addedKey;
/*@i@*/ fi->h = headerLink(ts->order[oc].h, "xfer to fi->h");
ts->order[oc].h = headerFree(ts->order[oc].h, "xfer to fi->h");
fi->h = alGetHeader(ts->addedPackages, pkgKey, 1);
#ifdef DYING /* XXX MULTILIB multiLib from transactionElement */
fi->multiLib = alGetMultiLib(ts->addedPackages, i);
#else
@ -1572,6 +1540,7 @@ fi->relocs = relocs;
/*@=noeffectuncon @*/
fi->fd = NULL;
}
fi->h = headerFree(fi->h, "TR_ADDED fini");
freeFi(fi);
/*@switchbreak@*/ break;
case TR_REMOVED:
@ -1583,6 +1552,7 @@ fi->relocs = relocs;
if (psmStage(psm, PSM_PKGERASE))
ourrc++;
}
fi->h = headerFree(fi->h, "TR_REMOVED fini");
freeFi(fi);
/*@switchbreak@*/ break;
}

View File

@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2001-11-10 19:10-0500\n"
"POT-Creation-Date: 2001-11-10 20:39-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -816,7 +816,7 @@ msgstr ""
msgid "Could not open %s: %s\n"
msgstr ""
#: build/pack.c:603 lib/psm.c:2146
#: build/pack.c:603 lib/psm.c:2139
#, c-format
msgid "Unable to write package: %s\n"
msgstr ""
@ -846,7 +846,7 @@ msgstr ""
msgid "Unable to write payload to %s: %s\n"
msgstr ""
#: build/pack.c:683 lib/psm.c:2411
#: build/pack.c:683 lib/psm.c:2404
#, c-format
msgid "Wrote: %s\n"
msgstr ""
@ -1410,83 +1410,83 @@ msgstr ""
msgid " failed - "
msgstr ""
#: lib/depends.c:114
#: lib/depends.c:113
#, c-format
msgid "cannot open Packages database in %s\n"
msgstr ""
#: lib/depends.c:413
#: lib/depends.c:415
#, c-format
msgid "package %s was already added, replacing with %s\n"
msgstr ""
#: lib/depends.c:681
#: lib/depends.c:684
msgid "(cached)"
msgstr ""
#: lib/depends.c:706
#: lib/depends.c:709
msgid "(rpmrc provides)"
msgstr ""
#: lib/depends.c:722
#: lib/depends.c:725
msgid "(rpmlib provides)"
msgstr ""
#: lib/depends.c:743
#: lib/depends.c:746
msgid "(db files)"
msgstr ""
#: lib/depends.c:755
#: lib/depends.c:758
msgid "(db provides)"
msgstr ""
#: lib/depends.c:768
#: lib/depends.c:771
msgid "(db package)"
msgstr ""
#: lib/depends.c:807
#: lib/depends.c:810
#, c-format
msgid "%9s: (%s, %s) added to Depends cache.\n"
msgstr ""
#: lib/depends.c:809 lib/rpmds.c:563 lib/rpmds.c:721
#: lib/depends.c:812 lib/rpmds.c:563 lib/rpmds.c:721
msgid "NO "
msgstr ""
#: lib/depends.c:809 lib/rpmds.c:563 lib/rpmds.c:721
#: lib/depends.c:812 lib/rpmds.c:563 lib/rpmds.c:721
msgid "YES"
msgstr ""
#: lib/depends.c:1151
#: lib/depends.c:1154
#, c-format
msgid "removing %s \"%s\" from tsort relations.\n"
msgstr ""
#. Record all relations.
#: lib/depends.c:1384
#: lib/depends.c:1387
msgid "========== recording tsort relations\n"
msgstr ""
#. T4. Scan for zeroes.
#: lib/depends.c:1455
#: lib/depends.c:1458
msgid ""
"========== tsorting packages (order, #predecessors, #succesors, depth)\n"
msgstr ""
#: lib/depends.c:1530
#: lib/depends.c:1533
msgid "========== successors only (presentation order)\n"
msgstr ""
#: lib/depends.c:1590
#: lib/depends.c:1593
msgid "LOOP:\n"
msgstr ""
#: lib/depends.c:1625
#: lib/depends.c:1628
msgid "========== continuing tsort ...\n"
msgstr ""
#. Return no. of packages that could not be ordered.
#: lib/depends.c:1630
#: lib/depends.c:1633
#, c-format
msgid "rpmdepOrder failed, %d elements remain\n"
msgstr ""
@ -1588,7 +1588,7 @@ msgid "dataLength() RPM_STRING_TYPE count must be 1.\n"
msgstr ""
#. @-modfilesys@
#: lib/header.c:384 lib/header_internal.c:161 lib/psm.c:956
#: lib/header.c:384 lib/header_internal.c:161 lib/psm.c:955
#, c-format
msgid "Data type %d not supported\n"
msgstr ""
@ -2173,108 +2173,108 @@ msgstr ""
msgid "is needed by"
msgstr ""
#: lib/psm.c:272
#: lib/psm.c:271
msgid "========== relocations\n"
msgstr ""
#: lib/psm.c:276
#: lib/psm.c:275
#, c-format
msgid "%5d exclude %s\n"
msgstr ""
#: lib/psm.c:279
#: lib/psm.c:278
#, c-format
msgid "%5d relocate %s -> %s\n"
msgstr ""
#: lib/psm.c:349
#: lib/psm.c:348
#, c-format
msgid "excluding multilib path %s%s\n"
msgstr ""
#: lib/psm.c:415
#: lib/psm.c:414
#, c-format
msgid "excluding %s %s\n"
msgstr ""
#: lib/psm.c:425
#: lib/psm.c:424
#, c-format
msgid "relocating %s to %s\n"
msgstr ""
#: lib/psm.c:504
#: lib/psm.c:503
#, c-format
msgid "relocating directory %s to %s\n"
msgstr ""
#: lib/psm.c:1153
#: lib/psm.c:1152
#, c-format
msgid "cannot create %%%s %s\n"
msgstr ""
#: lib/psm.c:1159
#: lib/psm.c:1158
#, c-format
msgid "cannot write to %%%s %s\n"
msgstr ""
#: lib/psm.c:1200
#: lib/psm.c:1198
msgid "source package expected, binary found\n"
msgstr ""
#: lib/psm.c:1324
#: lib/psm.c:1317
msgid "source package contains no .spec file\n"
msgstr ""
#: lib/psm.c:1434
#: lib/psm.c:1427
#, c-format
msgid "%s: running %s scriptlet\n"
msgstr ""
#: lib/psm.c:1602
#: lib/psm.c:1595
#, c-format
msgid "execution of %s scriptlet from %s-%s-%s failed, waitpid returned %s\n"
msgstr ""
#: lib/psm.c:1609
#: lib/psm.c:1602
#, c-format
msgid "execution of %s scriptlet from %s-%s-%s failed, exit status %d\n"
msgstr ""
#: lib/psm.c:1951
#: lib/psm.c:1944
#, c-format
msgid "%s: %s-%s-%s has %d files, test = %d\n"
msgstr ""
#: lib/psm.c:2068
#: lib/psm.c:2061
#, c-format
msgid "%s: %s scriptlet failed (%d), skipping %s-%s-%s\n"
msgstr ""
#: lib/psm.c:2182
#: lib/psm.c:2175
#, c-format
msgid "user %s does not exist - using root\n"
msgstr ""
#: lib/psm.c:2191
#: lib/psm.c:2184
#, c-format
msgid "group %s does not exist - using root\n"
msgstr ""
#: lib/psm.c:2232
#: lib/psm.c:2225
#, c-format
msgid "unpacking of archive failed%s%s: %s\n"
msgstr ""
#: lib/psm.c:2233
#: lib/psm.c:2226
msgid " on file "
msgstr ""
#: lib/psm.c:2419
#: lib/psm.c:2412
#, c-format
msgid "%s failed on file %s: %s\n"
msgstr ""
#: lib/psm.c:2422
#: lib/psm.c:2415
#, c-format
msgid "%s failed: %s\n"
msgstr ""
@ -2401,11 +2401,11 @@ msgstr ""
msgid "package %s is not installed\n"
msgstr ""
#: lib/rpmal.c:688
#: lib/rpmal.c:656
msgid "(added files)"
msgstr ""
#: lib/rpmal.c:787
#: lib/rpmal.c:755
msgid "(added provide)"
msgstr ""
@ -2815,13 +2815,13 @@ msgstr ""
msgid "Signature: UNKNOWN (%d)\n"
msgstr ""
#: lib/transaction.c:205
#: lib/transaction.c:206
#, c-format
msgid "%s skipped due to missingok flag\n"
msgstr ""
#. @innercontinue@
#: lib/transaction.c:906
#: lib/transaction.c:876
#, c-format
msgid "excluding directory %s\n"
msgstr ""