/[gentoo-x86]/eclass/office-ext.eclass
Gentoo

Diff of /eclass/office-ext.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.1 Revision 1.3
1# Copyright 1999-2011 Gentoo Foundation 1# Copyright 1999-2012 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/Attic/office-ext.eclass,v 1.1 2011/09/05 08:25:58 scarabeus Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/Attic/office-ext.eclass,v 1.3 2012/05/09 16:12:16 scarabeus Exp $
4 4
5# @ECLASS: office-ext.eclass 5# @ECLASS: office-ext.eclass
6# @AUTHOR: 6# @AUTHOR:
7# Tomáš Chvátal <scarabeus@gentoo.org> 7# Tomáš Chvátal <scarabeus@gentoo.org>
8# @MAINTAINER: 8# @MAINTAINER:
10# @BLURB: Eclass for installing libreoffice/openoffice extensions 10# @BLURB: Eclass for installing libreoffice/openoffice extensions
11# @DESCRIPTION: 11# @DESCRIPTION:
12# Eclass for easing maitenance of libreoffice/openoffice extensions. 12# Eclass for easing maitenance of libreoffice/openoffice extensions.
13 13
14case "${EAPI:-0}" in 14case "${EAPI:-0}" in
15 4) OEXT_EXPORTED_FUNCTIONS="src_install pkg_postinst pkg_prerm" ;; 15 4) OEXT_EXPORTED_FUNCTIONS="src_unpack src_install pkg_postinst pkg_prerm" ;;
16 *) die "EAPI=${EAPI} is not supported" ;; 16 *) die "EAPI=${EAPI} is not supported" ;;
17esac 17esac
18
19EXPORT_FUNCTIONS ${OEXT_EXPORTED_FUNCTIONS}
20unset OEXT_EXPORTED_FUNCTIONS
21 18
22inherit eutils multilib 19inherit eutils multilib
23 20
24UNOPKG_BINARY="${EPREFIX}/usr/bin/unopkg" 21UNOPKG_BINARY="${EPREFIX}/usr/bin/unopkg"
25 22
32 die "OO_EXTENSIONS variable is not an array." 29 die "OO_EXTENSIONS variable is not an array."
33fi 30fi
34 31
35DEPEND="virtual/ooo" 32DEPEND="virtual/ooo"
36RDEPEND="virtual/ooo" 33RDEPEND="virtual/ooo"
34
35# Most projects actually do not provide any workdir and we do not unpack the
36# .oxt file at all.
37S="${WORKDIR}"
38
39# @FUNCTION: office-ext_src_unpack
40# @DESCRIPTION:
41# Flush the cache after removal of an extension.
42office-ext_src_unpack() {
43 debug-print-function ${FUNCNAME} "$@"
44 local i
45
46 default
47
48 for i in ${OO_EXTENSIONS[@]}; do
49 debug-print "${FUNCNAME}: cp -v \"${DISTDIR}/${i}\" \"${S}\""
50 cp -v "${DISTDIR}/${i}" "${S}" || die
51 done
52}
37 53
38# @FUNCTION: office-ext_flush_unopkg_cache 54# @FUNCTION: office-ext_flush_unopkg_cache
39# @DESCRIPTION: 55# @DESCRIPTION:
40# Flush the cache after removal of an extension. 56# Flush the cache after removal of an extension.
41office-ext_flush_unopkg_cache() { 57office-ext_flush_unopkg_cache() {
74 debug-print-function ${FUNCNAME} "$@" 90 debug-print-function ${FUNCNAME} "$@"
75 local ext=$1 91 local ext=$1
76 local tmpdir=$(mktemp -d --tmpdir="${T}") 92 local tmpdir=$(mktemp -d --tmpdir="${T}")
77 93
78 debug-print "${FUNCNAME}: ${UNOPKG_BINARY} add --shared \"${ext}\"" 94 debug-print "${FUNCNAME}: ${UNOPKG_BINARY} add --shared \"${ext}\""
79 ebegin "Adding extension: \"${ext}\"" 95 ebegin "Adding office extension: \"${ext}\""
80 ${UNOPKG_BINARY} add --shared "${ext}" \ 96 ${UNOPKG_BINARY} add --shared "${ext}" \
81 "-env:UserInstallation=file:///${tmpdir}" \ 97 "-env:UserInstallation=file:///${tmpdir}" \
82 "-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1" 98 "-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1"
83 eend $? 99 eend $?
84 rm -rf "${tmpdir}" 100 rm -rf "${tmpdir}"
91 debug-print-function ${FUNCNAME} "$@" 107 debug-print-function ${FUNCNAME} "$@"
92 local ext=$1 108 local ext=$1
93 local tmpdir=$(mktemp -d --tmpdir="${T}") 109 local tmpdir=$(mktemp -d --tmpdir="${T}")
94 110
95 debug-print "${FUNCNAME}: ${UNOPKG_BINARY} remove --shared \"${ext}\"" 111 debug-print "${FUNCNAME}: ${UNOPKG_BINARY} remove --shared \"${ext}\""
96 ebegin "Removing extension: \"${ext}\"" 112 ebegin "Removing office extension: \"${ext}\""
97 ${UNOPKG_BINARY} remove --shared "${ext}" \ 113 ${UNOPKG_BINARY} remove --shared "${ext}" \
98 "-env:UserInstallation=file:///${tmpdir}" \ 114 "-env:UserInstallation=file:///${tmpdir}" \
99 "-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1" 115 "-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1"
100 eend $? 116 eend $?
101 flush_unopkg_cache 117 office-ext_flush_unopkg_cache
102 rm -rf "${tmpdir}" 118 rm -rf "${tmpdir}"
103} 119}
104 120
105# @FUNCTION: office-ext_src_install 121# @FUNCTION: office-ext_src_install
106# @DESCRIPTION: 122# @DESCRIPTION:
107# Install the extension source to the proper location. 123# Install the extension source to the proper location.
108office-ext_src_install() { 124office-ext_src_install() {
109 debug-print-function ${FUNCNAME} "$@" 125 debug-print-function ${FUNCNAME} "$@"
126 debug-print "Extensions: ${OO_EXTENSIONS[@]}"
110 local i 127 local i
111 128
112 # subshell to not pollute rest of the env with the insinto redefinition 129 # subshell to not pollute rest of the env with the insinto redefinition
113 ( 130 (
131 dodir $(office-ext_get_implementation)/share/extension/install/
114 insinto $(openoffice-ext_get_implementation)/share/extension/install/ 132 insinto $(office-ext_get_implementation)/share/extension/install/
115 for i in "${OO_EXTENSIONS[@]}"; do 133 for i in ${OO_EXTENSIONS[@]}; do
116 doins "${i}" 134 doins "${i}"
117 done 135 done
118 ) 136 )
119 137
120 einfo "Remember that if you replace your office implementation," 138 einfo "Remember that if you replace your office implementation,"
121 einfo "you need to recompile all the extensions." 139 einfo "you need to recompile all the extensions."
122 einfo "Your current implementation location is: " 140 einfo "Your current implementation location is: "
123 einfo " $(openoffice-ext_get_implementation)" 141 einfo " $(office-ext_get_implementation)"
124} 142}
125 143
126# @FUNCTION: office-ext_pkg_postinst 144# @FUNCTION: office-ext_pkg_postinst
127# @DESCRIPTION: 145# @DESCRIPTION:
128# Add the extensions to the libreoffice/openoffice. 146# Add the extensions to the libreoffice/openoffice.
129office-ext_pkg_postinst() { 147office-ext_pkg_postinst() {
130 debug-print-function ${FUNCNAME} "$@" 148 debug-print-function ${FUNCNAME} "$@"
149 debug-print "Extensions: ${OO_EXTENSIONS[@]}"
131 local i 150 local i
132 151
133 for i in "${OO_EXTENSIONS[$@]}"; do 152 for i in ${OO_EXTENSIONS[@]}; do
134 openoffice-ext_add_extension "${i}" 153 office-ext_add_extension "$(office-ext_get_implementation)/share/extension/install/${i}"
135 done 154 done
136 155
137} 156}
138 157
139# @FUNCTION: office-ext_pkg_prerm 158# @FUNCTION: office-ext_pkg_prerm
140# @DESCRIPTION: 159# @DESCRIPTION:
141# Remove the extensions from the libreoffice/openoffice. 160# Remove the extensions from the libreoffice/openoffice.
142office-ext_pkg_prerm() { 161office-ext_pkg_prerm() {
143 debug-print-function ${FUNCNAME} "$@" 162 debug-print-function ${FUNCNAME} "$@"
163 debug-print "Extensions: ${OO_EXTENSIONS[@]}"
144 local i 164 local i
145 165
146 for i in "${OO_EXTENSIONS[@]}"; do 166 for i in ${OO_EXTENSIONS[@]}; do
147 openoffice-ext_remove_extension "${i}" 167 office-ext_remove_extension "${i}"
148 done 168 done
149} 169}
170
171EXPORT_FUNCTIONS ${OEXT_EXPORTED_FUNCTIONS}
172unset OEXT_EXPORTED_FUNCTIONS

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.20