summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2012-10-11 12:31:15 -0700
committerAnas Nashif <anas.nashif@intel.com>2013-02-02 16:44:14 -0800
commit5300b55f775a6696db5b8d6cac909433728b516f (patch)
tree1a4603e864008a4f74e337fde2e7934d02393e73
parentff412beb0fbd5eab906b52a9905bd8c06b1608e7 (diff)
downloadlibrpm-tizen-5300b55f775a6696db5b8d6cac909433728b516f.tar.gz
librpm-tizen-5300b55f775a6696db5b8d6cac909433728b516f.tar.bz2
librpm-tizen-5300b55f775a6696db5b8d6cac909433728b516f.zip
compate name and version
Also compare the name and not only the version when checking if two packages are the same. rh#104066
-rw-r--r--lib/depends.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/depends.c b/lib/depends.c
index 6539396f1..fa11725a8 100644
--- a/lib/depends.c
+++ b/lib/depends.c
@@ -144,6 +144,24 @@ static int skipColor(rpm_color_t tscolor, rpm_color_t color, rpm_color_t ocolor)
return tscolor && color && ocolor && !(color & ocolor);
}
+static int rpmNameVersionCompare(Header first, Header second)
+{
+ const char * one, * two;
+ int rc;
+
+ one = headerGetString(first, RPMTAG_NAME);
+ two = headerGetString(second, RPMTAG_NAME);
+ rc = strcmp(one, two);
+ if (rc)
+ return rc;
+ one = headerGetString(first, RPMTAG_ARCH);
+ two = headerGetString(second, RPMTAG_ARCH);
+ rc = strcmp(one, two);
+ if (rc)
+ return rc;
+ return rpmVersionCompare(first, second);
+}
+
/* Add erase elements for older packages of same color (if any). */
static int addUpgradeErasures(rpmts ts, rpm_color_t tscolor,
rpmte p, rpm_color_t hcolor, Header h)
@@ -157,8 +175,8 @@ static int addUpgradeErasures(rpmts ts, rpm_color_t tscolor,
if (skipColor(tscolor, hcolor, headerGetNumber(oh, RPMTAG_HEADERCOLOR)))
continue;
- /* Skip packages that contain identical NEVR. */
- if (rpmVersionCompare(h, oh) == 0)
+ /* Skip packages that contain identical NEVRA. */
+ if (rpmNameVersionCompare(h, oh) == 0)
continue;
if (removePackage(ts, oh, p)) {