Commit d38d163c authored by Bernhard Link's avatar Bernhard Link

[refactor] always read source version from .deb, even if currently not needed

parent e3da09f2
......@@ -500,7 +500,7 @@ void binaries_debdone(struct deb_headers *pkg) {
free(pkg->priority);
}
retvalue binaries_readdeb(struct deb_headers *deb, const char *filename, bool needssourceversion) {
retvalue binaries_readdeb(struct deb_headers *deb, const char *filename) {
retvalue r;
char *architecture;
......@@ -538,11 +538,8 @@ retvalue binaries_readdeb(struct deb_headers *deb, const char *filename, bool ne
if (RET_WAS_ERROR(r))
return r;
/* can be there, otherwise we also know what it is */
if (needssourceversion)
r = chunk_getnameandversion(deb->control, "Source",
&deb->source, &deb->sourceversion);
else
r = chunk_getname(deb->control, "Source", &deb->source, true);
r = chunk_getnameandversion(deb->control, "Source",
&deb->source, &deb->sourceversion);
if (r == RET_NOTHING) {
deb->source = strdup(deb->name);
if (FAILEDTOALLOC(deb->source))
......@@ -550,7 +547,7 @@ retvalue binaries_readdeb(struct deb_headers *deb, const char *filename, bool ne
}
if (RET_WAS_ERROR(r))
return r;
if (needssourceversion && deb->sourceversion == NULL) {
if (deb->sourceversion == NULL) {
deb->sourceversion = strdup(deb->version);
if (FAILEDTOALLOC(deb->sourceversion))
return RET_ERROR_OOM;
......
......@@ -44,7 +44,7 @@ struct deb_headers {
* error returned
* - no checks for sanity of values, left to the caller */
retvalue binaries_readdeb(struct deb_headers *, const char *filename, bool /*needssourceversion*/);
retvalue binaries_readdeb(struct deb_headers *, const char *filename);
void binaries_debdone(struct deb_headers *);
retvalue binaries_calcfilekeys(component_t, const struct deb_headers *, packagetype_t, /*@out@*/struct strlist *);
......
......@@ -73,7 +73,7 @@ void deb_free(/*@only@*/struct debpackage *pkg) {
}
/* read the data from a .deb, make some checks and extract some data */
static retvalue deb_read(/*@out@*/struct debpackage **pkg, const char *filename, bool needssourceversion) {
static retvalue deb_read(/*@out@*/struct debpackage **pkg, const char *filename) {
retvalue r;
struct debpackage *deb;
......@@ -81,12 +81,12 @@ static retvalue deb_read(/*@out@*/struct debpackage **pkg, const char *filename,
if (FAILEDTOALLOC(deb))
return RET_ERROR_OOM;
r = binaries_readdeb(&deb->deb, filename, needssourceversion);
r = binaries_readdeb(&deb->deb, filename);
if (RET_IS_OK(r))
r = properpackagename(deb->deb.name);
if (RET_IS_OK(r))
r = propersourcename(deb->deb.source);
if (RET_IS_OK(r) && needssourceversion)
if (RET_IS_OK(r))
r = properversion(deb->deb.sourceversion);
if (RET_IS_OK(r))
r = properversion(deb->deb.version);
......@@ -240,7 +240,7 @@ retvalue deb_prepare(/*@out@*/struct debpackage **deb, component_t forcecomponen
/* First taking a closer look in the file: */
r = deb_read(&pkg, debfilename, true);
r = deb_read(&pkg, debfilename);
if (RET_WAS_ERROR(r)) {
return r;
}
......@@ -341,7 +341,7 @@ retvalue deb_add(component_t forcecomponent, const struct atomlist *forcearchite
causingfile = debfilename;
r = deb_read(&pkg, debfilename, tracks != NULL);
r = deb_read(&pkg, debfilename);
if (RET_WAS_ERROR(r)) {
return r;
}
......
......@@ -998,7 +998,7 @@ static retvalue candidate_read_deb(struct incoming *i, struct candidate *c, stru
char *base;
const char *packagenametocheck;
r = binaries_readdeb(&file->deb, file->tempfilename, true);
r = binaries_readdeb(&file->deb, file->tempfilename);
if (RET_WAS_ERROR(r))
return r;
if (strcmp(file->name, file->deb.name) != 0) {
......
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