Re: [gentoo-dev] Re: [RFC] office-ext.eclass

2011-08-31 Thread Tomáš Chvátal

Dne 31.8.2011 01:09, Jonathan Callen napsal(a):

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

Tomáš Chvátal wrote:

die Unable not determine libreoffice/openoffice implementation!


Unable to determine ...

- --
Jonathan Callen


Thanks, replaced.

# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

# @ECLASS: office-ext.eclass
# @AUTHOR:
# Tomáš Chvátal scarab...@gentoo.org
# @MAINTAINER:
# The office team openoff...@gentoo.org
# @BLURB: Eclass for installing libreoffice/openoffice extensions
# @DESCRIPTION:
# Eclass for easing maitenance of libreoffice/openoffice extensions.

case ${EAPI:-0} in
4) OEXT_EXPORTED_FUNCTIONS=src_install pkg_postinst pkg_prerm ;;
*) die EAPI=${EAPI} is not supported ;;
esac

EXPORT_FUNCTIONS ${OEXT_EXPORTED_FUNCTIONS}
unset OEXT_EXPORTED_FUNCTIONS

inherit eutils multilib

UNOPKG_BINARY=${EPREFIX}/usr/bin/unopkg

# @ECLASS-VARIABLE: OO_EXTENSIONS
# @REQUIRED
# @DESCRIPTION:
# Array containing list of extensions to install.
[[ -z ${OO_EXTENSIONS} ]]  die OO_EXTENSIONS variable is unset.
if [[ $(declare -p OO_EXTENSIONS 2/dev/null 21) != declare -a* ]]; then
die OO_EXTENSIONS variable is not an array.
fi

DEPEND=virtual/ooo
RDEPEND=virtual/ooo

# @FUNCTION: office-ext_flush_unopkg_cache
# @DESCRIPTION:
# Flush the cache after removal of an extension.
office-ext_flush_unopkg_cache() {
debug-print-function ${FUNCNAME} $@

debug-print ${FUNCNAME}: ${UNOPKG_BINARY} list --shared  /dev/null
${UNOPKG_BINARY} list --shared  /dev/null
}

# @FUNCTION: office-ext_get_implementation
# @DESCRIPTION:
# Determine the implementation we are building against.
office-ext_get_implementation() {
debug-print-function ${FUNCNAME} $@
local implementations=(
libreoffice
openoffice
)
local i

for i in ${implementations[@]}; do
if [[ -d ${EPREFIX}/usr/$(get_libdir)/${i} ]]; then
debug-print ${FUNCNAME}: Determined implementation is: 
\${EPREFIX}/usr/$(get_libdir)/${i}\
echo ${EPREFIX}/usr/$(get_libdir)/${i}
return
fi
done

die Unable to determine libreoffice/openoffice implementation!
}

# @FUNCTION: office-ext_add_extension
# @DESCRIPTION:
# Install the extension into the libreoffice/openoffice.
office-ext_add_extension() {
debug-print-function ${FUNCNAME} $@
local ext=$1
local tmpdir=$(mktemp -d --tmpdir=${T})

debug-print ${FUNCNAME}: ${UNOPKG_BINARY} add --shared \${ext}\
ebegin Adding extension: \${ext}\
${UNOPKG_BINARY} add --shared ${ext} \
-env:UserInstallation=file:///${tmpdir} \
-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1
eend $?
rm -rf ${tmpdir}
}

# @FUNCTION: office-ext_remove_extension
# @DESCRIPTION:
# Remove the extension from the libreoffice/openoffice.
office-ext_remove_extension() {
debug-print-function ${FUNCNAME} $@
local ext=$1
local tmpdir=$(mktemp -d --tmpdir=${T})

debug-print ${FUNCNAME}: ${UNOPKG_BINARY} remove --shared \${ext}\
ebegin Removing extension: \${ext}\
${UNOPKG_BINARY} remove --shared ${ext} \
-env:UserInstallation=file:///${tmpdir} \
-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1
eend $?
flush_unopkg_cache
rm -rf ${tmpdir}
}

# @FUNCTION: office-ext_src_install
# @DESCRIPTION:
# Install the extension source to the proper location.
office-ext_src_install() {
debug-print-function ${FUNCNAME} $@
local i

# subshell to not pollute rest of the env with the insinto redefinition
(
insinto 
$(openoffice-ext_get_implementation)/share/extension/install/
for i in ${OO_EXTENSIONS[@]}; do
doins ${i}
done
)

einfo Remember that if you replace your office implementation,
einfo you need to recompile all the extensions.
einfo Your current implementation location is: 
einfo $(openoffice-ext_get_implementation)
}

# @FUNCTION: office-ext_pkg_postinst
# @DESCRIPTION:
# Add the extensions to the libreoffice/openoffice.
office-ext_pkg_postinst() {
debug-print-function ${FUNCNAME} $@
local i

for i in ${OO_EXTENSIONS[$@]}; do
openoffice-ext_add_extension ${i}
done

}

# @FUNCTION: office-ext_pkg_prerm
# @DESCRIPTION:
# Remove the extensions from the libreoffice/openoffice.
office-ext_pkg_prerm() {
debug-print-function ${FUNCNAME} $@
local i

for i in ${OO_EXTENSIONS[@]}; do
openoffice-ext_remove_extension ${i}
done
}


[gentoo-dev] Re: [RFC] office-ext.eclass

2011-08-30 Thread Jonathan Callen
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

Tomáš Chvátal wrote:
   die Unable not determine libreoffice/openoffice implementation!

Unable to determine ...

- -- 
Jonathan Callen
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.18 (GNU/Linux)

iQIcBAEBCgAGBQJOXW2uAAoJELHSF2kinlg4WgkQAI+qmxqmKVcz0Ay3Ldj7XZgv
pzsaWElCK+UBSTvdky9bXdyZmR1aGJ9EBnQ7QW2QWK7MpZRpZmyOoaxusgu0Jt72
+otMI/Jo6L9v15vEM8WpOGfTXjN3YW0FEKNIvtRSVQamvtB3Va6xKdbRJDC69Qiz
1x1KAVKoIV7owzCuo+yEjkyp8UXhkyrZfTVrOhKnvAmjK1n+8jw5g7fzRzVTaSfg
RSGG3bFWAlkfBrzaLToFN9DRWVXUhlDC00mjbhnsMmr1y6oKmagKdxsWsa7NpJn5
2mElUeW5vm8wYJJGikQZC2n69KMz6DApt9bu2nqni7G64K1N9S3VnhfkIhkf1JaV
GjdtlQxw9imJNzFfZhNIJkUmDJ8xmiqroVWi3bkTar6ySQC6wMjgutMYSc3KF7RF
ep89WflYgH8woAmvsYKdfZF9B9v1v2cFHp4Ra2fdryE9tYYlLy0KHG+kUmAoRcDv
CQ9vuxc63aD6ezc5qK8b2pvEH/C2OpYmQSby1im3/CIyoFfPTNf/S5iKq2W+jS8g
cP8/XFRynoYzdSbFIddU3fqc1uCfpv/AawNzRDhKegIU/j8Kt8FDDzNHnouriS7b
iPoZgMCz4OhQflWBTUxShLbYGAPUoX+v811AeWy+y6ViYMukdbmOsA8HMkfx6gmN
3j59tZmDp0b7pEKf63XV
=9bkW
-END PGP SIGNATURE-