I'm trying to write a recipe for a local repo that is kept in mercurial, and encountering the following problem:
> Traceback (most recent call last): > File "/home/joel-cohen/code/waveos2/poky/bitbake/lib/bb/data_smart.py", > line 808, in DataSmart.getVarFlag(var='PV', flag='_content', expand=True, > noweakdefault=False, parsing=False, retparser=False): > if expand or retparser: > > parser = self.expandWithRefs(value, cachename) > if expand: > File "/home/joel-cohen/code/waveos2/poky/bitbake/lib/bb/data_smart.py", > line 416, in DataSmart.expandWithRefs(s='0.0.4+git${SRCPV}', varname='PV'): > try: > > s = __expand_var_regexp__.sub(varparse.var_sub, s) > try: > File "/home/joel-cohen/code/waveos2/poky/bitbake/lib/bb/data_smart.py", > line 108, in VariableParse.var_sub(match=<_sre.SRE_Match object; span=(9, > 17), match='${SRCPV}'>): > raise Exception("variable %s references itself!" > % self.varname) > > var = self.d.getVarFlag(key, "_content") > self.references.add(key) > File "/home/joel-cohen/code/waveos2/poky/bitbake/lib/bb/data_smart.py", > line 808, in DataSmart.getVarFlag(var='SRCPV', flag='_content', > expand=True, noweakdefault=False, parsing=False, retparser=False): > if expand or retparser: > > parser = self.expandWithRefs(value, cachename) > if expand: > File "/home/joel-cohen/code/waveos2/poky/bitbake/lib/bb/data_smart.py", > line 430, in DataSmart.expandWithRefs(s='${@bb.fetch2.get_srcrev(d)}', > varname='SRCPV'): > except Exception as exc: > > raise ExpansionError(varname, s, exc) from exc > > bb.data_smart.ExpansionError: Failure expanding variable SRCPV, expression > was ${@bb.fetch2.get_srcrev(d)} which triggered exception AttributeError: > 'FetchData' object has no attribute 'moddir' I've fixed this with the following patch, which moves some code in the Hg fetcher to later in the urldata_init method, after some necessary variables have been initialized. I'm not sure if I'm alone in seeing this problem or not? Thanks for any help, Aaron
diff --git a/bitbake/lib/bb/fetch2/hg.py b/bitbake/lib/bb/fetch2/hg.py index 936d043..9790e1b 100644 --- a/bitbake/lib/bb/fetch2/hg.py +++ b/bitbake/lib/bb/fetch2/hg.py @@ -66,13 +66,6 @@ class Hg(FetchMethod): else: ud.proto = "hg" - ud.setup_revisions(d) - - if 'rev' in ud.parm: - ud.revision = ud.parm['rev'] - elif not ud.revision: - ud.revision = self.latest_revision(ud, d) - # Create paths to mercurial checkouts hgsrcname = '%s_%s_%s' % (ud.module.replace('/', '.'), \ ud.host, ud.path.replace('/', '.')) @@ -86,6 +79,14 @@ class Hg(FetchMethod): ud.localfile = ud.moddir ud.basecmd = d.getVar("FETCHCMD_hg") or "/usr/bin/env hg" + ud.setup_revisions(d) + + if 'rev' in ud.parm: + ud.revision = ud.parm['rev'] + elif not ud.revision: + ud.revision = self.latest_revision(ud, d) + + ud.write_tarballs = d.getVar("BB_GENERATE_MIRROR_TARBALLS") def need_update(self, ud, d):
-- _______________________________________________ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto