Fixes for pkg_needrebuild() and also add rebuilds as warning

This commit is contained in:
Silvan Calarco 2014-07-06 17:10:16 +02:00
parent e2d17e725a
commit 56baf37545
3 changed files with 43 additions and 10 deletions

View File

@ -511,7 +511,6 @@ resolveFirstLevelDependencies(struct configTag *ct, int archidx)
!currheader->obsoleted) k++;
}
if (k == provided->numproviders) { // all provides are from older packages
addRebuild(provided->provider[j]->sourceheader,currheader->sourceheader);
snprintf(warning, PATH_MAX, "%s(%s,%s) requires %s which is only provided by older package(s):",
currheader->name,
currheader->arch,
@ -525,6 +524,7 @@ resolveFirstLevelDependencies(struct configTag *ct, int archidx)
}
fprintf(stderr,"Warning: %s\n",warning);
for (j = 0; j < provided->numproviders; j++) {
addRebuild(provided->provider[j]->sourceheader,currheader->sourceheader);
addWarning(provided->provider[j]->sourceheader,warning);
}
} else {
@ -934,7 +934,8 @@ main(int argc, char *argv[])
*configfile = NULL, *passed_arch = NULL;
struct headerList *currheaderlist;
struct headerSourceList *currheadersourcelist = NULL;
struct headerSourceList *currheadersourcelist = NULL, *oldheadersourcelist;
struct rebuildList *currrebuild;
int i = 0,hasbuilds[ARCHS_MAX],ptharg[ARCHS_MAX];
pthread_t pth[ARCHS_MAX];
@ -1197,6 +1198,31 @@ main(int argc, char *argv[])
strncat(warning,configtag->arch[i],PATH_MAX);
}
}
if (warning[0] != '\0') {
logmsg(LOG_WARNING, "%s: %s",
currheadersourcelist->name,
warning);
addWarning(currheadersourcelist, warning);
}
warning[0] = '\0';
currrebuild = currheadersourcelist->firstrebuild;
oldheadersourcelist = currheadersourcelist->old;
while (!currrebuild && oldheadersourcelist) {
currrebuild = oldheadersourcelist->firstrebuild;
oldheadersourcelist = oldheadersourcelist->old;
}
if (currrebuild) {
strncat(warning,"need to be rebuilt:", PATH_MAX);
while (currrebuild) {
strncat(warning," ",PATH_MAX);
strncat(warning,currrebuild->sourceheader->name,PATH_MAX);
currrebuild = currrebuild->next;
}
}
if (warning[0] != '\0') {
logmsg(LOG_WARNING, "%s: %s",
currheadersourcelist->name,

View File

@ -107,14 +107,13 @@ struct rebuildList* addRebuild(struct headerSourceList *pkg, struct headerSource
currrebuild = currrebuild->next;
}
currrebuild=malloc(sizeof(currrebuild));
currrebuild=malloc(sizeof(struct rebuildList));
if (!currrebuild) return NULL;
if (!pkg->firstrebuild) pkg->firstrebuild=currrebuild;
currrebuild->sourceheader=sourceheader;
if (!currrebuild->sourceheader) return NULL;
currrebuild->next=NULL;
if (prevrebuild) prevrebuild->next=currrebuild;
return pkg->firstrebuild;
}
@ -689,6 +688,7 @@ addToSourceHeaderList(struct headerSourceList **headersourcelist, struct configT
newheadersourcelist->updatingparent = NULL;
newheadersourcelist->altrepository = altrepository;
newheadersourcelist->firstwarning = NULL;
newheadersourcelist->firstrebuild = NULL;
newheadersourcelist->old = NULL;
newheadersourcelist->id = ++sourceid;
getPackageInfoIntoHeaderSourceList(h, newheadersourcelist);

View File

@ -1773,7 +1773,7 @@ print_datatables(struct configTag *ct, int arch) {
contents_filename[1024], warnings_filename[1024], buf[1024];
char obsoletebuf[PATH_MAX];
struct headerList *currheaderlist, *currchild;
struct headerSourceList * currheadersourcelist;
struct headerSourceList *currheadersourcelist, *oldheadersourcelist;
struct rebuildList *currrebuild;
int i, nonobsoletednumproviders;
@ -2088,13 +2088,20 @@ print_datatables(struct configTag *ct, int arch) {
}
fprintf(fbsh,"); pkg_obsoletes=(%s);",obsoletebuf);
fprintf(fbsh,"pkg_needrebuild=(");
/* find pointer to firstrebuild also looking into old packages */
currrebuild = currheadersourcelist->firstrebuild;
oldheadersourcelist = currheadersourcelist->old;
while (!currrebuild && oldheadersourcelist) {
currrebuild = oldheadersourcelist->firstrebuild;
oldheadersourcelist = oldheadersourcelist->old;
}
fprintf(fbsh," pkg_needrebuild=(");
while (currrebuild) {
fprintf(fbsh, "%s ", currrebuild->sourceheader->name);
currrebuild = currrebuild->next;
}
fprintf(fb,"); }\n\n");
fprintf(fbsh,"); }\n");
fprintf(fb,"\n");
}
currheadersourcelist = currheadersourcelist->next;