Commit 17738cf4 authored by Bernhard Link's avatar Bernhard Link

make some directory variables global, and some related cleanups

parent 15a8a858
2008-06-22 Bernhard R. Link <brlink@debian.org>
* move some directoy variables to global variables,
some related cleanup in the code
2008-06-07 Bernhard R. Link <brlink@debian.org>
* remove some checks that fail for version 2 or 3 debian
source packages. (in reprepro include and changestool verify)
......
......@@ -258,7 +258,7 @@ retvalue aptmethod_newmethod(struct aptmethodrun *run, const char *uri, const ch
/**************************Fire up a method*****************************/
inline static retvalue aptmethod_startup(struct aptmethod *method, const char *methoddir) {
inline static retvalue aptmethod_startup(struct aptmethod *method) {
pid_t f;
int mstdin[2];
int mstdout[2];
......@@ -330,9 +330,8 @@ inline static retvalue aptmethod_startup(struct aptmethod *method, const char *m
}
closefrom(3);
methodname = calc_dirconcat(methoddir,method->name);
if( methodname == NULL )
methodname = calc_dirconcat(global.methoddir, method->name);
if( FAILEDTOALLOC(methodname) )
exit(255);
(void)execl(methodname, methodname, ENDOFARGUMENTS);
......@@ -1137,7 +1136,7 @@ static retvalue readwrite(struct aptmethodrun *run,/*@out@*/int *workleft,struct
return result;
}
retvalue aptmethod_download(struct aptmethodrun *run,const char *methoddir,struct database *database) {
retvalue aptmethod_download(struct aptmethodrun *run, struct database *database) {
struct aptmethod *method;
retvalue result,r;
int workleft;
......@@ -1146,7 +1145,7 @@ retvalue aptmethod_download(struct aptmethodrun *run,const char *methoddir,struc
/* fire up all methods, removing those that do not work: */
for( method = run->methods; method != NULL ; method = method->next ) {
r = aptmethod_startup(method, methoddir);
r = aptmethod_startup(method);
/* do not remove failed methods here any longer,
* and not remove methods having nothing to do,
* as this breaks when no index files are downloaded
......
......@@ -37,7 +37,7 @@ retvalue aptmethod_newmethod(struct aptmethodrun *, const char *uri, const char
retvalue aptmethod_queuefile(struct aptmethod *, const char *origfile, const char *destfile, const struct checksums *, const char *filekey, /*@out@*/struct tobedone **);
retvalue aptmethod_queueindexfile(struct aptmethod *, const char *origfile, const char *destfile, /*@null@*/struct checksums **);
retvalue aptmethod_download(struct aptmethodrun *run,const char *methoddir,struct database *);
retvalue aptmethod_shutdown(/*@only@*/struct aptmethodrun *run);
retvalue aptmethod_download(struct aptmethodrun *, struct database *);
retvalue aptmethod_shutdown(/*@only@*/struct aptmethodrun *);
#endif
......@@ -1015,7 +1015,7 @@ static retvalue copy(const char *destination, const char *source, const struct c
retvalue checksums_hardlink(const char *directory, const char *filekey, const char *sourcefilename, const struct checksums *checksums) {
retvalue r;
int i,e;
char *fullfilename = calc_fullfilename(directory, filekey);
char *fullfilename = calc_dirconcat(directory, filekey);
if( fullfilename == NULL )
return RET_ERROR_OOM;
......
......@@ -131,7 +131,7 @@ static inline retvalue finishchunk(configfinishfunction finishfunc, void *privda
return r;
}
retvalue configfile_parse(const char *confdir, const char *filename, bool ignoreunknown, configinitfunction initfunc, configfinishfunction finishfunc, const struct configfield *fields, size_t fieldcount, void *privdata) {
retvalue configfile_parse(const char *filename, bool ignoreunknown, configinitfunction initfunc, configfinishfunction finishfunc, const struct configfield *fields, size_t fieldcount, void *privdata) {
bool found[fieldcount];
void *last = NULL, *this = NULL;
char key[100];
......@@ -141,7 +141,7 @@ retvalue configfile_parse(const char *confdir, const char *filename, bool ignore
struct configiterator iter;
retvalue result, r;
iter.filename = calc_dirconcat(confdir, filename);
iter.filename = calc_conffile(filename);
if( iter.filename == NULL )
return RET_ERROR_OOM;
iter.line = 0;
......@@ -281,7 +281,7 @@ retvalue configfile_parse(const char *confdir, const char *filename, bool ignore
iter.eol = false;
if( i < fieldcount ) {
r = fields[i].setfunc(privdata, confdir, fields[i].name, this, &iter);
r = fields[i].setfunc(privdata, fields[i].name, this, &iter);
RET_UPDATE(result, r);
if( RET_WAS_ERROR(r) )
break;
......
This diff is collapsed.
......@@ -697,13 +697,13 @@ retvalue copy_from_file(struct database *database, struct distribution *into, co
return r;
}
static retvalue restore_from_snapshot(const char *distdir, struct database *database, struct distribution *into, const char *component, const char *architecture, const char *packagetype, const char *snapshotname, chunkaction action, void *d, struct strlist *dereferenced) {
static retvalue restore_from_snapshot(struct database *database, struct distribution *into, const char *component, const char *architecture, const char *packagetype, const char *snapshotname, chunkaction action, void *d, struct strlist *dereferenced) {
retvalue result, r;
struct copy_from_file_data data;
struct package_list list;
char *basedir;
basedir = calc_snapshotbasedir(distdir, into->codename, snapshotname);
basedir = calc_snapshotbasedir(into->codename, snapshotname);
if( FAILEDTOALLOC(basedir) )
return RET_ERROR_OOM;
......@@ -769,21 +769,21 @@ static retvalue restore_from_snapshot(const char *distdir, struct database *data
return r;
}
retvalue restore_by_name(const char *distdir, struct database *database, struct distribution *into, const char *component, const char *architecture, const char *packagetype, const char *snapshotname, int argc, const char **argv, struct strlist *dereferenced) {
retvalue restore_by_name(struct database *database, struct distribution *into, const char *component, const char *architecture, const char *packagetype, const char *snapshotname, int argc, const char **argv, struct strlist *dereferenced) {
struct namelist d = {argc, argv};
return restore_from_snapshot(distdir, database, into,
return restore_from_snapshot(database, into,
component, architecture, packagetype,
snapshotname, choose_by_name, &d, dereferenced);
}
retvalue restore_by_source(const char *distdir, struct database *database, struct distribution *into, const char *component, const char *architecture, const char *packagetype, const char *snapshotname, int argc, const char **argv, struct strlist *dereferenced) {
retvalue restore_by_source(struct database *database, struct distribution *into, const char *component, const char *architecture, const char *packagetype, const char *snapshotname, int argc, const char **argv, struct strlist *dereferenced) {
struct namelist d = {argc, argv};
return restore_from_snapshot(distdir, database, into,
return restore_from_snapshot(database, into,
component, architecture, packagetype,
snapshotname, choose_by_source, &d, dereferenced);
}
retvalue restore_by_formula(const char *distdir, struct database *database, struct distribution *into, const char *component, const char *architecture, const char *packagetype, const char *snapshotname, const char *filter, struct strlist *dereferenced) {
retvalue restore_by_formula(struct database *database, struct distribution *into, const char *component, const char *architecture, const char *packagetype, const char *snapshotname, const char *filter, struct strlist *dereferenced) {
term *condition;
retvalue r;
......@@ -792,7 +792,7 @@ retvalue restore_by_formula(const char *distdir, struct database *database, stru
if( !RET_IS_OK(r) ) {
return r;
}
r = restore_from_snapshot(distdir, database, into,
r = restore_from_snapshot(database, into,
component, architecture, packagetype,
snapshotname, choose_by_condition, condition,
dereferenced);
......
......@@ -11,8 +11,8 @@ retvalue copy_by_formula(struct database *, struct distribution *into, struct di
retvalue copy_from_file(struct database *, struct distribution *into, const char *component, const char *architecture, const char *packagetype, const char *filename, int, const char **, struct strlist *dereferenced);
retvalue restore_by_name(const char *distdir, struct database *, struct distribution *, /*@null@*/const char *component, /*@null@*/const char *architecture, /*@null@*/const char *packagetype, const char *snapshotname, int, const char **, struct strlist *dereferenced);
retvalue restore_by_source(const char *distdir, struct database *, struct distribution *, /*@null@*/const char *component, /*@null@*/const char *architecture, /*@null@*/const char *packagetype, const char *snapshotname, int, const char **, struct strlist *dereferenced);
retvalue restore_by_formula(const char *distdir, struct database *, struct distribution *, /*@null@*/const char *component, /*@null@*/const char *architecture, /*@null@*/const char *packagetype, const char *snapshotname, const char *filter, struct strlist *dereferenced);
retvalue restore_by_name(struct database *, struct distribution *, /*@null@*/const char *component, /*@null@*/const char *architecture, /*@null@*/const char *packagetype, const char *snapshotname, int, const char **, struct strlist *dereferenced);
retvalue restore_by_source(struct database *, struct distribution *, /*@null@*/const char *component, /*@null@*/const char *architecture, /*@null@*/const char *packagetype, const char *snapshotname, int, const char **, struct strlist *dereferenced);
retvalue restore_by_formula(struct database *, struct distribution *, /*@null@*/const char *component, /*@null@*/const char *architecture, /*@null@*/const char *packagetype, const char *snapshotname, const char *filter, struct strlist *dereferenced);
#endif
......@@ -169,7 +169,6 @@ static retvalue createtargets(struct distribution *distribution) {
}
struct read_distribution_data {
const char *logdir;
struct distribution *distributions;
};
......@@ -335,8 +334,8 @@ CFUSETPROC(distribution, Contents) {
return contentsoptions_parse(d, iter);
}
CFuSETPROC(distribution, logger) {
CFSETPROCVARS(distribution, d, mydata);
return logger_init(confdir, mydata->logdir, iter, &d->logger);
CFSETPROCVAR(distribution, d);
return logger_init(iter, &d->logger);
}
CFUSETPROC(distribution, Tracking) {
CFSETPROCVAR(distribution, d);
......@@ -374,11 +373,10 @@ static const struct configfield distributionconfigfields[] = {
};
/* read specification of all distributions */
retvalue distribution_readall(const char *confdir, const char *logdir, struct distribution **distributions) {
retvalue distribution_readall(struct distribution **distributions) {
struct read_distribution_data mydata;
retvalue result;
mydata.logdir = logdir;
mydata.distributions = NULL;
// TODO: readd some way to tell about -b or --confdir here?
......@@ -394,7 +392,7 @@ retvalue distribution_readall(const char *confdir, const char *logdir, struct di
}
*/
result = configfile_parse(confdir, "distributions",
result = configfile_parse("distributions",
IGNORABLE(unknownfield),
startparsedistribution, finishparsedistribution,
distributionconfigfields,
......@@ -408,7 +406,7 @@ retvalue distribution_readall(const char *confdir, const char *logdir, struct di
}
if( mydata.distributions == NULL ) {
fprintf(stderr, "No distribution definitions found in %s/distributions!\n",
confdir);
global.confdir);
distribution_freelist(mydata.distributions);
return RET_ERROR_MISSING;
}
......@@ -649,7 +647,7 @@ retvalue distribution_get(struct distribution *alldistributions, const char *nam
return RET_OK;
}
retvalue distribution_snapshot(struct distribution *distribution, const char *distdir, struct database *database, const char *name) {
retvalue distribution_snapshot(struct distribution *distribution, struct database *database, const char *name) {
struct target *target;
retvalue result,r;
struct release *release;
......@@ -657,7 +655,7 @@ retvalue distribution_snapshot(struct distribution *distribution, const char *di
assert( distribution != NULL );
r = release_initsnapshot(distdir,distribution->codename,name,&release);
r = release_initsnapshot(distribution->codename, name, &release);
if( RET_WAS_ERROR(r) )
return r;
......@@ -700,14 +698,14 @@ retvalue distribution_snapshot(struct distribution *distribution, const char *di
return result;
}
static retvalue export(struct distribution *distribution, const char *distdir, struct database *database, bool onlyneeded) {
static retvalue export(struct distribution *distribution, struct database *database, bool onlyneeded) {
struct target *target;
retvalue result,r;
struct release *release;
assert( distribution != NULL );
r = release_init(&release, database, distdir, distribution->codename);
r = release_init(&release, database, distribution->codename);
if( RET_WAS_ERROR(r) )
return r;
......@@ -764,8 +762,8 @@ static retvalue export(struct distribution *distribution, const char *distdir, s
return result;
}
retvalue distribution_fullexport(struct distribution *distribution, const char *distdir, struct database *database) {
return export(distribution, distdir, database, false);
retvalue distribution_fullexport(struct distribution *distribution, struct database *database) {
return export(distribution, database, false);
}
retvalue distribution_freelist(struct distribution *distributions) {
......@@ -781,7 +779,7 @@ retvalue distribution_freelist(struct distribution *distributions) {
return result;
}
retvalue distribution_exportlist(enum exportwhen when, struct distribution *distributions, const char *distdir, struct database *database) {
retvalue distribution_exportlist(enum exportwhen when, struct distribution *distributions, struct database *database) {
retvalue result,r;
bool todo = false;
struct distribution *d;
......@@ -837,7 +835,7 @@ retvalue distribution_exportlist(enum exportwhen when, struct distribution *dist
"Please report this and how you got this message as bugreport. Thanks.\n"
"Doing a export despite --export=changed....\n",
d->codename);
r = export(d, distdir, database, true);
r = export(d, database, true);
RET_UPDATE(result,r);
break;
}
......@@ -847,14 +845,14 @@ retvalue distribution_exportlist(enum exportwhen when, struct distribution *dist
( d->status == RET_NOTHING &&
when != EXPORT_CHANGED) ||
when == EXPORT_FORCE);
r = export(d, distdir, database, true);
r = export(d, database, true);
RET_UPDATE(result,r);
}
}
return result;
}
retvalue distribution_export(enum exportwhen when, struct distribution *distribution, const char *distdir, struct database *database) {
retvalue distribution_export(enum exportwhen when, struct distribution *distribution, struct database *database) {
if( when == EXPORT_NEVER ) {
if( verbose >= 10 )
fprintf(stderr,
......@@ -887,8 +885,7 @@ retvalue distribution_export(enum exportwhen when, struct distribution *distribu
"Please report this and how you got this message as bugreport. Thanks.\n"
"Doing a export despite --export=changed....\n",
distribution->codename);
return export(distribution, distdir,
database, true);
return export(distribution, database, true);
break;
}
}
......@@ -897,7 +894,7 @@ retvalue distribution_export(enum exportwhen when, struct distribution *distribu
}
if( verbose >= 0 )
printf("Exporting indices...\n");
return export(distribution, distdir, database, true);
return export(distribution, database, true);
}
/* get a pointer to the apropiate part of the linked list */
......@@ -936,25 +933,25 @@ struct distribution *distribution_find(struct distribution *distributions, const
return NULL;
}
retvalue distribution_loadalloverrides(struct distribution *distribution, const char *confdir, const char *overridedir) {
retvalue distribution_loadalloverrides(struct distribution *distribution) {
retvalue r;
if( distribution->overrides.deb == NULL ) {
r = override_read(confdir, overridedir, distribution->deb_override, &distribution->overrides.deb);
r = override_read(distribution->deb_override, &distribution->overrides.deb);
if( RET_WAS_ERROR(r) ) {
distribution->overrides.deb = NULL;
return r;
}
}
if( distribution->overrides.udeb == NULL ) {
r = override_read(confdir, overridedir, distribution->udeb_override, &distribution->overrides.udeb);
r = override_read(distribution->udeb_override, &distribution->overrides.udeb);
if( RET_WAS_ERROR(r) ) {
distribution->overrides.udeb = NULL;
return r;
}
}
if( distribution->overrides.dsc == NULL ) {
r = override_read(confdir, overridedir, distribution->dsc_override, &distribution->overrides.dsc);
r = override_read(distribution->dsc_override, &distribution->overrides.dsc);
if( RET_WAS_ERROR(r) ) {
distribution->overrides.dsc = NULL;
return r;
......@@ -968,12 +965,12 @@ retvalue distribution_loadalloverrides(struct distribution *distribution, const
return RET_NOTHING;
}
retvalue distribution_loaduploaders(struct distribution *distribution, const char *confdir) {
retvalue distribution_loaduploaders(struct distribution *distribution) {
if( distribution->uploaders != NULL ) {
if( distribution->uploaderslist != NULL )
return RET_OK;
return uploaders_get(&distribution->uploaderslist,
confdir, distribution->uploaders);
distribution->uploaders);
} else {
distribution->uploaderslist = NULL;
return RET_NOTHING;
......
......@@ -120,15 +120,15 @@ retvalue distribution_remove_packages(struct distribution *, struct database *,
/* like distribtion_getpart, but returns NULL if there is no such target */
/*@dependent@*/struct target *distribution_gettarget(const struct distribution *distribution,const char *component,const char *architecture,const char *packagetype);
retvalue distribution_fullexport(struct distribution *distribution, const char *distdir, struct database *);
retvalue distribution_fullexport(struct distribution *distribution, struct database *);
enum exportwhen {EXPORT_NEVER, EXPORT_CHANGED, EXPORT_NORMAL, EXPORT_FORCE };
retvalue distribution_export(enum exportwhen, struct distribution *, const char *distdir, struct database *);
retvalue distribution_export(enum exportwhen, struct distribution *, struct database *);
retvalue distribution_snapshot(struct distribution *distribution, const char *distdir, struct database *, const char *name);
retvalue distribution_snapshot(struct distribution *distribution, struct database *, const char *name);
/* read the configuration from all distributions */
retvalue distribution_readall(const char *confdir,const char *logdir,/*@out@*/struct distribution **distributions);
retvalue distribution_readall(/*@out@*/struct distribution **distributions);
/* mark all dists from <conf> fitting in the filter given in <argc,argv> */
retvalue distribution_match(struct distribution *alldistributions, int argc, const char *argv[], bool lookedat);
......@@ -137,12 +137,12 @@ retvalue distribution_match(struct distribution *alldistributions, int argc, con
struct distribution *distribution_find(struct distribution *distributions, const char *name);
retvalue distribution_freelist(/*@only@*/struct distribution *distributions);
retvalue distribution_exportandfreelist(enum exportwhen when, /*@only@*/struct distribution *distributions,const char *confdir, const char *distdir, struct database *);
retvalue distribution_exportlist(enum exportwhen when, /*@only@*/struct distribution *distributions, const char *distdir, struct database *);
retvalue distribution_exportandfreelist(enum exportwhen when, /*@only@*/struct distribution *distributions, struct database *);
retvalue distribution_exportlist(enum exportwhen when, /*@only@*/struct distribution *distributions, struct database *);
retvalue distribution_loadalloverrides(struct distribution *, const char *confdir, const char *overridedir);
retvalue distribution_loadalloverrides(struct distribution *);
void distribution_unloadoverrides(struct distribution *distribution);
retvalue distribution_loaduploaders(struct distribution *, const char *confdir);
retvalue distribution_loaduploaders(struct distribution *);
void distribution_unloaduploaders(struct distribution *distribution);
#endif
......@@ -111,7 +111,7 @@ retvalue exportmode_init(/*@out@*/struct exportmode *mode, bool uncompressed, /*
}
// TODO: check for scripts in confdir early...
retvalue exportmode_set(struct exportmode *mode, const char *confdir, struct configiterator *iter) {
retvalue exportmode_set(struct exportmode *mode, struct configiterator *iter) {
retvalue r;
char *word;
......@@ -193,9 +193,9 @@ retvalue exportmode_set(struct exportmode *mode, const char *confdir, struct con
free(mode->hook);
mode->hook = word;
} else {
char *fullfilename = calc_dirconcat(confdir, word);
char *fullfilename = calc_conffile(word);
free(word);
if( fullfilename == NULL )
if( FAILEDTOALLOC(fullfilename) )
return RET_ERROR_OOM;
free(mode->hook);
mode->hook = fullfilename;
......
......@@ -19,7 +19,7 @@ struct exportmode {
retvalue exportmode_init(/*@out@*/struct exportmode *mode, bool uncompressed, /*@null@*/const char *release, const char *indexfile);
struct configiterator;
retvalue exportmode_set(struct exportmode *mode, const char *confdir, struct configiterator *iter);
retvalue exportmode_set(struct exportmode *mode, struct configiterator *iter);
void exportmode_done(struct exportmode *mode);
retvalue export_target(const char *relativedir, struct target *, struct database *, const struct exportmode *, struct release *, bool onlyifmissing, bool snapshot);
......
......@@ -177,7 +177,7 @@ static inline retvalue filterlistfile_read(struct filterlistfile *n, const char
return r;
}
static inline retvalue filterlistfile_getl(const char *confdir, const char *filename, size_t len, struct filterlistfile **list) {
static inline retvalue filterlistfile_getl(const char *filename, size_t len, struct filterlistfile **list) {
struct filterlistfile *p;
retvalue r;
......@@ -200,7 +200,7 @@ static inline retvalue filterlistfile_getl(const char *confdir, const char *file
return RET_ERROR_OOM;
}
if( p->filename[0] != '/' ) {
char *fullfilename = calc_dirconcat(confdir, p->filename);
char *fullfilename = calc_conffile(p->filename);
if( fullfilename == NULL )
r = RET_ERROR_OOM;
else {
......@@ -222,7 +222,7 @@ static inline retvalue filterlistfile_getl(const char *confdir, const char *file
return r;
}
static inline retvalue filterlistfile_get(const char *confdir, /*@only@*/char *filename, /*@out@*/struct filterlistfile **list) {
static inline retvalue filterlistfile_get(/*@only@*/char *filename, /*@out@*/struct filterlistfile **list) {
struct filterlistfile *p;
retvalue r;
size_t len = strlen(filename);
......@@ -249,7 +249,7 @@ static inline retvalue filterlistfile_get(const char *confdir, /*@only@*/char *f
return RET_ERROR_OOM;
}
if( p->filename[0] != '/' ) {
char *fullfilename = calc_dirconcat(confdir, p->filename);
char *fullfilename = calc_conffile(p->filename);
if( fullfilename == NULL )
r = RET_ERROR_OOM;
else {
......@@ -295,7 +295,7 @@ static const struct constant filterlisttype_listtypes[] = {
{NULL, 0}
};
retvalue filterlist_load(struct filterlist *list, const char *confdir, struct configiterator *iter) {
retvalue filterlist_load(struct filterlist *list, struct configiterator *iter) {
enum filterlisttype defaulttype;
size_t count;
struct filterlistfile **files;
......@@ -328,7 +328,7 @@ retvalue filterlist_load(struct filterlist *list, const char *confdir, struct co
n[count] = NULL;
files = n;
// TODO: make filename only
r = filterlistfile_get(confdir, filename, &files[count]);
r = filterlistfile_get(filename, &files[count]);
if( RET_IS_OK(r) )
count++;
}
......
......@@ -21,7 +21,7 @@ struct filterlist {
};
struct configiterator;
retvalue filterlist_load(/*@out@*/struct filterlist *, const char *confdir, struct configiterator *);
retvalue filterlist_load(/*@out@*/struct filterlist *, struct configiterator *);
void filterlist_release(struct filterlist *list);
......
......@@ -63,4 +63,18 @@ enum config_option_owner { CONFIG_OWNER_DEFAULT=0,
#endif
/* for systems defining NULL to 0 instead of the nicer (void*)0 */
#define ENDOFARGUMENTS ((char *)0)
/* global information */
extern struct global_config {
const char *basedir;
const char *outdir;
const char *distdir;
const char *confdir;
const char *methoddir;
const char *logdir;
const char *listdir;
/* deprecated: */
const char *overridedir;
} global;
#endif
......@@ -160,7 +160,6 @@ struct read_incoming_data {
/*@temp@*/const char *name;
/*@temp@*/struct distribution *distributions;
struct incoming *i;
/*@temp@*/const char *basedir;
};
static retvalue translate(struct distribution *distributions, struct strlist *names, struct distribution ***r) {
......@@ -211,7 +210,7 @@ CFfinishparse(incoming) {
return RET_ERROR;
}
if( i->tempdir[0] != '/' ) {
char *n = calc_dirconcat(d->basedir, i->tempdir);
char *n = calc_dirconcat(global.basedir, i->tempdir);
if( n == NULL ) {
incoming_free(i);
return RET_ERROR_OOM;
......@@ -220,7 +219,7 @@ CFfinishparse(incoming) {
i->tempdir = n;
}
if( i->directory[0] != '/' ) {
char *n = calc_dirconcat(d->basedir, i->directory);
char *n = calc_dirconcat(global.basedir, i->directory);
if( n == NULL ) {
incoming_free(i);
return RET_ERROR_OOM;
......@@ -352,16 +351,15 @@ static const struct configfield incomingconfigfields[] = {
CF("Permit", incoming, permit)
};
static retvalue incoming_init(const char *basedir,const char *confdir, struct distribution *distributions, const char *name, /*@out@*/struct incoming **result) {
static retvalue incoming_init(struct distribution *distributions, const char *name, /*@out@*/struct incoming **result) {
retvalue r;
struct read_incoming_data imports;
imports.name = name;
imports.distributions = distributions;
imports.i = NULL;
imports.basedir = basedir;
r = configfile_parse(confdir, "incoming", IGNORABLE(unknownfield),
r = configfile_parse("incoming", IGNORABLE(unknownfield),
startparseincoming, finishparseincoming,
incomingconfigfields, ARRAYCOUNT(incomingconfigfields),
&imports);
......@@ -369,7 +367,7 @@ static retvalue incoming_init(const char *basedir,const char *confdir, struct di
return r;
if( imports.i == NULL ) {
fprintf(stderr, "No definition for '%s' found in '%s/incoming'!\n",
name, confdir);
name, global.confdir);
return RET_ERROR_MISSING;
}
......@@ -1533,7 +1531,7 @@ static inline bool isallowed(UNUSED(struct incoming *i), UNUSED(struct candidate
return permissions->allowall;
}
static retvalue candidate_checkpermissions(const char *confdir, struct incoming *i, struct candidate *c, struct distribution *into) {
static retvalue candidate_checkpermissions(struct incoming *i, struct candidate *c, struct distribution *into) {
retvalue r;
int j;
......@@ -1541,7 +1539,7 @@ static retvalue candidate_checkpermissions(const char *confdir, struct incoming
if( into->uploaders == NULL )
return RET_OK;
r = distribution_loaduploaders(into, confdir);
r = distribution_loaduploaders(into);
if( RET_WAS_ERROR(r) )
return r;
assert(into->uploaderslist != NULL);
......@@ -1638,7 +1636,7 @@ static retvalue check_architecture_availability(const struct incoming *i, const
return RET_OK;
}
static retvalue candidate_add(const char *confdir, const char *overridedir,struct database *database, struct strlist *dereferenced, struct incoming *i, struct candidate *c) {
static retvalue candidate_add(struct database *database, struct strlist *dereferenced, struct incoming *i, struct candidate *c) {
struct candidate_perdistribution *d;
struct candidate_file *file;
retvalue r;
......@@ -1652,7 +1650,7 @@ static retvalue candidate_add(const char *confdir, const char *overridedir,struc
return r;
for( d = c->perdistribution ; d != NULL ; d = d->next ) {
r = distribution_loadalloverrides(d->into, confdir, overridedir);
r = distribution_loadalloverrides(d->into);
if( RET_WAS_ERROR(r) )
return r;
}
......@@ -1745,7 +1743,7 @@ static retvalue candidate_add(const char *confdir, const char *overridedir,struc
return RET_OK;
}
static retvalue process_changes(const char *confdir,const char *overridedir,struct database *database,struct strlist *dereferenced,struct incoming *i,int ofs) {
static retvalue process_changes(struct database *database, struct strlist *dereferenced, struct incoming *i, int ofs) {
struct candidate *c IFSTUPIDCC(=NULL);
struct candidate_file *file;
retvalue r;
......@@ -1773,7 +1771,7 @@ static retvalue process_changes(const char *confdir,const char *overridedir,stru
// TODO: implement "*"
if( strcmp(name, i->allow.values[j]) == 0 ) {
tried = true;
r = candidate_checkpermissions(confdir, i, c,
r = candidate_checkpermissions(i, c,
i->allow_into[j]);
if( r == RET_NOTHING )
continue;
......@@ -1793,7 +1791,7 @@ static retvalue process_changes(const char *confdir,const char *overridedir,stru
}
if( c->perdistribution == NULL && i->default_into != NULL ) {
tried = true;
r = candidate_checkpermissions(confdir, i, c, i->default_into);
r = candidate_checkpermissions(i, c, i->default_into);
if( RET_WAS_ERROR(r) ) {
candidate_free(c);
return r;
......@@ -1824,7 +1822,7 @@ static retvalue process_changes(const char *confdir,const char *overridedir,stru
i->files.values[ofs]);
r = RET_ERROR;
} else
r = candidate_add(confdir, overridedir, database,
r = candidate_add(database,
dereferenced,
i, c);
if( RET_WAS_ERROR(r) && i->cleanup[cuf_on_error] ) {
......@@ -1842,14 +1840,14 @@ static retvalue process_changes(const char *confdir,const char *overridedir,stru
}
/* tempdir should ideally be on the same partition like the pooldir */
retvalue process_incoming(const char *basedir,const char *confdir,const char *overridedir,struct database *database,struct strlist *dereferenced,struct distribution *distributions,const char *name,const char *changesfilename) {
retvalue process_incoming(struct database *database, struct strlist *dereferenced, struct distribution *distributions, const char *name, const char *changesfilename) {
struct incoming *i;
retvalue result,r;
int j;
result = RET_NOTHING;
r = incoming_init(basedir, confdir, distributions, name, &i);
r = incoming_init(distributions, name, &i);
if( RET_WAS_ERROR(r) )
return r;
......@@ -1863,7 +1861,7 @@ retvalue process_incoming(const char *basedir,const char *confdir,const char *ov
if( changesfilename != NULL && strcmp(basename, changesfilename) != 0 )
continue;
/* a .changes file, check it */
r = process_changes(confdir, overridedir, database, dereferenced, i, j);
r = process_changes(database, dereferenced, i, j);
RET_UPDATE(result, r);
}
......
......@@ -6,5 +6,5 @@
#warning "What's hapening here?"
#endif
retvalue process_incoming(const char *basedir,const char *confdir,const char *overridedir, struct database *,struct strlist *dereferenced,struct distribution *distributions,const char *name,/*@null@*/const char *onlychangesfilename);
retvalue process_incoming(struct database *,struct strlist *dereferenced,struct distribution *distributions,const char *name,/*@null@*/const char *onlychangesfilename);
#endif
......@@ -51,10 +51,10 @@ const char *causingfile = NULL;
int fd;
} *logfile_root = NULL;
static retvalue logfile_reference(const char *logdir,/*@only@*/char *filename,/*@out@*/struct logfile **logfile) {
static retvalue logfile_reference(/*@only@*/char *filename, /*@out@*/struct logfile **logfile) {
struct logfile *l;
assert( logdir != NULL && filename != NULL );
assert( global.logdir != NULL && filename != NULL );
for( l = logfile_root ; l != NULL ; l = l->next ) {
if( strcmp(l->filename, filename) == 0 ) {
......@@ -72,7 +72,7 @@ static retvalue logfile_reference(const char *logdir,/*@only@*/char *filename,/*
if( filename[0] == '/' )
l->filename = filename;
else {
l->filename = calc_dirconcat(logdir,filename);
l->filename = calc_dirconcat(global.logdir, filename);
free(filename);
}
if( l->filename == NULL ) {
......@@ -215,7 +215,7 @@ static void notificator_done(/*@special@*/struct notificator *n) /*@releases n->
free(n->architecture);
}
static retvalue notificator_parse(struct notificator *n, const char *confdir, struct configiterator *iter) {
static retvalue notificator_parse(struct notificator *n, struct configiterator *iter) {
retvalue r;
int c;
......@@ -379,7 +379,7 @@ static retvalue notificator_parse(struct notificator *n, const char *confdir, st
if( script[0] == '/' )
n->scriptname = script;
else {
n->scriptname = calc_dirconcat(confdir, script);
n->scriptname = calc_conffile(script);
free(script);
}
if( n->scriptname == NULL )
......@@ -916,7 +916,7 @@ void logger_free(struct logger *logger) {
free(logger);
}
retvalue logger_init(const char *confdir,const char *logdir,struct configiterator *iter,struct logger **logger_p) {
retvalue logger_init(struct configiterator *iter, struct logger **logger_p) {
struct logger *n;
retvalue r;
char *logfilename;
......@@ -949,7 +949,7 @@ retvalue logger_init(const char *confdir,const char *logdir,struct configiterato
}
if( logfilename != NULL ) {