From 948d75312e48c4877aca0c92a5ea6a649216ab94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Hundeb=C3=B8ll?= Date: Tue, 7 Jun 2016 14:41:45 +0200 Subject: [PATCH] classes/binconfig: create binconfig symlink package Packages that create a ${PN}-config script used by dependent packages during their configure step, inherits the binconfig class to both fixup paths in the script and to make the script available to dependent packages during their stage step. Until now, this was done by the binconfig class, which adds a call to binconfig_stage_fixup() during the dependent stage step. However, binconfig_stage_fixup() symlinks into ./stage/cross/bin/, which is not "allowed" in the stage fixup functions. (They should only touch ./stage.unpack/ and not ./stage ). Also, the symlink-during-stage fixup approach might fail as ./stage/cross/bin is not guarenteed to be created when binconfig_stage_fixup() is called. Fix this mess by changing the class to create the symlink during do_install(), and adding the symlink to cross-package created in the class (${PN}-binconfig). Provide this package to dependent packages by adding cross:${PN}-binconfig as a dependency to the primary package. --- classes/binconfig-stage.oeclass | 14 -------------- classes/binconfig.oeclass | 30 ++++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/classes/binconfig-stage.oeclass b/classes/binconfig-stage.oeclass index 46927567..e1022a2a 100644 --- a/classes/binconfig-stage.oeclass +++ b/classes/binconfig-stage.oeclass @@ -73,20 +73,6 @@ def binconfig_stage_fixup(d): binconfig_file) with open(filename, "w") as output_file: output_file.write(binconfig_file) - if pkg_type in ("machine", "sdk"): - if pkg_type == "sdk": - cross_type = "sdk-cross" - else: - cross_type = "cross" - srcfile = os.path.join(sysroot, filename) - dstlink = os.path.join( - stage_dir, cross_type, d.get("stage_bindir").lstrip("/"), - os.path.basename(filename)) - dstdir = os.path.dirname(dstlink) - print("creating destination dir: {}".format(dstdir)) - oelite.util.makedirs(dstdir) - print "symlinking %s to %s"%(dstlink, srcfile) - os.symlink(srcfile, dstlink) # Local Variables: # mode: python diff --git a/classes/binconfig.oeclass b/classes/binconfig.oeclass index eb866292..006a5f17 100644 --- a/classes/binconfig.oeclass +++ b/classes/binconfig.oeclass @@ -1,6 +1,19 @@ ## Class for packages having binconfig files. ## ## Rewrites the paths in the binconfig files so that it contains valid dirs. +## +## @var BINCONFIG_FILES Space separated list of glob patterns to match files +## for ${PN}-dev (defaults to "${bindir}/*-config") +## @var BINCONFIG_GLOB Glob pattern to match files that need fixup (defaults +## to "${BINCONFIG_FILES}") +## @var BINCONFIG_PACKAGE Name of cross package with symlink to binconfig files +## (defaults to "${PN}-binconfig") +## @var BINCONFIG_LIB Name of package that depends on binconfig package +## (default to "${PN}") +## @var BINCONFIG_FIXUP_STRIP_DIRS +## Space separated list of directories to fixup in binconfig +## files (default to "${HOST_SYSROOT} ${TARGET_SYSROOT} ${D} +## ${B} ${S}") require conf/meta.conf @@ -8,6 +21,14 @@ BINCONFIG_FILES ?= "${bindir}/*-config" BINCONFIG_GLOB ?= "${BINCONFIG_FILES}" FILES_${PN}-dev += "${BINCONFIG_FILES}" BINCONFIG_FIXUP_STRIP_DIRS ?= "${HOST_SYSROOT} ${TARGET_SYSROOT} ${D} ${B} ${S}" +BINCONFIG_PACKAGE ?= "${PN}-binconfig" +BINCONFIG_LIB ?= "${PN}" + +# Add cross package for the binconfig files +PACKAGES =+ "${BINCONFIG_PACKAGE}" +PACKAGE_TYPE_${BINCONFIG_PACKAGE} = "${TARGET_CROSS}" +FILES_${BINCONFIG_PACKAGE} = "${stage_bindir}/*-config" +DEPENDS_${BINCONFIG_LIB} += "cross:${BINCONFIG_PACKAGE}" do_install[postfuncs] += "do_install_binconfig_fixup" do_install_binconfig_fixup[dirs] = "${D}" @@ -45,6 +66,15 @@ def do_install_binconfig_fixup(d): with open(filename, "w") as output_file: output_file.write(binconfig_file) + # create symlink + srcdir = os.path.join("..", "..", "machine", d.get("machine_bindir").lstrip("/")) + srcfile = os.path.join(srcdir, os.path.basename(filename)) + dstdir = os.path.join(d.get("D"), d.get("stage_bindir").lstrip("/")) + dstlink = os.path.join(dstdir, os.path.basename(filename)) + oelite.util.makedirs(dstdir) + print "symlinking %s to %s"%(dstlink, srcfile) + os.symlink(srcfile, dstlink) + do_split[postfuncs] += "do_split_binconfig_fixup" def do_split_binconfig_fixup(d): pkgd = d.get("PKGD")