Patchwork [3/7] sstate: Add SSTATE_SCAN_FILES

login
register
mail settings
Submitter Saul Wold
Date Dec. 15, 2011, 1:50 a.m.
Message ID <54c5ffb66f2e947b81d7cdbb8e8c34c51b38770f.1323911699.git.sgw@linux.intel.com>
Download mbox | patch
Permalink /patch/16959/
State New
Headers show

Comments

Saul Wold - Dec. 15, 2011, 1:50 a.m.
This allows recipes to specify files that may be outside the normal set
for inclusion when there are hardcoded paths that need to be fixmepathed
to work correctly.

Signed-off-by: Saul Wold <sgw@linux.intel.com>
---
 meta/classes/sstate.bbclass |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
Saul Wold - Dec. 15, 2011, 8:38 a.m.
On 12/14/2011 05:50 PM, Saul Wold wrote:
> This allows recipes to specify files that may be outside the normal set
> for inclusion when there are hardcoded paths that need to be fixmepathed
> to work correctly.
>
> Signed-off-by: Saul Wold<sgw@linux.intel.com>
> ---
>   meta/classes/sstate.bbclass |   11 ++++++++++-
>   1 files changed, 10 insertions(+), 1 deletions(-)
>
> diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
> index 504b099..5452a43 100644
> --- a/meta/classes/sstate.bbclass
> +++ b/meta/classes/sstate.bbclass
> @@ -10,7 +10,8 @@ SSTATE_PKGSPEC    = "sstate-${PN}-${PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}-$
>   SSTATE_PKGNAME    = "${SSTATE_PKGSPEC}${BB_TASKHASH}"
>   SSTATE_PKG        = "${SSTATE_DIR}/${SSTATE_PKGNAME}"
>
> -SSTATE_SCAN_CMD ?= "find ${SSTATE_BUILDDIR} \( -name "*.la" -o -name "*-config" \) -type f"
> +SSTATE_SCAN_FILES ?= "*.la *-config"
> +SSTATE_SCAN_CMD ?= "find ${SSTATE_BUILDDIR} \( ${SSTATE_FIND_CMD_FILES} \) -type f"
>
>   BB_HASHFILENAME = "${SSTATE_PKGNAME}"
>
> @@ -33,6 +34,13 @@ python () {
>       else:
>           d.setVar('SSTATE_MANMACH', bb.data.expand("${MACHINE}", d))
>
> +    find_cmd_files = ""
> +    for file in d.getVar('SSTATE_SCAN_FILES', True).split():
> +        find_file = "-o -name \"" + file + "\""
> +        find_cmd_files = find_cmd_files + " " + find_file
> +    d.setVar('SSTATE_FIND_CMD_FILES', find_cmd_files.replace("-o ", "", 1))
> +    bb.note("FIND_CMD_FILES = %s" % find_cmd_files)
> +
Just realized I left some debugging stuff here and below, this is fixed 
in the bracnh
>       # These classes encode staging paths into their scripts data so can only be
>       # reused if we manipulate the paths
>       if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross', d) or bb.data.inherits_class('sdk', d) or bb.data.inherits_class('crosssdk', d):
> @@ -299,6 +307,7 @@ def sstate_hardcode_path(d):
>   	# Need to remove hardcoded paths and fix these when we install the
>   	# staging packages.
>   	sstate_scan_cmd = d.getVar('SSTATE_SCAN_CMD', True)
> +        bb.note("SCAN_CMD = %s" % sstate_scan_cmd)
Bad Sau! left debugging!

Sau!

>   	p = os.popen("%s" % sstate_scan_cmd)
>   	file_list = p.read()
>
Richard Purdie - Dec. 15, 2011, 11:12 a.m.
On Wed, 2011-12-14 at 17:50 -0800, Saul Wold wrote:
> This allows recipes to specify files that may be outside the normal set
> for inclusion when there are hardcoded paths that need to be fixmepathed
> to work correctly.
> 
> Signed-off-by: Saul Wold <sgw@linux.intel.com>
> ---
>  meta/classes/sstate.bbclass |   11 ++++++++++-
>  1 files changed, 10 insertions(+), 1 deletions(-)
> 
> diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
> index 504b099..5452a43 100644
> --- a/meta/classes/sstate.bbclass
> +++ b/meta/classes/sstate.bbclass
> @@ -10,7 +10,8 @@ SSTATE_PKGSPEC    = "sstate-${PN}-${PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}-$
>  SSTATE_PKGNAME    = "${SSTATE_PKGSPEC}${BB_TASKHASH}"
>  SSTATE_PKG        = "${SSTATE_DIR}/${SSTATE_PKGNAME}"
>  
> -SSTATE_SCAN_CMD ?= "find ${SSTATE_BUILDDIR} \( -name "*.la" -o -name "*-config" \) -type f"
> +SSTATE_SCAN_FILES ?= "*.la *-config"
> +SSTATE_SCAN_CMD ?= "find ${SSTATE_BUILDDIR} \( ${SSTATE_FIND_CMD_FILES} \) -type f"
>  
>  BB_HASHFILENAME = "${SSTATE_PKGNAME}"
>  
> @@ -33,6 +34,13 @@ python () {
>      else:
>          d.setVar('SSTATE_MANMACH', bb.data.expand("${MACHINE}", d))
>  
> +    find_cmd_files = ""
> +    for file in d.getVar('SSTATE_SCAN_FILES', True).split():
> +        find_file = "-o -name \"" + file + "\""
> +        find_cmd_files = find_cmd_files + " " + find_file
> +    d.setVar('SSTATE_FIND_CMD_FILES', find_cmd_files.replace("-o ", "", 1))
> +    bb.note("FIND_CMD_FILES = %s" % find_cmd_files)
> +
>      # These classes encode staging paths into their scripts data so can only be
>      # reused if we manipulate the paths
>      if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross', d) or bb.data.inherits_class('sdk', d) or bb.data.inherits_class('crosssdk', d):

We could just do:

SSTATE_SCAN_CMD ?= 'find ${SSTATE_BUILDDIR} \( -name "${@"\" -o -name \"".join(d.getVar("SSTATE_SCAN_FILES", True).split())}" \) -type f'

which would save some of the anonymous python overhead and the temporary
variable.

Cheers,

Richard

Patch

diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index 504b099..5452a43 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -10,7 +10,8 @@  SSTATE_PKGSPEC    = "sstate-${PN}-${PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}-$
 SSTATE_PKGNAME    = "${SSTATE_PKGSPEC}${BB_TASKHASH}"
 SSTATE_PKG        = "${SSTATE_DIR}/${SSTATE_PKGNAME}"
 
-SSTATE_SCAN_CMD ?= "find ${SSTATE_BUILDDIR} \( -name "*.la" -o -name "*-config" \) -type f"
+SSTATE_SCAN_FILES ?= "*.la *-config"
+SSTATE_SCAN_CMD ?= "find ${SSTATE_BUILDDIR} \( ${SSTATE_FIND_CMD_FILES} \) -type f"
 
 BB_HASHFILENAME = "${SSTATE_PKGNAME}"
 
@@ -33,6 +34,13 @@  python () {
     else:
         d.setVar('SSTATE_MANMACH', bb.data.expand("${MACHINE}", d))
 
+    find_cmd_files = ""
+    for file in d.getVar('SSTATE_SCAN_FILES', True).split():
+        find_file = "-o -name \"" + file + "\""
+        find_cmd_files = find_cmd_files + " " + find_file
+    d.setVar('SSTATE_FIND_CMD_FILES', find_cmd_files.replace("-o ", "", 1))
+    bb.note("FIND_CMD_FILES = %s" % find_cmd_files)
+
     # These classes encode staging paths into their scripts data so can only be
     # reused if we manipulate the paths
     if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross', d) or bb.data.inherits_class('sdk', d) or bb.data.inherits_class('crosssdk', d):
@@ -299,6 +307,7 @@  def sstate_hardcode_path(d):
 	# Need to remove hardcoded paths and fix these when we install the
 	# staging packages.
 	sstate_scan_cmd = d.getVar('SSTATE_SCAN_CMD', True)
+        bb.note("SCAN_CMD = %s" % sstate_scan_cmd)
 	p = os.popen("%s" % sstate_scan_cmd)
 	file_list = p.read()