-
Notifications
You must be signed in to change notification settings - Fork 17
classes/binconfig: create binconfig package instead of doing binconfig-fixup #141
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,34 @@ | ||
| ## 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 | ||
|
|
||
| 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}" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. More naming. It seems weird to call it BINCONFIG_LIB when it is just the name of a package containing one (or more) binconfig scripts. Maybe BINCONFIG_CROSS_PACKAGE and BINCONFIG_PACKAGE instead of BINCONFIG_PACKAGE and BINCONFIG_LIB. |
||
|
|
||
| # 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) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens if ${machine_bindir} == ${stage_bindir} ?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nothing good will come from that.. We might need a better way to separate the symlink from the real script. Does it make sense to rename the real script prior to creating the symlink?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same issue arises in line 30: |
||
|
|
||
| do_split[postfuncs] += "do_split_binconfig_fixup" | ||
| def do_split_binconfig_fixup(d): | ||
| pkgd = d.get("PKGD") | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe call it ${PN}-binconfig-cross to make it more clear that it is not actually the binconfig files, but just a cross thingy (ie. symlink) of it.