7 if bb.data.inherits_class('rootfs_rpm', d):
8 rootfsdepends = d.getVarFlag("do_rootfs", "depends", True)
9 rootfsdepends = rootfsdepends.replace("rpmresolve-native:do_populate_sysroot", "")
10 d.setVarFlag("do_rootfs", "depends", rootfsdepends)
13 # MANIFESTFILES_<pn> is the Tizen Smack .manifest file to be used for a binary .rpm.
14 # It must be part of the source tree (either at the root or in a sub-directory)
15 # or get created there during configure. Out-of-tree compilation is not supported.
17 # Enable extra code for the binary .rpm spec files which injects the %manifest
18 # lines for each package.
19 RPM_EXTRA_PKGDATA = "1"
20 def package_rpm_extra_pkgdata(splitname, spec_file, d):
21 if d.getVar('MANIFESTFILES', True):
22 # Must use .manifest files at the location where tizen_copy_manifest() put it.
23 spec_file.append('%%manifest ../packages-split/%s' % (d.getVar('MANIFESTFILES', True)))
25 fetch = bb.fetch2.Fetch([], d)
26 for url in fetch.urls:
27 local = fetch.localpath(url)
28 base = os.path.basename(local)
29 if base.endswith('.manifest.in'):
33 if manifest.endswith('.manifest'):
34 urldata = fetch.ud[url]
35 if 'pkg' in urldata.parm:
36 pkg = urldata.parm['pkg'].split(',')
37 enabled = splitname in pkg or not pkg
41 # Optionally replace placeholders with content of the corresponding variables,
42 # otherwise just copy to a place where rpm can find it. Absolute paths
43 # refering to a file on the host do not work, because rpm interprets them
44 # relative to the build dir.
45 content = open(local).read()
50 # Must be a known variable.
51 return d.getVar(word, True)
52 content = re.sub('@([a-zA-Z0-9_]+)@', replace, content)
53 # Create relative to _builddir = $S, see package_rpm.bbclass/do_package_rpm ().
54 dvar = d.getVar('S', True)
55 copy = os.path.join(dvar, manifest)
57 if not os.path.exists(dvar):
62 spec_file.append('%%manifest %s' % manifest)
65 # Copies manifest files from source to packages-split. Necessary because
66 # source is not always available during packaging (for example, when
67 # using sstate), only $PKGDEST is.
68 PACKAGESPLITFUNCS_append = " tizen_copy_manifest"
69 python tizen_copy_manifest () {
70 dest = d.getVar('S', True)
71 dvar = d.getVar('PKGDEST', True)
73 packages = d.getVar('PACKAGES', True)
74 for pkg in packages.split():
75 manifest_path=d.getVar('MANIFESTFILES_%s' % pkg, True)
77 manifest_dir = os.path.dirname(manifest_path)
80 cmd = 'mkdir -p %s/%s' % (dvar,manifest_dir)
81 (retval, output) = oe.utils.getstatusoutput(cmd)
83 bb.fatal("directory failed to be created with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else ""))
85 cmd = 'cp %s/%s %s/%s' % (dest, manifest_path , dvar,manifest_dir)
87 (retval, output) = oe.utils.getstatusoutput(cmd)
89 bb.fatal("file copy failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else ""))