On 01/12/13 00:10, Bernhard R. Link wrote:
> How about something like the following instead

Thanks, that does seem better. Here's the version of your patch that I'm
testing now.

It fixes the case we're particularly concerned with, which was when you
upload something that's partially Arch:any and partially Arch:all, like
src:dbus (dbus and dbus-1-doc). If the amd64 builder finishes its build
before the armhf builder, we'll get the amd64-built version of
dbus-1-doc, the armhf-built version is thrown away, and everything is
basically fine (if retained, the armhf .changes file will have a hash
sum mismatch for the _all deb, but that's minor - everything can still
be verified against the .changes files if needed, as long as they're all
kept).

If a source package has no binary packages that aren't Architecture:all
(my current test-case is miscfiles), our current autobuilder
infrastructure will still redundantly build them on all architectures;
if the amd64 builder finishes first again, the armhf-built version will
fail to import into reprepro, because reprepro renames the changes files
to a colliding _all.changes filename. However, that doesn't seem like
too big a problem: by definition, building such a package on one
architecture is enough, so we don't mind if publishing the redundant
copies from the second and subsequent architectures fails.

     S

>From d7a1ca12ac98158422efe053f590827e7db68a37 Mon Sep 17 00:00:00 2001
From: "Bernhard R. Link" <brl...@debian.org>
Date: Wed, 18 Dec 2013 19:13:04 +0000
Subject: [PATCH 1/3] Add --ignore=conflictingarchall

This is useful if autobuilders for more than one architecture will build
Architecture: all packages of the same version. For instance, if amd64
and i386 builders both try to build dbus, and the amd64 builder finishes
first, the amd64-built version of dbus-1-doc will be included in the
archive and the i386-built version will be discarded.

Based on a patch by Sjoerd Simons.

[Added commit message, fixed a warning message -Simon McVittie]
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=697630
---
 checkin.c | 21 +++++++++++++++++++--
 ignore.h  |  3 ++-
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/checkin.c b/checkin.c
index 3b1ec32..6fd4679 100644
--- a/checkin.c
+++ b/checkin.c
@@ -880,12 +880,13 @@ static retvalue changes_check(const struct distribution *distribution, const cha
 }
 
 static retvalue changes_checkfiles(const char *filename, struct changes *changes) {
-	struct fileentry *e;
+	struct fileentry *e, **pe;
 	retvalue r;
 
 	r = RET_NOTHING;
 
-	for (e = changes->files; e != NULL ; e = e->next) {
+	pe = &changes->files;
+	while ((e = *pe) != NULL) {
 		//TODO: decide earlier which files to include
 		if (e->type == fe_BYHAND) {
 			/* byhand files might have the same name and not
@@ -918,6 +919,21 @@ static retvalue changes_checkfiles(const char *filename, struct changes *changes
 			return RET_ERROR_OOM;
 		/* do not copy yet, but only check if it could be included */
 		r = files_canadd(e->filekey, e->checksums);
+		if (r == RET_ERROR_WRONG_MD5 &&
+		    e->architecture_into == architecture_all &&
+		    IGNORABLE(conflictingarchall)) {
+			struct fileentry *removedentry;
+
+			fprintf(stderr,
+"Ignoring '%s' as --ignore=conflictingarchall given and there is already a file with different contents of that name.\n",
+				e->name);
+
+			removedentry = e;
+			*pe = removedentry->next;
+			removedentry->next = NULL;
+			freeentries(removedentry);
+			continue;
+		}
 		if (RET_WAS_ERROR(r))
 			return r;
 		/* If is was already there, remember that */
@@ -943,6 +959,7 @@ static retvalue changes_checkfiles(const char *filename, struct changes *changes
 			}
 			free(fullfilename);
 		}
+		pe = &e->next;
 	}
 
 	return RET_OK;
diff --git a/ignore.h b/ignore.h
index 5a64288..d2c0c5d 100644
--- a/ignore.h
+++ b/ignore.h
@@ -36,7 +36,8 @@
 	IGN(wrongarchitecture) \
 	IGN(oldfile) \
 	IGN(longkeyid) \
-	IGN(missingfile)
+	IGN(missingfile) \
+	IGN(conflictingarchall)
 
 
 enum ignore {
-- 
1.8.5.2

Reply via email to