1 |
commit: c4fedcc829ef955b8e8e1e2c4cad7ed62ab58d99 |
2 |
Author: Jauhien Piatlicki (jauhien) <piatlicki <AT> gmail <DOT> com> |
3 |
AuthorDate: Thu Aug 29 01:03:20 2013 +0000 |
4 |
Commit: Jauhien Piatlicki <piatlicki <AT> gmail <DOT> com> |
5 |
CommitDate: Thu Aug 29 01:03:20 2013 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/g-sorcery.git;a=commit;h=c4fedcc8 |
7 |
|
8 |
refactoring of eclasses |
9 |
|
10 |
--- |
11 |
g_sorcery/data/g-sorcery.eclass | 49 ++++++++++++++++++++++++++ |
12 |
g_sorcery/eclass.py | 32 +++++++++-------- |
13 |
gs_elpa/data/{g-elpa.eclass => gs-elpa.eclass} | 41 ++++++--------------- |
14 |
gs_elpa/ebuild.py | 4 +-- |
15 |
gs_elpa/elpa_db.py | 2 +- |
16 |
5 files changed, 80 insertions(+), 48 deletions(-) |
17 |
|
18 |
diff --git a/g_sorcery/data/g-sorcery.eclass b/g_sorcery/data/g-sorcery.eclass |
19 |
new file mode 100644 |
20 |
index 0000000..68635e0 |
21 |
--- /dev/null |
22 |
+++ b/g_sorcery/data/g-sorcery.eclass |
23 |
@@ -0,0 +1,49 @@ |
24 |
+# Copyright 1999-2013 Gentoo Foundation |
25 |
+# Distributed under the terms of the GNU General Public License v2 |
26 |
+# $Header: $ |
27 |
+# automatically generated by g-sorcery |
28 |
+# please do not edit this file |
29 |
+# |
30 |
+# Original Author: Jauhien Piatlicki <piatlicki@×××××.com> |
31 |
+# Purpose: base routines for g-sorcery backends' eclasses |
32 |
+# |
33 |
+# Bugs to piatlicki@×××××.com |
34 |
+# |
35 |
+# @ECLASS: g-sorcery.eclass |
36 |
+# |
37 |
+# @ECLASS-VARIABLE: REPO_URI |
38 |
+# @DESCRIPTION: address of a repository with sources |
39 |
+# |
40 |
+# @ECLASS-VARIABLE: DIGEST_SOURCES |
41 |
+# @DESCRIPTION: whether manifest for sources exists |
42 |
+# |
43 |
+# @ECLASS-VARIABLE: SOURCEFILE |
44 |
+# @DESCRIPTION: source file name |
45 |
+# |
46 |
+# @ECLASS-VARIABLE: GSORCERY_STORE_DIR |
47 |
+# @DESCRIPTION: store location for downloaded sources |
48 |
+GSORCERY_STORE_DIR="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}" |
49 |
+# |
50 |
+# @ECLASS-VARIABLE: GSORCERY_FETCH_CMD |
51 |
+# @DESCRIPTION: fetch command |
52 |
+GSORCERY_FETCH_CMD="wget" |
53 |
+ |
54 |
+EXPORT_FUNCTIONS src_unpack |
55 |
+ |
56 |
+g-sorcery_fetch() { |
57 |
+ addwrite "${GSORCERY_STORE_DIR}" |
58 |
+ pushd "${GSORCERY_STORE_DIR}" >/dev/null || die "can't chdir to ${GSORCERY_STORE_DIR}" |
59 |
+ if [[ ! -f "${SOURCEFILE}" ]]; then |
60 |
+ $GSORCERY_FETCH_CMD ${REPO_URI}${SOURCEFILE} || die |
61 |
+ fi |
62 |
+ popd >/dev/null || die |
63 |
+} |
64 |
+ |
65 |
+g-sorcery_src_unpack() { |
66 |
+ if [[ x${DIGEST_SOURCES} = x ]]; then |
67 |
+ g-sorcery_fetch |
68 |
+ fi |
69 |
+ |
70 |
+ cp ${GSORCERY_STORE_DIR}/${SOURCEFILE} . || die |
71 |
+ unpack ./${SOURCEFILE} |
72 |
+} |
73 |
|
74 |
diff --git a/g_sorcery/eclass.py b/g_sorcery/eclass.py |
75 |
index 5fe2f6f..0ebaf6c 100644 |
76 |
--- a/g_sorcery/eclass.py |
77 |
+++ b/g_sorcery/eclass.py |
78 |
@@ -15,6 +15,7 @@ import glob |
79 |
import os |
80 |
|
81 |
from .exceptions import EclassError |
82 |
+from .fileutils import get_pkgpath |
83 |
|
84 |
class EclassGenerator(object): |
85 |
""" |
86 |
@@ -35,10 +36,13 @@ class EclassGenerator(object): |
87 |
List of all eclasses with string entries. |
88 |
""" |
89 |
result = [] |
90 |
- if self.eclass_dir: |
91 |
- for f_name in glob.iglob(os.path.join(self.eclass_dir, '*.eclass')): |
92 |
- result.append(os.path.basename(f_name)[:-7]) |
93 |
- return result |
94 |
+ |
95 |
+ for directory in [self.eclass_dir, os.path.join(get_pkgpath(), 'data')]: |
96 |
+ if directory: |
97 |
+ for f_name in glob.iglob(os.path.join(directory, '*.eclass')): |
98 |
+ result.append(os.path.basename(f_name)[:-7]) |
99 |
+ |
100 |
+ return list(set(result)) |
101 |
|
102 |
def generate(self, eclass): |
103 |
""" |
104 |
@@ -50,13 +54,13 @@ class EclassGenerator(object): |
105 |
Returns: |
106 |
Eclass source as a list of strings. |
107 |
""" |
108 |
- if not self.eclass_dir: |
109 |
- EclassError('No eclass dir') |
110 |
- f_name = os.path.join(self.eclass_dir, eclass + '.eclass') |
111 |
- if not os.path.isfile(f_name): |
112 |
- EclassError('No eclass ' + eclass) |
113 |
- with open(f_name, 'r') as f: |
114 |
- eclass = f.read().split('\n') |
115 |
- if eclass[-1] == '': |
116 |
- eclass = eclass[:-1] |
117 |
- return eclass |
118 |
+ for directory in [self.eclass_dir, os.path.join(get_pkgpath(), 'data')]: |
119 |
+ f_name = os.path.join(directory, eclass + '.eclass') |
120 |
+ if os.path.isfile(f_name): |
121 |
+ with open(f_name, 'r') as f: |
122 |
+ eclass = f.read().split('\n') |
123 |
+ if eclass[-1] == '': |
124 |
+ eclass = eclass[:-1] |
125 |
+ return eclass |
126 |
+ |
127 |
+ raise EclassError('No eclass ' + eclass) |
128 |
|
129 |
diff --git a/gs_elpa/data/g-elpa.eclass b/gs_elpa/data/gs-elpa.eclass |
130 |
similarity index 57% |
131 |
rename from gs_elpa/data/g-elpa.eclass |
132 |
rename to gs_elpa/data/gs-elpa.eclass |
133 |
index ad9bb65..2a621f4 100644 |
134 |
--- a/gs_elpa/data/g-elpa.eclass |
135 |
+++ b/gs_elpa/data/gs-elpa.eclass |
136 |
@@ -1,16 +1,16 @@ |
137 |
# Copyright 1999-2013 Gentoo Foundation |
138 |
# Distributed under the terms of the GNU General Public License v2 |
139 |
# $Header: $ |
140 |
-# automatically generated by g-elpa |
141 |
+# automatically generated by gs-elpa |
142 |
# please do not edit this file |
143 |
# |
144 |
# Original Author: Jauhien Piatlicki <piatlicki@×××××.com> |
145 |
# Purpose: support installation of elisp packages for emacs |
146 |
-# from overlays generated by g-elpa |
147 |
+# from overlays generated by gs-elpa |
148 |
# |
149 |
# Bugs to piatlicki@×××××.com |
150 |
# |
151 |
-# @ECLASS: g-elpa.eclass |
152 |
+# @ECLASS: gs-elpa.eclass |
153 |
# |
154 |
# @ECLASS-VARIABLE: REPO_URI |
155 |
# @DESCRIPTION: address of a repository of elisp packages |
156 |
@@ -24,15 +24,8 @@ |
157 |
# @ECLASS-VARIABLE: REALNAME |
158 |
# @DESCRIPTION: real name of a package in the repository |
159 |
# |
160 |
-# @ECLASS-VARIABLE: GELPA_STORE_DIR |
161 |
-# @DESCRIPTION: store location for downloaded sources |
162 |
-GELPA_STORE_DIR="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}" |
163 |
-# |
164 |
-# @ECLASS-VARIABLE: GELPA_FETCH_CMD |
165 |
-# @DESCRIPTION: fetch command |
166 |
-GELPA_FETCH_CMD="wget" |
167 |
|
168 |
-inherit elisp |
169 |
+inherit elisp g-sorcery |
170 |
|
171 |
EXPORT_FUNCTIONS src_{unpack,compile,install} |
172 |
|
173 |
@@ -44,35 +37,21 @@ fi |
174 |
|
175 |
SOURCEFILE=${REALNAME}-${PV}.${SUFFIX} |
176 |
|
177 |
-g-elpa_fetch() { |
178 |
- addwrite "${GELPA_STORE_DIR}" |
179 |
- pushd "${GELPA_STORE_DIR}" >/dev/null || die "can't chdir to ${GELPA_STORE_DIR}" |
180 |
- if [[ ! -f "${SOURCEFILE}" ]]; then |
181 |
- $GELPA_FETCH_CMD ${REPO_URI}${SOURCEFILE} || die |
182 |
- fi |
183 |
- popd >/dev/null || die |
184 |
-} |
185 |
- |
186 |
-g-elpa_src_unpack() { |
187 |
- if [[ x${DIGEST_SOURCES} = x ]]; then |
188 |
- g-elpa_fetch |
189 |
- fi |
190 |
- |
191 |
- if [[ ${SOURCE_TYPE} != "single" ]]; then |
192 |
- tar xvf ${GELPA_STORE_DIR}/${SOURCEFILE} || die |
193 |
- else |
194 |
+gs-elpa_src_unpack() { |
195 |
+ g-sorcery_src_unpack |
196 |
+ if [[ ${SOURCE_TYPE} = "single" ]]; then |
197 |
mkdir ${P} || die |
198 |
- cp ${GELPA_STORE_DIR}/${SOURCEFILE} ./${P} || die |
199 |
+ mv ./${SOURCEFILE} ./${P} || die |
200 |
fi |
201 |
} |
202 |
|
203 |
-g-elpa_src_compile() { |
204 |
+gs-elpa_src_compile() { |
205 |
rm -f ${PN}-pkg.el || die |
206 |
elisp-make-autoload-file || die |
207 |
elisp_src_compile || die |
208 |
} |
209 |
|
210 |
-g-elpa_src_install() { |
211 |
+gs-elpa_src_install() { |
212 |
local sitefile="50${PN}-gentoo.el" |
213 |
cat <<EOF >> ${sitefile} || die |
214 |
(add-to-list 'load-path "@SITELISP@") |
215 |
|
216 |
diff --git a/gs_elpa/ebuild.py b/gs_elpa/ebuild.py |
217 |
index e7fd502..460ccfa 100644 |
218 |
--- a/gs_elpa/ebuild.py |
219 |
+++ b/gs_elpa/ebuild.py |
220 |
@@ -29,7 +29,7 @@ class ElpaEbuildWithDigestGenerator(DefaultEbuildGenerator): |
221 |
vars_before_inherit = \ |
222 |
["repo_uri", "source_type", "realname", ("digest_sources", "yes")] |
223 |
|
224 |
- inherit = ["g-elpa"] |
225 |
+ inherit = ["g-sorcery", "gs-elpa"] |
226 |
|
227 |
vars_after_description = \ |
228 |
["homepage", ("src_uri", "${REPO_URI}${REALNAME}-${PV}.${SUFFIX}")] |
229 |
@@ -51,7 +51,7 @@ class ElpaEbuildWithoutDigestGenerator(DefaultEbuildGenerator): |
230 |
vars_before_inherit = \ |
231 |
["repo_uri", "source_type", "realname"] |
232 |
|
233 |
- inherit = ["g-elpa"] |
234 |
+ inherit = ["g-sorcery", "gs-elpa"] |
235 |
|
236 |
vars_after_description = \ |
237 |
["homepage"] |
238 |
|
239 |
diff --git a/gs_elpa/elpa_db.py b/gs_elpa/elpa_db.py |
240 |
index b7ffefb..8f8cd6d 100644 |
241 |
--- a/gs_elpa/elpa_db.py |
242 |
+++ b/gs_elpa/elpa_db.py |
243 |
@@ -107,7 +107,7 @@ class ElpaDBGenerator(DBGenerator): |
244 |
'repo_uri' : repo_uri, |
245 |
'realname' : realname, |
246 |
#eclass entry |
247 |
- 'eclasses' : ['g-elpa'], |
248 |
+ 'eclasses' : ['g-sorcery', 'gs-elpa'], |
249 |
#metadata entries |
250 |
'maintainer' : [{'email' : 'piatlicki@×××××.com', |
251 |
'name' : 'Jauhien Piatlicki'}], |