diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-06-24 00:06:59 +1200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-07-07 13:29:01 +0100 |
commit | 370f08d434480c1790950e40db8f7687da78cb14 (patch) | |
tree | ac4011b21b74197963e61c6aeb9d39c53e540784 /meta/lib | |
parent | 1f33659a92b2d4b1514984183384fbdcf72ddb99 (diff) | |
download | openembedded-core-370f08d434480c1790950e40db8f7687da78cb14.tar.gz openembedded-core-370f08d434480c1790950e40db8f7687da78cb14.tar.bz2 openembedded-core-370f08d434480c1790950e40db8f7687da78cb14.zip |
classes/image: implement progress support for do_rootfs
Use the new task progress functionality to report progress during
do_rootfs. This is a little coarse and ideally we would have some
progress within the installation section, but it's better than
nothing.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oe/rootfs.py | 101 |
1 files changed, 88 insertions, 13 deletions
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py index 1fc35bdc78..ed0bab1fa4 100644 --- a/meta/lib/oe/rootfs.py +++ b/meta/lib/oe/rootfs.py @@ -15,11 +15,12 @@ class Rootfs(object, metaclass=ABCMeta): This is an abstract class. Do not instantiate this directly. """ - def __init__(self, d): + def __init__(self, d, progress_reporter=None): self.d = d self.pm = None self.image_rootfs = self.d.getVar('IMAGE_ROOTFS', True) self.deploy_dir_image = self.d.getVar('DEPLOY_DIR_IMAGE', True) + self.progress_reporter = progress_reporter self.install_order = Manifest.INSTALL_ORDER @@ -191,6 +192,9 @@ class Rootfs(object, metaclass=ABCMeta): execute_pre_post_process(self.d, pre_process_cmds) + if self.progress_reporter: + self.progress_reporter.next_stage() + # call the package manager dependent create method self._create() @@ -205,6 +209,9 @@ class Rootfs(object, metaclass=ABCMeta): execute_pre_post_process(self.d, post_process_cmds) + if self.progress_reporter: + self.progress_reporter.next_stage() + if bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", True, False, self.d): delayed_postinsts = self._get_delayed_postinsts() @@ -218,6 +225,9 @@ class Rootfs(object, metaclass=ABCMeta): self._uninstall_unneeded() + if self.progress_reporter: + self.progress_reporter.next_stage() + self._insert_feed_uris() self._run_ldconfig() @@ -228,6 +238,10 @@ class Rootfs(object, metaclass=ABCMeta): self._cleanup() self._log_check() + if self.progress_reporter: + self.progress_reporter.next_stage() + + def _uninstall_unneeded(self): # Remove unneeded init script symlinks delayed_postinsts = self._get_delayed_postinsts() @@ -359,8 +373,8 @@ class Rootfs(object, metaclass=ABCMeta): class RpmRootfs(Rootfs): - def __init__(self, d, manifest_dir): - super(RpmRootfs, self).__init__(d) + def __init__(self, d, manifest_dir, progress_reporter=None): + super(RpmRootfs, self).__init__(d, progress_reporter) self.log_check_regex = '(unpacking of archive failed|Cannot find package'\ '|exit 1|ERROR: |Error: |Error |ERROR '\ '|Failed |Failed: |Failed$|Failed\(\d+\):)' @@ -418,11 +432,17 @@ class RpmRootfs(Rootfs): execute_pre_post_process(self.d, rpm_pre_process_cmds) + if self.progress_reporter: + self.progress_reporter.next_stage() + self.pm.dump_all_available_pkgs() if self.inc_rpm_image_gen == "1": self._create_incremental(pkgs_to_install) + if self.progress_reporter: + self.progress_reporter.next_stage() + self.pm.update() pkgs = [] @@ -433,12 +453,24 @@ class RpmRootfs(Rootfs): else: pkgs += pkgs_to_install[pkg_type] + if self.progress_reporter: + self.progress_reporter.next_stage() + self.pm.install(pkgs) + if self.progress_reporter: + self.progress_reporter.next_stage() + self.pm.install(pkgs_attempt, True) + if self.progress_reporter: + self.progress_reporter.next_stage() + self.pm.install_complementary() + if self.progress_reporter: + self.progress_reporter.next_stage() + self._setup_dbg_rootfs(['/etc/rpm', '/var/lib/rpm', '/var/lib/smart']) execute_pre_post_process(self.d, rpm_post_process_cmds) @@ -450,6 +482,10 @@ class RpmRootfs(Rootfs): self.pm.rpm_setup_smart_target_config() + if self.progress_reporter: + self.progress_reporter.next_stage() + + @staticmethod def _depends_list(): return ['DEPLOY_DIR_RPM', 'INC_RPM_IMAGE_GEN', 'RPM_PREPROCESS_COMMANDS', @@ -494,8 +530,8 @@ class RpmRootfs(Rootfs): bb.utils.remove(self.pm.install_dir_path, True) class DpkgOpkgRootfs(Rootfs): - def __init__(self, d): - super(DpkgOpkgRootfs, self).__init__(d) + def __init__(self, d, progress_reporter=None): + super(DpkgOpkgRootfs, self).__init__(d, progress_reporter) def _get_pkgs_postinsts(self, status_file): def _get_pkg_depends_list(pkg_depends): @@ -589,8 +625,8 @@ class DpkgOpkgRootfs(Rootfs): num += 1 class DpkgRootfs(DpkgOpkgRootfs): - def __init__(self, d, manifest_dir): - super(DpkgRootfs, self).__init__(d) + def __init__(self, d, manifest_dir, progress_reporter=None): + super(DpkgRootfs, self).__init__(d, progress_reporter) self.log_check_regex = '^E:' self.log_check_expected_regexes = \ [ @@ -618,15 +654,31 @@ class DpkgRootfs(DpkgOpkgRootfs): execute_pre_post_process(self.d, deb_pre_process_cmds) + if self.progress_reporter: + self.progress_reporter.next_stage() + # Don't support incremental, so skip that + self.progress_reporter.next_stage() + self.pm.update() + if self.progress_reporter: + self.progress_reporter.next_stage() + for pkg_type in self.install_order: if pkg_type in pkgs_to_install: self.pm.install(pkgs_to_install[pkg_type], [False, True][pkg_type == Manifest.PKG_TYPE_ATTEMPT_ONLY]) + if self.progress_reporter: + # Don't support attemptonly, so skip that + self.progress_reporter.next_stage() + self.progress_reporter.next_stage() + self.pm.install_complementary() + if self.progress_reporter: + self.progress_reporter.next_stage() + self._setup_dbg_rootfs(['/var/lib/dpkg']) self.pm.fix_broken_dependencies() @@ -637,6 +689,9 @@ class DpkgRootfs(DpkgOpkgRootfs): execute_pre_post_process(self.d, deb_post_process_cmds) + if self.progress_reporter: + self.progress_reporter.next_stage() + @staticmethod def _depends_list(): return ['DEPLOY_DIR_DEB', 'DEB_SDK_ARCH', 'APTCONF_TARGET', 'APT_ARGS', 'DPKG_ARCH', 'DEB_PREPROCESS_COMMANDS', 'DEB_POSTPROCESS_COMMANDS'] @@ -662,8 +717,8 @@ class DpkgRootfs(DpkgOpkgRootfs): class OpkgRootfs(DpkgOpkgRootfs): - def __init__(self, d, manifest_dir): - super(OpkgRootfs, self).__init__(d) + def __init__(self, d, manifest_dir, progress_reporter=None): + super(OpkgRootfs, self).__init__(d, progress_reporter) self.log_check_regex = '(exit 1|Collected errors)' self.manifest = OpkgManifest(d, manifest_dir) @@ -857,13 +912,24 @@ class OpkgRootfs(DpkgOpkgRootfs): execute_pre_post_process(self.d, opkg_pre_process_cmds) + if self.progress_reporter: + self.progress_reporter.next_stage() + # Steps are a bit different in order, skip next + self.progress_reporter.next_stage() + self.pm.update() self.pm.handle_bad_recommendations() + if self.progress_reporter: + self.progress_reporter.next_stage() + if self.inc_opkg_image_gen == "1": self._remove_extra_packages(pkgs_to_install) + if self.progress_reporter: + self.progress_reporter.next_stage() + for pkg_type in self.install_order: if pkg_type in pkgs_to_install: # For multilib, we perform a sanity test before final install @@ -875,8 +941,14 @@ class OpkgRootfs(DpkgOpkgRootfs): self.pm.install(pkgs_to_install[pkg_type], [False, True][pkg_type == Manifest.PKG_TYPE_ATTEMPT_ONLY]) + if self.progress_reporter: + self.progress_reporter.next_stage() + self.pm.install_complementary() + if self.progress_reporter: + self.progress_reporter.next_stage() + self._setup_dbg_rootfs(['/etc', '/var/lib/opkg', '/usr/lib/ssl']) execute_pre_post_process(self.d, opkg_post_process_cmds) @@ -884,6 +956,9 @@ class OpkgRootfs(DpkgOpkgRootfs): if self.inc_opkg_image_gen == "1": self.pm.backup_packaging_data() + if self.progress_reporter: + self.progress_reporter.next_stage() + @staticmethod def _depends_list(): return ['IPKGCONF_SDK', 'IPK_FEED_URIS', 'DEPLOY_DIR_IPK', 'IPKGCONF_TARGET', 'INC_IPK_IMAGE_GEN', 'OPKG_ARGS', 'OPKGLIBDIR', 'OPKG_PREPROCESS_COMMANDS', 'OPKG_POSTPROCESS_COMMANDS', 'OPKGLIBDIR'] @@ -919,16 +994,16 @@ def variable_depends(d, manifest_dir=None): cls = get_class_for_type(img_type) return cls._depends_list() -def create_rootfs(d, manifest_dir=None): +def create_rootfs(d, manifest_dir=None, progress_reporter=None): env_bkp = os.environ.copy() img_type = d.getVar('IMAGE_PKGTYPE', True) if img_type == "rpm": - RpmRootfs(d, manifest_dir).create() + RpmRootfs(d, manifest_dir, progress_reporter).create() elif img_type == "ipk": - OpkgRootfs(d, manifest_dir).create() + OpkgRootfs(d, manifest_dir, progress_reporter).create() elif img_type == "deb": - DpkgRootfs(d, manifest_dir).create() + DpkgRootfs(d, manifest_dir, progress_reporter).create() os.environ.clear() os.environ.update(env_bkp) |