diff options
-rw-r--r-- | meta/lib/oe/sdk.py | 138 |
1 files changed, 136 insertions, 2 deletions
diff --git a/meta/lib/oe/sdk.py b/meta/lib/oe/sdk.py index c24b34d1c0..b54e51697c 100644 --- a/meta/lib/oe/sdk.py +++ b/meta/lib/oe/sdk.py | |||
@@ -58,7 +58,141 @@ class Sdk(object): | |||
58 | 58 | ||
59 | 59 | ||
60 | class RpmSdk(Sdk): | 60 | class RpmSdk(Sdk): |
61 | pass | 61 | def __init__(self, d, manifest_dir=None): |
62 | super(RpmSdk, self).__init__(d, manifest_dir) | ||
63 | |||
64 | self.target_manifest = RpmManifest(d, self.manifest_dir, | ||
65 | Manifest.MANIFEST_TYPE_SDK_TARGET) | ||
66 | self.host_manifest = RpmManifest(d, self.manifest_dir, | ||
67 | Manifest.MANIFEST_TYPE_SDK_HOST) | ||
68 | |||
69 | package_archs = { | ||
70 | 'default': [], | ||
71 | } | ||
72 | target_os = { | ||
73 | 'default': "", | ||
74 | } | ||
75 | package_archs['default'] = self.d.getVar("PACKAGE_ARCHS", True).split() | ||
76 | # arch order is reversed. This ensures the -best- match is | ||
77 | # listed first! | ||
78 | package_archs['default'].reverse() | ||
79 | target_os['default'] = self.d.getVar("TARGET_OS", True).strip() | ||
80 | multilibs = self.d.getVar('MULTILIBS', True) or "" | ||
81 | for ext in multilibs.split(): | ||
82 | eext = ext.split(':') | ||
83 | if len(eext) > 1 and eext[0] == 'multilib': | ||
84 | localdata = bb.data.createCopy(self.d) | ||
85 | default_tune_key = "DEFAULTTUNE_virtclass-multilib-" + eext[1] | ||
86 | default_tune = localdata.getVar(default_tune_key, False) | ||
87 | if default_tune: | ||
88 | localdata.setVar("DEFAULTTUNE", default_tune) | ||
89 | bb.data.update_data(localdata) | ||
90 | package_archs[eext[1]] = localdata.getVar('PACKAGE_ARCHS', | ||
91 | True).split() | ||
92 | package_archs[eext[1]].reverse() | ||
93 | target_os[eext[1]] = localdata.getVar("TARGET_OS", | ||
94 | True).strip() | ||
95 | target_providename = ['/bin/sh', | ||
96 | '/bin/bash', | ||
97 | '/usr/bin/env', | ||
98 | '/usr/bin/perl', | ||
99 | 'pkgconfig' | ||
100 | ] | ||
101 | self.target_pm = RpmPM(d, | ||
102 | self.sdk_target_sysroot, | ||
103 | package_archs, | ||
104 | target_os, | ||
105 | self.d.getVar('TARGET_VENDOR', True), | ||
106 | 'target', | ||
107 | target_providename | ||
108 | ) | ||
109 | |||
110 | sdk_package_archs = { | ||
111 | 'default': [], | ||
112 | } | ||
113 | sdk_os = { | ||
114 | 'default': "", | ||
115 | } | ||
116 | sdk_package_archs['default'] = self.d.getVar("SDK_PACKAGE_ARCHS", | ||
117 | True).split() | ||
118 | # arch order is reversed. This ensures the -best- match is | ||
119 | # listed first! | ||
120 | sdk_package_archs['default'].reverse() | ||
121 | sdk_os['default'] = self.d.getVar("SDK_OS", True).strip() | ||
122 | sdk_providename = ['/bin/sh', | ||
123 | '/bin/bash', | ||
124 | '/usr/bin/env', | ||
125 | '/usr/bin/perl', | ||
126 | 'pkgconfig', | ||
127 | 'libGL.so()(64bit)', | ||
128 | 'libGL.so' | ||
129 | ] | ||
130 | self.host_pm = RpmPM(d, | ||
131 | self.sdk_host_sysroot, | ||
132 | sdk_package_archs, | ||
133 | sdk_os, | ||
134 | self.d.getVar('SDK_VENDOR', True), | ||
135 | 'host', | ||
136 | sdk_providename | ||
137 | ) | ||
138 | |||
139 | def _populate_sysroot(self, pm, manifest): | ||
140 | pkgs_to_install = manifest.parse_initial_manifest() | ||
141 | |||
142 | pm.create_configs() | ||
143 | pm.write_index() | ||
144 | pm.dump_all_available_pkgs() | ||
145 | pm.update() | ||
146 | |||
147 | for pkg_type in self.install_order: | ||
148 | if pkg_type in pkgs_to_install: | ||
149 | pm.install(pkgs_to_install[pkg_type], | ||
150 | [False, True][pkg_type == Manifest.PKG_TYPE_ATTEMPT_ONLY]) | ||
151 | |||
152 | def _populate(self): | ||
153 | bb.note("Installing TARGET packages") | ||
154 | self._populate_sysroot(self.target_pm, self.target_manifest) | ||
155 | |||
156 | self.target_pm.install_complementary(self.d.getVar('SDKIMAGE_INSTALL_COMPLEMENTARY', True)) | ||
157 | |||
158 | execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_POST_TARGET_COMMAND", True)) | ||
159 | |||
160 | self.target_pm.remove_packaging_data() | ||
161 | |||
162 | bb.note("Installing NATIVESDK packages") | ||
163 | self._populate_sysroot(self.host_pm, self.host_manifest) | ||
164 | |||
165 | execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_POST_HOST_COMMAND", True)) | ||
166 | |||
167 | self.host_pm.remove_packaging_data() | ||
168 | |||
169 | # Move host RPM library data | ||
170 | native_rpm_state_dir = os.path.join(self.sdk_output, | ||
171 | self.sdk_native_path, | ||
172 | self.d.getVar('localstatedir_nativesdk', True).strip('/'), | ||
173 | "lib", | ||
174 | "rpm" | ||
175 | ) | ||
176 | bb.utils.mkdirhier(native_rpm_state_dir) | ||
177 | for f in glob.glob(os.path.join(self.sdk_output, | ||
178 | "var", | ||
179 | "lib", | ||
180 | "rpm", | ||
181 | "*")): | ||
182 | bb.utils.movefile(f, native_rpm_state_dir) | ||
183 | |||
184 | bb.utils.remove(os.path.join(self.sdk_output, "var"), True) | ||
185 | |||
186 | # Move host sysconfig data | ||
187 | native_sysconf_dir = os.path.join(self.sdk_output, | ||
188 | self.sdk_native_path, | ||
189 | self.d.getVar('sysconfdir', | ||
190 | True).strip('/'), | ||
191 | ) | ||
192 | bb.utils.mkdirhier(native_sysconf_dir) | ||
193 | for f in glob.glob(os.path.join(self.sdk_output, "etc", "*")): | ||
194 | bb.utils.movefile(f, native_sysconf_dir) | ||
195 | bb.utils.remove(os.path.join(self.sdk_output, "etc"), True) | ||
62 | 196 | ||
63 | 197 | ||
64 | class OpkgSdk(Sdk): | 198 | class OpkgSdk(Sdk): |
@@ -196,7 +330,7 @@ def populate_sdk(d, manifest_dir=None): | |||
196 | 330 | ||
197 | img_type = d.getVar('IMAGE_PKGTYPE', True) | 331 | img_type = d.getVar('IMAGE_PKGTYPE', True) |
198 | if img_type == "rpm": | 332 | if img_type == "rpm": |
199 | bb.fatal("RPM backend was not implemented yet...") | 333 | RpmSdk(d, manifest_dir).populate() |
200 | elif img_type == "ipk": | 334 | elif img_type == "ipk": |
201 | OpkgSdk(d, manifest_dir).populate() | 335 | OpkgSdk(d, manifest_dir).populate() |
202 | elif img_type == "deb": | 336 | elif img_type == "deb": |