1 |
On 17:07 Tue 04 Dec , Jim Ramsay (lack) wrote: |
2 |
> Revision Changes Path |
3 |
> 1.1 eclass/rox-0install.eclass |
4 |
> |
5 |
> file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/rox-0install.eclass?rev=1.1&view=markup |
6 |
> plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/rox-0install.eclass?rev=1.1&content-type=text/plain |
7 |
|
8 |
I don't remember this going by gentoo-dev. Always send eclasses to |
9 |
gentoo-dev before committing them. |
10 |
|
11 |
> Index: rox-0install.eclass |
12 |
> =================================================================== |
13 |
> # Copyright 1999-2004 Gentoo Foundation |
14 |
> # Distributed under the terms of the GNU General Public License v2 |
15 |
> # $Header: /var/cvsroot/gentoo-x86/eclass/rox-0install.eclass,v 1.1 2007/12/04 17:07:52 lack Exp $ |
16 |
> |
17 |
> # ROX-0install eclass Version 1 |
18 |
> |
19 |
> # Created by Jim Ramsay (lack@g.o) to ease installation of ROX desktop |
20 |
> # applications and integrate this with zeroinstall-injector |
21 |
> # (http://0install.net) |
22 |
> |
23 |
> # These variables are only used inside functions, and so may be set anywhere in |
24 |
> # the ebuild: |
25 |
> # |
26 |
> # ZEROINSTALL_STRIP_REQUIRES - this flag, if set, will force the local |
27 |
> # zeroinstall feed to have all its 'requires' directives stripped out |
28 |
> # LOCAL_FEED_SRC - The ebuild-supplied native feed, for those packages which do |
29 |
> # not already contain one. By default we check for ${APPNAME}.xml and |
30 |
> # ${APPNAME}/${APPNAME}.xml |
31 |
> |
32 |
> # This is an extension of rox.eclass |
33 |
> inherit rox |
34 |
> |
35 |
> DEPEND="${DEPEND} |
36 |
> rox-base/zeroinstall-injector" |
37 |
> |
38 |
> # Some locations for ZEROINSTALL |
39 |
> NATIVE_FEED_DIR="/usr/share/0install.net/native_feeds" |
40 |
> ICON_CACHE_DIR="/var/cache/0install.net/interface_icons" |
41 |
> |
42 |
> # Does all the 0install local feed magic you could want: |
43 |
> # - Parses the input file to get the interface URI |
44 |
> # - Edits the input file and installs it to the final location |
45 |
> # - Installs a local feed pointer |
46 |
> # |
47 |
> # Environment variables: |
48 |
> # ZEROINSTALL_STRIP_REQUIRES - If set, strips all 'requires' sections from the XML |
49 |
> # on editing. Default: Not set |
50 |
> # |
51 |
> # 0install_native_feed <src> <destpath> |
52 |
> # src - The XML file we will edit, install, and point at |
53 |
> # path - The path where the implementation will be installed |
54 |
> # IE, the final edited xml will be at <path>/<basename of src> |
55 |
> 0install_native_feed() { |
56 |
> local src="${1}"; shift |
57 |
> local path="${1}"; shift |
58 |
|
59 |
This is a rather strange paradigm to me, instead of: |
60 |
|
61 |
local src=$1 path=$2 |
62 |
shift 2 |
63 |
|
64 |
> local feedfile=$(basename "${src}") |
65 |
|
66 |
You could do this in pure bash, although it doesn't really matter: |
67 |
|
68 |
local feedfile=${src##*/} |
69 |
|
70 |
> local dest="${path}/$feedfile" |
71 |
|
72 |
How do you decide when not to use braces { } around variables? |
73 |
|
74 |
> 0distutils "${src}" > tmp.native_feed || die "0distutils feed edit failed" |
75 |
> |
76 |
> if [[ ${ZEROINSTALL_STRIP_REQUIRES} ]]; then |
77 |
> # Strip out all 'requires' sections |
78 |
> sed -i -e '/<requires.*\/>/d' \ |
79 |
> -e '/<requires.*\>/,/<\/requires>/d' tmp.native_feed |
80 |
|
81 |
What happens if the contents of a <requires> section are on a separate |
82 |
line? Is this a concern? |
83 |
|
84 |
> fi |
85 |
> |
86 |
> ( |
87 |
> insinto ${path} |
88 |
> newins tmp.native_feed ${feedfile} |
89 |
> ) |
90 |
> |
91 |
> local feedname |
92 |
|
93 |
You could just declare feedname local and set it in the same line. |
94 |
|
95 |
> feedname=$(0distutils -e "${src}") || "0distutils URI escape failed" |
96 |
|
97 |
What's the || doing? You've got a string sitting there. Is 'die' |
98 |
missing? |
99 |
|
100 |
> dosym "${dest}" "${NATIVE_FEED_DIR}/${feedname}" |
101 |
> |
102 |
> local cachedname |
103 |
> cachedname=$(0distutils -c "${src}") || "0distutils URI escape failed" |
104 |
|
105 |
Same questions. |
106 |
|
107 |
> dosym "${path}/.DirIcon" "${ICON_CACHE_DIR}/${cachedname}" |
108 |
> } |
109 |
> |
110 |
> # Exported functions |
111 |
> rox-0install_src_install() { |
112 |
> # First do the regular Rox install |
113 |
> rox_src_install |
114 |
> |
115 |
> # Now search for the feed, and install it if found. |
116 |
> local search_list="${LOCAL_FEED_SRC} ${APPNAME}/${APPNAME}.xml ${APPNAME}.xml" |
117 |
> local installed=false |
118 |
> for feed in ${search_list}; do |
119 |
> if [[ -f "${feed}" ]]; then |
120 |
> 0install_native_feed "${feed}" "${APPDIR}/${APPNAME}" |
121 |
> installed=true |
122 |
> break |
123 |
> fi |
124 |
> done |
125 |
> |
126 |
> if ! $installed; then |
127 |
|
128 |
This is kind of a weird way to do it. I'd check instead for |
129 |
[[ -n ${installed} ]] and initialize it to empty. |
130 |
|
131 |
> ewarn "No native feed found - This application will not be found by 0launch." |
132 |
> fi |
133 |
> } |
134 |
> |
135 |
> EXPORT_FUNCTIONS src_install |
136 |
|
137 |
Thanks, |
138 |
Donnie |
139 |
-- |
140 |
gentoo-dev@g.o mailing list |