Bug#627716: update apt-xapian-index
Usertags: origin-ubuntu ubuntu-patch oneiric
apt-xapian-index.postinst (in Debian, and in Ubuntu with minor
modifications) contains the following code:
case "$1" in
# Just checking the main directory with -d should prevent the indexing
# to be started while an indexing is already going on, as the first
# thing that update-apt-xapian-index does is to create the directory if
# it is missing
if [ ! -d /var/lib/apt-xapian-index ]
if [ ! -x /usr/sbin/policy-rc.d ] || /usr/sbin/policy-rc.d apt-xapian-index start
echo "apt-xapian-index: Building new index in background..."
# Ensure that we can use our module. See #537376
nice /usr/sbin/update-apt-xapian-index --quiet &
This is of course effectively disabled in live-build due to policy-rc.d.
Extending live-build's policy-rc.d to allow 'apt-xapian-index start'
doesn't look like a great idea either, as that would run
update-apt-xapian-index in the background which will race with package
installation completing and mksquashfs (or whatever) starting.
I care about this because Ubuntu's Software Center uses
apt-xapian-index, and that's quite prominent in our UI these days so
it'll be fairly obvious if the index isn't up to date.
Could we just update this as a hack, along the lines of the attached
Colin Watson [email@example.com]
>From 8aa53bce90f42e203321f68fa5f87233c32b36be Mon Sep 17 00:00:00 2001
From: Colin Watson <firstname.lastname@example.org>
Date: Mon, 23 May 2011 20:51:18 +0100
Subject: [PATCH] Update the Apt Xapian index.
scripts/build/lb_chroot_hacks | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/scripts/build/lb_chroot_hacks b/scripts/build/lb_chroot_hacks
index 12279fd..4c26deb 100755
@@ -222,6 +222,14 @@ if [ -x chroot/usr/bin/updatedb.mlocate ]; then
Chroot chroot updatedb.mlocate
+# Update the Apt Xapian index. The package would do this itself, but (a) it
+# checks policy-rc.d which says it isn't allowed to, and (b) it wants to
+# build the index in the background which will be racy in the context of
+if [ -x chroot/usr/sbin/update-apt-xapian-index ]; then
+ Chroot chroot /usr/sbin/update-apt-xapian-index --force --quiet
# Remove build systems clock drift
echo "0.0 0 0.0" > chroot/etc/adjtime