summaryrefslogtreecommitdiff
path: root/meta/lib
diff options
context:
space:
mode:
authorHongxu Jia <hongxu.jia@windriver.com>2014-02-21 14:23:08 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-02-21 16:13:55 +0000
commit8d813f614cdfda31c85bbaf133f2822f90a4a78a (patch)
tree53b2dd2c76015077312f45fef3bac77078f4d013 /meta/lib
parent0566de3fa424af3bdfadcd0a08ce4c214abda083 (diff)
downloadopenembedded-core-8d813f614cdfda31c85bbaf133f2822f90a4a78a.tar.gz
openembedded-core-8d813f614cdfda31c85bbaf133f2822f90a4a78a.tar.bz2
openembedded-core-8d813f614cdfda31c85bbaf133f2822f90a4a78a.zip
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] Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oe/rootfs.py51
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
from oe.utils import contains as base_contains
from oe.package_manager import *
from oe.manifest import *
+import oe.path
+import filecmp
import shutil
import os
import subprocess
@@ -458,13 +460,58 @@ class OpkgRootfs(Rootfs):
bb.utils.remove(self.d.getVar('MULTILIB_TEMP_ROOTFS', True), True)
+ def _prelink_file(self, root_dir, filename):
+ bb.note('prelink %s in %s' % (filename, root_dir))
+ prelink_cfg = oe.path.join(root_dir,
+ self.d.expand('${sysconfdir}/prelink.conf'))
+ if not os.path.exists(prelink_cfg):
+ shutil.copy(self.d.expand('${STAGING_DIR_NATIVE}${sysconfdir_native}/prelink.conf'),
+ prelink_cfg)
+
+ cmd_prelink = self.d.expand('${STAGING_DIR_NATIVE}${sbindir_native}/prelink')
+ self._exec_shell_cmd([cmd_prelink,
+ '--root',
+ root_dir,
+ '-amR',
+ '-N',
+ '-c',
+ self.d.expand('${sysconfdir}/prelink.conf')])
+
+ '''
+ Compare two files with the same key twice to see if they are equal.
+ If they are not equal, it means they are duplicated and come from
+ different packages.
+ 1st: Comapre them directly;
+ 2nd: While incremental image creation is enabled, one of the
+ files could be probaly prelinked in the previous image
+ creation and the file has been changed, so we need to
+ prelink the other one and compare them.
+ '''
+ def _file_equal(self, key, f1, f2):
+
+ # Both of them are not prelinked
+ if filecmp.cmp(f1, f2):
+ return True
+
+ if self.image_rootfs not in f1:
+ self._prelink_file(f1.replace(key, ''), f1)
+
+ if self.image_rootfs not in f2:
+ self._prelink_file(f2.replace(key, ''), f2)
+
+ # Both of them are prelinked
+ if filecmp.cmp(f1, f2):
+ return True
+
+ # Not equal
+ return False
+
"""
This function was reused from the old implementation.
See commit: "image.bbclass: Added variables for multilib support." by
Lianhao Lu.
"""
def _multilib_sanity_test(self, dirs):
- import filecmp
allow_replace = self.d.getVar("MULTILIBRE_ALLOW_REP", True)
if allow_replace is None:
@@ -488,7 +535,7 @@ class OpkgRootfs(Rootfs):
else:
if os.path.exists(files[key]) and \
os.path.exists(item) and \
- not filecmp.cmp(files[key], item):
+ not self._file_equal(key, files[key], item):
valid = False
bb.fatal("%s duplicate files %s %s is not the same\n" %
(error_prompt, item, files[key]))