diff options
-rw-r--r-- | meta/lib/oe/manifest.py | 72 | ||||
-rw-r--r-- | meta/lib/oe/package_manager/ipk/__init__.py | 3 | ||||
-rw-r--r-- | meta/lib/oe/package_manager/ipk/manifest.py | 73 | ||||
-rw-r--r-- | meta/lib/oe/rootfs.py | 1 |
4 files changed, 78 insertions, 71 deletions
diff --git a/meta/lib/oe/manifest.py b/meta/lib/oe/manifest.py index 17461cda64..f87c150d33 100644 --- a/meta/lib/oe/manifest.py +++ b/meta/lib/oe/manifest.py | |||
@@ -187,76 +187,6 @@ class Manifest(object, metaclass=ABCMeta): | |||
187 | 187 | ||
188 | return installed_pkgs | 188 | return installed_pkgs |
189 | 189 | ||
190 | |||
191 | class OpkgManifest(Manifest): | ||
192 | """ | ||
193 | Returns a dictionary object with mip and mlp packages. | ||
194 | """ | ||
195 | def _split_multilib(self, pkg_list): | ||
196 | pkgs = dict() | ||
197 | |||
198 | for pkg in pkg_list.split(): | ||
199 | pkg_type = self.PKG_TYPE_MUST_INSTALL | ||
200 | |||
201 | ml_variants = self.d.getVar('MULTILIB_VARIANTS').split() | ||
202 | |||
203 | for ml_variant in ml_variants: | ||
204 | if pkg.startswith(ml_variant + '-'): | ||
205 | pkg_type = self.PKG_TYPE_MULTILIB | ||
206 | |||
207 | if not pkg_type in pkgs: | ||
208 | pkgs[pkg_type] = pkg | ||
209 | else: | ||
210 | pkgs[pkg_type] += " " + pkg | ||
211 | |||
212 | return pkgs | ||
213 | |||
214 | def create_initial(self): | ||
215 | pkgs = dict() | ||
216 | |||
217 | with open(self.initial_manifest, "w+") as manifest: | ||
218 | manifest.write(self.initial_manifest_file_header) | ||
219 | |||
220 | for var in self.var_maps[self.manifest_type]: | ||
221 | if var in self.vars_to_split: | ||
222 | split_pkgs = self._split_multilib(self.d.getVar(var)) | ||
223 | if split_pkgs is not None: | ||
224 | pkgs = dict(list(pkgs.items()) + list(split_pkgs.items())) | ||
225 | else: | ||
226 | pkg_list = self.d.getVar(var) | ||
227 | if pkg_list is not None: | ||
228 | pkgs[self.var_maps[self.manifest_type][var]] = self.d.getVar(var) | ||
229 | |||
230 | for pkg_type in sorted(pkgs): | ||
231 | for pkg in sorted(pkgs[pkg_type].split()): | ||
232 | manifest.write("%s,%s\n" % (pkg_type, pkg)) | ||
233 | |||
234 | def create_final(self): | ||
235 | pass | ||
236 | |||
237 | def create_full(self, pm): | ||
238 | if not os.path.exists(self.initial_manifest): | ||
239 | self.create_initial() | ||
240 | |||
241 | initial_manifest = self.parse_initial_manifest() | ||
242 | pkgs_to_install = list() | ||
243 | for pkg_type in initial_manifest: | ||
244 | pkgs_to_install += initial_manifest[pkg_type] | ||
245 | if len(pkgs_to_install) == 0: | ||
246 | return | ||
247 | |||
248 | output = pm.dummy_install(pkgs_to_install) | ||
249 | |||
250 | with open(self.full_manifest, 'w+') as manifest: | ||
251 | pkg_re = re.compile('^Installing ([^ ]+) [^ ].*') | ||
252 | for line in set(output.split('\n')): | ||
253 | m = pkg_re.match(line) | ||
254 | if m: | ||
255 | manifest.write(m.group(1) + '\n') | ||
256 | |||
257 | return | ||
258 | |||
259 | |||
260 | class DpkgManifest(Manifest): | 190 | class DpkgManifest(Manifest): |
261 | def create_initial(self): | 191 | def create_initial(self): |
262 | with open(self.initial_manifest, "w+") as manifest: | 192 | with open(self.initial_manifest, "w+") as manifest: |
@@ -281,8 +211,8 @@ class DpkgManifest(Manifest): | |||
281 | 211 | ||
282 | def create_manifest(d, final_manifest=False, manifest_dir=None, | 212 | def create_manifest(d, final_manifest=False, manifest_dir=None, |
283 | manifest_type=Manifest.MANIFEST_TYPE_IMAGE): | 213 | manifest_type=Manifest.MANIFEST_TYPE_IMAGE): |
284 | |||
285 | from oe.package_manager.rpm.manifest import RpmManifest | 214 | from oe.package_manager.rpm.manifest import RpmManifest |
215 | from oe.package_manager.ipk.manifest import OpkgManifest | ||
286 | manifest_map = {'rpm': RpmManifest, | 216 | manifest_map = {'rpm': RpmManifest, |
287 | 'ipk': OpkgManifest, | 217 | 'ipk': OpkgManifest, |
288 | 'deb': DpkgManifest} | 218 | 'deb': DpkgManifest} |
diff --git a/meta/lib/oe/package_manager/ipk/__init__.py b/meta/lib/oe/package_manager/ipk/__init__.py new file mode 100644 index 0000000000..a2094304c9 --- /dev/null +++ b/meta/lib/oe/package_manager/ipk/__init__.py | |||
@@ -0,0 +1,3 @@ | |||
1 | # | ||
2 | # SPDX-License-Identifier: GPL-2.0-only | ||
3 | # | ||
diff --git a/meta/lib/oe/package_manager/ipk/manifest.py b/meta/lib/oe/package_manager/ipk/manifest.py new file mode 100644 index 0000000000..69676903ab --- /dev/null +++ b/meta/lib/oe/package_manager/ipk/manifest.py | |||
@@ -0,0 +1,73 @@ | |||
1 | # | ||
2 | # SPDX-License-Identifier: GPL-2.0-only | ||
3 | # | ||
4 | |||
5 | from oe.manifest import Manifest | ||
6 | |||
7 | class OpkgManifest(Manifest): | ||
8 | """ | ||
9 | Returns a dictionary object with mip and mlp packages. | ||
10 | """ | ||
11 | def _split_multilib(self, pkg_list): | ||
12 | pkgs = dict() | ||
13 | |||
14 | for pkg in pkg_list.split(): | ||
15 | pkg_type = self.PKG_TYPE_MUST_INSTALL | ||
16 | |||
17 | ml_variants = self.d.getVar('MULTILIB_VARIANTS').split() | ||
18 | |||
19 | for ml_variant in ml_variants: | ||
20 | if pkg.startswith(ml_variant + '-'): | ||
21 | pkg_type = self.PKG_TYPE_MULTILIB | ||
22 | |||
23 | if not pkg_type in pkgs: | ||
24 | pkgs[pkg_type] = pkg | ||
25 | else: | ||
26 | pkgs[pkg_type] += " " + pkg | ||
27 | |||
28 | return pkgs | ||
29 | |||
30 | def create_initial(self): | ||
31 | pkgs = dict() | ||
32 | |||
33 | with open(self.initial_manifest, "w+") as manifest: | ||
34 | manifest.write(self.initial_manifest_file_header) | ||
35 | |||
36 | for var in self.var_maps[self.manifest_type]: | ||
37 | if var in self.vars_to_split: | ||
38 | split_pkgs = self._split_multilib(self.d.getVar(var)) | ||
39 | if split_pkgs is not None: | ||
40 | pkgs = dict(list(pkgs.items()) + list(split_pkgs.items())) | ||
41 | else: | ||
42 | pkg_list = self.d.getVar(var) | ||
43 | if pkg_list is not None: | ||
44 | pkgs[self.var_maps[self.manifest_type][var]] = self.d.getVar(var) | ||
45 | |||
46 | for pkg_type in sorted(pkgs): | ||
47 | for pkg in sorted(pkgs[pkg_type].split()): | ||
48 | manifest.write("%s,%s\n" % (pkg_type, pkg)) | ||
49 | |||
50 | def create_final(self): | ||
51 | pass | ||
52 | |||
53 | def create_full(self, pm): | ||
54 | if not os.path.exists(self.initial_manifest): | ||
55 | self.create_initial() | ||
56 | |||
57 | initial_manifest = self.parse_initial_manifest() | ||
58 | pkgs_to_install = list() | ||
59 | for pkg_type in initial_manifest: | ||
60 | pkgs_to_install += initial_manifest[pkg_type] | ||
61 | if len(pkgs_to_install) == 0: | ||
62 | return | ||
63 | |||
64 | output = pm.dummy_install(pkgs_to_install) | ||
65 | |||
66 | with open(self.full_manifest, 'w+') as manifest: | ||
67 | pkg_re = re.compile('^Installing ([^ ]+) [^ ].*') | ||
68 | for line in set(output.split('\n')): | ||
69 | m = pkg_re.match(line) | ||
70 | if m: | ||
71 | manifest.write(m.group(1) + '\n') | ||
72 | |||
73 | return | ||
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py index c674551764..1ba0a71253 100644 --- a/meta/lib/oe/rootfs.py +++ b/meta/lib/oe/rootfs.py | |||
@@ -12,6 +12,7 @@ import os | |||
12 | import subprocess | 12 | import subprocess |
13 | import re | 13 | import re |
14 | from oe.package_manager.rpm.manifest import RpmManifest | 14 | from oe.package_manager.rpm.manifest import RpmManifest |
15 | from oe.package_manager.ipk.manifest import OpkgManifest | ||
15 | 16 | ||
16 | class Rootfs(object, metaclass=ABCMeta): | 17 | class Rootfs(object, metaclass=ABCMeta): |
17 | """ | 18 | """ |