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);