summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorGilles Dartiguelongue <eva@gentoo.org>2012-05-02 21:05:38 +0000
committerGilles Dartiguelongue <eva@gentoo.org>2012-05-02 21:05:38 +0000
commit03623f9ee8c5a2451d0070626506eef2076046c4 (patch)
treef25897d3c98dc6c26b799aa069f4b9dfe24e1c89 /eclass
parentMask media-sound/qsampler for removal. (diff)
downloadgentoo-2-03623f9ee8c5a2451d0070626506eef2076046c4.tar.gz
gentoo-2-03623f9ee8c5a2451d0070626506eef2076046c4.tar.bz2
gentoo-2-03623f9ee8c5a2451d0070626506eef2076046c4.zip
Rewrite scrollkeeper support as proposed in bug #301311.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/ChangeLog6
-rw-r--r--eclass/gnome2-utils.eclass48
-rw-r--r--eclass/gnome2.eclass25
3 files changed, 56 insertions, 23 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog
index 8918f0ed8833..8cb3ee4b4b6f 100644
--- a/eclass/ChangeLog
+++ b/eclass/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for eclass directory
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.232 2012/05/02 18:31:42 jdhore Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.233 2012/05/02 21:05:38 eva Exp $
+
+ 02 May 2012; Gilles Dartiguelongue <eva@gentoo.org> gnome2-utils.eclass,
+ gnome2.eclass:
+ Rewrite scrollkeeper support as proposed in bug #301311.
02 May 2012; Jeff Horelick <jdhore@gentoo.org> clutter.eclass,
gkrellm-plugin.eclass, gnome-python-common.eclass, go-mono.eclass,
diff --git a/eclass/gnome2-utils.eclass b/eclass/gnome2-utils.eclass
index f3a2513e52e4..ace8b207a688 100644
--- a/eclass/gnome2-utils.eclass
+++ b/eclass/gnome2-utils.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2-utils.eclass,v 1.26 2012/04/08 02:29:44 tetromino Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2-utils.eclass,v 1.27 2012/05/02 21:05:38 eva Exp $
# @ECLASS: gnome2-utils.eclass
# @MAINTAINER:
@@ -62,13 +62,18 @@ esac
# @DESCRIPTION:
# List of icons provided by the package
+# @ECLASS-VARIABLE: GNOME2_ECLASS_SCROLLS
+# @INTERNAL
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# List of scrolls (documentation files) provided by the package
+
# @ECLASS-VARIABLE: GNOME2_ECLASS_GLIB_SCHEMAS
# @INTERNAL
# @DEFAULT_UNSET
# @DESCRIPTION:
# List of GSettings schemas provided by the package
-
DEPEND=">=sys-apps/sed-4"
@@ -274,10 +279,14 @@ gnome2_omf_fix() {
omf_makefiles="${omf_makefiles} ${S}/omf.make"
fi
+ if [[ -f ${S}/gnome-doc-utils.make ]] ; then
+ omf_makefiles="${omf_makefiles} ${S}/gnome-doc-utils.make"
+ fi
+
# testing fixing of all makefiles found
# The sort is important to ensure .am is listed before the respective .in for
# maintainer mode regeneration not kicking in due to .am being newer than .in
- for filename in $(find ./ -name "Makefile.in" -o -name "Makefile.am" |sort) ; do
+ for filename in $(find "${S}" -name "Makefile.in" -o -name "Makefile.am" |sort) ; do
omf_makefiles="${omf_makefiles} ${filename}"
done
@@ -287,12 +296,10 @@ gnome2_omf_fix() {
local fails=( )
for omf in ${omf_makefiles} ; do
- local rv=0
-
sed -i -e 's:scrollkeeper-update:true:' "${omf}"
retval=$?
- if [[ ! $rv -eq 0 ]] ; then
+ if [[ $retval -ne 0 ]] ; then
debug-print "updating of ${omf} failed"
# Add to the list of failures
@@ -309,16 +316,39 @@ gnome2_omf_fix() {
done
}
+# @FUNCTION: gnome2_scrollkeeper_savelist
+# @DESCRIPTION:
+# Find the scrolls that are about to be installed and save their location
+# in the GNOME2_ECLASS_SCROLLS environment variable.
+# This function should be called from pkg_preinst.
+gnome2_scrollkeeper_savelist() {
+ has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
+ pushd "${ED}" &> /dev/null
+ export GNOME2_ECLASS_SCROLLS=$(find 'usr/share/omf' -type f -name "*.omf" 2> /dev/null)
+ popd &> /dev/null
+}
+
# @FUNCTION: gnome2_scrollkeeper_update
# @DESCRIPTION:
# Updates the global scrollkeeper database.
# This function should be called from pkg_postinst and pkg_postrm.
gnome2_scrollkeeper_update() {
has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
- if [[ -x "${EROOT}${SCROLLKEEPER_UPDATE_BIN}" ]]; then
- einfo "Updating scrollkeeper database ..."
- "${EROOT}${SCROLLKEEPER_UPDATE_BIN}" -q -p "${EROOT}${SCROLLKEEPER_DIR}"
+ local updater="${EROOT}${SCROLLKEEPER_UPDATE_BIN}"
+
+ if [[ ! -x "${updater}" ]] ; then
+ debug-print "${updater} is not executable"
+ return
+ fi
+
+ if [[ -z "${GNOME2_ECLASS_SCROLLS}" ]]; then
+ debug-print "No scroll cache to update"
+ return
fi
+
+ ebegin "Updating scrollkeeper database ..."
+ "${updater}" -q -p "${EROOT}${SCROLLKEEPER_DIR}"
+ eend $?
}
# @FUNCTION: gnome2_schemas_savelist
diff --git a/eclass/gnome2.eclass b/eclass/gnome2.eclass
index 1dda3dd0f580..6a8288422143 100644
--- a/eclass/gnome2.eclass
+++ b/eclass/gnome2.eclass
@@ -1,6 +1,6 @@
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2.eclass,v 1.104 2011/12/14 19:47:54 tetromino Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2.eclass,v 1.105 2012/05/02 21:05:38 eva Exp $
# @ECLASS: gnome2.eclass
# @MAINTAINER:
@@ -125,6 +125,11 @@ gnome2_src_configure() {
G2CONF="${G2CONF} --disable-maintainer-mode"
fi
+ # Pass --disable-scrollkeeper when possible
+ if grep -q "disable-scrollkeeper" configure; then
+ G2CONF="${G2CONF} --disable-scrollkeeper"
+ fi
+
# Avoid sandbox violations caused by gnome-vfs (bug #128289 and #345659)
addwrite "$(unset HOME; echo ~)/.gnome2"
@@ -172,10 +177,9 @@ gnome2_src_install() {
# 1. The scrollkeeper database is regenerated at pkg_postinst()
# 2. ${ED}/var/lib/scrollkeeper contains only indexes for the current pkg
# thus it makes no sense if pkg_postinst ISN'T run for some reason.
- if [[ -z "$(find "${D}" -name '*.omf')" ]]; then
- export SCROLLKEEPER_UPDATE="0"
- fi
rm -rf "${ED}${sk_tmp_dir}"
+ rmdir "${ED}/var/lib" 2>/dev/null
+ rmdir "${ED}/var" 2>/dev/null
# Make sure this one doesn't get in the portage db
rm -fr "${ED}/usr/share/applications/mimeinfo.cache"
@@ -197,6 +201,7 @@ gnome2_pkg_preinst() {
gnome2_gconf_savelist
gnome2_icon_savelist
gnome2_schemas_savelist
+ gnome2_scrollkeeper_savelist
}
# @FUNCTION: gnome2_pkg_postinst
@@ -209,10 +214,7 @@ gnome2_pkg_postinst() {
fdo-mime_mime_database_update
gnome2_icon_cache_update
gnome2_schemas_update
-
- if [[ "${SCROLLKEEPER_UPDATE}" = "1" ]]; then
- gnome2_scrollkeeper_update
- fi
+ gnome2_scrollkeeper_update
}
# @#FUNCTION: gnome2_pkg_prerm
@@ -230,8 +232,5 @@ gnome2_pkg_postrm() {
fdo-mime_mime_database_update
gnome2_icon_cache_update
gnome2_schemas_update
-
- if [[ "${SCROLLKEEPER_UPDATE}" = "1" ]]; then
- gnome2_scrollkeeper_update
- fi
+ gnome2_scrollkeeper_update
}