/[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.5
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.5 2012/05/10 09:33:59 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 # Copy only if the oxt is present, sometimes they are in tarballs
50 # so we want to fail only when we do need to do the cp.
51 if [[ -f "${DISTDIR}/${i}" ]] ; then
52 debug-print "${FUNCNAME}: cp -v \"${DISTDIR}/${i}\" \"${S}\""
53 cp -v "${DISTDIR}/${i}" "${S}" || die
54 fi
55 done
56}
37 57
38# @FUNCTION: office-ext_flush_unopkg_cache 58# @FUNCTION: office-ext_flush_unopkg_cache
39# @DESCRIPTION: 59# @DESCRIPTION:
40# Flush the cache after removal of an extension. 60# Flush the cache after removal of an extension.
41office-ext_flush_unopkg_cache() { 61office-ext_flush_unopkg_cache() {
74 debug-print-function ${FUNCNAME} "$@" 94 debug-print-function ${FUNCNAME} "$@"
75 local ext=$1 95 local ext=$1
76 local tmpdir=$(mktemp -d --tmpdir="${T}") 96 local tmpdir=$(mktemp -d --tmpdir="${T}")
77 97
78 debug-print "${FUNCNAME}: ${UNOPKG_BINARY} add --shared \"${ext}\"" 98 debug-print "${FUNCNAME}: ${UNOPKG_BINARY} add --shared \"${ext}\""
79 ebegin "Adding extension: \"${ext}\"" 99 ebegin "Adding office extension: \"${ext}\""
80 ${UNOPKG_BINARY} add --shared "${ext}" \ 100 ${UNOPKG_BINARY} add --suppress-license \
101 --shared "${ext}" \
81 "-env:UserInstallation=file:///${tmpdir}" \ 102 "-env:UserInstallation=file:///${tmpdir}" \
82 "-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1" 103 "-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1"
83 eend $? 104 eend $?
84 rm -rf "${tmpdir}" 105 rm -rf "${tmpdir}"
85} 106}
91 debug-print-function ${FUNCNAME} "$@" 112 debug-print-function ${FUNCNAME} "$@"
92 local ext=$1 113 local ext=$1
93 local tmpdir=$(mktemp -d --tmpdir="${T}") 114 local tmpdir=$(mktemp -d --tmpdir="${T}")
94 115
95 debug-print "${FUNCNAME}: ${UNOPKG_BINARY} remove --shared \"${ext}\"" 116 debug-print "${FUNCNAME}: ${UNOPKG_BINARY} remove --shared \"${ext}\""
96 ebegin "Removing extension: \"${ext}\"" 117 ebegin "Removing office extension: \"${ext}\""
97 ${UNOPKG_BINARY} remove --shared "${ext}" \ 118 ${UNOPKG_BINARY} remove --suppress-license \
119 --shared "${ext}" \
98 "-env:UserInstallation=file:///${tmpdir}" \ 120 "-env:UserInstallation=file:///${tmpdir}" \
99 "-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1" 121 "-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1"
100 eend $? 122 eend $?
101 flush_unopkg_cache 123 office-ext_flush_unopkg_cache
102 rm -rf "${tmpdir}" 124 rm -rf "${tmpdir}"
103} 125}
104 126
105# @FUNCTION: office-ext_src_install 127# @FUNCTION: office-ext_src_install
106# @DESCRIPTION: 128# @DESCRIPTION:
107# Install the extension source to the proper location. 129# Install the extension source to the proper location.
108office-ext_src_install() { 130office-ext_src_install() {
109 debug-print-function ${FUNCNAME} "$@" 131 debug-print-function ${FUNCNAME} "$@"
132 debug-print "Extensions: ${OO_EXTENSIONS[@]}"
110 local i 133 local i
111 134
112 # subshell to not pollute rest of the env with the insinto redefinition 135 # subshell to not pollute rest of the env with the insinto redefinition
113 ( 136 (
137 dodir $(office-ext_get_implementation)/share/extension/install/
114 insinto $(openoffice-ext_get_implementation)/share/extension/install/ 138 insinto $(office-ext_get_implementation)/share/extension/install/
115 for i in "${OO_EXTENSIONS[@]}"; do 139 for i in ${OO_EXTENSIONS[@]}; do
116 doins "${i}" 140 doins "${i}"
117 done 141 done
118 ) 142 )
119 143
120 einfo "Remember that if you replace your office implementation," 144 einfo "Remember that if you replace your office implementation,"
121 einfo "you need to recompile all the extensions." 145 einfo "you need to recompile all the extensions."
122 einfo "Your current implementation location is: " 146 einfo "Your current implementation location is: "
123 einfo " $(openoffice-ext_get_implementation)" 147 einfo " $(office-ext_get_implementation)"
124} 148}
125 149
126# @FUNCTION: office-ext_pkg_postinst 150# @FUNCTION: office-ext_pkg_postinst
127# @DESCRIPTION: 151# @DESCRIPTION:
128# Add the extensions to the libreoffice/openoffice. 152# Add the extensions to the libreoffice/openoffice.
129office-ext_pkg_postinst() { 153office-ext_pkg_postinst() {
130 debug-print-function ${FUNCNAME} "$@" 154 debug-print-function ${FUNCNAME} "$@"
155 debug-print "Extensions: ${OO_EXTENSIONS[@]}"
131 local i 156 local i
132 157
133 for i in "${OO_EXTENSIONS[$@]}"; do 158 for i in ${OO_EXTENSIONS[@]}; do
134 openoffice-ext_add_extension "${i}" 159 office-ext_add_extension "$(office-ext_get_implementation)/share/extension/install/${i}"
135 done 160 done
136 161
137} 162}
138 163
139# @FUNCTION: office-ext_pkg_prerm 164# @FUNCTION: office-ext_pkg_prerm
140# @DESCRIPTION: 165# @DESCRIPTION:
141# Remove the extensions from the libreoffice/openoffice. 166# Remove the extensions from the libreoffice/openoffice.
142office-ext_pkg_prerm() { 167office-ext_pkg_prerm() {
143 debug-print-function ${FUNCNAME} "$@" 168 debug-print-function ${FUNCNAME} "$@"
169 debug-print "Extensions: ${OO_EXTENSIONS[@]}"
144 local i 170 local i
145 171
146 for i in "${OO_EXTENSIONS[@]}"; do 172 for i in ${OO_EXTENSIONS[@]}; do
147 openoffice-ext_remove_extension "${i}" 173 office-ext_remove_extension "${i}"
148 done 174 done
149} 175}
176
177EXPORT_FUNCTIONS ${OEXT_EXPORTED_FUNCTIONS}
178unset OEXT_EXPORTED_FUNCTIONS

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

  ViewVC Help
Powered by ViewVC 1.1.20