Commit 6634d096 authored by Bernhard Link's avatar Bernhard Link

fix 'pull' copying packages with wrong architecture

parent 5a2e4392
......@@ -2,6 +2,7 @@
* 'check' also checks if architectures match
* fix 'sourcemissing', 'unusedsources' and 'reportcruft'
on distributions without tracking.
* fix 'pull' copying packages with wrong architecture
2010-02-21
* support reading of Release files without MD5Sum
......
......@@ -23,6 +23,7 @@
#include <assert.h>
#include "error.h"
#include "ignore.h"
#include "strlist.h"
#include "indexfile.h"
#include "dpkgversions.h"
......@@ -196,6 +197,15 @@ static retvalue upgradelist_trypackage(struct upgradelist *upgrade, void *privda
upgrade_decision decision;
struct package_data *current,*insertafter;
if( architecture == architecture_all ) {
if( upgrade->target->packagetype_atom == pt_dsc ) {
fputs("Internal error: trying to put binary ('all')"
" package into source architecture!\n",
stderr);
return RET_ERROR_INTERNAL;
}
}
/* insertafter = NULL will mean insert before list */
insertafter = upgrade->last;
/* the next one to test, current = NULL will mean not found */
......@@ -513,17 +523,45 @@ retvalue upgradelist_pull(struct upgradelist *upgrade, struct target *source, up
char *version;
architecture_t package_architecture;
r = upgrade->target->getversion(control, &version);
assert (source->packagetype_atom
== upgrade->target->packagetype_atom);
r = source->getversion(control, &version);
assert( r != RET_NOTHING );
if( !RET_IS_OK(r) ) {
RET_UPDATE(result, r);
break;
}
r = upgrade->target->getarchitecture(control, &package_architecture);
r = source->getarchitecture(control, &package_architecture);
if( !RET_IS_OK(r) ) {
RET_UPDATE(result, r);
break;
}
if( package_architecture != upgrade->target->architecture_atom &&
package_architecture != architecture_all ) {
free(version);
continue;
if( source->architecture_atom
== upgrade->target->architecture_atom
&& !ignore[IGN_wrongarchitecture] ) {
fprintf(stderr,
"WARNING: architecture '%s' package '%s' in '%s'!\n",
atoms_architectures[
package_architecture],
package,
source->identifier);
if( ignored[IGN_wrongarchitecture] == 0 ) {
fprintf(stderr,
"(expected 'all' or '%s', so ignoring this package, but\n"
"your database seems to be in a bad state. (Try running 'reprepro check')!)\n",
atoms_architectures[
source->architecture_atom]);
}
ignored[IGN_wrongarchitecture]++;
}
free(version);
continue;
}
r = upgradelist_trypackage(upgrade, privdata,
predecide, decide_data,
package, NULL, version,
......@@ -650,6 +688,11 @@ retvalue upgradelist_install(struct upgradelist *upgrade, struct logger *logger,
if( pkg->version == pkg->new_version && !pkg->deleted ) {
char *newcontrol;
assert( (pkg->architecture == architecture_all &&
upgrade->target->packagetype_atom != pt_dsc)
|| pkg->architecture ==
upgrade->target->architecture_atom);
r = files_checkorimprove(database,
&pkg->new_filekeys,
pkg->new_origfiles.checksums);
......
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