/[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.4
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.4 2012/05/09 20:33: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 # 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 --shared "${ext}" \
81 "-env:UserInstallation=file:///${tmpdir}" \ 101 "-env:UserInstallation=file:///${tmpdir}" \
82 "-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1" 102 "-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1"
83 eend $? 103 eend $?
84 rm -rf "${tmpdir}" 104 rm -rf "${tmpdir}"
91 debug-print-function ${FUNCNAME} "$@" 111 debug-print-function ${FUNCNAME} "$@"
92 local ext=$1 112 local ext=$1
93 local tmpdir=$(mktemp -d --tmpdir="${T}") 113 local tmpdir=$(mktemp -d --tmpdir="${T}")
94 114
95 debug-print "${FUNCNAME}: ${UNOPKG_BINARY} remove --shared \"${ext}\"" 115 debug-print "${FUNCNAME}: ${UNOPKG_BINARY} remove --shared \"${ext}\""
96 ebegin "Removing extension: \"${ext}\"" 116 ebegin "Removing office extension: \"${ext}\""
97 ${UNOPKG_BINARY} remove --shared "${ext}" \ 117 ${UNOPKG_BINARY} remove --shared "${ext}" \
98 "-env:UserInstallation=file:///${tmpdir}" \ 118 "-env:UserInstallation=file:///${tmpdir}" \
99 "-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1" 119 "-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1"
100 eend $? 120 eend $?
101 flush_unopkg_cache 121 office-ext_flush_unopkg_cache
102 rm -rf "${tmpdir}" 122 rm -rf "${tmpdir}"
103} 123}
104 124
105# @FUNCTION: office-ext_src_install 125# @FUNCTION: office-ext_src_install
106# @DESCRIPTION: 126# @DESCRIPTION:
107# Install the extension source to the proper location. 127# Install the extension source to the proper location.
108office-ext_src_install() { 128office-ext_src_install() {
109 debug-print-function ${FUNCNAME} "$@" 129 debug-print-function ${FUNCNAME} "$@"
130 debug-print "Extensions: ${OO_EXTENSIONS[@]}"
110 local i 131 local i
111 132
112 # subshell to not pollute rest of the env with the insinto redefinition 133 # subshell to not pollute rest of the env with the insinto redefinition
113 ( 134 (
135 dodir $(office-ext_get_implementation)/share/extension/install/
114 insinto $(openoffice-ext_get_implementation)/share/extension/install/ 136 insinto $(office-ext_get_implementation)/share/extension/install/
115 for i in "${OO_EXTENSIONS[@]}"; do 137 for i in ${OO_EXTENSIONS[@]}; do
116 doins "${i}" 138 doins "${i}"
117 done 139 done
118 ) 140 )
119 141
120 einfo "Remember that if you replace your office implementation," 142 einfo "Remember that if you replace your office implementation,"
121 einfo "you need to recompile all the extensions." 143 einfo "you need to recompile all the extensions."
122 einfo "Your current implementation location is: " 144 einfo "Your current implementation location is: "
123 einfo " $(openoffice-ext_get_implementation)" 145 einfo " $(office-ext_get_implementation)"
124} 146}
125 147
126# @FUNCTION: office-ext_pkg_postinst 148# @FUNCTION: office-ext_pkg_postinst
127# @DESCRIPTION: 149# @DESCRIPTION:
128# Add the extensions to the libreoffice/openoffice. 150# Add the extensions to the libreoffice/openoffice.
129office-ext_pkg_postinst() { 151office-ext_pkg_postinst() {
130 debug-print-function ${FUNCNAME} "$@" 152 debug-print-function ${FUNCNAME} "$@"
153 debug-print "Extensions: ${OO_EXTENSIONS[@]}"
131 local i 154 local i
132 155
133 for i in "${OO_EXTENSIONS[$@]}"; do 156 for i in ${OO_EXTENSIONS[@]}; do
134 openoffice-ext_add_extension "${i}" 157 office-ext_add_extension "$(office-ext_get_implementation)/share/extension/install/${i}"
135 done 158 done
136 159
137} 160}
138 161
139# @FUNCTION: office-ext_pkg_prerm 162# @FUNCTION: office-ext_pkg_prerm
140# @DESCRIPTION: 163# @DESCRIPTION:
141# Remove the extensions from the libreoffice/openoffice. 164# Remove the extensions from the libreoffice/openoffice.
142office-ext_pkg_prerm() { 165office-ext_pkg_prerm() {
143 debug-print-function ${FUNCNAME} "$@" 166 debug-print-function ${FUNCNAME} "$@"
167 debug-print "Extensions: ${OO_EXTENSIONS[@]}"
144 local i 168 local i
145 169
146 for i in "${OO_EXTENSIONS[@]}"; do 170 for i in ${OO_EXTENSIONS[@]}; do
147 openoffice-ext_remove_extension "${i}" 171 office-ext_remove_extension "${i}"
148 done 172 done
149} 173}
174
175EXPORT_FUNCTIONS ${OEXT_EXPORTED_FUNCTIONS}
176unset OEXT_EXPORTED_FUNCTIONS

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

  ViewVC Help
Powered by ViewVC 1.1.20