[Rpm-maint] [Suse patch] Test architecture in refresh
Michael Schroeder
mls at suse.de
Fri Jun 8 13:13:07 UTC 2007
On Fri, Jun 08, 2007 at 03:11:54PM +0300, Panu Matilainen wrote:
>
> Hmm.. I fail to see any behavior change with this patch, but maybe I'm
> testing something else. This would seem to be related to the
> nameversioncompare.diff to some extent - Michael?
Right, the patch is about keeping the refresh detection in depends.c
and psm.c in sync. Here's a much cleaner (but untested) patch, with
some extra comments. What's missing is the definition of
rpmHeadersIdentical().
--- lib/depends.c.orig 2007-06-08 12:51:51.000000000 +0000
+++ lib/depends.c 2007-06-08 13:01:02.000000000 +0000
@@ -302,8 +302,8 @@ addheader:
if (tscolor && hcolor && ohcolor && !(hcolor & ohcolor))
continue;
- /* Skip packages that contain identical NEVR. */
- if (rpmVersionCompare(h, oh) == 0)
+ /* Skip remove for packages refresh operations */
+ if (rpmHeadersIdentical(h, oh))
continue;
xx = removePackage(ts, oh, rpmdbGetIteratorOffset(mi), pkgKey);
@@ -349,6 +349,10 @@ addheader:
if (tscolor && hcolor && ohcolor && !(hcolor & ohcolor))
/*@innercontinue@*/ continue;
+ /* do not obsolete ourself for package refresh operations */
+ if (rpmHeadersIdentical(h, oh))
+ continue;
+
/*
* Rpm prior to 3.0.3 does not have versioned obsoletes.
* If no obsoletes version info is available, match all names.
@@ -356,10 +360,7 @@ addheader:
if (rpmdsEVR(obsoletes) == NULL
|| rpmdsAnyMatchesDep(oh, obsoletes, _rpmds_nopromote)) {
const char * ohNEVRA = hGetNEVRA(oh, NULL);
-#ifdef DYING /* XXX see http://bugzilla.redhat.com #134497 */
- if (rpmVersionCompare(h, oh))
-#endif
- xx = removePackage(ts, oh, rpmdbGetIteratorOffset(mi), pkgKey);
+ xx = removePackage(ts, oh, rpmdbGetIteratorOffset(mi), pkgKey);
/*@-nullptrarith@*/
rpmMessage(RPMMESS_DEBUG, _(" Obsoletes: %s\t\terases %s\n"),
rpmdsDNEVR(obsoletes)+2, ohNEVRA);
--- lib/psm.c.orig 2007-06-08 13:01:10.000000000 +0000
+++ lib/psm.c 2007-06-08 13:08:20.000000000 +0000
@@ -1424,21 +1424,15 @@ rpmRC rpmpsmStage(rpmpsm psm, pkgStage s
psm->scriptArg = psm->npkgs_installed + 1;
assert(psm->mi == NULL);
+ /* if this is a refresh operation, the code in depends.c
+ * did not add a remove transaction element for the old
+ * package, so we have to make sure that the old header
+ * is deleted.
+ */
psm->mi = rpmtsInitIterator(ts, RPMTAG_NAME, rpmteN(psm->te), 0);
- xx = rpmdbSetIteratorRE(psm->mi, RPMTAG_EPOCH, RPMMIRE_STRCMP,
- rpmteE(psm->te));
- xx = rpmdbSetIteratorRE(psm->mi, RPMTAG_VERSION, RPMMIRE_STRCMP,
- rpmteV(psm->te));
- xx = rpmdbSetIteratorRE(psm->mi, RPMTAG_RELEASE, RPMMIRE_STRCMP,
- rpmteR(psm->te));
- if (tscolor) {
- xx = rpmdbSetIteratorRE(psm->mi, RPMTAG_ARCH, RPMMIRE_STRCMP,
- rpmteA(psm->te));
- xx = rpmdbSetIteratorRE(psm->mi, RPMTAG_OS, RPMMIRE_STRCMP,
- rpmteO(psm->te));
- }
-
while ((psm->oh = rpmdbNextIterator(psm->mi)) != NULL) {
+ if (!rpmHeadersIdentical(fi->h, psm->oh))
+ continue;
fi->record = rpmdbGetIteratorOffset(psm->mi);
psm->oh = NULL;
/*@loopbreak@*/ break;
Cheers,
Michael.
--
Michael Schroeder mls at suse.de
SUSE LINUX Products GmbH, GF Markus Rex, HRB 16746 AG Nuernberg
main(_){while(_=~getchar())putchar(~_-1/(~(_|32)/13*2-11)*13);}
More information about the Rpm-maint
mailing list