utils.bbclass: add wrapper script generator
authorChris Larson <chris_larson@mentor.com>
Fri, 1 Oct 2010 16:56:20 +0000 (09:56 -0700)
committerChris Larson <chris_larson@mentor.com>
Fri, 1 Oct 2010 17:00:32 +0000 (10:00 -0700)
Signed-off-by: Chris Larson <chris_larson@mentor.com>
classes/utils.bbclass

index 1c636be..9a9c7b5 100644 (file)
@@ -177,7 +177,7 @@ def base_chk_file_checksum(localpath, src_uri, expected_md5sum, expected_sha256s
     return True
 
 def base_get_checksums(pn, pv, src_uri, localpath, params, data):
-    # Try checksum from recipe and then parse checksums.ini 
+    # Try checksum from recipe and then parse checksums.ini
     # and try PN-PV-SRC_URI first and then try PN-SRC_URI
     # we rely on the get method to create errors
     try:
@@ -228,7 +228,7 @@ def base_get_checksums(pn, pv, src_uri, localpath, params, data):
             expected_sha256sum = parser.get(src_uri, "sha256")
         else:
             return (None,None)
-        
+
         if name:
             bb.note("This package has no checksums in corresponding recipe '%s', please consider moving its checksums from checksums.ini file \
                 \nSRC_URI[%s.md5sum] = \"%s\"\nSRC_URI[%s.sha256sum] = \"%s\"\n" % (bb.data.getVar("FILE", data, True), name, expected_md5sum, name, expected_sha256sum))
@@ -449,6 +449,25 @@ oe_machinstall() {
        fi
 }
 
+create_wrapper () {
+   # Create a wrapper script
+   #
+   # These are useful to work around relocation issues, by setting environment
+   # variables which point to paths in the filesystem.
+   #
+   # Usage: create_wrapper FILENAME [[VAR=VALUE]..]
+
+   cmd=$1
+   shift
+   mv $cmd $cmd.real
+   cmdname=`basename $cmd`.real
+   cat <<END >$cmd
+#!/bin/sh
+exec env $@ \`dirname \$0\`/$cmdname
+END
+   chmod +x $cmd
+}
+
 def check_app_exists(app, d):
        from bb import which, data