From 5ef070496741b4475b8b48c71650087915560223 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Fri, 16 Mar 2012 15:18:43 +0100 Subject: [PATCH] Check for binary packages with same name in upper level repositories when coming from sources with different names --- src/distromatic.c | 37 +++++++++++++++++++++++++++++++++++++ src/headerlist.c | 2 +- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/distromatic.c b/src/distromatic.c index e216d5a..3153bab 100644 --- a/src/distromatic.c +++ b/src/distromatic.c @@ -375,6 +375,43 @@ resolveFirstLevelDependencies(struct configTag *ct, int archidx) scanheader = ct->headerlist[archidx]; currrequire = NULL; currheader->requirelist = NULL; + if ((!currheader->obsoleted) && (currheader->next) && (!strcmp(currheader->name,currheader->next->name))) { + // mark obsoleted any package with same name in upper level repositories + if (currheader->altrepository < currheader->next->altrepository) { + currheader->obsoleted = 1; + if (checkVersionWithFlags( + currheader->version, + RPMSENSE_GREATER & RPMSENSE_EQUAL, + currheader->next->version)) { + snprintf(warning,PATH_MAX,"%s(%s,%s): same or higher version than package with same name in %s (%s >= %s)", + currheader->name, + ct->arch[archidx], + ct->repository[currheader->altrepository]->tag, + ct->repository[currheader->next->altrepository]->tag, + currheader->version, + currheader->next->version); + fprintf(stderr,"Warning: %s\n",warning); + addWarning(currheader->sourceheader,warning); + } + } else if (currheader->altrepository >= currheader->next->altrepository) { + currheader->next->obsoleted = 1; + if (checkVersionWithFlags( + currheader->version, + RPMSENSE_LESS & RPMSENSE_EQUAL, + currheader->next->version)) { + snprintf(warning,PATH_MAX,"%s(%s,%s): same or higher version than package with same name in %s (%s >= %s)", + currheader->next->name, + ct->arch[archidx], + ct->repository[currheader->next->altrepository]->tag, + ct->repository[currheader->altrepository]->tag, + currheader->next->version, + currheader->version); + fprintf(stderr,"Warning: %s\n",warning); + addWarning(currheader->sourceheader,warning); + } + } + } + if (currheader->obsoleted) { currheader = currheader->next; continue; diff --git a/src/headerlist.c b/src/headerlist.c index 15ce15a..73046f7 100644 --- a/src/headerlist.c +++ b/src/headerlist.c @@ -824,7 +824,7 @@ addToHeaderList(struct configTag *ct, currname[0] = '\0'; } for (i = 0; i < ALT_REPS_MAX; i++) { - /* scan alternate repositories to find any packge which comes first according to name sorting */ + /* scan alternate repositories to find any package which comes first according to name sorting */ if (altscanpath[i] && (altcnt[i] < altn[i]) && ((rpmnamecmp(currname, altnamelist[i][altcnt[i]]->d_name,0) >= 0) || (currname[0] == '\0'))) { strncpy(currname, altnamelist[i][altcnt[i]]->d_name,bufsize);