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