From f79ed692f676d78b3d06f7d169e2ad2fdab6a4cb Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Thu, 31 May 2012 12:08:36 +0200 Subject: [PATCH] Print warning only when all providing packages are obsoleted --- src/distromatic.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/distromatic.c b/src/distromatic.c index 5252a2c..a718051 100644 --- a/src/distromatic.c +++ b/src/distromatic.c @@ -473,20 +473,25 @@ resolveFirstLevelDependencies(struct configTag *ct, int archidx) addWarning(currheader->sourceheader,warning); } } else { /* provided->numproviders > 0 */ - for (j = 0; j < provided->numproviders; j++) { - if (provided->provider[j]->obsoleted && !currheader->obsoleted) { - snprintf(warning, PATH_MAX, "%s needed by %s(%s,%s) is provided by obsoleted package %s(%s,%s)", - provided->name, - currheader->name, - currheader->arch, - ct->repository[currheader->altrepository]->tag, - provided->provider[j]->name, - provided->provider[j]->arch, - ct->repository[provided->provider[j]->altrepository]->tag); - fprintf(stderr,"Warning: %s\n",warning); - addWarning(currheader->sourceheader,warning); - } - } + k=0; + for (j = 0; j < provided->numproviders; j++) { + if (provided->provider[j]->obsoleted && !currheader->obsoleted) k++; + } + if (k == provided->numproviders) { // all provides are obsoleted + snprintf(warning, PATH_MAX, "%s needed by %s(%s,%s) is only provided by obsoleted package(s):", + provided->name, + currheader->name, + currheader->arch, + ct->repository[currheader->altrepository]->tag); + for (j = 0; j < provided->numproviders; j++) { + snprintf(&warning[strlen(warning)], PATH_MAX - strlen(warning), " %s(%s,%s)", + provided->provider[j]->name, + provided->provider[j]->arch, + ct->repository[provided->provider[j]->altrepository]->tag); + } + fprintf(stderr,"Warning: %s\n",warning); + addWarning(currheader->sourceheader,warning); + } if ((currheader->require[i]->name)[0] == '/') { /* when there is a Requires: /file/requirement add provide from file tree as well */ file=findOrCreateFileTreeEntry(&ct->filetree[archidx],currheader->require[i]->name);