/[gentoo-x86]/eclass/rox-0install.eclass
Gentoo

Contents of /eclass/rox-0install.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download)
Tue Dec 27 17:55:12 2011 UTC (2 years, 6 months ago) by fauli
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +2 -2 lines
Update copyright years in headers

1 # Copyright 1999-2011 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/rox-0install.eclass,v 1.3 2011/08/29 01:28:10 vapier Exp $
4
5 # ROX-0install eclass Version 1
6
7 # Created by Jim Ramsay (lack@gentoo.org) to ease installation of ROX desktop
8 # applications and integrate this with zeroinstall-injector
9 # (http://0install.net)
10
11 # These variables are only used inside functions, and so may be set anywhere in
12 # the ebuild:
13 #
14 # ZEROINSTALL_STRIP_REQUIRES - this flag, if set, will force the local
15 # zeroinstall feed to have all its 'requires' directives stripped out
16 # LOCAL_FEED_SRC - The ebuild-supplied native feed, for those packages which do
17 # not already contain one. By default we check for ${APPNAME}.xml and
18 # ${APPNAME}/${APPNAME}.xml
19
20 # This is an extension of rox.eclass
21 inherit rox
22
23 DEPEND="${DEPEND}
24 >=rox-base/zeroinstall-injector-0.31"
25
26 # Some locations for ZEROINSTALL
27 NATIVE_FEED_DIR="/usr/share/0install.net/native_feeds"
28 ICON_CACHE_DIR="/var/cache/0install.net/interface_icons"
29
30 # Does all the 0install local feed magic you could want:
31 # - Parses the input file to get the interface URI
32 # - Edits the input file and installs it to the final location
33 # - Installs a local feed pointer
34 #
35 # Environment variables:
36 # ZEROINSTALL_STRIP_REQUIRES - If set, strips all 'requires' sections from the XML
37 # on editing. Default: Not set
38 #
39 # 0install_native_feed <src> <destpath>
40 # src - The XML file we will edit, install, and point at
41 # path - The path where the implementation will be installed
42 # IE, the final edited xml will be at <path>/<basename of src>
43 0install_native_feed() {
44 local src=$1 path=$2
45 local feedfile=${src##*/}
46 local dest="${path}/${feedfile}"
47
48 0distutils "${src}" > tmp.native_feed || die "0distutils feed edit failed"
49
50 if [[ ${ZEROINSTALL_STRIP_REQUIRES} ]]; then
51 # Strip out all 'requires' sections
52 sed -i -e '/<requires.*\/>/d' \
53 -e '/<requires.*\>/,/<\/requires>/d' tmp.native_feed
54 fi
55
56 (
57 insinto ${path}
58 newins tmp.native_feed ${feedfile}
59 )
60
61 local feedname
62 feedname=$(0distutils -e "${src}") || die "0distutils URI escape failed"
63 dosym "${dest}" "${NATIVE_FEED_DIR}/${feedname}"
64
65 local cachedname
66 cachedname=$(0distutils -c "${src}") || die "0distutils URI escape failed"
67 dosym "${path}/.DirIcon" "${ICON_CACHE_DIR}/${cachedname}"
68 }
69
70 # Exported functions
71 rox-0install_src_install() {
72 # First do the regular Rox install
73 rox_src_install
74
75 # Now search for the feed, and install it if found.
76 local search_list="${LOCAL_FEED_SRC} ${APPNAME}/${APPNAME}.xml ${APPNAME}.xml"
77 local installed=""
78 for feed in ${search_list}; do
79 if [[ -f "${feed}" ]]; then
80 0install_native_feed "${feed}" "${APPDIR}/${APPNAME}"
81 installed="true"
82 break
83 fi
84 done
85
86 if [[ -z ${installed} ]]; then
87 ewarn "No native feed found - This application will not be found by 0launch."
88 fi
89 }
90
91 EXPORT_FUNCTIONS src_install

  ViewVC Help
Powered by ViewVC 1.1.20