Don't check for missing ports and builds in single arch mode passed by command line

This commit is contained in:
Silvan Calarco 2013-01-10 18:22:03 +01:00
parent 636f2364d3
commit 5bc95d28e1

View File

@ -108,7 +108,6 @@ int handleObsoletedPackages(struct configTag *ct, int arch);
static struct configDefaults configdefaults; static struct configDefaults configdefaults;
static struct configTag *firstconfigtag = NULL, *configtag = NULL; static struct configTag *firstconfigtag = NULL, *configtag = NULL;
static char* arch =NULL;
static const unsigned int bufsize = 1024; static const unsigned int bufsize = 1024;
static const unsigned int maxlinelenght = 1024; static const unsigned int maxlinelenght = 1024;
@ -1035,7 +1034,7 @@ main(int argc, char *argv[])
{ {
char *name = NULL, *date = NULL, char *name = NULL, *date = NULL,
*repository_dir = NULL, *repository_tag = NULL, *repository_dir = NULL, *repository_tag = NULL,
*configfile = NULL; *configfile = NULL, *passed_arch = NULL;
struct headerList *currheaderlist; struct headerList *currheaderlist;
struct headerSourceList *currheadersourcelist = NULL; struct headerSourceList *currheadersourcelist = NULL;
@ -1123,7 +1122,7 @@ main(int argc, char *argv[])
} }
break; break;
case 'a': case 'a':
arch = optarg; passed_arch = optarg;
break; break;
case 'c': case 'c':
configfile = optarg; configfile = optarg;
@ -1188,13 +1187,13 @@ main(int argc, char *argv[])
exit(1); exit(1);
} }
if (arch) { if (passed_arch) {
configtag->arch[0] = malloc(sizeof arch); configtag->arch[0] = malloc(sizeof passed_arch);
if (!configtag->arch[0]) { if (!configtag->arch[0]) {
fprintf(stderr, "The system is out of memory\n"); fprintf(stderr, "The system is out of memory\n");
exit(1); exit(1);
} }
strcpy(configtag->arch[0], arch); strcpy(configtag->arch[0], passed_arch);
configtag->arch[1] = NULL; configtag->arch[1] = NULL;
} }
@ -1314,51 +1313,54 @@ main(int argc, char *argv[])
} // archs loop } // archs loop
if (!quietmode) if (!passed_arch) { // can't do missing builds and ports check in single arch mode
fprintf(stdout, "Checking for SRPMS with no builds and missing ports...\n"); if (!quietmode)
else fprintf(stdout, "Checking for SRPMS with no builds and missing ports...\n");
logmsg(LOG_MARK, "Missing ports and SRPMS with no builds check"); else
logmsg(LOG_MARK, "Missing ports and SRPMS with no builds check");
currheadersourcelist = configtag->headersourcelist; currheadersourcelist = configtag->headersourcelist;
while (currheadersourcelist != NULL) { while (currheadersourcelist != NULL) {
for (i = 0; i < ARCHS_MAX && configtag->arch[i]; i++) for (i = 0; i < ARCHS_MAX && configtag->arch[i]; i++)
hasbuilds[i] = 0; hasbuilds[i] = 0;
for (i = 0; i < ARCHS_MAX && configtag->arch[i]; i++) { for (i = 0; i < ARCHS_MAX && configtag->arch[i]; i++) {
if (currheadersourcelist->firstchild[i]) if (currheadersourcelist->firstchild[i])
hasbuilds[i] = 1; hasbuilds[i] = 1;
else if (currheadersourcelist->old && currheadersourcelist->old->firstchild[i]) else if (currheadersourcelist->old && currheadersourcelist->old->firstchild[i])
hasbuilds[i] = -1; hasbuilds[i] = -1;
}
warning[0] = '\0';
for (i = 0; i < ARCHS_MAX && configtag->arch[i]; i++) {
if (hasbuilds[i] == 1) {
strncat(warning," ",PATH_MAX);
strncat(warning,configtag->arch[i],PATH_MAX);
} }
} warning[0] = '\0';
if (warning[0] == '\0') { for (i = 0; i < ARCHS_MAX && configtag->arch[i]; i++) {
snprintf(warning, PATH_MAX, "SRPM does not have any valid RPM build"); if (hasbuilds[i] == 1) {
logmsg(LOG_WARNING, "%s: %s", strncat(warning," ",PATH_MAX);
currheadersourcelist->name, strncat(warning,configtag->arch[i],PATH_MAX);
warning); }
}
if (warning[0] == '\0') {
snprintf(warning, PATH_MAX, "SRPM does not have any valid RPM build");
logmsg(LOG_WARNING, "%s: %s",
currheadersourcelist->name,
warning);
addWarning(currheadersourcelist, warning);
}
warning[0] = '\0';
for (i = 0; i < ARCHS_MAX && configtag->arch[i]; i++) {
if (hasbuilds[i] == -1) {
if (warning[0] == '\0')
strncat(warning, "requires port to arch(s):", PATH_MAX);
strncat(warning," ",PATH_MAX);
strncat(warning,configtag->arch[i],PATH_MAX);
}
}
if (warning[0] != '\0') {
logmsg(LOG_WARNING, "%s: %s",
currheadersourcelist->name,
warning);
addWarning(currheadersourcelist, warning); addWarning(currheadersourcelist, warning);
}
warning[0] = '\0';
for (i = 0; i < ARCHS_MAX && configtag->arch[i]; i++) {
if (hasbuilds[i] == -1) {
if (warning[0] == '\0')
strncat(warning, "requires port to arch(s):", PATH_MAX);
strncat(warning," ",PATH_MAX);
strncat(warning,configtag->arch[i],PATH_MAX);
} }
currheadersourcelist = currheadersourcelist->next;
} }
if (warning[0] != '\0') {
logmsg(LOG_WARNING, "%s: %s",
currheadersourcelist->name,
warning);
addWarning(currheadersourcelist, warning);
}
currheadersourcelist = currheadersourcelist->next;
} }
} // if (genheader_mode) } // if (genheader_mode)