Message ID | 20200703114402.8850-2-fredrigu@axis.com |
---|---|
State | New |
Headers | show |
diff --git a/meta/lib/oe/manifest.py b/meta/lib/oe/manifest.py index f7c88f9a09..cf2cbe22eb 100644 --- a/meta/lib/oe/manifest.py +++ b/meta/lib/oe/manifest.py @@ -189,56 +189,6 @@ class Manifest(object, metaclass=ABCMeta): return installed_pkgs -class RpmManifest(Manifest): - """ - Returns a dictionary object with mip and mlp packages. - """ - def _split_multilib(self, pkg_list): - pkgs = dict() - - for pkg in pkg_list.split(): - pkg_type = self.PKG_TYPE_MUST_INSTALL - - ml_variants = self.d.getVar('MULTILIB_VARIANTS').split() - - for ml_variant in ml_variants: - if pkg.startswith(ml_variant + '-'): - pkg_type = self.PKG_TYPE_MULTILIB - - if not pkg_type in pkgs: - pkgs[pkg_type] = pkg - else: - pkgs[pkg_type] += " " + pkg - - return pkgs - - def create_initial(self): - pkgs = dict() - - with open(self.initial_manifest, "w+") as manifest: - manifest.write(self.initial_manifest_file_header) - - for var in self.var_maps[self.manifest_type]: - if var in self.vars_to_split: - split_pkgs = self._split_multilib(self.d.getVar(var)) - if split_pkgs is not None: - pkgs = dict(list(pkgs.items()) + list(split_pkgs.items())) - else: - pkg_list = self.d.getVar(var) - if pkg_list is not None: - pkgs[self.var_maps[self.manifest_type][var]] = self.d.getVar(var) - - for pkg_type in pkgs: - for pkg in pkgs[pkg_type].split(): - manifest.write("%s,%s\n" % (pkg_type, pkg)) - - def create_final(self): - pass - - def create_full(self, pm): - pass - - class OpkgManifest(Manifest): """ Returns a dictionary object with mip and mlp packages. @@ -332,6 +282,7 @@ class DpkgManifest(Manifest): def create_manifest(d, final_manifest=False, manifest_dir=None, manifest_type=Manifest.MANIFEST_TYPE_IMAGE): + from oe.package_managers.rpm.manifest import RpmManifest manifest_map = {'rpm': RpmManifest, 'ipk': OpkgManifest, 'deb': DpkgManifest} diff --git a/meta/lib/oe/package_managers/rpm/__init__.py b/meta/lib/oe/package_managers/rpm/__init__.py new file mode 100644 index 0000000000..a2094304c9 --- /dev/null +++ b/meta/lib/oe/package_managers/rpm/__init__.py @@ -0,0 +1,3 @@ +# +# SPDX-License-Identifier: GPL-2.0-only +# diff --git a/meta/lib/oe/package_managers/rpm/manifest.py b/meta/lib/oe/package_managers/rpm/manifest.py new file mode 100644 index 0000000000..9047462951 --- /dev/null +++ b/meta/lib/oe/package_managers/rpm/manifest.py @@ -0,0 +1,56 @@ +# +# SPDX-License-Identifier: GPL-2.0-only +# + +from oe.manifest import Manifest + +class RpmManifest(Manifest): + """ + Returns a dictionary object with mip and mlp packages. + """ + def _split_multilib(self, pkg_list): + pkgs = dict() + + for pkg in pkg_list.split(): + pkg_type = self.PKG_TYPE_MUST_INSTALL + + ml_variants = self.d.getVar('MULTILIB_VARIANTS').split() + + for ml_variant in ml_variants: + if pkg.startswith(ml_variant + '-'): + pkg_type = self.PKG_TYPE_MULTILIB + + if not pkg_type in pkgs: + pkgs[pkg_type] = pkg + else: + pkgs[pkg_type] += " " + pkg + + return pkgs + + def create_initial(self): + pkgs = dict() + + with open(self.initial_manifest, "w+") as manifest: + manifest.write(self.initial_manifest_file_header) + + for var in self.var_maps[self.manifest_type]: + if var in self.vars_to_split: + split_pkgs = self._split_multilib(self.d.getVar(var)) + if split_pkgs is not None: + pkgs = dict(list(pkgs.items()) + list(split_pkgs.items())) + else: + pkg_list = self.d.getVar(var) + if pkg_list is not None: + pkgs[self.var_maps[self.manifest_type][var]] = self.d.getVar(var) + + for pkg_type in pkgs: + for pkg in pkgs[pkg_type].split(): + manifest.write("%s,%s\n" % (pkg_type, pkg)) + + def create_final(self): + pass + + def create_full(self, pm): + pass + + diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py index a0ac33ada6..b6d2028e9b 100644 --- a/meta/lib/oe/rootfs.py +++ b/meta/lib/oe/rootfs.py @@ -359,6 +359,8 @@ class RpmRootfs(Rootfs): self.log_check_regex = r'(unpacking of archive failed|Cannot find package'\ r'|exit 1|ERROR: |Error: |Error |ERROR '\ r'|Failed |Failed: |Failed$|Failed\(\d+\):)' + + from oe.package_managers.rpm.manifest import RpmManifest self.manifest = RpmManifest(d, manifest_dir) self.pm = RpmPM(d,
Hi, is there something I can do to make this series move forward? /Fredrik
On Thu, 9 Jul 2020 at 11:42, Fredrik Gustafsson <Fredrik.Gustafsson@axis.com> wrote: > > Hi, > is there something I can do to make this series move forward? > I guess it's waiting for at least one person to review it in detail. It's in my backlog, I should get to it on Monday.
Thank you, just let me know if I can make it any easier to review this, I know it's a big patch. BR Fredrik
On Tue, 14 Jul 2020 at 08:02, Fredrik Gustafsson <Fredrik.Gustafsson@axis.com> wrote: > > Thank you, just let me know if I can make it any easier to review this, > I know it's a big patch. Hi Fredrik, Sorry for the delays here, I've been unable to get back to this until today due to other commitments and a few health issues. Here's my feedback on the series as a whole. Overall I think it's excellent, I much prefer the result where the code is grouped by package manager (opkg, dpkg or rpm) to the existing code where it's spread across package_manager.py, rootfs.py, manifest.py and sdk.py. 1) Please edit the first line of each commit message to follow the style guide at https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines. 2) Please also fix the following whitespace errors reported when applying these patches: $ git am ../v4-Move-rpm-manifest-to-its-...-and-11-more.mbox Applying: Move rpm manifest to its own subdir .git/rebase-apply/patch:148: new blank line at EOF. + warning: 1 line adds whitespace errors. Applying: Move ipk manifest to its own subdir .git/rebase-apply/patch:187: new blank line at EOF. + warning: 1 line adds whitespace errors. Applying: Move deb manifest to its own subdir Applying: Move rpm rootfs to its own dir .git/rebase-apply/patch:161: new blank line at EOF. + warning: 1 line adds whitespace errors. Applying: Move ipk rootfs to its own dir Applying: Move deb rootfs to its own dir .git/rebase-apply/patch:222: new blank line at EOF. + warning: 1 line adds whitespace errors. Applying: Move rpm sdk to its own dir .git/rebase-apply/patch:127: new blank line at EOF. + warning: 1 line adds whitespace errors. Applying: Move ipk sdk to its own dir .git/rebase-apply/patch:42: trailing whitespace. self.d.getVar("ALL_MULTILIB_PACKAGE_ARCHS"), .git/rebase-apply/patch:109: new blank line at EOF. + warning: 2 lines add whitespace errors. Applying: Move deb sdk to its own dir .git/rebase-apply/patch:108: new blank line at EOF. + warning: 1 line adds whitespace errors. Applying: Move rpm package manager to its own dir .git/rebase-apply/patch:840: new blank line at EOF. + warning: 1 line adds whitespace errors. Applying: Move ipk package manager to its own dir .git/rebase-apply/patch:951: new blank line at EOF. + warning: 1 line adds whitespace errors. Applying: Move deb package manager to its own dir .git/rebase-apply/patch:1042: new blank line at EOF. + warning: 1 line adds whitespace errors. 3) I'd recommend the new module keeps the name package_manager. You can do this by moving the existing code into package_manager/__init__.py and then splitting it up inside that directory. Imports and wrappers in the __init__.py file can be used to ensure no other bit of the code needs to worry about the changes. 4) Please avoid unnecessarily using imports inside functions. In rootfs.py, manifest.py and sdk.py you can import the required classes at the top level. Functions like create_rootfs(), populate_sdk(), etc should not require any changes as part of this patch series. I'll run as much of the selftest suite as I can on this series as-is to see if there are any other issues. Thanks,
Hi Paul, thank you for your review, I hope you're feeling better! I think I've managed to fix all your comments. Some imports was not possible to move to the top of the file but those who where possible to move I've moved. Please note that I'll be away from monday and four weeks forward. Please don't take my silence then as a lack of interest. This has my highest priority. Best regards Fredrik
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. Signed-off-by: Fredrik Gustafsson <fredrigu@axis.com> --- meta/lib/oe/manifest.py | 51 +----------------- meta/lib/oe/package_managers/rpm/__init__.py | 3 ++ meta/lib/oe/package_managers/rpm/manifest.py | 56 ++++++++++++++++++++ meta/lib/oe/rootfs.py | 2 + 4 files changed, 62 insertions(+), 50 deletions(-) create mode 100644 meta/lib/oe/package_managers/rpm/__init__.py create mode 100644 meta/lib/oe/package_managers/rpm/manifest.py