meta-qt6/classes/srcrev-update.bbclass
Samuli Piippo 6492c16955 srcrev_update: fix update task with latest fetcher
Additional check was added into the bb.fetcher that needs to be
workaround in srcrev_update task. Otherwise task will fail with
error:

Exception: bb.fetch2.FetchError: Fetcher failure: Recipe uses a
floating tag/branch without a fixed SRCREV yet doesn't call
bb.fetch2.get_srcrev() (use SRCPV in PV for OE).

Pick-to: 6.3 6.2
Change-Id: Ib3c2665257c344c312074519a03d96437866cd8d
Reviewed-by: Mikko Gronoff <mikko.gronoff@qt.io>
2022-03-04 07:06:21 +00:00

37 lines
1.1 KiB
Plaintext

python do_srcrev_update() {
import subprocess
recipe = d.getVar('FILE')
srcrev_file = os.path.join(os.path.dirname(recipe), 'qt6-git.inc')
module = d.getVar('QT_MODULE')
scms = []
fetcher = bb.fetch2.Fetch(d.getVar('SRC_URI').split(), d)
urldata = fetcher.ud
for u in urldata:
if urldata[u].method.supports_srcrev():
scms.append(u)
if len(scms) == 0:
return
d.setVar("__BBSEENSRCREV", "1")
for scm in scms:
ud = urldata[scm]
for name in ud.names:
rev = ud.method.latest_revision(ud, d, name)
srcrev = d.getVar("SRCREV_%s" % name)
if srcrev is None: srcrev = d.getVar("SRCREV")
if srcrev == rev:
bb.plain("%s: %s is already latest" % (name, srcrev))
continue
bb.plain("%s: %s -> %s" % (name, srcrev, rev))
cmd = "sed -E -i %s %s -e '/SRCREV(_%s)? /s/%s/%s/'" % (recipe, srcrev_file, name, srcrev, rev)
bb.process.run(cmd, log=None, shell=True, stderr=subprocess.PIPE, cwd=None)
}
do_srcrev_update[nostamp] = "1"
addtask srcrev_update after do_fetch