diff options
author | Hongxu Jia <hongxu.jia@windriver.com> | 2014-02-21 14:23:08 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-02-21 16:14:15 +0000 |
commit | 3ccc90c9d04906239630819c24009d8d6d5f3369 (patch) | |
tree | 7a3071454e7c1a1be5d58240dcfcee613148ef9c /meta | |
parent | ec87d0c8b952cc106666a3742493f0d9e0648796 (diff) | |
download | poky-3ccc90c9d04906239630819c24009d8d6d5f3369.tar.gz |
rootfs.py: tweak _multilib_sanity_test for ipk incremental image generation
The _multilib_sanity_test installs multilib packages in a temporary
root fs, and compare with the current image to figure out duplicated
files that come from different packages.
While incremental image generation enabled and the previous image
was existed, there was an Multilib check error:
...
ERROR: Multilib check error: duplicate files tmp/work/qemux86_64-poky-
linux/core-image-minimal/1.0-r0/multilib/lib32/lib/libc.so.6 tmp/work/
qemux86_64-poky-linux/core-image-minimal/1.0-r0/rootfs/lib/libc.so.6
is not the same
...
The reason is the file in the existing image has been prelinked by
previous image generation and the file in a temporary root fs is not
prelinked, even though both of them came from the same package, the
Multilib check failed.
[YOCTO #1894]
(From OE-Core rev: 8d813f614cdfda31c85bbaf133f2822f90a4a78a)
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/lib/oe/rootfs.py | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py index 78e9627682..2b2915e470 100644 --- a/meta/lib/oe/rootfs.py +++ b/meta/lib/oe/rootfs.py | |||
@@ -3,6 +3,8 @@ from oe.utils import execute_pre_post_process | |||
3 | from oe.utils import contains as base_contains | 3 | from oe.utils import contains as base_contains |
4 | from oe.package_manager import * | 4 | from oe.package_manager import * |
5 | from oe.manifest import * | 5 | from oe.manifest import * |
6 | import oe.path | ||
7 | import filecmp | ||
6 | import shutil | 8 | import shutil |
7 | import os | 9 | import os |
8 | import subprocess | 10 | import subprocess |
@@ -458,13 +460,58 @@ class OpkgRootfs(Rootfs): | |||
458 | 460 | ||
459 | bb.utils.remove(self.d.getVar('MULTILIB_TEMP_ROOTFS', True), True) | 461 | bb.utils.remove(self.d.getVar('MULTILIB_TEMP_ROOTFS', True), True) |
460 | 462 | ||
463 | def _prelink_file(self, root_dir, filename): | ||
464 | bb.note('prelink %s in %s' % (filename, root_dir)) | ||
465 | prelink_cfg = oe.path.join(root_dir, | ||
466 | self.d.expand('${sysconfdir}/prelink.conf')) | ||
467 | if not os.path.exists(prelink_cfg): | ||
468 | shutil.copy(self.d.expand('${STAGING_DIR_NATIVE}${sysconfdir_native}/prelink.conf'), | ||
469 | prelink_cfg) | ||
470 | |||
471 | cmd_prelink = self.d.expand('${STAGING_DIR_NATIVE}${sbindir_native}/prelink') | ||
472 | self._exec_shell_cmd([cmd_prelink, | ||
473 | '--root', | ||
474 | root_dir, | ||
475 | '-amR', | ||
476 | '-N', | ||
477 | '-c', | ||
478 | self.d.expand('${sysconfdir}/prelink.conf')]) | ||
479 | |||
480 | ''' | ||
481 | Compare two files with the same key twice to see if they are equal. | ||
482 | If they are not equal, it means they are duplicated and come from | ||
483 | different packages. | ||
484 | 1st: Comapre them directly; | ||
485 | 2nd: While incremental image creation is enabled, one of the | ||
486 | files could be probaly prelinked in the previous image | ||
487 | creation and the file has been changed, so we need to | ||
488 | prelink the other one and compare them. | ||
489 | ''' | ||
490 | def _file_equal(self, key, f1, f2): | ||
491 | |||
492 | # Both of them are not prelinked | ||
493 | if filecmp.cmp(f1, f2): | ||
494 | return True | ||
495 | |||
496 | if self.image_rootfs not in f1: | ||
497 | self._prelink_file(f1.replace(key, ''), f1) | ||
498 | |||
499 | if self.image_rootfs not in f2: | ||
500 | self._prelink_file(f2.replace(key, ''), f2) | ||
501 | |||
502 | # Both of them are prelinked | ||
503 | if filecmp.cmp(f1, f2): | ||
504 | return True | ||
505 | |||
506 | # Not equal | ||
507 | return False | ||
508 | |||
461 | """ | 509 | """ |
462 | This function was reused from the old implementation. | 510 | This function was reused from the old implementation. |
463 | See commit: "image.bbclass: Added variables for multilib support." by | 511 | See commit: "image.bbclass: Added variables for multilib support." by |
464 | Lianhao Lu. | 512 | Lianhao Lu. |
465 | """ | 513 | """ |
466 | def _multilib_sanity_test(self, dirs): | 514 | def _multilib_sanity_test(self, dirs): |
467 | import filecmp | ||
468 | 515 | ||
469 | allow_replace = self.d.getVar("MULTILIBRE_ALLOW_REP", True) | 516 | allow_replace = self.d.getVar("MULTILIBRE_ALLOW_REP", True) |
470 | if allow_replace is None: | 517 | if allow_replace is None: |
@@ -488,7 +535,7 @@ class OpkgRootfs(Rootfs): | |||
488 | else: | 535 | else: |
489 | if os.path.exists(files[key]) and \ | 536 | if os.path.exists(files[key]) and \ |
490 | os.path.exists(item) and \ | 537 | os.path.exists(item) and \ |
491 | not filecmp.cmp(files[key], item): | 538 | not self._file_equal(key, files[key], item): |
492 | valid = False | 539 | valid = False |
493 | bb.fatal("%s duplicate files %s %s is not the same\n" % | 540 | bb.fatal("%s duplicate files %s %s is not the same\n" % |
494 | (error_prompt, item, files[key])) | 541 | (error_prompt, item, files[key])) |