From 5bc95d28e133997692d8b7d7586fe18643af8ba3 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Thu, 10 Jan 2013 18:22:03 +0100 Subject: [PATCH] Don't check for missing ports and builds in single arch mode passed by command line --- src/distromatic.c | 94 ++++++++++++++++++++++++----------------------- 1 file changed, 48 insertions(+), 46 deletions(-) diff --git a/src/distromatic.c b/src/distromatic.c index 36c5f3e..a336901 100644 --- a/src/distromatic.c +++ b/src/distromatic.c @@ -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)