summaryrefslogtreecommitdiffstats
path: root/meta/classes-global/base.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes-global/base.bbclass')
-rw-r--r--meta/classes-global/base.bbclass40
1 files changed, 24 insertions, 16 deletions
diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass
index 0999b42daa..b6940bbb6f 100644
--- a/meta/classes-global/base.bbclass
+++ b/meta/classes-global/base.bbclass
@@ -153,20 +153,38 @@ python base_do_fetch() {
153} 153}
154 154
155addtask unpack after do_fetch 155addtask unpack after do_fetch
156do_unpack[dirs] = "${WORKDIR}" 156do_unpack[cleandirs] = "${UNPACKDIR}"
157
158do_unpack[cleandirs] = "${@d.getVar('S') if os.path.normpath(d.getVar('S')) != os.path.normpath(d.getVar('WORKDIR')) else os.path.join('${S}', 'patches')}"
159 157
160python base_do_unpack() { 158python base_do_unpack() {
159 import shutil
160
161 sourcedir = d.getVar('S')
162 # Intentionally keep SOURCE_BASEDIR internal to the task just for SDE
163 d.setVar("SOURCE_BASEDIR", sourcedir)
164
161 src_uri = (d.getVar('SRC_URI') or "").split() 165 src_uri = (d.getVar('SRC_URI') or "").split()
162 if not src_uri: 166 if not src_uri:
163 return 167 return
164 168
169 basedir = None
170 unpackdir = d.getVar('UNPACKDIR')
171 workdir = d.getVar('WORKDIR')
172 if sourcedir.startswith(workdir) and not sourcedir.startswith(unpackdir):
173 basedir = sourcedir.replace(workdir, '').strip("/").split('/')[0]
174 if basedir:
175 bb.utils.remove(workdir + '/' + basedir, True)
176 d.setVar("SOURCE_BASEDIR", workdir + '/' + basedir)
177
165 try: 178 try:
166 fetcher = bb.fetch2.Fetch(src_uri, d) 179 fetcher = bb.fetch2.Fetch(src_uri, d)
167 fetcher.unpack(d.getVar('WORKDIR')) 180 fetcher.unpack(d.getVar('UNPACKDIR'))
168 except bb.fetch2.BBFetchException as e: 181 except bb.fetch2.BBFetchException as e:
169 bb.fatal("Bitbake Fetcher Error: " + repr(e)) 182 bb.fatal("Bitbake Fetcher Error: " + repr(e))
183
184 if basedir and os.path.exists(unpackdir + '/' + basedir):
185 # Compatibility magic to ensure ${WORKDIR}/git and ${WORKDIR}/${BP}
186 # as often used in S work as expected.
187 shutil.move(unpackdir + '/' + basedir, workdir + '/' + basedir)
170} 188}
171 189
172SSTATETASKS += "do_deploy_source_date_epoch" 190SSTATETASKS += "do_deploy_source_date_epoch"
@@ -199,8 +217,8 @@ addtask do_deploy_source_date_epoch_setscene
199addtask do_deploy_source_date_epoch before do_configure after do_patch 217addtask do_deploy_source_date_epoch before do_configure after do_patch
200 218
201python create_source_date_epoch_stamp() { 219python create_source_date_epoch_stamp() {
202 # Version: 1 220 # Version: 2
203 source_date_epoch = oe.reproducible.get_source_date_epoch(d, d.getVar('S')) 221 source_date_epoch = oe.reproducible.get_source_date_epoch(d, d.getVar('SOURCE_BASEDIR') or d.getVar('S'))
204 oe.reproducible.epochfile_write(source_date_epoch, d.getVar('SDE_FILE'), d) 222 oe.reproducible.epochfile_write(source_date_epoch, d.getVar('SDE_FILE'), d)
205} 223}
206do_unpack[postfuncs] += "create_source_date_epoch_stamp" 224do_unpack[postfuncs] += "create_source_date_epoch_stamp"
@@ -410,16 +428,6 @@ python () {
410 oe.utils.features_backfill("DISTRO_FEATURES", d) 428 oe.utils.features_backfill("DISTRO_FEATURES", d)
411 oe.utils.features_backfill("MACHINE_FEATURES", d) 429 oe.utils.features_backfill("MACHINE_FEATURES", d)
412 430
413 if d.getVar("S")[-1] == '/':
414 bb.warn("Recipe %s sets S variable with trailing slash '%s', remove it" % (d.getVar("PN"), d.getVar("S")))
415 if d.getVar("B")[-1] == '/':
416 bb.warn("Recipe %s sets B variable with trailing slash '%s', remove it" % (d.getVar("PN"), d.getVar("B")))
417
418 if os.path.normpath(d.getVar("WORKDIR")) != os.path.normpath(d.getVar("S")):
419 d.appendVar("PSEUDO_IGNORE_PATHS", ",${S}")
420 if os.path.normpath(d.getVar("WORKDIR")) != os.path.normpath(d.getVar("B")):
421 d.appendVar("PSEUDO_IGNORE_PATHS", ",${B}")
422
423 # To add a recipe to the skip list , set: 431 # To add a recipe to the skip list , set:
424 # SKIP_RECIPE[pn] = "message" 432 # SKIP_RECIPE[pn] = "message"
425 pn = d.getVar('PN') 433 pn = d.getVar('PN')