sqlite-backend: support for single repository not incremental db creation
- also don't resolve dependencies and obsoletes
This commit is contained in:
parent
57786153d2
commit
b9b62dc14c
@ -127,7 +127,9 @@ unsigned int quietmode = 0;
|
|||||||
unsigned int genheader_mode = GENHEADER_BASE + GENHEADER_REQUIREMENTS;
|
unsigned int genheader_mode = GENHEADER_BASE + GENHEADER_REQUIREMENTS;
|
||||||
unsigned int mode = 0;
|
unsigned int mode = 0;
|
||||||
unsigned int recursive_mode = 0;
|
unsigned int recursive_mode = 0;
|
||||||
|
unsigned int incremental_mode = 1;
|
||||||
unsigned int obsolete_packages = 1;
|
unsigned int obsolete_packages = 1;
|
||||||
|
unsigned int resolve_dependencies = 1;
|
||||||
|
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
static const char *freelicense[] = {
|
static const char *freelicense[] = {
|
||||||
@ -1107,7 +1109,7 @@ read_configuration(const char *confFile, const char *tag)
|
|||||||
void *threadArchScan(void* arg) {
|
void *threadArchScan(void* arg) {
|
||||||
int arch = *(int *)arg;
|
int arch = *(int *)arg;
|
||||||
|
|
||||||
if (generateHeaderList(configtag,arch)) {
|
if (generateHeaderList(configtag,arch,incremental_mode)) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Fatal error: could not generate header list\n");
|
"Fatal error: could not generate header list\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -1124,6 +1126,7 @@ void *threadArchScan(void* arg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (resolve_dependencies) {
|
||||||
if (!quietmode) fprintf(stdout, "%s: resolving dependencies...\n",configtag->arch[arch]);
|
if (!quietmode) fprintf(stdout, "%s: resolving dependencies...\n",configtag->arch[arch]);
|
||||||
if (resolveFirstLevelDependencies(configtag, arch)) {
|
if (resolveFirstLevelDependencies(configtag, arch)) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
@ -1150,6 +1153,7 @@ void *threadArchScan(void* arg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (mode & MODE_DATA_TABLES) {
|
if (mode & MODE_DATA_TABLES) {
|
||||||
if (!quietmode) fprintf(stdout,"%s: writing dependencies table...\n",configtag->arch[arch]);
|
if (!quietmode) fprintf(stdout,"%s: writing dependencies table...\n",configtag->arch[arch]);
|
||||||
@ -1263,8 +1267,11 @@ main(int argc, char *argv[])
|
|||||||
name = NULL;
|
name = NULL;
|
||||||
} else if (!strcmp(longopts[longindex].name, "gensqlite3")) {
|
} else if (!strcmp(longopts[longindex].name, "gensqlite3")) {
|
||||||
mode |= MODE_SQLITE3;
|
mode |= MODE_SQLITE3;
|
||||||
genheader_mode |= GENHEADER_CHANGELOG | GENHEADER_STATS;
|
genheader_mode |= GENHEADER_CHANGELOG;
|
||||||
recursive_mode = 1;
|
recursive_mode = 0;
|
||||||
|
incremental_mode = 0;
|
||||||
|
obsolete_packages = 0;
|
||||||
|
resolve_dependencies = 0;
|
||||||
name = NULL;
|
name = NULL;
|
||||||
} else if (!strcmp(longopts[longindex].name, "gensrcpkglist")) {
|
} else if (!strcmp(longopts[longindex].name, "gensrcpkglist")) {
|
||||||
mode |= MODE_GENSRCPKGLIST;
|
mode |= MODE_GENSRCPKGLIST;
|
||||||
@ -1367,7 +1374,7 @@ main(int argc, char *argv[])
|
|||||||
else
|
else
|
||||||
logmsg(LOG_MARK,"Source packages check for %s:", configtag->tag);
|
logmsg(LOG_MARK,"Source packages check for %s:", configtag->tag);
|
||||||
|
|
||||||
if (generateSourceHeaderList(configtag, genheader_mode)) {
|
if (generateSourceHeaderList(configtag, genheader_mode, incremental_mode)) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Fatal error: could not generate source header list\n");
|
"Fatal error: could not generate source header list\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -567,6 +567,10 @@ addToSourceHeaderList(struct headerSourceList **headersourcelist, struct configT
|
|||||||
|
|
||||||
if (altrepository == ct->repository_level) {
|
if (altrepository == ct->repository_level) {
|
||||||
scanpath = ct->repository_source_dir;
|
scanpath = ct->repository_source_dir;
|
||||||
|
} else if (altrepository == -1) {
|
||||||
|
// non-incremental mode
|
||||||
|
scanpath = ct->repository_source_dir;
|
||||||
|
altrepository = 0;
|
||||||
} else {
|
} else {
|
||||||
scanpath = ct->repository[altrepository]->repository_source_dir;
|
scanpath = ct->repository[altrepository]->repository_source_dir;
|
||||||
}
|
}
|
||||||
@ -591,6 +595,7 @@ addToSourceHeaderList(struct headerSourceList **headersourcelist, struct configT
|
|||||||
}
|
}
|
||||||
strcpy(&filepath[strlen(scanpath)], namelist[cnt]->d_name);
|
strcpy(&filepath[strlen(scanpath)], namelist[cnt]->d_name);
|
||||||
|
|
||||||
|
logmsg(LOG_DEBUG, "getting header for %s", filepath);
|
||||||
if (getHeader(&ts, filepath, &h)) {
|
if (getHeader(&ts, filepath, &h)) {
|
||||||
errstr = strerror(errno);
|
errstr = strerror(errno);
|
||||||
logmsg(LOG_WARNING,
|
logmsg(LOG_WARNING,
|
||||||
@ -741,20 +746,15 @@ addToSourceHeaderList(struct headerSourceList **headersourcelist, struct configT
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
generateSourceHeaderList(struct configTag *ct, int mode)
|
generateSourceHeaderList(struct configTag *ct, int mode, int incremental)
|
||||||
{
|
{
|
||||||
struct headerSourceList **headersourcelist = &(ct->headersourcelist);
|
struct headerSourceList **headersourcelist = &(ct->headersourcelist);
|
||||||
/* struct headerSourceList **currheadersourcelist;*/
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (incremental) {
|
||||||
for (i = 0; i <= ct->repository_level; i++) {
|
for (i = 0; i <= ct->repository_level; i++) {
|
||||||
if (ct->repository[i]) {
|
if (ct->repository[i]) {
|
||||||
/* currheadersourcelist = headersourcelist;
|
if (addToSourceHeaderList(headersourcelist, ct, mode, i)) {
|
||||||
while ((*currheadersourcelist) && (*currheadersourcelist)->next) {
|
|
||||||
currheadersourcelist = &((*currheadersourcelist)->next);
|
|
||||||
}*/
|
|
||||||
if (addToSourceHeaderList
|
|
||||||
(headersourcelist, ct, mode, i)) {
|
|
||||||
logmsg(LOG_ERROR,"Error scanning alternate SRPMs repository");
|
logmsg(LOG_ERROR,"Error scanning alternate SRPMs repository");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -762,11 +762,12 @@ generateSourceHeaderList(struct configTag *ct, int mode)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
/* if (addToSourceHeaderList(headersourcelist, ct, mode, i)) {
|
if (addToSourceHeaderList(headersourcelist, ct, mode, -1)) {
|
||||||
logmsg(LOG_ERROR,"Error scanning SRPMs repository");
|
logmsg(LOG_ERROR,"Error scanning alternate SRPMs repository");
|
||||||
return 1;
|
return 1;
|
||||||
}*/
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -928,7 +929,7 @@ addToHeaderList(struct configTag *ct,
|
|||||||
|
|
||||||
if (!newheaderlist->sourcename) {
|
if (!newheaderlist->sourcename) {
|
||||||
logmsg(LOG_WARNING,
|
logmsg(LOG_WARNING,
|
||||||
"sourcename undefined in RPM file %s, it looks like a source RPM; skipping package.",
|
"sourcename undefined in RPM file %s, it might be a source RPM with wrong filename; skipping package.",
|
||||||
filepath);
|
filepath);
|
||||||
newheaderlist->sourceheader = NULL;
|
newheaderlist->sourceheader = NULL;
|
||||||
(void) headerFree(h);
|
(void) headerFree(h);
|
||||||
@ -1092,7 +1093,7 @@ addToHeaderList(struct configTag *ct,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
generateHeaderList(struct configTag* ct, int arch)
|
generateHeaderList(struct configTag* ct, int arch, int incremental)
|
||||||
{
|
{
|
||||||
char scanpath[bufsize + 1], *altscanpath[ALT_REPS_MAX];
|
char scanpath[bufsize + 1], *altscanpath[ALT_REPS_MAX];
|
||||||
char *scantag, *altscantag[ALT_REPS_MAX];
|
char *scantag, *altscantag[ALT_REPS_MAX];
|
||||||
@ -1103,6 +1104,7 @@ generateHeaderList(struct configTag* ct, int arch)
|
|||||||
|
|
||||||
cleanProvidedListIndex(ct,arch);
|
cleanProvidedListIndex(ct,arch);
|
||||||
|
|
||||||
|
if (incremental) {
|
||||||
if (ct->repository[0]) {
|
if (ct->repository[0]) {
|
||||||
snprintf(scanpath,bufsize,"%sRPMS.%s/",ct->repository[0]->repository_dir,ct->arch[arch]);
|
snprintf(scanpath,bufsize,"%sRPMS.%s/",ct->repository[0]->repository_dir,ct->arch[arch]);
|
||||||
scantag = ct->repository[0]->tag;
|
scantag = ct->repository[0]->tag;
|
||||||
@ -1120,10 +1122,10 @@ generateHeaderList(struct configTag* ct, int arch)
|
|||||||
logmsg(LOG_ERROR,"repository[0] is not defined; aborting.");
|
logmsg(LOG_ERROR,"repository[0] is not defined; aborting.");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/* else {
|
} else {
|
||||||
snprintf(scanpath,bufsize,"%sRPMS.%s/",ct->repository_dir,ct->arch[arch]);
|
snprintf(scanpath,bufsize,"%sRPMS.%s/",ct->repository_dir,ct->arch[arch]);
|
||||||
scantag = ct->tag;
|
scantag = ct->tag;
|
||||||
}*/
|
}
|
||||||
if (addToHeaderList(ct, scanpath, scantag, (const char**)altscanpath, (const char**)altscantag, arch)) {
|
if (addToHeaderList(ct, scanpath, scantag, (const char**)altscanpath, (const char**)altscantag, arch)) {
|
||||||
logmsg(LOG_ERROR,"Error scanning RPMs repository");
|
logmsg(LOG_ERROR,"Error scanning RPMs repository");
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -180,11 +180,9 @@ cleanProvidedListIndex(struct configTag *ct, int arch);
|
|||||||
void
|
void
|
||||||
createProvidedListIndex(struct providedList* *idx, int arch);
|
createProvidedListIndex(struct providedList* *idx, int arch);
|
||||||
|
|
||||||
int generateHeaderList(
|
int generateHeaderList(struct configTag *ct, int arch, int incremental);
|
||||||
struct configTag *ct,
|
|
||||||
int arch);
|
|
||||||
|
|
||||||
int generateSourceHeaderList(struct configTag *ct, int mode);
|
int generateSourceHeaderList(struct configTag *ct, int mode, int incremental);
|
||||||
|
|
||||||
/*int generateSourceHeaderList(
|
/*int generateSourceHeaderList(
|
||||||
struct headerSourceList **headersourcelist,
|
struct headerSourceList **headersourcelist,
|
||||||
|
Loading…
Reference in New Issue
Block a user