Commit a447f2ba authored by Bernhard Link's avatar Bernhard Link

[refactor] do not pass control data to log.c

The options that needed that were never implemented anyway. So simplify
the code, making other refactors possible.
parent d38d163c
......@@ -1577,7 +1577,6 @@ retvalue changes_add(trackingdb const tracks, const struct atomlist *packagetype
assert (logger_isprepared(distribution->logger));
logger_logchanges(distribution->logger, distribution->codename,
changes->source, changes->changesversion,
changes->control,
changesfilename, changes->changesfilekey);
}
/* wait for notify scripts (including those for the packages)
......
......@@ -2268,7 +2268,7 @@ static retvalue candidate_really_add(struct incoming *i, struct candidate *c) {
} else if (d->byhandhookstocall == NULL)
continue;
logger_logchanges(into->logger, into->codename,
c->source, c->changesversion, c->control,
c->source, c->changesversion,
changesfile(c)->tempfilename, changesfilekey);
}
return RET_OK;
......
......@@ -672,7 +672,7 @@ static retvalue startchild(void) {
return RET_OK;
}
static retvalue notificator_enqueuechanges(struct notificator *n, const char *codename, const char *name, const char *version, const char *changeschunk, const char *safefilename, /*@null@*/const char *filekey) {
static retvalue notificator_enqueuechanges(struct notificator *n, const char *codename, const char *name, const char *version, const char *safefilename, /*@null@*/const char *filekey) {
size_t count, i, j;
char **arguments;
struct notification_process *p;
......@@ -744,16 +744,13 @@ static retvalue notificator_enqueuechanges(struct notificator *n, const char *co
p->datalen = 0;
p->datasent = 0;
p->data = NULL;
// TODO: implement --withcontrol
// until that changeschunk is not yet needed:
changeschunk = changeschunk;
if (runningchildren() < 1)
startchild();
return RET_OK;
}
static retvalue notificator_enqueue(struct notificator *n, struct target *target, const char *name, /*@null@*/const char *version, /*@null@*/const char *oldversion, /*@null@*/const char *control, /*@null@*/const char *oldcontrol, /*@null@*/const struct strlist *filekeys, /*@null@*/const struct strlist *oldfilekeys, bool renotification, /*@null@*/const char *causingrule, /*@null@*/ const char *suitefrom) {
static retvalue notificator_enqueue(struct notificator *n, struct target *target, const char *name, /*@null@*/const char *version, /*@null@*/const char *oldversion, /*@null@*/const struct strlist *filekeys, /*@null@*/const struct strlist *oldfilekeys, bool renotification, /*@null@*/const char *causingrule, /*@null@*/ const char *suitefrom) {
size_t count, i;
char **arguments;
const char *action = NULL;
......@@ -909,9 +906,6 @@ static retvalue notificator_enqueue(struct notificator *n, struct target *target
p->datalen = 0;
p->datasent = 0;
p->data = NULL;
// TODO: implement --withcontrol
// until that control is not yet needed:
control = control; oldcontrol = oldcontrol;
if (runningchildren() < 1)
startchild();
return RET_OK;
......@@ -1073,16 +1067,10 @@ bool logger_isprepared(/*@null@*/const struct logger *logger) {
return true;
}
void logger_log(struct logger *log, struct target *target, const char *name, const char *version, const char *oldversion, const char *control, const char *oldcontrol, const struct strlist *filekeys, const struct strlist *oldfilekeys, const char *causingrule, const char *suitefrom) {
void logger_log(struct logger *log, struct target *target, const char *name, const char *version, const char *oldversion, const struct strlist *filekeys, const struct strlist *oldfilekeys, const char *causingrule, const char *suitefrom) {
size_t i;
assert (name != NULL);
assert (control != NULL || oldcontrol != NULL);
assert (version != NULL || control == NULL);
/* so that a replacement can be detected by existence of oldversion */
if (oldcontrol != NULL && oldversion == NULL)
oldversion = "#unparseable#";
assert (version != NULL || oldversion != NULL);
......@@ -1091,13 +1079,12 @@ void logger_log(struct logger *log, struct target *target, const char *name, con
for (i = 0 ; i < log->notificator_count ; i++) {
notificator_enqueue(&log->notificators[i], target,
name, version, oldversion,
control, oldcontrol,
filekeys, oldfilekeys, false,
causingrule, suitefrom);
}
}
void logger_logchanges(struct logger *log, const char *codename, const char *name, const char *version, const char *data, const char *safefilename, const char *changesfilekey) {
void logger_logchanges(struct logger *log, const char *codename, const char *name, const char *version, const char *safefilename, const char *changesfilekey) {
size_t i;
assert (name != NULL);
......@@ -1108,7 +1095,7 @@ void logger_logchanges(struct logger *log, const char *codename, const char *nam
for (i = 0 ; i < log->notificator_count ; i++) {
notificator_enqueuechanges(&log->notificators[i], codename,
name, version, data, safefilename,
name, version, safefilename,
changesfilekey);
}
}
......@@ -1131,20 +1118,18 @@ bool logger_rerun_needs_target(const struct logger *logger, const struct target
return false;
}
retvalue logger_reruninfo(struct logger *logger, struct target *target, const char *name, const char *version, const char *control, /*@null@*/const struct strlist *filekeys) {
retvalue logger_reruninfo(struct logger *logger, struct target *target, const char *name, const char *version, /*@null@*/const struct strlist *filekeys) {
retvalue result, r;
size_t i;
assert (name != NULL);
assert (version != NULL);
assert (control != NULL);
result = RET_NOTHING;
for (i = 0 ; i < logger->notificator_count ; i++) {
r = notificator_enqueue(&logger->notificators[i], target,
name, version, NULL,
control, NULL,
filekeys, NULL, true,
NULL, NULL);
RET_UPDATE(result, r);
......
......@@ -17,12 +17,12 @@ void logger_free(/*@only@*/struct logger *);
retvalue logger_prepare(struct logger *logger);
bool logger_isprepared(/*@null@*/const struct logger *logger);
void logger_logchanges(struct logger *, const char * /*codename*/, const char * /*name*/, const char * /*version*/, const char * /*data*/, const char * /*safefilename*/, /*@null@*/const char * /*changesfilekey*/);
void logger_logchanges(struct logger *, const char * /*codename*/, const char * /*name*/, const char * /*version*/, const char * /*safefilename*/, /*@null@*/const char * /*changesfilekey*/);
void logger_log(struct logger *, struct target *, const char * /*name*/, /*@null@*/const char * /*version*/, /*@null@*/const char */*oldversion*/, /*@null@*/const char * /*control*/, /*@null@*/const char * /*oldcontrol*/, /*@null@*/const struct strlist * /*filekeys*/, /*@null@*/const struct strlist * /*oldfilekeys*/, /*@null@*/const char * /*causingrule*/, /*@null@*/const char * /*suitefrom*/);
void logger_log(struct logger *, struct target *, const char * /*name*/, /*@null@*/const char * /*version*/, /*@null@*/const char */*oldversion*/, /*@null@*/const struct strlist * /*filekeys*/, /*@null@*/const struct strlist * /*oldfilekeys*/, /*@null@*/const char * /*causingrule*/, /*@null@*/const char * /*suitefrom*/);
bool logger_rerun_needs_target(const struct logger *, const struct target *);
retvalue logger_reruninfo(struct logger *, struct target *, const char * /*name*/, const char * /*version*/, const char * /*control*/, /*@null@*/const struct strlist * /*filekeys*/);
retvalue logger_reruninfo(struct logger *, struct target *, const char * /*name*/, const char * /*version*/, /*@null@*/const struct strlist * /*filekeys*/);
/* wait for all jobs to finish */
void logger_wait(void);
......
......@@ -256,8 +256,10 @@ retvalue package_remove(struct package *old, struct logger *logger, struct track
old->target->staletracking = true;
if (logger != NULL)
logger_log(logger, old->target, old->name,
NULL, old->version,
NULL, old->control,
NULL,
(old->version == NULL)
? "#unparseable#"
: old->version,
NULL, &files,
NULL, NULL);
r = references_delete(old->target->identifier, &files, NULL);
......@@ -325,8 +327,10 @@ retvalue package_remove_by_cursor(struct package_cursor *tc, struct logger *logg
old->target->staletracking = true;
if (logger != NULL)
logger_log(logger, old->target, old->name,
NULL, old->version,
NULL, old->control,
NULL,
(old->version == NULL)
? "#unparseable"
: old->version,
NULL, &files,
NULL, NULL);
r = references_delete(old->target->identifier, &files, NULL);
......@@ -376,11 +380,13 @@ static retvalue addpackages(struct target *target, const char *packagename, cons
return result;
}
if (logger != NULL)
if (logger != NULL) {
if (oldversion == NULL && oldcontrolchunk != NULL)
oldversion = "#unparseable";
logger_log(logger, target, packagename,
version, oldversion,
controlchunk, oldcontrolchunk,
files, oldfiles, causingrule, suitefrom);
}
r = trackingdata_insert(trackingdata, filetype, files,
oldsource, oldsversion, oldfiles);
......@@ -913,7 +919,7 @@ retvalue package_rerunnotifiers(struct package *package, UNUSED(void *data)) {
return r;
}
r = logger_reruninfo(logger, target, package->name, package->version,
package->control, &filekeys);
&filekeys);
strlist_done(&filekeys);
return r;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment