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-08 09:57:23 +0100 |
commit | 40712171b2072171ae878de4889faa7be842451d (patch) | |
tree | 76b3696a098584b10e057b50c468e4046ccc3241 /meta/lib/oe/rootfs.py | |
parent | 8daa1b419f8d114bc621c05de4ee0f29cbd0d786 (diff) | |
download | poky-40712171b2072171ae878de4889faa7be842451d.tar.gz |
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.
(From OE-Core rev: 370f08d434480c1790950e40db8f7687da78cb14)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/rootfs.py')
-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): | |||
15 | This is an abstract class. Do not instantiate this directly. | 15 | This is an abstract class. Do not instantiate this directly. |
16 | """ | 16 | """ |
17 | 17 | ||
18 | def __init__(self, d): | 18 | def __init__(self, d, progress_reporter=None): |
19 | self.d = d | 19 | self.d = d |
20 | self.pm = None | 20 | self.pm = None |
21 | self.image_rootfs = self.d.getVar('IMAGE_ROOTFS', True) | 21 | self.image_rootfs = self.d.getVar('IMAGE_ROOTFS', True) |
22 | self.deploy_dir_image = self.d.getVar('DEPLOY_DIR_IMAGE', True) | 22 | self.deploy_dir_image = self.d.getVar('DEPLOY_DIR_IMAGE', True) |
23 | self.progress_reporter = progress_reporter | ||
23 | 24 | ||
24 | self.install_order = Manifest.INSTALL_ORDER | 25 | self.install_order = Manifest.INSTALL_ORDER |
25 | 26 | ||
@@ -191,6 +192,9 @@ class Rootfs(object, metaclass=ABCMeta): | |||
191 | 192 | ||
192 | execute_pre_post_process(self.d, pre_process_cmds) | 193 | execute_pre_post_process(self.d, pre_process_cmds) |
193 | 194 | ||
195 | if self.progress_reporter: | ||
196 | self.progress_reporter.next_stage() | ||
197 | |||
194 | # call the package manager dependent create method | 198 | # call the package manager dependent create method |
195 | self._create() | 199 | self._create() |
196 | 200 | ||
@@ -205,6 +209,9 @@ class Rootfs(object, metaclass=ABCMeta): | |||
205 | 209 | ||
206 | execute_pre_post_process(self.d, post_process_cmds) | 210 | execute_pre_post_process(self.d, post_process_cmds) |
207 | 211 | ||
212 | if self.progress_reporter: | ||
213 | self.progress_reporter.next_stage() | ||
214 | |||
208 | if bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", | 215 | if bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", |
209 | True, False, self.d): | 216 | True, False, self.d): |
210 | delayed_postinsts = self._get_delayed_postinsts() | 217 | delayed_postinsts = self._get_delayed_postinsts() |
@@ -218,6 +225,9 @@ class Rootfs(object, metaclass=ABCMeta): | |||
218 | 225 | ||
219 | self._uninstall_unneeded() | 226 | self._uninstall_unneeded() |
220 | 227 | ||
228 | if self.progress_reporter: | ||
229 | self.progress_reporter.next_stage() | ||
230 | |||
221 | self._insert_feed_uris() | 231 | self._insert_feed_uris() |
222 | 232 | ||
223 | self._run_ldconfig() | 233 | self._run_ldconfig() |
@@ -228,6 +238,10 @@ class Rootfs(object, metaclass=ABCMeta): | |||
228 | self._cleanup() | 238 | self._cleanup() |
229 | self._log_check() | 239 | self._log_check() |
230 | 240 | ||
241 | if self.progress_reporter: | ||
242 | self.progress_reporter.next_stage() | ||
243 | |||
244 | |||
231 | def _uninstall_unneeded(self): | 245 | def _uninstall_unneeded(self): |
232 | # Remove unneeded init script symlinks | 246 | # Remove unneeded init script symlinks |
233 | delayed_postinsts = self._get_delayed_postinsts() | 247 | delayed_postinsts = self._get_delayed_postinsts() |
@@ -359,8 +373,8 @@ class Rootfs(object, metaclass=ABCMeta): | |||
359 | 373 | ||
360 | 374 | ||
361 | class RpmRootfs(Rootfs): | 375 | class RpmRootfs(Rootfs): |
362 | def __init__(self, d, manifest_dir): | 376 | def __init__(self, d, manifest_dir, progress_reporter=None): |
363 | super(RpmRootfs, self).__init__(d) | 377 | super(RpmRootfs, self).__init__(d, progress_reporter) |
364 | self.log_check_regex = '(unpacking of archive failed|Cannot find package'\ | 378 | self.log_check_regex = '(unpacking of archive failed|Cannot find package'\ |
365 | '|exit 1|ERROR: |Error: |Error |ERROR '\ | 379 | '|exit 1|ERROR: |Error: |Error |ERROR '\ |
366 | '|Failed |Failed: |Failed$|Failed\(\d+\):)' | 380 | '|Failed |Failed: |Failed$|Failed\(\d+\):)' |
@@ -418,11 +432,17 @@ class RpmRootfs(Rootfs): | |||
418 | 432 | ||
419 | execute_pre_post_process(self.d, rpm_pre_process_cmds) | 433 | execute_pre_post_process(self.d, rpm_pre_process_cmds) |
420 | 434 | ||
435 | if self.progress_reporter: | ||
436 | self.progress_reporter.next_stage() | ||
437 | |||
421 | self.pm.dump_all_available_pkgs() | 438 | self.pm.dump_all_available_pkgs() |
422 | 439 | ||
423 | if self.inc_rpm_image_gen == "1": | 440 | if self.inc_rpm_image_gen == "1": |
424 | self._create_incremental(pkgs_to_install) | 441 | self._create_incremental(pkgs_to_install) |
425 | 442 | ||
443 | if self.progress_reporter: | ||
444 | self.progress_reporter.next_stage() | ||
445 | |||
426 | self.pm.update() | 446 | self.pm.update() |
427 | 447 | ||
428 | pkgs = [] | 448 | pkgs = [] |
@@ -433,12 +453,24 @@ class RpmRootfs(Rootfs): | |||
433 | else: | 453 | else: |
434 | pkgs += pkgs_to_install[pkg_type] | 454 | pkgs += pkgs_to_install[pkg_type] |
435 | 455 | ||
456 | if self.progress_reporter: | ||
457 | self.progress_reporter.next_stage() | ||
458 | |||
436 | self.pm.install(pkgs) | 459 | self.pm.install(pkgs) |
437 | 460 | ||
461 | if self.progress_reporter: | ||
462 | self.progress_reporter.next_stage() | ||
463 | |||
438 | self.pm.install(pkgs_attempt, True) | 464 | self.pm.install(pkgs_attempt, True) |
439 | 465 | ||
466 | if self.progress_reporter: | ||
467 | self.progress_reporter.next_stage() | ||
468 | |||
440 | self.pm.install_complementary() | 469 | self.pm.install_complementary() |
441 | 470 | ||
471 | if self.progress_reporter: | ||
472 | self.progress_reporter.next_stage() | ||
473 | |||
442 | self._setup_dbg_rootfs(['/etc/rpm', '/var/lib/rpm', '/var/lib/smart']) | 474 | self._setup_dbg_rootfs(['/etc/rpm', '/var/lib/rpm', '/var/lib/smart']) |
443 | 475 | ||
444 | execute_pre_post_process(self.d, rpm_post_process_cmds) | 476 | execute_pre_post_process(self.d, rpm_post_process_cmds) |
@@ -450,6 +482,10 @@ class RpmRootfs(Rootfs): | |||
450 | 482 | ||
451 | self.pm.rpm_setup_smart_target_config() | 483 | self.pm.rpm_setup_smart_target_config() |
452 | 484 | ||
485 | if self.progress_reporter: | ||
486 | self.progress_reporter.next_stage() | ||
487 | |||
488 | |||
453 | @staticmethod | 489 | @staticmethod |
454 | def _depends_list(): | 490 | def _depends_list(): |
455 | return ['DEPLOY_DIR_RPM', 'INC_RPM_IMAGE_GEN', 'RPM_PREPROCESS_COMMANDS', | 491 | return ['DEPLOY_DIR_RPM', 'INC_RPM_IMAGE_GEN', 'RPM_PREPROCESS_COMMANDS', |
@@ -494,8 +530,8 @@ class RpmRootfs(Rootfs): | |||
494 | bb.utils.remove(self.pm.install_dir_path, True) | 530 | bb.utils.remove(self.pm.install_dir_path, True) |
495 | 531 | ||
496 | class DpkgOpkgRootfs(Rootfs): | 532 | class DpkgOpkgRootfs(Rootfs): |
497 | def __init__(self, d): | 533 | def __init__(self, d, progress_reporter=None): |
498 | super(DpkgOpkgRootfs, self).__init__(d) | 534 | super(DpkgOpkgRootfs, self).__init__(d, progress_reporter) |
499 | 535 | ||
500 | def _get_pkgs_postinsts(self, status_file): | 536 | def _get_pkgs_postinsts(self, status_file): |
501 | def _get_pkg_depends_list(pkg_depends): | 537 | def _get_pkg_depends_list(pkg_depends): |
@@ -589,8 +625,8 @@ class DpkgOpkgRootfs(Rootfs): | |||
589 | num += 1 | 625 | num += 1 |
590 | 626 | ||
591 | class DpkgRootfs(DpkgOpkgRootfs): | 627 | class DpkgRootfs(DpkgOpkgRootfs): |
592 | def __init__(self, d, manifest_dir): | 628 | def __init__(self, d, manifest_dir, progress_reporter=None): |
593 | super(DpkgRootfs, self).__init__(d) | 629 | super(DpkgRootfs, self).__init__(d, progress_reporter) |
594 | self.log_check_regex = '^E:' | 630 | self.log_check_regex = '^E:' |
595 | self.log_check_expected_regexes = \ | 631 | self.log_check_expected_regexes = \ |
596 | [ | 632 | [ |
@@ -618,15 +654,31 @@ class DpkgRootfs(DpkgOpkgRootfs): | |||
618 | 654 | ||
619 | execute_pre_post_process(self.d, deb_pre_process_cmds) | 655 | execute_pre_post_process(self.d, deb_pre_process_cmds) |
620 | 656 | ||
657 | if self.progress_reporter: | ||
658 | self.progress_reporter.next_stage() | ||
659 | # Don't support incremental, so skip that | ||
660 | self.progress_reporter.next_stage() | ||
661 | |||
621 | self.pm.update() | 662 | self.pm.update() |
622 | 663 | ||
664 | if self.progress_reporter: | ||
665 | self.progress_reporter.next_stage() | ||
666 | |||
623 | for pkg_type in self.install_order: | 667 | for pkg_type in self.install_order: |
624 | if pkg_type in pkgs_to_install: | 668 | if pkg_type in pkgs_to_install: |
625 | self.pm.install(pkgs_to_install[pkg_type], | 669 | self.pm.install(pkgs_to_install[pkg_type], |
626 | [False, True][pkg_type == Manifest.PKG_TYPE_ATTEMPT_ONLY]) | 670 | [False, True][pkg_type == Manifest.PKG_TYPE_ATTEMPT_ONLY]) |
627 | 671 | ||
672 | if self.progress_reporter: | ||
673 | # Don't support attemptonly, so skip that | ||
674 | self.progress_reporter.next_stage() | ||
675 | self.progress_reporter.next_stage() | ||
676 | |||
628 | self.pm.install_complementary() | 677 | self.pm.install_complementary() |
629 | 678 | ||
679 | if self.progress_reporter: | ||
680 | self.progress_reporter.next_stage() | ||
681 | |||
630 | self._setup_dbg_rootfs(['/var/lib/dpkg']) | 682 | self._setup_dbg_rootfs(['/var/lib/dpkg']) |
631 | 683 | ||
632 | self.pm.fix_broken_dependencies() | 684 | self.pm.fix_broken_dependencies() |
@@ -637,6 +689,9 @@ class DpkgRootfs(DpkgOpkgRootfs): | |||
637 | 689 | ||
638 | execute_pre_post_process(self.d, deb_post_process_cmds) | 690 | execute_pre_post_process(self.d, deb_post_process_cmds) |
639 | 691 | ||
692 | if self.progress_reporter: | ||
693 | self.progress_reporter.next_stage() | ||
694 | |||
640 | @staticmethod | 695 | @staticmethod |
641 | def _depends_list(): | 696 | def _depends_list(): |
642 | return ['DEPLOY_DIR_DEB', 'DEB_SDK_ARCH', 'APTCONF_TARGET', 'APT_ARGS', 'DPKG_ARCH', 'DEB_PREPROCESS_COMMANDS', 'DEB_POSTPROCESS_COMMANDS'] | 697 | 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): | |||
662 | 717 | ||
663 | 718 | ||
664 | class OpkgRootfs(DpkgOpkgRootfs): | 719 | class OpkgRootfs(DpkgOpkgRootfs): |
665 | def __init__(self, d, manifest_dir): | 720 | def __init__(self, d, manifest_dir, progress_reporter=None): |
666 | super(OpkgRootfs, self).__init__(d) | 721 | super(OpkgRootfs, self).__init__(d, progress_reporter) |
667 | self.log_check_regex = '(exit 1|Collected errors)' | 722 | self.log_check_regex = '(exit 1|Collected errors)' |
668 | 723 | ||
669 | self.manifest = OpkgManifest(d, manifest_dir) | 724 | self.manifest = OpkgManifest(d, manifest_dir) |
@@ -857,13 +912,24 @@ class OpkgRootfs(DpkgOpkgRootfs): | |||
857 | 912 | ||
858 | execute_pre_post_process(self.d, opkg_pre_process_cmds) | 913 | execute_pre_post_process(self.d, opkg_pre_process_cmds) |
859 | 914 | ||
915 | if self.progress_reporter: | ||
916 | self.progress_reporter.next_stage() | ||
917 | # Steps are a bit different in order, skip next | ||
918 | self.progress_reporter.next_stage() | ||
919 | |||
860 | self.pm.update() | 920 | self.pm.update() |
861 | 921 | ||
862 | self.pm.handle_bad_recommendations() | 922 | self.pm.handle_bad_recommendations() |
863 | 923 | ||
924 | if self.progress_reporter: | ||
925 | self.progress_reporter.next_stage() | ||
926 | |||
864 | if self.inc_opkg_image_gen == "1": | 927 | if self.inc_opkg_image_gen == "1": |
865 | self._remove_extra_packages(pkgs_to_install) | 928 | self._remove_extra_packages(pkgs_to_install) |
866 | 929 | ||
930 | if self.progress_reporter: | ||
931 | self.progress_reporter.next_stage() | ||
932 | |||
867 | for pkg_type in self.install_order: | 933 | for pkg_type in self.install_order: |
868 | if pkg_type in pkgs_to_install: | 934 | if pkg_type in pkgs_to_install: |
869 | # For multilib, we perform a sanity test before final install | 935 | # For multilib, we perform a sanity test before final install |
@@ -875,8 +941,14 @@ class OpkgRootfs(DpkgOpkgRootfs): | |||
875 | self.pm.install(pkgs_to_install[pkg_type], | 941 | self.pm.install(pkgs_to_install[pkg_type], |
876 | [False, True][pkg_type == Manifest.PKG_TYPE_ATTEMPT_ONLY]) | 942 | [False, True][pkg_type == Manifest.PKG_TYPE_ATTEMPT_ONLY]) |
877 | 943 | ||
944 | if self.progress_reporter: | ||
945 | self.progress_reporter.next_stage() | ||
946 | |||
878 | self.pm.install_complementary() | 947 | self.pm.install_complementary() |
879 | 948 | ||
949 | if self.progress_reporter: | ||
950 | self.progress_reporter.next_stage() | ||
951 | |||
880 | self._setup_dbg_rootfs(['/etc', '/var/lib/opkg', '/usr/lib/ssl']) | 952 | self._setup_dbg_rootfs(['/etc', '/var/lib/opkg', '/usr/lib/ssl']) |
881 | 953 | ||
882 | execute_pre_post_process(self.d, opkg_post_process_cmds) | 954 | execute_pre_post_process(self.d, opkg_post_process_cmds) |
@@ -884,6 +956,9 @@ class OpkgRootfs(DpkgOpkgRootfs): | |||
884 | if self.inc_opkg_image_gen == "1": | 956 | if self.inc_opkg_image_gen == "1": |
885 | self.pm.backup_packaging_data() | 957 | self.pm.backup_packaging_data() |
886 | 958 | ||
959 | if self.progress_reporter: | ||
960 | self.progress_reporter.next_stage() | ||
961 | |||
887 | @staticmethod | 962 | @staticmethod |
888 | def _depends_list(): | 963 | def _depends_list(): |
889 | 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'] | 964 | 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): | |||
919 | cls = get_class_for_type(img_type) | 994 | cls = get_class_for_type(img_type) |
920 | return cls._depends_list() | 995 | return cls._depends_list() |
921 | 996 | ||
922 | def create_rootfs(d, manifest_dir=None): | 997 | def create_rootfs(d, manifest_dir=None, progress_reporter=None): |
923 | env_bkp = os.environ.copy() | 998 | env_bkp = os.environ.copy() |
924 | 999 | ||
925 | img_type = d.getVar('IMAGE_PKGTYPE', True) | 1000 | img_type = d.getVar('IMAGE_PKGTYPE', True) |
926 | if img_type == "rpm": | 1001 | if img_type == "rpm": |
927 | RpmRootfs(d, manifest_dir).create() | 1002 | RpmRootfs(d, manifest_dir, progress_reporter).create() |
928 | elif img_type == "ipk": | 1003 | elif img_type == "ipk": |
929 | OpkgRootfs(d, manifest_dir).create() | 1004 | OpkgRootfs(d, manifest_dir, progress_reporter).create() |
930 | elif img_type == "deb": | 1005 | elif img_type == "deb": |
931 | DpkgRootfs(d, manifest_dir).create() | 1006 | DpkgRootfs(d, manifest_dir, progress_reporter).create() |
932 | 1007 | ||
933 | os.environ.clear() | 1008 | os.environ.clear() |
934 | os.environ.update(env_bkp) | 1009 | os.environ.update(env_bkp) |