From 30b58fb9bdbd9848c946da2b86ea59dbc186aaaf Mon Sep 17 00:00:00 2001 From: ewt Date: Wed, 3 Jul 1996 02:55:03 +0000 Subject: [PATCH] added handling for arch strings, INSTALL_NOARCH flag CVS patchset: 723 CVS date: 1996/07/03 02:55:03 --- lib/install.c | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/lib/install.c b/lib/install.c index 50da446..e66de56 100644 --- a/lib/install.c +++ b/lib/install.c @@ -114,7 +114,8 @@ int rpmInstallPackage(char * prefix, rpmdb db, int fd, int flags, dbIndexSet matches; int * oldVersions; int * intptr; - int_8 thisArch, * pkgArch; + int_8 * pkgArchNum; + void * pkgArch; int scriptArg; oldVersions = alloca(sizeof(int)); @@ -144,14 +145,27 @@ int rpmInstallPackage(char * prefix, rpmdb db, int fd, int flags, getEntry(h, RPMTAG_VERSION, &type, (void **) &version, &fileCount); getEntry(h, RPMTAG_RELEASE, &type, (void **) &release, &fileCount); - /* make sure we're trying to install this on the proper architecture */ - thisArch = getArchNum(); - getEntry(h, RPMTAG_ARCH, &type, (void **) &pkgArch, &fileCount); - if (thisArch != *pkgArch) { - error(RPMERR_BADARCH, "package %s-%s-%s is for a different " - "architecture", name, version, release); - freeHeader(h); - return 2; + if (!(flags & INSTALL_NOARCH)) { + /* make sure we're trying to install this on the proper architecture */ + getEntry(h, RPMTAG_ARCH, &type, (void **) &pkgArch, &fileCount); + if (type == INT8_TYPE) { + /* old arch handling */ + pkgArchNum = pkgArch; + if (getArchNum() != *pkgArchNum) { + error(RPMERR_BADARCH, "package %s-%s-%s is for a different " + "architecture", name, version, release); + freeHeader(h); + return 2; + } + } else { + /* new arch handling */ + if (!rpmArchScore(pkgArch)) { + error(RPMERR_BADARCH, "package %s-%s-%s is for a different " + "architecture", name, version, release); + freeHeader(h); + return 2; + } + } } if (labelFormat) { -- 2.7.4