summaryrefslogtreecommitdiffstats
path: root/meta/classes-global
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes-global')
-rw-r--r--meta/classes-global/base.bbclass38
-rw-r--r--meta/classes-global/insane.bbclass14
2 files changed, 36 insertions, 16 deletions
diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass
index 066f3848f7..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] = "${UNPACKDIR}" 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('UNPACKDIR')) 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')
diff --git a/meta/classes-global/insane.bbclass b/meta/classes-global/insane.bbclass
index c32dfffd83..99736830b9 100644
--- a/meta/classes-global/insane.bbclass
+++ b/meta/classes-global/insane.bbclass
@@ -1399,7 +1399,7 @@ python do_qa_patch() {
1399 oe.qa.handle_error("unimplemented-ptest", "%s: autotools-based tests detected" % d.getVar('PN'), d) 1399 oe.qa.handle_error("unimplemented-ptest", "%s: autotools-based tests detected" % d.getVar('PN'), d)
1400 1400
1401 # Last resort, detect a test directory in sources 1401 # Last resort, detect a test directory in sources
1402 elif any(filename.lower() in ["test", "tests"] for filename in os.listdir(srcdir)): 1402 elif os.path.exists(srcdir) and any(filename.lower() in ["test", "tests"] for filename in os.listdir(srcdir)):
1403 oe.qa.handle_error("unimplemented-ptest", "%s: test subdirectory detected" % d.getVar('PN'), d) 1403 oe.qa.handle_error("unimplemented-ptest", "%s: test subdirectory detected" % d.getVar('PN'), d)
1404 1404
1405 oe.qa.exit_if_errors(d) 1405 oe.qa.exit_if_errors(d)
@@ -1602,6 +1602,18 @@ python () {
1602 if prog.search(pn): 1602 if prog.search(pn):
1603 oe.qa.handle_error("uppercase-pn", 'PN: %s is upper case, this can result in unexpected behavior.' % pn, d) 1603 oe.qa.handle_error("uppercase-pn", 'PN: %s is upper case, this can result in unexpected behavior.' % pn, d)
1604 1604
1605 sourcedir = d.getVar("S")
1606 builddir = d.getVar("B")
1607 workdir = d.getVar("WORKDIR")
1608 if sourcedir == workdir:
1609 bb.fatal("Using S = ${WORKDIR} is no longer supported")
1610 if builddir == workdir:
1611 bb.fatal("Using B = ${WORKDIR} is no longer supported")
1612 if sourcedir[-1] == '/':
1613 bb.warn("Recipe %s sets S variable with trailing slash '%s', remove it" % (d.getVar("PN"), d.getVar("S")))
1614 if builddir[-1] == '/':
1615 bb.warn("Recipe %s sets B variable with trailing slash '%s', remove it" % (d.getVar("PN"), d.getVar("B")))
1616
1605 # Some people mistakenly use DEPENDS:${PN} instead of DEPENDS and wonder 1617 # Some people mistakenly use DEPENDS:${PN} instead of DEPENDS and wonder
1606 # why it doesn't work. 1618 # why it doesn't work.
1607 if (d.getVar(d.expand('DEPENDS:${PN}'))): 1619 if (d.getVar(d.expand('DEPENDS:${PN}'))):