diff options
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/externalsrc.bbclass | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass index d3cede2b68..f98335980f 100644 --- a/meta/classes/externalsrc.bbclass +++ b/meta/classes/externalsrc.bbclass | |||
@@ -85,8 +85,10 @@ python () { | |||
85 | d.prependVarFlag('do_compile', 'prefuncs', "externalsrc_compile_prefunc ") | 85 | d.prependVarFlag('do_compile', 'prefuncs', "externalsrc_compile_prefunc ") |
86 | d.prependVarFlag('do_configure', 'prefuncs', "externalsrc_configure_prefunc ") | 86 | d.prependVarFlag('do_configure', 'prefuncs', "externalsrc_configure_prefunc ") |
87 | 87 | ||
88 | # Ensure compilation happens every time | 88 | # Force the recipe to be always re-parsed so that the file_checksums |
89 | d.setVarFlag('do_compile', 'nostamp', '1') | 89 | # function is run every time |
90 | d.setVar('BB_DONT_CACHE', '1') | ||
91 | d.setVarFlag('do_compile', 'file-checksums', '${@srctree_hash_files(d)}') | ||
90 | 92 | ||
91 | # We don't want the workdir to go away | 93 | # We don't want the workdir to go away |
92 | d.appendVar('RM_WORK_EXCLUDE', ' ' + d.getVar('PN', True)) | 94 | d.appendVar('RM_WORK_EXCLUDE', ' ' + d.getVar('PN', True)) |
@@ -124,3 +126,28 @@ python externalsrc_compile_prefunc() { | |||
124 | # Make it obvious that this is happening, since forgetting about it could lead to much confusion | 126 | # Make it obvious that this is happening, since forgetting about it could lead to much confusion |
125 | bb.plain('NOTE: %s: compiling from external source tree %s' % (d.getVar('PN', True), d.getVar('EXTERNALSRC', True))) | 127 | bb.plain('NOTE: %s: compiling from external source tree %s' % (d.getVar('PN', True), d.getVar('EXTERNALSRC', True))) |
126 | } | 128 | } |
129 | |||
130 | def srctree_hash_files(d): | ||
131 | import shutil | ||
132 | import subprocess | ||
133 | |||
134 | s_dir = d.getVar('EXTERNALSRC', True) | ||
135 | git_dir = os.path.join(s_dir, '.git') | ||
136 | oe_index_file = os.path.join(git_dir, 'oe-devtool-index') | ||
137 | oe_hash_file = os.path.join(git_dir, 'oe-devtool-tree-sha1') | ||
138 | |||
139 | ret = " " | ||
140 | if os.path.exists(git_dir): | ||
141 | # Clone index | ||
142 | shutil.copy2(os.path.join(git_dir, 'index'), oe_index_file) | ||
143 | # Update our custom index | ||
144 | env = os.environ.copy() | ||
145 | env['GIT_INDEX_FILE'] = oe_index_file | ||
146 | subprocess.check_output(['git', 'add', '.'], cwd=s_dir, env=env) | ||
147 | sha1 = subprocess.check_output(['git', 'write-tree'], cwd=s_dir, env=env) | ||
148 | with open(oe_hash_file, 'w') as fobj: | ||
149 | fobj.write(sha1) | ||
150 | ret = oe_hash_file + ':True' | ||
151 | else: | ||
152 | d.setVarFlag('do_compile', 'nostamp', '1') | ||
153 | return ret | ||