From 77e3c9015c821ff9986d62ddf3e18c5c00b21d3d Mon Sep 17 00:00:00 2001 From: Steve McIntyre <93sam@debian.org> Date: Thu, 21 Dec 2006 03:45:01 +0000 Subject: [PATCH] Add extra logic to source-tracking code. If we have more than 1 binary arch along with source, there's a chance that the different arches may have refs to a particular binary package (and hence its source) at completely different points. Rather than just go with the one we find first (from the first binary ref), make sure that the source will match up with the earliest binary record, measured across all arches. As noticed on the multi-arch DVD; make sure that source:kde-i18n makes it into the package list before amd64:kde-i18n-ar. --- tools/merge_package_lists | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/tools/merge_package_lists b/tools/merge_package_lists index 076c878d..cd3b21fe 100755 --- a/tools/merge_package_lists +++ b/tools/merge_package_lists @@ -90,16 +90,34 @@ if [ $source = "yes" ] ; then split($0,fields,":") arch=fields[1] pkg=fields[2] - if (!included[bin2src[pkg]]) { - print "# Adding source " bin2src[pkg] " because of " pkg - included[bin2src[pkg]] = pkg - printf("%d:aaaaaaaaaaaaaaaaaa:%s\n", FNR, pkg) + source=bin2src[pkg] + if (!included[source]) { + printf("# Adding source %s at %d because of %s:%s\n", + source, FNR, arch, pkg) + included[source] = pkg + incarch[source] = arch + indexnr[source] = FNR } else { - print "# Not adding pkg " pkg " source (" bin2src[pkg] "), already added due to " included[bin2src[pkg]] + if (FNR < indexnr[source]) { + printf("# Updating source %s: was due to %d:%s:%s, now moved earlier because of %d:%s:%s\n", + source, indexnr[source], + incarch[source], included[source], + FNR, arch, pkg); + included[source] = pkg + incarch[source] = arch + indexnr[source] = FNR + } else { + printf("# Not adding pkg %s source (%d:%s:%s), already added due to %d:%s:%s\n", pkg, FNR, arch, source, indexnr[source], incarch[source], included[source]) + } } printf("%d:%s\n", FNR, $0) } - } ' $ADIR/$CODENAME-source/apt-state/lists/*Sources $BDIR/DONE $list | sort -nk 1 -t : >> $BDIR/list.mid + } + END { + for (source in included) { + printf("%d:aaaaaaaaaaaaaaaaaa:%s\n", indexnr[source], source) + } + }' $ADIR/$CODENAME-source/apt-state/lists/*Sources $BDIR/DONE $list | sort -nk 1 -t : >> $BDIR/list.mid else awk '{printf("%d:%s\n", FNR, $0)}' $list | sort -nk 1 -t : >> $BDIR/list.mid fi