diff options
author | Fredrik Gustafsson <fredrik.gustafsson@axis.com> | 2020-07-24 16:42:30 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-07-27 19:58:10 +0100 |
commit | a0416ca06e9150b19bc572f3ad6a49428312961e (patch) | |
tree | 4ff520839a5c7bb4a8919bfd882342328575111c /meta/lib | |
parent | 34dc8571d2d7c2bb9b5f92e157ab91e9d4f9e992 (diff) | |
download | poky-a0416ca06e9150b19bc572f3ad6a49428312961e.tar.gz |
rpm: Move 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: 87a1c8ee406f73e53888df3b682e8a5f0f610c2f)
Signed-off-by: Fredrik Gustafsson <fredrigu@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oe/manifest.py | 53 | ||||
-rw-r--r-- | meta/lib/oe/package_manager/rpm/__init__.py | 3 | ||||
-rw-r--r-- | meta/lib/oe/package_manager/rpm/manifest.py | 54 | ||||
-rw-r--r-- | meta/lib/oe/rootfs.py | 3 |
4 files changed, 61 insertions, 52 deletions
diff --git a/meta/lib/oe/manifest.py b/meta/lib/oe/manifest.py index f7c88f9a09..17461cda64 100644 --- a/meta/lib/oe/manifest.py +++ b/meta/lib/oe/manifest.py | |||
@@ -7,7 +7,6 @@ import os | |||
7 | import re | 7 | import re |
8 | import bb | 8 | import bb |
9 | 9 | ||
10 | |||
11 | class Manifest(object, metaclass=ABCMeta): | 10 | class Manifest(object, metaclass=ABCMeta): |
12 | """ | 11 | """ |
13 | This is an abstract class. Do not instantiate this directly. | 12 | This is an abstract class. Do not instantiate this directly. |
@@ -189,56 +188,6 @@ class Manifest(object, metaclass=ABCMeta): | |||
189 | return installed_pkgs | 188 | return installed_pkgs |
190 | 189 | ||
191 | 190 | ||
192 | class RpmManifest(Manifest): | ||
193 | """ | ||
194 | Returns a dictionary object with mip and mlp packages. | ||
195 | """ | ||
196 | def _split_multilib(self, pkg_list): | ||
197 | pkgs = dict() | ||
198 | |||
199 | for pkg in pkg_list.split(): | ||
200 | pkg_type = self.PKG_TYPE_MUST_INSTALL | ||
201 | |||
202 | ml_variants = self.d.getVar('MULTILIB_VARIANTS').split() | ||
203 | |||
204 | for ml_variant in ml_variants: | ||
205 | if pkg.startswith(ml_variant + '-'): | ||
206 | pkg_type = self.PKG_TYPE_MULTILIB | ||
207 | |||
208 | if not pkg_type in pkgs: | ||
209 | pkgs[pkg_type] = pkg | ||
210 | else: | ||
211 | pkgs[pkg_type] += " " + pkg | ||
212 | |||
213 | return pkgs | ||
214 | |||
215 | def create_initial(self): | ||
216 | pkgs = dict() | ||
217 | |||
218 | with open(self.initial_manifest, "w+") as manifest: | ||
219 | manifest.write(self.initial_manifest_file_header) | ||
220 | |||
221 | for var in self.var_maps[self.manifest_type]: | ||
222 | if var in self.vars_to_split: | ||
223 | split_pkgs = self._split_multilib(self.d.getVar(var)) | ||
224 | if split_pkgs is not None: | ||
225 | pkgs = dict(list(pkgs.items()) + list(split_pkgs.items())) | ||
226 | else: | ||
227 | pkg_list = self.d.getVar(var) | ||
228 | if pkg_list is not None: | ||
229 | pkgs[self.var_maps[self.manifest_type][var]] = self.d.getVar(var) | ||
230 | |||
231 | for pkg_type in pkgs: | ||
232 | for pkg in pkgs[pkg_type].split(): | ||
233 | manifest.write("%s,%s\n" % (pkg_type, pkg)) | ||
234 | |||
235 | def create_final(self): | ||
236 | pass | ||
237 | |||
238 | def create_full(self, pm): | ||
239 | pass | ||
240 | |||
241 | |||
242 | class OpkgManifest(Manifest): | 191 | class OpkgManifest(Manifest): |
243 | """ | 192 | """ |
244 | Returns a dictionary object with mip and mlp packages. | 193 | Returns a dictionary object with mip and mlp packages. |
@@ -332,6 +281,8 @@ class DpkgManifest(Manifest): | |||
332 | 281 | ||
333 | def create_manifest(d, final_manifest=False, manifest_dir=None, | 282 | def create_manifest(d, final_manifest=False, manifest_dir=None, |
334 | manifest_type=Manifest.MANIFEST_TYPE_IMAGE): | 283 | manifest_type=Manifest.MANIFEST_TYPE_IMAGE): |
284 | |||
285 | from oe.package_manager.rpm.manifest import RpmManifest | ||
335 | manifest_map = {'rpm': RpmManifest, | 286 | manifest_map = {'rpm': RpmManifest, |
336 | 'ipk': OpkgManifest, | 287 | 'ipk': OpkgManifest, |
337 | 'deb': DpkgManifest} | 288 | 'deb': DpkgManifest} |
diff --git a/meta/lib/oe/package_manager/rpm/__init__.py b/meta/lib/oe/package_manager/rpm/__init__.py new file mode 100644 index 0000000000..a2094304c9 --- /dev/null +++ b/meta/lib/oe/package_manager/rpm/__init__.py | |||
@@ -0,0 +1,3 @@ | |||
1 | # | ||
2 | # SPDX-License-Identifier: GPL-2.0-only | ||
3 | # | ||
diff --git a/meta/lib/oe/package_manager/rpm/manifest.py b/meta/lib/oe/package_manager/rpm/manifest.py new file mode 100644 index 0000000000..a75f6bdabf --- /dev/null +++ b/meta/lib/oe/package_manager/rpm/manifest.py | |||
@@ -0,0 +1,54 @@ | |||
1 | # | ||
2 | # SPDX-License-Identifier: GPL-2.0-only | ||
3 | # | ||
4 | |||
5 | from oe.manifest import Manifest | ||
6 | |||
7 | class RpmManifest(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 pkgs: | ||
47 | for pkg in 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 | pass | ||
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py index 0e05f1f75e..c674551764 100644 --- a/meta/lib/oe/rootfs.py +++ b/meta/lib/oe/rootfs.py | |||
@@ -11,7 +11,7 @@ import shutil | |||
11 | import os | 11 | import os |
12 | import subprocess | 12 | import subprocess |
13 | import re | 13 | import re |
14 | 14 | from oe.package_manager.rpm.manifest import RpmManifest | |
15 | 15 | ||
16 | class Rootfs(object, metaclass=ABCMeta): | 16 | class Rootfs(object, metaclass=ABCMeta): |
17 | """ | 17 | """ |
@@ -359,6 +359,7 @@ class RpmRootfs(Rootfs): | |||
359 | self.log_check_regex = r'(unpacking of archive failed|Cannot find package'\ | 359 | self.log_check_regex = r'(unpacking of archive failed|Cannot find package'\ |
360 | r'|exit 1|ERROR: |Error: |Error |ERROR '\ | 360 | r'|exit 1|ERROR: |Error: |Error |ERROR '\ |
361 | r'|Failed |Failed: |Failed$|Failed\(\d+\):)' | 361 | r'|Failed |Failed: |Failed$|Failed\(\d+\):)' |
362 | |||
362 | self.manifest = RpmManifest(d, manifest_dir) | 363 | self.manifest = RpmManifest(d, manifest_dir) |
363 | 364 | ||
364 | self.pm = RpmPM(d, | 365 | self.pm = RpmPM(d, |