summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2010-05-07 14:07:39 +0300
committerPanu Matilainen <pmatilai@redhat.com>2010-05-07 14:16:18 +0300
commit8f7c2d7063df6d1057425d014ce4168d46c5e7d9 (patch)
treef1fc34981466d59f11b9bf80acf2ecca21caaf0b
parent0782ee6b71b2cdad2a6fb6ff2f90d506e3230eb2 (diff)
downloadlibrpm-tizen-8f7c2d7063df6d1057425d014ce4168d46c5e7d9.tar.gz
librpm-tizen-8f7c2d7063df6d1057425d014ce4168d46c5e7d9.tar.bz2
librpm-tizen-8f7c2d7063df6d1057425d014ce4168d46c5e7d9.zip
Store pointer to transaction set in transaction elements
- unused now but allows various new things and more element "independency" - eliminate the unused dboffset argument while at it
-rw-r--r--lib/depends.c13
-rw-r--r--lib/rpmte.c11
-rw-r--r--lib/rpmte_internal.h9
3 files changed, 15 insertions, 18 deletions
diff --git a/lib/depends.c b/lib/depends.c
index 549ebc982..d9b392cf7 100644
--- a/lib/depends.c
+++ b/lib/depends.c
@@ -53,8 +53,9 @@ static rpmds rpmlibP = NULL;
* @param depends installed package of pair (or RPMAL_NOMATCH on erase)
* @return 0 on success
*/
-static int removePackage(tsMembers tsmem, Header h, rpmte depends)
+static int removePackage(rpmts ts, Header h, rpmte depends)
{
+ tsMembers tsmem = rpmtsMembers(ts);
rpmte p;
unsigned int dboffset = headerGetInstance(h);
@@ -73,7 +74,7 @@ static int removePackage(tsMembers tsmem, Header h, rpmte depends)
tsmem->order = xrealloc(tsmem->order, sizeof(*tsmem->order) * tsmem->orderAlloced);
}
- p = rpmteNew(NULL, h, TR_REMOVED, NULL, NULL, -1);
+ p = rpmteNew(ts, h, TR_REMOVED, NULL, NULL);
rpmteSetDependsOn(p, depends);
tsmem->order[tsmem->orderCount] = p;
@@ -110,7 +111,7 @@ static void addUpgradeErasures(rpmts ts, tsMembers tsmem, rpm_color_t tscolor,
if (rpmVersionCompare(h, oh) == 0)
continue;
- removePackage(tsmem, oh, p);
+ removePackage(ts, oh, p);
}
mi = rpmdbFreeIterator(mi);
}
@@ -152,7 +153,7 @@ static void addObsoleteErasures(rpmts ts, tsMembers tsmem, rpm_color_t tscolor,
rpmdsDNEVR(obsoletes)+2, ohNEVRA);
ohNEVRA = _free(ohNEVRA);
- removePackage(tsmem, oh, p);
+ removePackage(ts, oh, p);
}
}
mi = rpmdbFreeIterator(mi);
@@ -291,7 +292,7 @@ int rpmtsAddInstallElement(rpmts ts, Header h,
tsmem->orderAlloced * sizeof(*tsmem->order));
}
- p = rpmteNew(NULL, h, TR_ADDED, key, relocs, -1);
+ p = rpmteNew(ts, h, TR_ADDED, key, relocs);
tsmem->order[oc] = p;
if (oc == tsmem->orderCount) {
@@ -322,7 +323,7 @@ exit:
int rpmtsAddEraseElement(rpmts ts, Header h, int dboffset)
{
- return removePackage(rpmtsMembers(ts), h, NULL);
+ return removePackage(ts, h, NULL);
}
/**
diff --git a/lib/rpmte.c b/lib/rpmte.c
index 1b9b16765..30acace03 100644
--- a/lib/rpmte.c
+++ b/lib/rpmte.c
@@ -44,6 +44,7 @@ struct rpmte_s {
rpmds obsoletes; /*!< Obsoletes: dependencies. */
rpmfi fi; /*!< File information. */
rpmps probs; /*!< Problems (relocations) */
+ rpmts ts; /*!< Parent transaction */
rpm_color_t color; /*!< Color bit(s) from package dependencies. */
rpm_loff_t pkgFileSize; /*!< No. of bytes in package file (approx). */
@@ -256,6 +257,7 @@ rpmte rpmteFree(rpmte te)
rpmfsFree(te->fs);
rpmpsFree(te->probs);
rpmteCleanDS(te);
+ rpmtsUnlink(te->ts);
memset(te, 0, sizeof(*te)); /* XXX trash and burn */
free(te);
@@ -263,14 +265,11 @@ rpmte rpmteFree(rpmte te)
return NULL;
}
-rpmte rpmteNew(const rpmts ts, Header h,
- rpmElementType type,
- fnpyKey key,
- rpmRelocation * relocs,
- int dboffset)
+rpmte rpmteNew(rpmts ts, Header h, rpmElementType type, fnpyKey key,
+ rpmRelocation * relocs)
{
rpmte p = xcalloc(1, sizeof(*p));
-
+ p->ts = rpmtsLink(ts);
p->type = type;
addTE(p, h, key, relocs);
switch (type) {
diff --git a/lib/rpmte_internal.h b/lib/rpmte_internal.h
index 160409d61..cfb0ee51a 100644
--- a/lib/rpmte_internal.h
+++ b/lib/rpmte_internal.h
@@ -23,19 +23,16 @@ typedef struct tsortInfo_s * tsortInfo;
/** \ingroup rpmte
* Create a transaction element.
- * @param ts unused
+ * @param ts transaction set
* @param h header
* @param type TR_ADDED/TR_REMOVED
* @param key (TR_ADDED) package retrieval key (e.g. file name)
* @param relocs (TR_ADDED) package file relocations
- * @param dboffset unused
* @return new transaction element
*/
RPM_GNUC_INTERNAL
-rpmte rpmteNew(const rpmts ts, Header h, rpmElementType type,
- fnpyKey key,
- rpmRelocation * relocs,
- int dboffset);
+rpmte rpmteNew(rpmts ts, Header h, rpmElementType type, fnpyKey key,
+ rpmRelocation * relocs);
/** \ingroup rpmte
* Destroy a transaction element.