diff options
author | Fredrik Gustafsson <fredrik.gustafsson@axis.com> | 2020-07-24 16:42:31 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-07-27 19:58:10 +0100 |
commit | 59397b3a01d03f4063c3665a1d7e7e6e7dfb853d (patch) | |
tree | 48db01f790e0f347c9b368355f536da5bf21b358 /meta/lib/oe/package_manager | |
parent | a0416ca06e9150b19bc572f3ad6a49428312961e (diff) | |
download | poky-59397b3a01d03f4063c3665a1d7e7e6e7dfb853d.tar.gz |
ipk: Move ipk manifest to its own subdir
This is a part of a refactor that will split the package manager
code so that it's possible to use other package managers in other
layers.
(From OE-Core rev: 405cd8560fed2e05fc82919d728c42516793cc0f)
Signed-off-by: Fredrik Gustafsson <fredrigu@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/package_manager')
-rw-r--r-- | meta/lib/oe/package_manager/ipk/__init__.py | 3 | ||||
-rw-r--r-- | meta/lib/oe/package_manager/ipk/manifest.py | 73 |
2 files changed, 76 insertions, 0 deletions
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 | ||