Commit 0d1df41e authored by Bernhard Link's avatar Bernhard Link

[refactor] reinstalldata: replace parameter with struct package

parent 3d3471dd
......@@ -443,8 +443,7 @@ static retvalue floodlist_trypackage(struct floodlist *list, struct package *pac
return RET_ERROR_OOM;
}
r = list->target->getinstalldata(list->target,
new->name, new->new_version,
architecture_all, package->control,
package,
&new->new_control, &new->new_filekeys,
&new->new_origfiles);
if (RET_WAS_ERROR(r)) {
......@@ -525,8 +524,7 @@ static retvalue floodlist_trypackage(struct floodlist *list, struct package *pac
return RET_ERROR_OOM;
r = list->target->getinstalldata(list->target,
package->name, package->version,
architecture_all, package->control,
package,
&control, &files, &origfiles);
if (RET_WAS_ERROR(r)) {
free(new_version);
......
......@@ -36,6 +36,7 @@
#include "override.h"
#include "tracking.h"
#include "debfile.h"
#include "package.h"
static const char * const deb_checksum_headers[cs_COUNT] = {
"MD5sum", "SHA1", "SHA256", "Size"};
......@@ -231,14 +232,15 @@ retvalue binaries_getversion(const char *control, char **version) {
return r;
}
retvalue binaries_getinstalldata(const struct target *t, const char *packagename, const char *version, architecture_t package_architecture, const char *chunk, char **control, struct strlist *filekeys, struct checksumsarray *origfiles) {
retvalue binaries_getinstalldata(const struct target *t, const struct package *package, char **control, struct strlist *filekeys, struct checksumsarray *origfiles) {
char *sourcename, *basefilename;
struct checksumsarray origfilekeys;
retvalue r;
const char *chunk = package->control;
r = binaries_parse_chunk(chunk, packagename,
t->packagetype, package_architecture,
version, &sourcename, &basefilename);
r = binaries_parse_chunk(chunk, package->name,
t->packagetype, package->architecture,
package->version, &sourcename, &basefilename);
if (RET_WAS_ERROR(r)) {
return r;
} else if (r == RET_NOTHING) {
......@@ -252,7 +254,7 @@ retvalue binaries_getinstalldata(const struct target *t, const char *packagename
return r;
}
r = calcnewcontrol(chunk, packagename, sourcename, basefilename,
r = calcnewcontrol(chunk, package->name, sourcename, basefilename,
t->component, filekeys, control);
if (RET_WAS_ERROR(r)) {
checksumsarray_done(&origfilekeys);
......
......@@ -182,8 +182,7 @@ static retvalue list_prepareadd(struct package_list *list, struct target *target
assert (new != NULL);
new->architecture = package->architecture;
r = target->getinstalldata(target, new->name, new->version,
new->architecture, package->control,
r = target->getinstalldata(target, package,
&new->control, &new->filekeys, &new->origfiles);
assert (r != RET_NOTHING);
if (RET_WAS_ERROR(r)) {
......
......@@ -34,6 +34,7 @@
#include "override.h"
#include "tracking.h"
#include "signature.h"
#include "package.h"
/* split a "<md5> <size> <filename>" into md5sum and filename */
static retvalue calc_parsefileline(const char *fileline, /*@out@*/char **filename) {
......@@ -137,7 +138,7 @@ retvalue sources_getarchitecture(UNUSED(const char *chunk), architecture_t *arch
return RET_OK;
}
retvalue sources_getinstalldata(const struct target *t, const char *packagename, UNUSED(const char *version), architecture_t architecture, const char *chunk, char **control, struct strlist *filekeys, struct checksumsarray *origfiles) {
retvalue sources_getinstalldata(const struct target *t, const struct package *package, char **control, struct strlist *filekeys, struct checksumsarray *origfiles) {
retvalue r;
char *origdirectory, *directory, *mychunk;
struct strlist myfilekeys;
......@@ -145,8 +146,9 @@ retvalue sources_getinstalldata(const struct target *t, const char *packagename,
struct checksumsarray files;
enum checksumtype cs;
bool gothash = false;
const char *chunk = package->control;
assert (architecture == architecture_source);
assert (package->architecture == architecture_source);
for (cs = cs_md5sum ; cs < cs_hashCOUNT ; cs++) {
assert (source_checksum_names[cs] != NULL);
......@@ -170,7 +172,7 @@ retvalue sources_getinstalldata(const struct target *t, const char *packagename,
strlist_done(&filelines[cs]);
return RET_ERROR;
}
r = checksumsarray_parse(&files, filelines, packagename);
r = checksumsarray_parse(&files, filelines, package->name);
for (cs = cs_md5sum ; cs < cs_hashCOUNT ; cs++) {
strlist_done(&filelines[cs]);
}
......@@ -192,19 +194,19 @@ retvalue sources_getinstalldata(const struct target *t, const char *packagename,
return r;
}
r = propersourcename(packagename);
r = propersourcename(package->name);
assert (r != RET_NOTHING);
if (RET_IS_OK(r))
r = properfilenames(&files.names);
if (RET_WAS_ERROR(r)) {
fprintf(stderr,
"Forbidden characters in source package '%s'!\n", packagename);
"Forbidden characters in source package '%s'!\n", package->name);
free(origdirectory);
checksumsarray_done(&files);
return r;
}
directory = calc_sourcedir(t->component, packagename);
directory = calc_sourcedir(t->component, package->name);
if (FAILEDTOALLOC(directory))
r = RET_ERROR_OOM;
else
......@@ -220,7 +222,7 @@ retvalue sources_getinstalldata(const struct target *t, const char *packagename,
if (!RET_WAS_ERROR(r)) {
char *n;
n = chunk_normalize(chunk, "Package", packagename);
n = chunk_normalize(chunk, "Package", package->name);
if (FAILEDTOALLOC(n))
mychunk = NULL;
else
......
......@@ -28,7 +28,8 @@ struct alloverrides;
typedef retvalue get_version(const char *, /*@out@*/char **);
typedef retvalue get_architecture(const char *, /*@out@*/architecture_t *);
typedef retvalue get_installdata(const struct target *, const char *, const char *, architecture_t, const char *, /*@out@*/char **, /*@out@*/struct strlist *, /*@out@*/struct checksumsarray *);
struct package;
typedef retvalue get_installdata(const struct target *, const struct package *, /*@out@*/char **, /*@out@*/struct strlist *, /*@out@*/struct checksumsarray *);
/* md5sums may be NULL */
typedef retvalue get_filekeys(const char *, /*@out@*/struct strlist *);
typedef retvalue get_checksums(const char *, /*@out@*/struct checksumsarray *);
......
......@@ -317,8 +317,7 @@ static retvalue upgradelist_trypackage(struct upgradelist *upgrade, void *privda
new->architecture = package->architecture;
version = NULL; //to be sure...
r = upgrade->target->getinstalldata(upgrade->target,
new->name, new->new_version,
new->architecture, package->control,
package,
&new->new_control, &new->new_filekeys,
&new->new_origfiles);
if (RET_WAS_ERROR(r)) {
......@@ -447,8 +446,7 @@ static retvalue upgradelist_trypackage(struct upgradelist *upgrade, void *privda
current->architecture = package->architecture;
r = upgrade->target->getinstalldata(upgrade->target,
package->name, version,
package->architecture, package->control,
package,
&control, &files, &origfiles);
if (RET_WAS_ERROR(r)) {
free(version);
......
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