summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurentiu Palcu <laurentiu.palcu@intel.com>2014-01-22 13:53:50 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-02-11 11:53:39 +0000
commitb91e800764be6806b691078143ffc2b049d695d1 (patch)
tree4a98520e392fe0097c3e7233fd2e87b974e8b067
parentaaa92a67d8b78df548d5170f76b8f790b68812d3 (diff)
downloadpoky-b91e800764be6806b691078143ffc2b049d695d1.tar.gz
lib/oe/manifest.py: create manifests for SDK too
This commit contains several changes: * it is possible to create manifests for following types of images: regular image, target SDK and host SDK. To distinguish between these types of manifests, one has to pass the manifest_type argument to the contructor or create_manifest() wrapper. The manifest type can have the following values: image, sdk_host, sdk_target; * move image_rootfs variable to _create_dummy_initial() since it's used only here. This function will probably be removed in the future; * fix a bug in the Dpkg class; * add INSTALL_ORDER property to Manifest class which contains the default install order for the packages and will be used Rootfs/Sdk classes; (From OE-Core rev: a8c1b7504bf9cd5625fdecfdc3c3adce53aa164c) Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oe/manifest.py75
1 files changed, 57 insertions, 18 deletions
diff --git a/meta/lib/oe/manifest.py b/meta/lib/oe/manifest.py
index 4f61cb9d8c..e6338981c3 100644
--- a/meta/lib/oe/manifest.py
+++ b/meta/lib/oe/manifest.py
@@ -14,6 +14,33 @@ class Manifest(object):
14 PKG_TYPE_LANGUAGE = "lgp" 14 PKG_TYPE_LANGUAGE = "lgp"
15 PKG_TYPE_ATTEMPT_ONLY = "aop" 15 PKG_TYPE_ATTEMPT_ONLY = "aop"
16 16
17 MANIFEST_TYPE_IMAGE = "image"
18 MANIFEST_TYPE_SDK_HOST = "sdk_host"
19 MANIFEST_TYPE_SDK_TARGET = "sdk_target"
20
21 var_maps = {
22 MANIFEST_TYPE_IMAGE: {
23 "PACKAGE_INSTALL": PKG_TYPE_MUST_INSTALL,
24 "PACKAGE_INSTALL_ATTEMPTONLY": PKG_TYPE_ATTEMPT_ONLY,
25 "LINGUAS_INSTALL": PKG_TYPE_LANGUAGE
26 },
27 MANIFEST_TYPE_SDK_HOST: {
28 "TOOLCHAIN_HOST_TASK": PKG_TYPE_MUST_INSTALL,
29 "TOOLCHAIN_HOST_TASK_ATTEMPTONLY": PKG_TYPE_ATTEMPT_ONLY
30 },
31 MANIFEST_TYPE_SDK_TARGET: {
32 "TOOLCHAIN_TARGET_TASK": PKG_TYPE_MUST_INSTALL,
33 "TOOLCHAIN_TARGET_ATTEMPTONLY": PKG_TYPE_ATTEMPT_ONLY
34 }
35 }
36
37 INSTALL_ORDER = [
38 PKG_TYPE_LANGUAGE,
39 PKG_TYPE_MUST_INSTALL,
40 PKG_TYPE_ATTEMPT_ONLY,
41 PKG_TYPE_MULTILIB
42 ]
43
17 initial_manifest_file_header = \ 44 initial_manifest_file_header = \
18 "# This file was generated automatically and contains the packages\n" \ 45 "# This file was generated automatically and contains the packages\n" \
19 "# passed on to the package manager in order to create the rootfs.\n\n" \ 46 "# passed on to the package manager in order to create the rootfs.\n\n" \
@@ -26,29 +53,37 @@ class Manifest(object):
26 "# 'mlp' = multilib package\n" \ 53 "# 'mlp' = multilib package\n" \
27 "# 'lgp' = language package\n\n" 54 "# 'lgp' = language package\n\n"
28 55
29 def __init__(self, d, manifest_dir=None): 56 def __init__(self, d, manifest_dir=None, manifest_type=MANIFEST_TYPE_IMAGE):
30 self.d = d 57 self.d = d
31 self.image_rootfs = d.getVar('IMAGE_ROOTFS', True) 58 self.manifest_type = manifest_type
32 59
33 if manifest_dir is None: 60 if manifest_dir is None:
34 self.manifest_dir = self.d.getVar('WORKDIR', True) 61 if manifest_type != self.MANIFEST_TYPE_IMAGE:
62 self.manifest_dir = self.d.getVar('SDK_DIR', True)
63 else:
64 self.manifest_dir = self.d.getVar('WORKDIR', True)
35 else: 65 else:
36 self.manifest_dir = manifest_dir 66 self.manifest_dir = manifest_dir
37 67
38 self.initial_manifest = os.path.join(self.manifest_dir, "initial_manifest") 68 bb.utils.mkdirhier(self.manifest_dir)
39 self.final_manifest = os.path.join(self.manifest_dir, "final_manifest") 69
70 self.initial_manifest = os.path.join(self.manifest_dir, "%s_initial_manifest" % manifest_type)
71 self.final_manifest = os.path.join(self.manifest_dir, "%s_final_manifest" % manifest_type)
40 72
41 self.var_map = {"PACKAGE_INSTALL": self.PKG_TYPE_MUST_INSTALL, 73 # packages in the following vars will be split in 'must install' and
42 "PACKAGE_INSTALL_ATTEMPTONLY": self.PKG_TYPE_ATTEMPT_ONLY, 74 # 'multilib'
43 "LINGUAS_INSTALL": self.PKG_TYPE_LANGUAGE} 75 self.vars_to_split = ["PACKAGE_INSTALL",
76 "TOOLCHAIN_HOST_TASK",
77 "TOOLCHAIN_TARGET_TASK"]
44 78
45 """ 79 """
46 This creates a standard initial manifest for core-image-(minimal|sato|sato-sdk). 80 This creates a standard initial manifest for core-image-(minimal|sato|sato-sdk).
47 This will be used for testing until the class is implemented properly! 81 This will be used for testing until the class is implemented properly!
48 """ 82 """
49 def _create_dummy_initial(self): 83 def _create_dummy_initial(self):
84 image_rootfs = self.d.getVar('IMAGE_ROOTFS', True)
50 pkg_list = dict() 85 pkg_list = dict()
51 if self.image_rootfs.find("core-image-sato-sdk") > 0: 86 if image_rootfs.find("core-image-sato-sdk") > 0:
52 pkg_list[self.PKG_TYPE_MUST_INSTALL] = \ 87 pkg_list[self.PKG_TYPE_MUST_INSTALL] = \
53 "packagegroup-core-x11-sato-games packagegroup-base-extended " \ 88 "packagegroup-core-x11-sato-games packagegroup-base-extended " \
54 "packagegroup-core-x11-sato packagegroup-core-x11-base " \ 89 "packagegroup-core-x11-sato packagegroup-core-x11-base " \
@@ -60,14 +95,14 @@ class Manifest(object):
60 "packagegroup-core-ssh-openssh dpkg kernel-dev" 95 "packagegroup-core-ssh-openssh dpkg kernel-dev"
61 pkg_list[self.PKG_TYPE_LANGUAGE] = \ 96 pkg_list[self.PKG_TYPE_LANGUAGE] = \
62 "locale-base-en-us locale-base-en-gb" 97 "locale-base-en-us locale-base-en-gb"
63 elif self.image_rootfs.find("core-image-sato") > 0: 98 elif image_rootfs.find("core-image-sato") > 0:
64 pkg_list[self.PKG_TYPE_MUST_INSTALL] = \ 99 pkg_list[self.PKG_TYPE_MUST_INSTALL] = \
65 "packagegroup-core-ssh-dropbear packagegroup-core-x11-sato-games " \ 100 "packagegroup-core-ssh-dropbear packagegroup-core-x11-sato-games " \
66 "packagegroup-core-x11-base psplash apt dpkg packagegroup-base-extended " \ 101 "packagegroup-core-x11-base psplash apt dpkg packagegroup-base-extended " \
67 "packagegroup-core-x11-sato packagegroup-core-boot" 102 "packagegroup-core-x11-sato packagegroup-core-boot"
68 pkg_list['lgp'] = \ 103 pkg_list['lgp'] = \
69 "locale-base-en-us locale-base-en-gb" 104 "locale-base-en-us locale-base-en-gb"
70 elif self.image_rootfs.find("core-image-minimal") > 0: 105 elif image_rootfs.find("core-image-minimal") > 0:
71 pkg_list[self.PKG_TYPE_MUST_INSTALL] = "run-postinsts packagegroup-core-boot" 106 pkg_list[self.PKG_TYPE_MUST_INSTALL] = "run-postinsts packagegroup-core-boot"
72 107
73 with open(self.initial_manifest, "w+") as manifest: 108 with open(self.initial_manifest, "w+") as manifest:
@@ -161,13 +196,15 @@ class OpkgManifest(Manifest):
161 with open(self.initial_manifest, "w+") as manifest: 196 with open(self.initial_manifest, "w+") as manifest:
162 manifest.write(self.initial_manifest_file_header) 197 manifest.write(self.initial_manifest_file_header)
163 198
164 for var in self.var_map: 199 for var in self.var_maps[self.manifest_type]:
165 if var == "PACKAGE_INSTALL": 200 if var in self.vars_to_split:
166 split_pkgs = self._split_multilib(self.d.getVar(var, True)) 201 split_pkgs = self._split_multilib(self.d.getVar(var, True))
167 if split_pkgs is not None: 202 if split_pkgs is not None:
168 pkgs = dict(pkgs.items() + split_pkgs.items()) 203 pkgs = dict(pkgs.items() + split_pkgs.items())
169 else: 204 else:
170 pkgs[self.var_map[var]] = self.d.getVar(var, True) 205 pkg_list = self.d.getVar(var, True)
206 if pkg_list is not None:
207 pkgs[self.var_maps[self.manifest_type][var]] = self.d.getVar(var, True)
171 208
172 for pkg_type in pkgs: 209 for pkg_type in pkgs:
173 for pkg in pkgs[pkg_type].split(): 210 for pkg in pkgs[pkg_type].split():
@@ -182,25 +219,27 @@ class DpkgManifest(Manifest):
182 with open(self.initial_manifest, "w+") as manifest: 219 with open(self.initial_manifest, "w+") as manifest:
183 manifest.write(self.initial_manifest_file_header) 220 manifest.write(self.initial_manifest_file_header)
184 221
185 for var in self.var_map: 222 for var in self.var_maps[self.manifest_type]:
186 pkg_list = self.d.getVar(var, True) 223 pkg_list = self.d.getVar(var, True)
187 224
188 if pkg_list is None: 225 if pkg_list is None:
189 continue 226 continue
190 227
191 for pkg in pkg_list.split(): 228 for pkg in pkg_list.split():
192 manifest.write("%s,%s\n" % (self.var_map[var], pkg)) 229 manifest.write("%s,%s\n" %
230 (self.var_maps[self.manifest_type][var], pkg))
193 231
194 def create_final(self): 232 def create_final(self):
195 pass 233 pass
196 234
197 235
198def create_manifest(d, final_manifest=False, manifest_dir=None): 236def create_manifest(d, final_manifest=False, manifest_dir=None,
237 manifest_type=Manifest.MANIFEST_TYPE_IMAGE):
199 manifest_map = {'rpm': RpmManifest, 238 manifest_map = {'rpm': RpmManifest,
200 'ipk': OpkgManifest, 239 'ipk': OpkgManifest,
201 'deb': DpkgManifest} 240 'deb': DpkgManifest}
202 241
203 manifest = manifest_map[d.getVar('IMAGE_PKGTYPE', True)](d, manifest_dir) 242 manifest = manifest_map[d.getVar('IMAGE_PKGTYPE', True)](d, manifest_dir, manifest_type)
204 243
205 if final_manifest: 244 if final_manifest:
206 manifest.create_final() 245 manifest.create_final()