1 # ex:ts=4:sw=4:sts=4:et
2 # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
4 # Copyright (C) 2003, 2004 Chris Larson
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.
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.
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.
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
31 splitline = line.split()
32 if not len(splitline):
36 for f in xrange(len(fieldmap)):
37 if splitline[f] == '-':
39 fields[fieldmap[f]] = splitline[f]
47 line = mfile.readline()
50 if line.startswith("#"):
52 fields = getfields(line)
55 manifest.append(fields)
58 def emit (func, manifest, d):
59 #str = "%s () {\n" % func
62 emittedline = emit_line(func, line, d)
65 str += emittedline + "\n"
69 def mangle (func, line, d):
71 newline = copy.copy(line)
72 src = bb.data.expand(newline["src"], d)
75 if not os.path.isabs(src):
76 src = "${WORKDIR}/" + src
78 dest = newline["dest"]
82 if dest.startswith("/"):
85 if func is "do_install":
88 elif func is "do_populate":
89 dest = "${WORKDIR}/install/" + newline["pkg"] + "/" + dest
91 elif func is "do_stage":
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}"
99 for key in varmap.keys():
100 if dest.startswith(key):
101 dest = varmap[key] + "/" + dest[len(key):]
111 newline["dest"] = dest
114 def emit_line (func, line, d):
116 newline = copy.deepcopy(line)
117 newline = mangle(func, newline, d)
122 type = newline["type"]
123 mode = newline["mode"]
125 dest = newline["dest"]
129 str += "-m %s " % mode
134 if dest.endswith("/"):
141 str += "-m %s " % mode
142 str += src + " " + dest