diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2010-01-20 18:46:02 +0000 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-01-20 18:46:02 +0000 |
commit | 22c29d8651668195f72e2f6a8e059d625eb511c3 (patch) | |
tree | dd1dd43f0ec47a9964c8a766eb8b3ad75cf51a64 /bitbake-dev/lib/bb/manifest.py | |
parent | 1bfd6edef9db9c9175058ae801d1b601e4f15263 (diff) | |
download | poky-22c29d8651668195f72e2f6a8e059d625eb511c3.tar.gz |
bitbake: Switch to bitbake-dev version (bitbake master upstream)
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake-dev/lib/bb/manifest.py')
-rw-r--r-- | bitbake-dev/lib/bb/manifest.py | 144 |
1 files changed, 0 insertions, 144 deletions
diff --git a/bitbake-dev/lib/bb/manifest.py b/bitbake-dev/lib/bb/manifest.py deleted file mode 100644 index 4e4b7d98ec..0000000000 --- a/bitbake-dev/lib/bb/manifest.py +++ /dev/null | |||
@@ -1,144 +0,0 @@ | |||
1 | # ex:ts=4:sw=4:sts=4:et | ||
2 | # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- | ||
3 | # | ||
4 | # Copyright (C) 2003, 2004 Chris Larson | ||
5 | # | ||
6 | # This program is free software; you can redistribute it and/or modify | ||
7 | # it under the terms of the GNU General Public License version 2 as | ||
8 | # published by the Free Software Foundation. | ||
9 | # | ||
10 | # This program is distributed in the hope that it will be useful, | ||
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | # GNU General Public License for more details. | ||
14 | # | ||
15 | # You should have received a copy of the GNU General Public License along | ||
16 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
17 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
18 | |||
19 | import os, sys | ||
20 | import bb, bb.data | ||
21 | |||
22 | def getfields(line): | ||
23 | fields = {} | ||
24 | fieldmap = ( "pkg", "src", "dest", "type", "mode", "uid", "gid", "major", "minor", "start", "inc", "count" ) | ||
25 | for f in xrange(len(fieldmap)): | ||
26 | fields[fieldmap[f]] = None | ||
27 | |||
28 | if not line: | ||
29 | return None | ||
30 | |||
31 | splitline = line.split() | ||
32 | if not len(splitline): | ||
33 | return None | ||
34 | |||
35 | try: | ||
36 | for f in xrange(len(fieldmap)): | ||
37 | if splitline[f] == '-': | ||
38 | continue | ||
39 | fields[fieldmap[f]] = splitline[f] | ||
40 | except IndexError: | ||
41 | pass | ||
42 | return fields | ||
43 | |||
44 | def parse (mfile, d): | ||
45 | manifest = [] | ||
46 | while 1: | ||
47 | line = mfile.readline() | ||
48 | if not line: | ||
49 | break | ||
50 | if line.startswith("#"): | ||
51 | continue | ||
52 | fields = getfields(line) | ||
53 | if not fields: | ||
54 | continue | ||
55 | manifest.append(fields) | ||
56 | return manifest | ||
57 | |||
58 | def emit (func, manifest, d): | ||
59 | #str = "%s () {\n" % func | ||
60 | str = "" | ||
61 | for line in manifest: | ||
62 | emittedline = emit_line(func, line, d) | ||
63 | if not emittedline: | ||
64 | continue | ||
65 | str += emittedline + "\n" | ||
66 | # str += "}\n" | ||
67 | return str | ||
68 | |||
69 | def mangle (func, line, d): | ||
70 | import copy | ||
71 | newline = copy.copy(line) | ||
72 | src = bb.data.expand(newline["src"], d) | ||
73 | |||
74 | if src: | ||
75 | if not os.path.isabs(src): | ||
76 | src = "${WORKDIR}/" + src | ||
77 | |||
78 | dest = newline["dest"] | ||
79 | if not dest: | ||
80 | return | ||
81 | |||
82 | if dest.startswith("/"): | ||
83 | dest = dest[1:] | ||
84 | |||
85 | if func is "do_install": | ||
86 | dest = "${D}/" + dest | ||
87 | |||
88 | elif func is "do_populate": | ||
89 | dest = "${WORKDIR}/install/" + newline["pkg"] + "/" + dest | ||
90 | |||
91 | elif func is "do_stage": | ||
92 | varmap = {} | ||
93 | varmap["${bindir}"] = "${STAGING_DIR}/${HOST_SYS}/bin" | ||
94 | varmap["${libdir}"] = "${STAGING_DIR}/${HOST_SYS}/lib" | ||
95 | varmap["${includedir}"] = "${STAGING_DIR}/${HOST_SYS}/include" | ||
96 | varmap["${datadir}"] = "${STAGING_DATADIR}" | ||
97 | |||
98 | matched = 0 | ||
99 | for key in varmap.keys(): | ||
100 | if dest.startswith(key): | ||
101 | dest = varmap[key] + "/" + dest[len(key):] | ||
102 | matched = 1 | ||
103 | if not matched: | ||
104 | newline = None | ||
105 | return | ||
106 | else: | ||
107 | newline = None | ||
108 | return | ||
109 | |||
110 | newline["src"] = src | ||
111 | newline["dest"] = dest | ||
112 | return newline | ||
113 | |||
114 | def emit_line (func, line, d): | ||
115 | import copy | ||
116 | newline = copy.deepcopy(line) | ||
117 | newline = mangle(func, newline, d) | ||
118 | if not newline: | ||
119 | return None | ||
120 | |||
121 | str = "" | ||
122 | type = newline["type"] | ||
123 | mode = newline["mode"] | ||
124 | src = newline["src"] | ||
125 | dest = newline["dest"] | ||
126 | if type is "d": | ||
127 | str = "install -d " | ||
128 | if mode: | ||
129 | str += "-m %s " % mode | ||
130 | str += dest | ||
131 | elif type is "f": | ||
132 | if not src: | ||
133 | return None | ||
134 | if dest.endswith("/"): | ||
135 | str = "install -d " | ||
136 | str += dest + "\n" | ||
137 | str += "install " | ||
138 | else: | ||
139 | str = "install -D " | ||
140 | if mode: | ||
141 | str += "-m %s " % mode | ||
142 | str += src + " " + dest | ||
143 | del newline | ||
144 | return str | ||