Bug#627716: update apt-xapian-index
Package: live-build
Version: 3.0~a17-1
Severity: wishlist
Tags: patch
User: ubuntu-devel@lists.ubuntu.com
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
configure)
# 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 ]
then
if [ ! -x /usr/sbin/policy-rc.d ] || /usr/sbin/policy-rc.d apt-xapian-index start
then
echo "apt-xapian-index: Building new index in background..."
# Ensure that we can use our module. See #537376
update-python-modules -p
nice /usr/sbin/update-apt-xapian-index --quiet &
fi
fi
;;
esac
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
patch?
Thanks,
--
Colin Watson [cjwatson@ubuntu.com]
>From 8aa53bce90f42e203321f68fa5f87233c32b36be Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@canonical.com>
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
--- a/scripts/build/lb_chroot_hacks
+++ b/scripts/build/lb_chroot_hacks
@@ -222,6 +222,14 @@ if [ -x chroot/usr/bin/updatedb.mlocate ]; then
Chroot chroot updatedb.mlocate
fi
+# 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
+# live-build.
+if [ -x chroot/usr/sbin/update-apt-xapian-index ]; then
+ Chroot chroot /usr/sbin/update-apt-xapian-index --force --quiet
+fi
+
# Remove build systems clock drift
echo "0.0 0 0.0" > chroot/etc/adjtime
--
1.7.4.1
Reply to: