Skip to contentSkip to conversation

bitbake: add file-native to ASSUME_PROVIDED

PATCH In review Ross Burton 2 participants 7 messages Oct 20, 2015 – Jun 9, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/5 bitbake: add file-native to ASSUME_PROVIDED

Various key parts of the core classes (for example, do_package and do_populate_sysroot) currently require file. As it's not possible to build a file-native without invoking do_populate_sysroot mark file-native as ASSUME_PROVIDED and expect to use the host's binary.

---
 meta/conf/bitbake.conf | 1 +
 1 file changed, 1 insertion(+)
meta/conf/bitbake.conf +1 -0
index 9ddd1c0..06971da 100644
@@ -166,6 +166,7 @@ DATETIME = "${DATE}${TIME}"
 ASSUME_PROVIDED = "\
     bzip2-native \
     chrpath-native \
+    file-native \
     git-native \
     grep-native \
     diffstat-native \
Signature · 1 line
2.1.4
#1 lore raw

PATCH v3 2/5 sanity: check that the host has file installed

Now that file-native is ASSUME_PROVIDED, check that it's actually present.

---
 meta/classes/sanity.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/sanity.bbclass +1 -1
index d0b5cd0..ae86d26 100644
@@ -3,7 +3,7 @@
 #
 
 SANITY_REQUIRED_UTILITIES ?= "patch diffstat makeinfo git bzip2 tar \
-    gzip gawk chrpath wget cpio perl"
+    gzip gawk chrpath wget cpio perl file"
 
 def bblayers_conf_file(d):
     return os.path.join(d.getVar('TOPDIR', True), 'conf/bblayers.conf')
Signature · 1 line
2.1.4
#2 lore raw

PATCH v3 3/5 file: don't replace host file when built natively

In reply to Ross Burton

To avoid races over the file binaries being replaced mid-build we made file-native an assume-provided binary and check for it at startup, but target file still needs a native file binary of the same version to compile the magic data.

The least invasive way of doing this is to build a native file don't put it on PATH, and tell the target build where to find the native binary. We do however want the native libmagic to be installed normally (as for example rpm and subversion need it) so we can't use NATIVE_PACKAGE_PATH_SUFFIX as that change libdir.

[ YOCTO #8144 ]

---
 meta/recipes-devtools/file/file/host-file.patch | 32 +++++++++++++++++++++++++
 meta/recipes-devtools/file/file_5.24.bb         | 10 +++++++-
 2 files changed, 41 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-devtools/file/file/host-file.patch
meta/recipes-devtools/file/file/host-file.patch new file +32 -0
new file mode 100644
index 0000000..a7efbdc
@@ -0,0 +1,32 @@
+Upstream-Status: Submitted (http://bugs.gw.com/view.php?id=485)
+Signed-off-by: Ross Burton <[email protected]>
+
+From 3cde199d03b39632361c275cd30fa0612a03138b Mon Sep 17 00:00:00 2001
+From: Ross Burton <[email protected]>
+Date: Mon, 19 Oct 2015 10:30:57 +0100
+Subject: [PATCH 2/2] When using the host file, respect FILE_COMPILE
+
+If we're cross-compiling and not using the file binary that was just built,
+execute the binary that we've been told to use (via FILE_COMPILE) when checking
+the version instead of assuming that "file" is correct as the actual compile
+uses FILE_COMPILE so different binaries may be used.
+---
+ magic/Makefile.am | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/magic/Makefile.am b/magic/Makefile.am
+index 89ac844..67067fe 100644
+--- a/magic/Makefile.am
++++ b/magic/Makefile.am
+@@ -293,7 +293,7 @@ ${MAGIC}: $(EXTRA_DIST) $(FILE_COMPILE_DEP)
+ 	@(if expr "${FILE_COMPILE}" : '.*/.*' > /dev/null; then \
+ 	    echo "Using ${FILE_COMPILE} to generate ${MAGIC}" > /dev/null; \
+ 	  else \
+-	    v=$$(file --version | sed -e s/file-// -e q); \
++	    v=$$(${FILE_COMPILE} --version | sed -e s/file-// -e q); \
+ 	    if [ "$$v" != "${PACKAGE_VERSION}" ]; then \
+ 		echo "Cannot use the installed version of file ($$v) to"; \
+ 		echo "cross-compile file ${PACKAGE_VERSION}"; \
+-- 
+2.1.4
+
meta/recipes-devtools/file/file_5.24.bb +9 -1
index 08b95d7..d04f121 100644
@@ -8,12 +8,13 @@ SECTION = "console/utils"
 LICENSE = "BSD"
 LIC_FILES_CHKSUM = "file://COPYING;beginline=2;md5=6a7382872edb68d33e1a9398b6e03188"
 
-DEPENDS = "zlib file-native"
+DEPENDS = "zlib file-replacement-native"
 DEPENDS_class-native = "zlib-native"
 
 SRC_URI = "git://github.com/file/file.git \
         file://debian-742262.patch \
         file://0001-Add-P-prompt-into-Usage-info.patch \
+        file://host-file.patch \
         "
 
 SRCREV = "3c0874be4d3232d672b20f513451a39cfd7c585a"
@@ -21,6 +22,9 @@ S = "${WORKDIR}/git"
 
 inherit autotools
 
+EXTRA_OEMAKE_append_class-target = "-e FILE_COMPILE=${STAGING_BINDIR_NATIVE}/file-native/file"
+EXTRA_OEMAKE_append_class-nativesdk = "-e FILE_COMPILE=${STAGING_BINDIR_NATIVE}/file-native/file"
+
 FILES_${PN} += "${datadir}/misc/*.mgc"
 
 do_install_append_class-native() {
@@ -34,3 +38,7 @@ do_install_append_class-nativesdk() {
 }
 
 BBCLASSEXTEND = "native nativesdk"
+PROVIDES_append_class-native = " file-replacement-native"
+# Don't use NATIVE_PACKAGE_PATH_SUFFIX as that hides libmagic from anyone who
+# depends on file-replacement-native.
+bindir_append_class-native = "/file-native"
Signature · 1 line
2.1.4
#3 lore raw

PATCH v3 4/5 rpm: add explicit dependency on file-replacement-native for native builds

In reply to Ross Burton
---
 meta/recipes-devtools/rpm/rpm_4.11.2.bb  | 1 +
 meta/recipes-devtools/rpm/rpm_5.4+cvs.bb | 1 +
 meta/recipes-devtools/rpm/rpm_5.4.14.bb  | 1 +
 3 files changed, 3 insertions(+)
meta/recipes-devtools/rpm/rpm_4.11.2.bb +1 -0
index bc36f99..f4a2110 100644
@@ -23,6 +23,7 @@ LICENSE = "GPL-2.0+"
 LIC_FILES_CHKSUM ??= "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
 
 DEPENDS = "db libxml2 xz findutils file popt nss bzip2 elfutils attr zlib acl gzip python"
+DEPENDS_append_class-native = " file-replacement-native"
 
 SRC_URI += "http://rpm.org/releases/rpm-4.11.x/${BP}.tar.bz2 \
             file://use-pkgconfig-for-python.patch \
meta/recipes-devtools/rpm/rpm_5.4+cvs.bb +1 -0
index 8903f3b..951b251 100644
@@ -43,6 +43,7 @@ LICENSE = "LGPLv2.1"
 LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1"
 
 DEPENDS = "libpcre attr acl popt ossp-uuid file byacc-native"
+DEPENDS_append_class-native = " file-replacement-native"
 
 S = "${WORKDIR}/rpm"
 
meta/recipes-devtools/rpm/rpm_5.4.14.bb +1 -0
index b450c6f..73b3734 100644
@@ -41,6 +41,7 @@ LICENSE = "LGPLv2.1"
 LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1"
 
 DEPENDS = "libpcre attr acl popt ossp-uuid file byacc-native"
+DEPENDS_append_class-native = " file-replacement-native"
 
 # rpm2cpio is a shell script, which is part of the rpm src.rpm.  It is needed
 # in order to extract the distribution SRPM into a format we can extract...
Signature · 1 line
2.1.4
#4 lore raw

PATCH v3 5/5 subversion: add explicit dependency on file-replacement-native for native builds

In reply to Ross Burton
---
 meta/recipes-devtools/subversion/subversion_1.8.13.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-devtools/subversion/subversion_1.8.13.bb +1 -0
index f843b95..9c9bdb1 100644
@@ -1,6 +1,7 @@
 SUMMARY = "Subversion (svn) version control system client"
 SECTION = "console/network"
 DEPENDS = "apr-util serf sqlite3 file"
+DEPENDS_append_class-native = " file-replacement-native"
 RDEPENDS_${PN} = "serf"
 LICENSE = "Apache-2"
 HOMEPAGE = "http://subversion.tigris.org"
Signature · 1 line
2.1.4
#5 lore raw

Re: [PATCH][V3 5/5] subversion: add explicit dependency on file-replacement-native for native builds

Quoted 10 lines · Ross Burton
---
 meta/recipes-devtools/subversion/subversion_1.8.13.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-devtools/subversion/subversion_1.8.13.bb +0 -0
index f843b95..9c9bdb1 100644

meta/recipes-devtools/subversion/subversion_1.8.13.bb line 4

Quoted 4 lines
meta/recipes-devtools/subversion/subversion_1.8.13.bb +1 -0
@@ -1,6 +1,7 @@
 SUMMARY = "Subversion (svn) version control system client"
 SECTION = "console/network"
 DEPENDS = "apr-util serf sqlite3 file"
+DEPENDS_append_class-native = " file-replacement-native"

To make this work, isn't something like:

EXTRANATIVEPATH_append_class-native = " file-native"

needed too?

Same comment for rpm-native.

Quoted 11 lines
meta/recipes-devtools/subversion/subversion_1.8.13.bb +0 -1
 RDEPENDS_${PN} = "serf"
 LICENSE = "Apache-2"
 HOMEPAGE = "http://subversion.tigris.org"
--

2.1.4

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#6 lore raw

Re: [PATCH][V3 5/5] subversion: add explicit dependency on file-replacement-native for native builds

Quoted 4 lines · Andre McCurdy

To make this work, isn't something like:

EXTRANATIVEPATH_append_class-native = " file-native"

God I wish I wrote better commit messages sometimes.

subversion and rpm don't use the file binary but link to libmagic, so EXTRANATIVEPATH isn't needed (as only the file binary is affected by that).

Ross