Commit 3f328c75 authored by Bernhard Link's avatar Bernhard Link

make database global, don't pass struct database around all the time

parent 745ff9ac
......@@ -325,7 +325,7 @@ static retvalue save_package_version(struct floodlist *list, const char *package
return RET_OK;
}
static retvalue floodlist_initialize(struct floodlist **fl, struct target *t, struct database *database) {
static retvalue floodlist_initialize(struct floodlist **fl, struct target *t) {
struct floodlist *list;
retvalue r, r2;
const char *packagename, *controlchunk;
......@@ -339,7 +339,7 @@ static retvalue floodlist_initialize(struct floodlist **fl, struct target *t, st
/* Begin with the packages currently in the archive */
r = target_openiterator(t, database, READONLY, &iterator);
r = target_openiterator(t, READONLY, &iterator);
if (RET_WAS_ERROR(r)) {
floodlist_free(list);
return r;
......@@ -569,13 +569,13 @@ static retvalue floodlist_trypackage(struct floodlist *list, const char *package
return RET_OK;
}
static retvalue floodlist_pull(struct floodlist *list, struct target *source, struct database *database) {
static retvalue floodlist_pull(struct floodlist *list, struct target *source) {
retvalue result, r;
const char *package, *control;
struct target_cursor iterator;
list->last = NULL;
r = target_openiterator(source, database, READONLY, &iterator);
r = target_openiterator(source, READONLY, &iterator);
if (RET_WAS_ERROR(r))
return r;
result = RET_NOTHING;
......@@ -615,21 +615,20 @@ static retvalue floodlist_pull(struct floodlist *list, struct target *source, st
return result;
}
static retvalue floodlist_install(struct floodlist *list, struct logger *logger, struct database *database, /*@NULL@*/struct trackingdata *td) {
static retvalue floodlist_install(struct floodlist *list, struct logger *logger, /*@NULL@*/struct trackingdata *td) {
struct aa_package_data *pkg;
retvalue result, r;
if (list->list == NULL)
return RET_NOTHING;
result = target_initpackagesdb(list->target, database, READWRITE);
result = target_initpackagesdb(list->target, READWRITE);
if (RET_WAS_ERROR(result))
return result;
result = RET_NOTHING;
for (pkg = list->list ; pkg != NULL ; pkg = pkg->next) {
if (pkg->new_version != NULL) {
r = files_expectfiles(database,
&pkg->new_filekeys,
r = files_expectfiles(&pkg->new_filekeys,
pkg->new_origfiles.checksums);
RET_UPDATE(result, r);
if (RET_WAS_ERROR(r))
......@@ -667,8 +666,7 @@ static retvalue floodlist_install(struct floodlist *list, struct logger *logger,
}
}
r = target_addpackage(list->target,
logger, database,
pkg->name, pkg->new_version,
logger, pkg->name, pkg->new_version,
pkg->new_control, &pkg->new_filekeys,
false, td, architecture_all,
NULL, NULL);
......@@ -682,7 +680,7 @@ static retvalue floodlist_install(struct floodlist *list, struct logger *logger,
return result;
}
retvalue flood(struct distribution *d, const struct atomlist *components, const struct atomlist *architectures, const struct atomlist *packagetypes, architecture_t architecture, struct database *database, trackingdb tracks) {
retvalue flood(struct distribution *d, const struct atomlist *components, const struct atomlist *architectures, const struct atomlist *packagetypes, architecture_t architecture, trackingdb tracks) {
struct target *t, *s;
retvalue result = RET_NOTHING, r;
struct trackingdata trackingdata;
......@@ -709,7 +707,7 @@ retvalue flood(struct distribution *d, const struct atomlist *components, const
if (t->packagetype != pt_deb && t->packagetype != pt_udeb)
continue;
r = floodlist_initialize(&fl, t, database);
r = floodlist_initialize(&fl, t);
if (RET_WAS_ERROR(r)) {
if (tracks != NULL)
trackingdata_done(&trackingdata);
......@@ -727,7 +725,7 @@ retvalue flood(struct distribution *d, const struct atomlist *components, const
if (limitations_missed(architectures,
s->architecture))
continue;
r = floodlist_pull(fl, s, database);
r = floodlist_pull(fl, s);
RET_UPDATE(d->status, r);
if (RET_WAS_ERROR(r)) {
if (tracks != NULL)
......@@ -736,7 +734,7 @@ retvalue flood(struct distribution *d, const struct atomlist *components, const
return r;
}
}
r = floodlist_install(fl, d->logger, database,
r = floodlist_install(fl, d->logger,
(tracks != NULL)?&trackingdata:NULL);
RET_UPDATE(result, r);
floodlist_free(fl);
......@@ -747,7 +745,7 @@ retvalue flood(struct distribution *d, const struct atomlist *components, const
}
}
if (tracks != NULL) {
r = trackingdata_finish(tracks, &trackingdata, database);
r = trackingdata_finish(tracks, &trackingdata);
RET_ENDUPDATE(result, r);
}
return result;
......
#ifndef REPREPRO_ARCHALLFLOOD_H
#define REPREPRO_ARCHALLFLOOD_H
retvalue flood(struct distribution *, /*@null@*/const struct atomlist * /*components*/, /*@NULL@*/const struct atomlist * /*architectures*/, /*@NULL@*/const struct atomlist * /*packagetypes*/, architecture_t, struct database *, trackingdb);
retvalue flood(struct distribution *, /*@null@*/const struct atomlist * /*components*/, /*@NULL@*/const struct atomlist * /*architectures*/, /*@NULL@*/const struct atomlist * /*packagetypes*/, architecture_t, trackingdb);
#endif
......@@ -326,7 +326,7 @@ retvalue ubinaries_doreoverride(const struct target *target, const char *package
return RET_OK;
}
retvalue binaries_retrack(const char *packagename, const char *chunk, trackingdb tracks, struct database *database) {
retvalue binaries_retrack(const char *packagename, const char *chunk, trackingdb tracks) {
retvalue r;
const char *sourcename;
char *fsourcename, *sourceversion, *arch, *filekey;
......@@ -404,8 +404,7 @@ retvalue binaries_retrack(const char *packagename, const char *chunk, trackingdb
return r;
}
assert (r != RET_NOTHING);
r = trackedpackage_addfilekey(tracks, pkg, filetype, filekey, true,
database);
r = trackedpackage_addfilekey(tracks, pkg, filetype, filekey, true);
if (RET_WAS_ERROR(r)) {
trackedpackage_free(pkg);
return r;
......@@ -634,7 +633,7 @@ retvalue binaries_complete_checksums(const char *chunk, const struct strlist *fi
return RET_OK;
}
retvalue binaries_adddeb(const struct deb_headers *deb, struct database *database, const struct atomlist *forcearchitectures, packagetype_t packagetype, struct distribution *distribution, struct trackingdata *trackingdata, component_t component, const struct strlist *filekeys, const char *control) {
retvalue binaries_adddeb(const struct deb_headers *deb, const struct atomlist *forcearchitectures, packagetype_t packagetype, struct distribution *distribution, struct trackingdata *trackingdata, component_t component, const struct strlist *filekeys, const char *control) {
retvalue r, result;
int i;
......@@ -648,14 +647,13 @@ retvalue binaries_adddeb(const struct deb_headers *deb, struct database *databas
struct target *t = distribution_getpart(distribution,
component, deb->architecture,
packagetype);
r = target_initpackagesdb(t, database, READWRITE);
r = target_initpackagesdb(t, READWRITE);
if (!RET_WAS_ERROR(r)) {
retvalue r2;
if (interrupted())
r = RET_ERROR_INTERRUPTED;
else
r = target_addpackage(t, distribution->logger,
database,
deb->name, deb->version,
control,
filekeys,
......@@ -691,14 +689,13 @@ retvalue binaries_adddeb(const struct deb_headers *deb, struct database *databas
continue;
t = distribution_getpart(distribution,
component, a, packagetype);
r = target_initpackagesdb(t, database, READWRITE);
r = target_initpackagesdb(t, READWRITE);
if (!RET_WAS_ERROR(r)) {
retvalue r2;
if (interrupted())
r = RET_ERROR_INTERRUPTED;
else
r = target_addpackage(t, distribution->logger,
database,
deb->name, deb->version,
control,
filekeys,
......@@ -715,14 +712,14 @@ retvalue binaries_adddeb(const struct deb_headers *deb, struct database *databas
return result;
}
static inline retvalue checkadddeb(struct database *database, struct distribution *distribution, component_t component, architecture_t architecture, packagetype_t packagetype, bool tracking, const struct deb_headers *deb, bool permitnewerold) {
static inline retvalue checkadddeb(struct distribution *distribution, component_t component, architecture_t architecture, packagetype_t packagetype, bool tracking, const struct deb_headers *deb, bool permitnewerold) {
retvalue r;
struct target *t;
t = distribution_getpart(distribution,
component, architecture, packagetype);
assert (t != NULL);
r = target_initpackagesdb(t, database, READONLY);
r = target_initpackagesdb(t, READONLY);
if (!RET_WAS_ERROR(r)) {
retvalue r2;
if (interrupted())
......@@ -738,7 +735,7 @@ static inline retvalue checkadddeb(struct database *database, struct distributio
return r;
}
retvalue binaries_checkadddeb(const struct deb_headers *deb, struct database *database, architecture_t forcearchitecture, packagetype_t packagetype, struct distribution *distribution, bool tracking, component_t component, bool permitnewerold) {
retvalue binaries_checkadddeb(const struct deb_headers *deb, architecture_t forcearchitecture, packagetype_t packagetype, struct distribution *distribution, bool tracking, component_t component, bool permitnewerold) {
retvalue r, result;
int i;
......@@ -746,26 +743,23 @@ retvalue binaries_checkadddeb(const struct deb_headers *deb, struct database *da
result = RET_NOTHING;
if (deb->architecture != architecture_all) {
r = checkadddeb(database, distribution,
r = checkadddeb(distribution,
component, deb->architecture, packagetype,
tracking, deb,
permitnewerold);
tracking, deb, permitnewerold);
RET_UPDATE(result, r);
} else if (atom_defined(forcearchitecture)
&& forcearchitecture != architecture_all) {
r = checkadddeb(database, distribution,
r = checkadddeb(distribution,
component, forcearchitecture, packagetype,
tracking, deb,
permitnewerold);
tracking, deb, permitnewerold);
RET_UPDATE(result, r);
} else for (i = 0 ; i < distribution->architectures.count ; i++) {
architecture_t a = distribution->architectures.atoms[i];
if (a == architecture_source)
continue;
r = checkadddeb(database, distribution,
r = checkadddeb(distribution,
component, a, packagetype,
tracking, deb,
permitnewerold);
tracking, deb, permitnewerold);
RET_UPDATE(result, r);
}
return result;
......
......@@ -52,6 +52,6 @@ retvalue binaries_calcfilekeys(component_t, const struct deb_headers *, packaget
struct overridedata;
retvalue binaries_complete(const struct deb_headers *, const char * /*filekey*/, const struct checksums *, const struct overridedata *, const char * /*section*/, const char * /*priority*/, char **/*newcontrol_p*/);
retvalue binaries_adddeb(const struct deb_headers *, struct database *, const struct atomlist */*forcedarchitectures*/, packagetype_t, struct distribution *, /*@null@*/struct trackingdata *, component_t, const struct strlist */*filekeys*/, const char */*control*/);
retvalue binaries_checkadddeb(const struct deb_headers *, struct database *, architecture_t /*forcearchitecture*/, packagetype_t, struct distribution *, bool tracking, component_t, bool /*permitnewerold*/);
retvalue binaries_adddeb(const struct deb_headers *, const struct atomlist */*forcedarchitectures*/, packagetype_t, struct distribution *, /*@null@*/struct trackingdata *, component_t, const struct strlist */*filekeys*/, const char */*control*/);
retvalue binaries_checkadddeb(const struct deb_headers *, architecture_t /*forcearchitecture*/, packagetype_t, struct distribution *, bool tracking, component_t, bool /*permitnewerold*/);
#endif
......@@ -878,7 +878,7 @@ static retvalue changes_check(const struct distribution *distribution, const cha
return r;
}
static retvalue changes_checkfiles(struct database *database, const char *filename, struct changes *changes) {
static retvalue changes_checkfiles(const char *filename, struct changes *changes) {
struct fileentry *e;
retvalue r;
......@@ -916,7 +916,7 @@ static retvalue changes_checkfiles(struct database *database, const char *filena
if (FAILEDTOALLOC(e->filekey))
return RET_ERROR_OOM;
/* do not copy yet, but only check if it could be included */
r = files_canadd(database, e->filekey, e->checksums);
r = files_canadd(e->filekey, e->checksums);
if (RET_WAS_ERROR(r))
return r;
/* If is was already there, remember that */
......@@ -947,7 +947,7 @@ static retvalue changes_checkfiles(struct database *database, const char *filena
return RET_OK;
}
static retvalue changes_includefiles(struct database *database, struct changes *changes) {
static retvalue changes_includefiles(struct changes *changes) {
struct fileentry *e;
retvalue r;
......@@ -959,9 +959,8 @@ static retvalue changes_includefiles(struct database *database, struct changes *
if (e->wasalreadythere && checksums_iscomplete(e->checksums))
continue;
r = files_checkincludefile(database,
changes->incomingdirectory, e->basename,
e->filekey, &e->checksums);
r = files_checkincludefile(changes->incomingdirectory,
e->basename, e->filekey, &e->checksums);
if (RET_WAS_ERROR(r))
return r;
}
......@@ -1003,10 +1002,10 @@ static retvalue changes_deleteleftoverfiles(struct changes *changes, int delete)
return result;
}
static retvalue changes_check_sourcefile(struct changes *changes, struct fileentry *dsc, struct database *database, const char *basefilename, const char *filekey, struct checksums **checksums_p) {
static retvalue changes_check_sourcefile(struct changes *changes, struct fileentry *dsc, const char *basefilename, const char *filekey, struct checksums **checksums_p) {
retvalue r;
r = files_expect(database, filekey, *checksums_p, false);
r = files_expect(filekey, *checksums_p, false);
if (RET_WAS_ERROR(r))
return r;
// TODO: get additionals checksum out of database, as future
......@@ -1026,11 +1025,11 @@ static retvalue changes_check_sourcefile(struct changes *changes, struct fileent
"Perhaps you forgot to give dpkg-buildpackage the -sa option.\n"
"--ignore=missingfile was given, searching for file...\n", filekey);
return files_checkincludefile(database, changes->incomingdirectory,
return files_checkincludefile(changes->incomingdirectory,
basefilename, filekey, checksums_p);
}
static retvalue dsc_prepare(struct changes *changes, struct fileentry *dsc, struct database *database, struct distribution *distribution, const char *dscfilename){
static retvalue dsc_prepare(struct changes *changes, struct fileentry *dsc, struct distribution *distribution, const char *dscfilename){
retvalue r;
const struct overridedata *oinfo;
char *dscbasename;
......@@ -1124,7 +1123,7 @@ static retvalue dsc_prepare(struct changes *changes, struct fileentry *dsc, stru
for (i = 1 ; i < dsc->pkg.dsc.files.names.count ; i ++) {
if (!RET_WAS_ERROR(r)) {
r = changes_check_sourcefile(
changes, dsc, database,
changes, dsc,
dsc->pkg.dsc.files.names.values[i],
dsc->needed_filekeys.values[i],
&dsc->pkg.dsc.files.checksums[i]);
......@@ -1144,7 +1143,7 @@ static retvalue dsc_prepare(struct changes *changes, struct fileentry *dsc, stru
}
static retvalue changes_checkpkgs(struct database *database, struct distribution *distribution, struct changes *changes) {
static retvalue changes_checkpkgs(struct distribution *distribution, struct changes *changes) {
struct fileentry *e;
retvalue r;
......@@ -1188,7 +1187,7 @@ static retvalue changes_checkpkgs(struct database *database, struct distribution
assert (atom_defined(changes->srccomponent));
assert (changes->srcdirectory!=NULL);
r = dsc_prepare(changes, e, database,
r = dsc_prepare(changes, e,
distribution, fullfilename);
} else
r = RET_ERROR;
......@@ -1203,7 +1202,7 @@ static retvalue changes_checkpkgs(struct database *database, struct distribution
return r;
}
static retvalue changes_includepkgs(struct database *database, struct distribution *distribution, struct changes *changes, /*@null@*/struct trackingdata *trackingdata, const struct atomlist *forcearchitectures, bool *missed_p) {
static retvalue changes_includepkgs(struct distribution *distribution, struct changes *changes, /*@null@*/struct trackingdata *trackingdata, const struct atomlist *forcearchitectures, bool *missed_p) {
struct fileentry *e;
retvalue result, r;
......@@ -1225,7 +1224,7 @@ static retvalue changes_includepkgs(struct database *database, struct distributi
if (interrupted())
return RET_ERROR_INTERRUPTED;
if (e->type == fe_DEB) {
r = deb_addprepared(e->pkg.deb, database,
r = deb_addprepared(e->pkg.deb,
/* architecture all needs this, the rest is
* already filtered out */
(e->architecture_into == architecture_all)?
......@@ -1234,7 +1233,7 @@ static retvalue changes_includepkgs(struct database *database, struct distributi
if (r == RET_NOTHING)
*missed_p = true;
} else if (e->type == fe_UDEB) {
r = deb_addprepared(e->pkg.deb, database,
r = deb_addprepared(e->pkg.deb,
/* architecture all needs this, the rest is
* already filtered out */
(e->architecture_into == architecture_all)?
......@@ -1243,7 +1242,7 @@ static retvalue changes_includepkgs(struct database *database, struct distributi
if (r == RET_NOTHING)
*missed_p = true;
} else if (e->type == fe_DSC) {
r = dsc_addprepared(database, &e->pkg.dsc,
r = dsc_addprepared(&e->pkg.dsc,
changes->srccomponent,
&e->needed_filekeys,
distribution, trackingdata);
......@@ -1252,14 +1251,12 @@ static retvalue changes_includepkgs(struct database *database, struct distributi
} else if (e->type == fe_LOG && trackingdata != NULL) {
r = trackedpackage_addfilekey(trackingdata->tracks,
trackingdata->pkg,
ft_LOG, e->filekey, false,
database);
ft_LOG, e->filekey, false);
e->filekey = NULL;
} else if (e->type == fe_BYHAND && trackingdata != NULL) {
r = trackedpackage_addfilekey(trackingdata->tracks,
trackingdata->pkg,
ft_XTRA_DATA, e->filekey, false,
database);
ft_XTRA_DATA, e->filekey, false);
e->filekey = NULL;
}
RET_UPDATE(result, r);
......@@ -1356,7 +1353,7 @@ static bool permissionssuffice(struct changes *changes, const struct distributio
/* insert the given .changes into the mirror in the <distribution>
* if forcecomponent, forcesection or forcepriority is NULL
* get it from the files or try to guess it. */
retvalue changes_add(struct database *database, trackingdb const tracks, const struct atomlist *packagetypes, component_t forcecomponent, const struct atomlist *forcearchitectures, const char *forcesection, const char *forcepriority, struct distribution *distribution, const char *changesfilename, int delete) {
retvalue changes_add(trackingdb const tracks, const struct atomlist *packagetypes, component_t forcecomponent, const struct atomlist *forcearchitectures, const char *forcesection, const char *forcepriority, struct distribution *distribution, const char *changesfilename, int delete) {
retvalue result, r;
struct changes *changes;
struct trackingdata trackingdata;
......@@ -1420,17 +1417,17 @@ retvalue changes_add(struct database *database, trackingdb const tracks, const s
RET_UPDATE(r, RET_ERROR_INTERRUPTED);
if (!RET_WAS_ERROR(r))
r = changes_checkfiles(database, changesfilename, changes);
r = changes_checkfiles(changesfilename, changes);
if (interrupted())
RET_UPDATE(r, RET_ERROR_INTERRUPTED);
/* add files in the pool */
if (!RET_WAS_ERROR(r))
r = changes_includefiles(database, changes);
r = changes_includefiles(changes);
if (!RET_WAS_ERROR(r))
r = changes_checkpkgs(database, distribution, changes);
r = changes_checkpkgs(distribution, changes);
if (RET_WAS_ERROR(r)) {
changes_free(changes);
......@@ -1463,8 +1460,7 @@ retvalue changes_add(struct database *database, trackingdb const tracks, const s
if (interrupted())
r = RET_ERROR_INTERRUPTED;
else
r = files_preinclude(database,
changesfilename,
r = files_preinclude(changesfilename,
changes->changesfilekey,
NULL);
if (RET_WAS_ERROR(r)) {
......@@ -1482,7 +1478,7 @@ retvalue changes_add(struct database *database, trackingdb const tracks, const s
}
/* add the source and binary packages in the given distribution */
result = changes_includepkgs(database, distribution, changes,
result = changes_includepkgs(distribution, changes,
(tracks!=NULL)?&trackingdata:NULL, forcearchitectures,
&somethingwasmissed);
......@@ -1505,11 +1501,10 @@ retvalue changes_add(struct database *database, trackingdb const tracks, const s
}
r = trackedpackage_addfilekey(tracks, trackingdata.pkg,
ft_CHANGES, changesfilekey, false,
database);
ft_CHANGES, changesfilekey, false);
RET_ENDUPDATE(result, r);
}
r = trackingdata_finish(tracks, &trackingdata, database);
r = trackingdata_finish(tracks, &trackingdata);
RET_ENDUPDATE(result, r);
if (RET_WAS_ERROR(result)) {
changes_free(changes);
......
......@@ -20,7 +20,7 @@
* get it from the files or try to guess it.
* if dereferencedfilekeys is != NULL, add filekeys that lost reference,
* if tracks != NULL, update/add tracking information there... */
retvalue changes_add(struct database *, /*@null@*/trackingdb, const struct atomlist * /*packagetypes*/, component_t, const struct atomlist * /*forcearchitecture*/, /*@null@*/const char * /*forcesection*/, /*@null@*/const char * /*forcepriority*/, struct distribution *, const char * /*changesfilename*/, int /*delete*/);
retvalue changes_add(/*@null@*/trackingdb, const struct atomlist * /*packagetypes*/, component_t, const struct atomlist * /*forcearchitecture*/, /*@null@*/const char * /*forcesection*/, /*@null@*/const char * /*forcepriority*/, struct distribution *, const char * /*changesfilename*/, int /*delete*/);
#endif
......@@ -295,8 +295,8 @@ retvalue deb_prepare(/*@out@*/struct debpackage **deb, component_t forcecomponen
return RET_OK;
}
retvalue deb_addprepared(const struct debpackage *pkg, struct database *database, const struct atomlist *forcearchitectures, packagetype_t packagetype, struct distribution *distribution, struct trackingdata *trackingdata) {
return binaries_adddeb(&pkg->deb, database, forcearchitectures,
retvalue deb_addprepared(const struct debpackage *pkg, const struct atomlist *forcearchitectures, packagetype_t packagetype, struct distribution *distribution, struct trackingdata *trackingdata) {
return binaries_adddeb(&pkg->deb, forcearchitectures,
packagetype, distribution, trackingdata,
pkg->component, &pkg->filekeys,
pkg->deb.control);
......@@ -306,7 +306,7 @@ retvalue deb_addprepared(const struct debpackage *pkg, struct database *database
* putting things with architecture of "all" into <d->architectures> (and also
* causing error, if it is not one of them otherwise)
* if component is NULL, guessing it from the section. */
retvalue deb_add(struct database *database, component_t forcecomponent, const struct atomlist *forcearchitectures, const char *forcesection, const char *forcepriority, packagetype_t packagetype, struct distribution *distribution, const char *debfilename, int delete, /*@null@*/trackingdb tracks) {
retvalue deb_add(component_t forcecomponent, const struct atomlist *forcearchitectures, const char *forcesection, const char *forcepriority, packagetype_t packagetype, struct distribution *distribution, const char *debfilename, int delete, /*@null@*/trackingdb tracks) {
struct debpackage *pkg;
retvalue r;
struct trackingdata trackingdata;
......@@ -327,7 +327,7 @@ retvalue deb_add(struct database *database, component_t forcecomponent, const st
deb_free(pkg);
return r;
}
r = files_preinclude(database, debfilename, pkg->filekey, &checksums);
r = files_preinclude(debfilename, pkg->filekey, &checksums);
if (RET_WAS_ERROR(r)) {
deb_free(pkg);
return r;
......@@ -353,7 +353,7 @@ retvalue deb_add(struct database *database, component_t forcecomponent, const st
}
}
r = binaries_adddeb(&pkg->deb, database, forcearchitectures,
r = binaries_adddeb(&pkg->deb, forcearchitectures,
packagetype, distribution,
(tracks!=NULL)?&trackingdata:NULL,
pkg->component, &pkg->filekeys,
......@@ -363,7 +363,7 @@ retvalue deb_add(struct database *database, component_t forcecomponent, const st
if (tracks != NULL) {
retvalue r2;
r2 = trackingdata_finish(tracks, &trackingdata, database);
r2 = trackingdata_finish(tracks, &trackingdata);
RET_ENDUPDATE(r, r2);
}
......
......@@ -18,11 +18,11 @@
* if overwrite is not NULL, it will be search for fields to reset for this
* package. (forcesection and forcepriority have higher priority than the
* information there), */
retvalue deb_add(struct database *, component_t, const struct atomlist * /*forcearchitectures*/, /*@null@*/const char * /*forcesection*/, /*@null@*/const char * /*forcepriority*/, packagetype_t, struct distribution *, const char * /*debfilename*/, int /*delete*/, /*@null@*/trackingdb);
retvalue deb_add(component_t, const struct atomlist * /*forcearchitectures*/, /*@null@*/const char * /*forcesection*/, /*@null@*/const char * /*forcepriority*/, packagetype_t, struct distribution *, const char * /*debfilename*/, int /*delete*/, /*@null@*/trackingdb);
/* in two steps */
struct debpackage;
retvalue deb_addprepared(const struct debpackage *, struct database *, const struct atomlist * /*forcearchitectures*/, packagetype_t, struct distribution *, struct trackingdata *);
retvalue deb_addprepared(const struct debpackage *, const struct atomlist * /*forcearchitectures*/, packagetype_t, struct distribution *, struct trackingdata *);
retvalue deb_prepare(/*@out@*/struct debpackage **, component_t, architecture_t /*forcearchitectures*/, const char * /*forcesection*/, const char * /*forcepriority*/, packagetype_t, struct distribution *, const char * /*debfilename*/, const char * const /*filekey*/, const struct checksums *, const struct strlist * /*allowed_binaries*/, const char * /*expectedsourcename*/, const char * /*expectedsourceversion*/);
void deb_free(/*@only@*/struct debpackage *);
#endif
......@@ -129,7 +129,7 @@ static retvalue dsc_read(/*@out@*/struct dscpackage **pkg, const char *filename)
return RET_OK;
}
retvalue dsc_addprepared(struct database *database, const struct dsc_headers *dsc, component_t component, const struct strlist *filekeys, struct distribution *distribution, struct trackingdata *trackingdata){
retvalue dsc_addprepared(const struct dsc_headers *dsc, component_t component, const struct strlist *filekeys, struct distribution *distribution, struct trackingdata *trackingdata){
retvalue r;
struct target *t = distribution_getpart(distribution,
component, architecture_source, pt_dsc);
......@@ -137,13 +137,13 @@ retvalue dsc_addprepared(struct database *database, const struct dsc_headers *ds
assert (logger_isprepared(distribution->logger));
/* finally put it into the source distribution */
r = target_initpackagesdb(t, database, READWRITE);
r = target_initpackagesdb(t, READWRITE);
if (!RET_WAS_ERROR(r)) {
retvalue r2;
if (interrupted())
r = RET_ERROR_INTERRUPTED;
else
r = target_addpackage(t, distribution->logger, database,
r = target_addpackage(t, distribution->logger,
dsc->name, dsc->version,
dsc->control, filekeys,
false, trackingdata,
......@@ -161,7 +161,7 @@ retvalue dsc_addprepared(struct database *database, const struct dsc_headers *ds
* If basename, filekey and directory are != NULL, then they are used instead
* of being newly calculated.
* (And all files are expected to already be in the pool). */
retvalue dsc_add(struct database *database, component_t forcecomponent, const char *forcesection, const char *forcepriority, struct distribution *distribution, const char *dscfilename, int delete, trackingdb tracks){
retvalue dsc_add(component_t forcecomponent, const char *forcesection, const char *forcepriority, struct distribution *distribution, const char *dscfilename, int delete, trackingdb tracks){
retvalue r;
struct dscpackage *pkg;
struct trackingdata trackingdata;
......@@ -337,7 +337,7 @@ retvalue dsc_add(struct database *database, component_t forcecomponent, const ch
r = RET_ERROR_OOM;
else
/* then look if we already have this, or copy it in */
r = files_preinclude(database,
r = files_preinclude(
dscfilename, dscfilekey,
&dscchecksums);
......@@ -361,7 +361,7 @@ retvalue dsc_add(struct database *database, component_t forcecomponent, const ch
assert (pkg->dsc.files.names.count == pkg->filekeys.count);
for (i = 1 ; i < pkg->dsc.files.names.count ; i ++) {
if (!RET_WAS_ERROR(r)) {
r = files_checkincludefile(database, origdirectory,
r = files_checkincludefile(origdirectory,
pkg->dsc.files.names.values[i],
pkg->filekeys.values[i],
&pkg->dsc.files.checksums[i]);
......@@ -399,7 +399,7 @@ retvalue dsc_add(struct database *database, component_t forcecomponent, const ch
}
}
r = dsc_addprepared(database, &pkg->dsc, pkg->component,
r = dsc_addprepared(&pkg->dsc, pkg->component,
&pkg->filekeys, distribution,
(tracks!=NULL)?&trackingdata:NULL);
......@@ -425,7 +425,7 @@ retvalue dsc_add(struct database *database, component_t forcecomponent, const ch
if (tracks != NULL) {
retvalue r2;
r2 = trackingdata_finish(tracks, &trackingdata, database);
r2 = trackingdata_finish(tracks, &trackingdata);
RET_ENDUPDATE(r, r2);
}
return r;
......
......@@ -17,7 +17,7 @@
/* insert the given .dsc into the mirror in <component> in the <distribution>
* if component is NULL, guess it from the section. */
retvalue dsc_add(struct database *, component_t, /*@null@*/const char * /*forcesection*/, /*@null@*/const char * /*forcepriority*/, struct distribution *, const char * /*dscfilename*/, int /*delete*/, /*@null@*/trackingdb);
retvalue dsc_add(component_t, /*@null@*/const char * /*forcesection*/, /*@null@*/const char * /*forcepriority*/, struct distribution *, const char * /*dscfilename*/, int /*delete*/, /*@null@*/trackingdb);
/* in two steps:
* If basename, filekey and directory are != NULL, then they are used instead
......@@ -26,6 +26,6 @@ retvalue dsc_add(struct database *, component_t, /*@null@*/const char * /*forces
* delete should be D_INPLACE then
*/
retvalue dsc_addprepared(struct database *, const struct dsc_headers *, component_t, const struct strlist * /*filekeys*/, struct distribution *, /*@null@*/struct trackingdata *);
retvalue dsc_addprepared(const struct dsc_headers *, component_t, const struct strlist * /*filekeys*/, struct distribution *, /*@null@*/struct trackingdata *);
#endif
......@@ -105,7 +105,7 @@ retvalue contentsoptions_parse(struct distribution *distribution, struct configi
return RET_OK;
}
static retvalue addpackagetocontents(struct database *database, UNUSED(struct distribution *di), UNUSED(struct target *ta), const char *packagename, const char *chunk, void *data) {
static retvalue addpackagetocontents(UNUSED(struct distribution *di), UNUSED(struct target *ta), const char *packagename, const char *chunk, void *data) {
struct filelist_list *contents = data;
retvalue r;
char *section, *filekey;
......@@ -120,15 +120,14 @@ static retvalue addpackagetocontents(struct database *database, UNUSED(struct di
free(section);
return r;
}
r = filelist_addpackage(contents, database,
packagename, section, filekey);
r = filelist_addpackage(contents, packagename, section, filekey);
free(filekey);
free(section);
return r;
}
static retvalue genarchcontents(struct database *database, struct distribution *distribution, architecture_t architecture, struct release *release, bool onlyneeded) {
static retvalue genarchcontents(struct distribution *distribution, architecture_t architecture, struct release *release, bool onlyneeded) {
retvalue r;
char *contentsfilename;
struct filetorelease *file;
......@@ -178,7 +177,7 @@ static retvalue genarchcontents(struct database *database, struct distribution *
release_abortfile(file);
return r;
}
r = distribution_foreach_package_c(distribution, database,
r = distribution_foreach_package_c(distribution,
components, architecture, pt_deb,
addpackagetocontents, contents);
if (!RET_WAS_ERROR(r))
......@@ -191,7 +190,7 @@ static retvalue genarchcontents(struct database *database, struct distribution *
return r;
}
static retvalue genarchudebcontents(struct database *database, struct distribution *distribution, architecture_t architecture, struct release *release, bool onlyneeded) {
static retvalue genarchudebcontents(struct distribution *distribution, architecture_t architecture, struct release *release, bool onlyneeded) {
retvalue r;
char *contentsfilename;
struct filetorelease *file;
......@@ -238,7 +237,7 @@ static retvalue genarchudebcontents(struct database *database, struct distributi
r = filelist_init(&contents);
if (RET_WAS_ERROR(r))
return r;
r = distribution_foreach_package_c(distribution, database,
r = distribution_foreach_package_c(distribution,
components, architecture, pt_udeb,
addpackagetocontents, contents);
if (!RET_WAS_ERROR(r))
......@@ -251,7 +250,7 @@ static retvalue genarchudebcontents(struct database *database, struct distributi
return r;
}
retvalue contents_generate(struct database *database, struct distribution *distribution, struct release *release, bool onlyneeded) {
retvalue contents_generate(struct distribution *distribution, struct release *release, bool onlyneeded) {
retvalue result, r;
int i;
const struct atomlist *architectures;
......@@ -272,12 +271,12 @@ retvalue contents_generate(struct database *database, struct distribution *distr
continue;
if (!distribution->contents.flags.nodebs) {
r = genarchcontents(database, distribution,
r = genarchcontents(distribution,
architecture, release, onlyneeded);
RET_UPDATE(result, r);
}
if (distribution->contents.flags.udebs) {
r = genarchudebcontents(database, distribution,
r = genarchudebcontents(distribution,
architecture, release, onlyneeded);
RET_UPDATE(result, r);
}
......
......@@ -24,6 +24,6 @@ struct distribution;
struct configiterator;
retvalue contentsoptions_parse(struct distribution *, struct configiterator *);
retvalue contents_generate(struct database *, struct distribution *, struct release *, bool /*onlyneeded*/);
retvalue contents_generate(struct distribution *, struct release *, bool /*onlyneeded*/);
#endif
This diff is collapsed.
......@@ -5,17 +5,17 @@
#include "strlist.h"
#endif
retvalue copy_by_name(struct database *, struct distribution * /*into*/, struct distribution * /*from*/, int, const char **, const struct atomlist *, const struct atomlist *, const struct atomlist *);
retvalue copy_by_source(struct database *, struct distribution * /*into*/, struct distribution * /*from*/, int, const char **, const struct atomlist *, const struct atomlist *, const struct atomlist *);
retvalue copy_by_formula(struct database *, struct distribution * /*into*/, struct distribution * /*from*/, const char *formula, const struct atomlist *, const struct atomlist *, const struct atomlist *);
retvalue copy_by_glob(struct database *, struct distribution * /*into*/, struct distribution * /*from*/, const char * /*glob*/, const struct atomlist *, const struct atomlist *, const struct atomlist *);
retvalue copy_by_name(struct distribution * /*into*/, struct distribution * /*from*/, int, const char **, const struct atomlist *, const struct atomlist *, const struct atomlist *);
retvalue copy_by_source(struct distribution * /*into*/, struct distribution * /*from*/, int, const char **, const struct atomlist *, const struct atomlist *, const struct atomlist *);