/[gentoo-x86]/eclass/gdesklets.eclass
Gentoo

Contents of /eclass/gdesklets.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.20 - (hide annotations) (download)
Sat May 8 22:18:28 2010 UTC (4 years, 2 months ago) by nixphoeni
Branch: MAIN
Changes since 1.19: +122 -155 lines
Simplified the eclass, since the rules for desklet and control submission have become much more standardized recently (http://gdesklets.de/index.php?q=node/2).  This also means that we will no longer support sensors and sensor-based desklets.  No more desklets that do not heed these rules will be put into portage.

1 nixphoeni 1.20 # Copyright 2004-2010 Gentoo Foundation
2 obz 1.1 # Distributed under the terms of the GNU General Public License, v2 or later
3 nixphoeni 1.20 # $Header: $
4    
5     # @ECLASS: gdesklets.eclass
6     # @MAINTAINER:
7     # gdesklets@gentoo.org
8     # @BLURB: Installation functions for Desklets and Controls supported
9     # by gDesklets
10     # @DESCRIPTION:
11     # The gdesklets eclass provides a simple way to create ebuilds for
12     # globally installing desktop applets ("Desklets") and supporting code
13     # ("Controls") used in the gDesklets framework (provided by
14     # gnome-extra/gdesklets-core)
15 obz 1.1 #
16 nixphoeni 1.20 # This eclass assumes a package following the instructions at
17     # http://gdesklets.de/index.php?q=node/2 . Specifically, the package
18     # should be a Desklet or Control ONLY (and *not* a Sensor). You
19     # technically could have an ebuild that works around this limitation,
20     # but no new packages should be added to the tree that do this (mainly
21     # for ease of maintenance).
22 obz 1.1 #
23 nixphoeni 1.20 # Original authors: Joe Sapp <nixphoeni@gentoo.org>
24     # Mike Gardiner <obz@gentoo.org>
25    
26     # @ECLASS_VARIABLE: DESKLET_NAME
27     # @DESCRIPTION:
28     # *Optional* The name of the Desklet, if the package is one. The
29     # default is to assume a Desklet with the name being ${PN} without the
30     # "desklet-" prefix.
31    
32     # @ECLASS_VARIABLE: CONTROL_NAME
33     # @DESCRIPTION:
34     # *Optional* The name of the Control, if the package is one.
35    
36     # @ECLASS_VARIABLE: DOCS
37     # @DESCRIPTION:
38     # Anything (like a README) that should be dodoc'd.
39    
40     # @ECLASS_VARIABLE: SLOT
41     # @DESCRIPTION:
42     # Set only if the package is a Control and it provides a different
43     # interface (i.e. expands to a different install directory) than a
44     # previous version.
45 obz 1.1
46 nixphoeni 1.13 inherit eutils multilib python
47 nixphoeni 1.5
48 nixphoeni 1.20 if [[ -n "${CONTROL_NAME}" ]]; then
49     debug-print "Looking for a Control named \"${CONTROL_NAME}\""
50     MY_PN="${CONTROL_NAME}"
51     SRC_URI="http://gdesklets.de/files/controls/${MY_PN}/${MY_PN}-${PV}.tar.gz"
52     unset DESKLET_NAME
53     else # [[ -n "${DESKLET_NAME}" ]]; then
54     # Assume an unset DESKLET_NAME means the name is ${PN} without
55     # the "desklet-" prefix
56     [[ -z "${DESKLET_NAME}" ]] && DESKLET_NAME="${PN#desklet-}"
57     debug-print "Looking for a Desklet named \"${DESKLET_NAME}\""
58     MY_PN="${DESKLET_NAME}"
59     SRC_URI="http://gdesklets.de/files/desklets/${MY_PN}/${MY_PN}-${PV}.tar.gz"
60     fi
61 obz 1.1
62 nixphoeni 1.17 MY_P="${MY_PN}-${PV}"
63 nixphoeni 1.20 S="${WORKDIR}/${MY_PN}"
64 obz 1.1
65     SLOT="0"
66 nixphoeni 1.20 # Ebuild writer shouldn't need to touch these (except maybe RDEPEND)
67 obz 1.1 IUSE=""
68 nixphoeni 1.20 RDEPEND=">=gnome-extra/gdesklets-core-0.36.1-r3"
69 obz 1.1
70 nixphoeni 1.15 GDESKLETS_INST_DIR="${ROOT}usr/$(get_libdir)/gdesklets"
71 obz 1.1
72 nixphoeni 1.20 # @FUNCTION: gdesklets_src_install
73     # @DESCRIPTION:
74     # Installs a Desklet or Control depending on which is set of
75     # CONTROL_NAME or DESKLET_NAME
76 obz 1.1 gdesklets_src_install() {
77 swegener 1.8
78 obz 1.1 debug-print-function $FUNCNAME $*
79 swegener 1.8
80 nixphoeni 1.20 # Disable compilation of included python modules (for Controls)
81 nixphoeni 1.13 python_disable_pyc
82    
83 nixphoeni 1.20 # Avoid sandbox violations caused by misbehaving packages (bug #128289)
84 nixphoeni 1.13 addwrite "${ROOT}/root/.gnome2"
85    
86 nixphoeni 1.20 # Both Displays and Controls only need to be readable
87     insopts -m0744
88 swegener 1.8
89 nixphoeni 1.20 debug-print-section docs_install
90 swegener 1.8
91 nixphoeni 1.20 # Install some docs if so requested (and then delete them so they
92     # don't get copied into the installation directory)
93     [[ -n "${DOCS}" ]] && dodoc ${DOCS} && \
94     rm -f ${DOCS} \
95     debug-print "Installed and deleted ${DOCS}"
96     # LICENSE doesn't need to get installed if it exists
97     find . -name LICENSE -delete
98 swegener 1.8
99 nixphoeni 1.20 if [[ -n "${DESKLET_NAME}" ]]; then
100 swegener 1.8
101 nixphoeni 1.20 debug-print-section display_install
102 swegener 1.8
103 nixphoeni 1.11 # Base installation directory for displays from this desklet
104 nixphoeni 1.20 INSDIR="${GDESKLETS_INST_DIR}/Displays/${DESKLET_NAME}"
105 swegener 1.8
106 nixphoeni 1.20 debug-print "Installing into ${INSDIR}"
107     debug-print "Exiting Display-specific installation code"
108 swegener 1.8
109 nixphoeni 1.20 elif [[ -n "${CONTROL_NAME}" ]]; then
110 swegener 1.8
111 nixphoeni 1.20 debug-print-section control_install
112 swegener 1.8
113 nixphoeni 1.20 # Unique name for this Control and its interface
114     CTRL_DIRNAME=$( "${GDESKLETS_INST_DIR}/gdesklets-control-getid" `pwd` 2> /dev/null )
115     einfo "Installing Control ${CTRL_DIRNAME}"
116 swegener 1.8
117 nixphoeni 1.20 # Base installation directory for this Control
118     INSDIR="${GDESKLETS_INST_DIR}/Controls/${CTRL_DIRNAME}"
119     debug-print "Installing into ${INSDIR}"
120 swegener 1.8
121 nixphoeni 1.20 # Mercilessly delete all existing compiled code
122     find . -iname '*.py[co]' -delete
123 swegener 1.12
124 nixphoeni 1.20 debug-print "Exiting Control-specific installation code"
125 swegener 1.12
126 nixphoeni 1.20 else
127     die "nothing to install, is the ebuild written correctly?"
128     fi
129 swegener 1.8
130 nixphoeni 1.20 debug-print-section common_install
131 swegener 1.8
132 nixphoeni 1.20 # Create the proper subdirectory in the global Controls or
133     # Displays directory
134     dodir "${INSDIR}"
135     insinto "${INSDIR}"
136     doins -r *
137 swegener 1.8
138 nixphoeni 1.20 }
139 swegener 1.8
140 nixphoeni 1.20 # @FUNCTION: gdesklets_pkg_postinst
141     # @DESCRIPTION:
142     # Marks the Control for rebuilding on Python version change and
143     # compiles the Python code or display a useful message to the user,
144     # depending on which of CONTROL_NAME or DESKLET_NAME is set.
145     gdesklets_pkg_postinst() {
146    
147     # The only time compilation of python modules should occur is
148     # for Controls, since Displays are run from inside the sandbox
149     # (and therefore can't be compiled).
150     if [[ -n "${CONTROL_NAME}" ]]; then
151    
152     CTRL_DIRNAME=$( "${GDESKLETS_INST_DIR}/gdesklets-control-getid" `pwd` 2> /dev/null )
153     python_need_rebuild
154     python_mod_optimize "${GDESKLETS_INST_DIR}/Controls/${CTRL_DIRNAME}"
155    
156     else
157    
158     einfo "Each user can now add this desklet to their desktop through the"
159     einfo "gDesklets shell or the command line (.display files can be"
160     einfo "found in ${GDESKLETS_INST_DIR}/Displays/${DESKLET_NAME})."
161 swegener 1.8
162 nixphoeni 1.20 fi
163 swegener 1.8
164 obz 1.1 }
165    
166 nixphoeni 1.20 EXPORT_FUNCTIONS src_install pkg_postinst

  ViewVC Help
Powered by ViewVC 1.1.20