2017-11-01 2 views
0

Learning Yocto von http://book.yoctoprojectbook.com/index. Kapitel 4 hat folgenden Codeyocto d.getVar schlägt fehl

SUMMARY = "Recipe to build the 'nano' editor" 

PN = "nano" 
PV = "2.2.6" 

SITE = "http://www.nano-editor.org/dist" 
PV_MAJOR = "${@bb.data.getVar('PV', d, 1).split('.')[0]}" 
PV_MINOR = "${@bb.data.getVar('PV', d, 1).split('.')[1]}" 

SRC_URI = "${SITE}/v${PV_MAJOR}.${PV_MINOR}/${PN}-${PV}.tar.gz" 
SRC_URI[md5sum] = "03233ae480689a008eb98feb1b599807" 
SRC_URI[sha256sum] = \ 
"be68e133b5e81df41873d32c517b3e5950770c00fc5f4dd23810cd635abce67a" 

python do_fetch() { 
    bb.plain("Downloading source tarball from ${SRC_URI} ...") 
    src_uri = (d.getVar('SRC_URI', True) or "").split() 
    if 0 == len(src_uri): 
     bb.fatal('Empty URI') 
    try: 
     fetcher = bb.fetch2.Fetch(src_uri, d) 
     fetcher.download() 
    except bb.fetch2.BBFetchException: 
     bb.fatal('Could not fetch source tarball.') 
    bb.plain("Download successful.") 
} 

addtask fetch before do_build 

python do_unpack() { 
    bb.plain("Unpacking source tarball ...") 
    os.system("tar x -C ${WORKDIR} -f ${DL_DIR}/${P}.tar.gz") 
    bb.plain("Unpacked source tarball.") 
} 

addtask unpack before do_build after do_fetch 

python do_configure() { 
    bb.plain("Configuring source package ...") 
    os.system("cd ${WORKDIR}/${P} && ./configure") 
    bb.plain("Configured source package.") 
} 

addtask configure before do_build after do_unpack 

python do_compile() { 
    bb.plain("Compiling package ...") 
    os.system("cd ${WORKDIR}/${P} && make") 
    bb.plain("Compiled package.") 
} 

addtask compile before do_build after do_configure 

do_clean[nostamp] = "1" 
do_clean() { 
    rm -rf ${WORKDIR}/${P} 
    rm -f ${TMPDIR}/stamps/* 
} 

addtask clean 

Das Rezept befindet sich in Meta-Hallo/Rezepte-Editor/Nano. Im Grunde versucht es, ein nano Text-Editor-Paket zu erstellen. Es ist bei der do_fetch() Task fehlgeschlagen. Nach dem Debugging einiger Druckanweisungen habe ich herausgefunden, dass der Fehler in dieser Zeile auftritt: src_uri = (d.getVar('SRC_URI', True) or "").split(), speziell unter d.getVar('SRC_URI', True). Ich bin nicht wirklich sicher, was genau das Problem verursacht. Möchte jemand helfen? Ich betreibe eine rocko Build von yocto.

Hier ist die Terminal-Ausgabe erhalte ich, wenn ich das Rezept ausführen:

$bitbake nano 
NOTE: Not using a cache. Set CACHE = <directory> to enable. 
Parsing recipes: 100% |#################################################################################################################| Time: 0:00:00 
Parsing of 2 .bb files complete (0 cached, 2 parsed). 2 targets, 0 skipped, 0 masked, 0 errors. 
NOTE: Resolving any missing task queue dependencies 
Initialising tasks: 100% |##############################################################################################################| Time: 0:00:00 
NOTE: Executing RunQueue Tasks 
Downloading source tarball from ${SRC_URI} ... 
ERROR: nano-2.2.6-r0 do_fetch: Function failed: do_fetch 
ERROR: Logfile of failure stored in: /home/some-user/projects/bbhello/tmp/work/nano-2.2.6-r0/temp/log.do_fetch.14350 
ERROR: Task (/home/some-user/projects/bbhello/meta-hello/recipes-editor/nano/nano.bb:do_fetch) failed with exit code '1' 
NOTE: Tasks Summary: Attempted 1 tasks of which 0 didn't need to be rerun and 1 failed. 

Summary: 1 task failed: 
    /home/some-user/projects/bbhello/meta-hello/recipes-editor/nano/nano.bb:do_fetch 
Summary: There was 1 ERROR message shown, returning a non-zero exit code. 

Und hier ist die eigentliche Protokolldatei:

DEBUG: Executing python function do_fetch 
Downloading source tarball from ${SRC_URI} ... 
DEBUG: Python function do_fetch finished 
ERROR: Function failed: do_fetch 

Antwort

2

Ich bin nicht sicher, was Sie testen, aber wenn ich dieses Beispiel versuchen, scheitert es bei der Analyse mit:

ERROR: ExpansionError during parsing /media/build/poky/meta/recipes-core/base-files/test_1.0.bb
Traceback (most recent call last): File "/media/build/poky/bitbake/lib/bb/data_smart.py", line 412, in DataSmart.expandWithRefs(s='${SITE}/v${PV_MAJOR}.${PV_MINOR}/${PN}-${PV}.tar.gz', varname='SRC_URI'): try: > s = expand_var_regexp.sub(varparse.var_sub, s) try: File "/media/build/poky/bitbake/lib/bb/data_smart.py", line 111, in VariableParse.var_sub(match=<_sre.SRE_Match object; span=(9, 20), match='${PV_MAJOR}'>): else: > var = self.d.getVarFlag(key, "_content") self.references.add(key) File "/media/build/poky/bitbake/lib/bb/data_smart.py", line 794, in DataSmart.getVarFlag(var='PV_MAJOR', flag='_content', expand=True, noweakdefault=False, parsing=False): cachename = var + "[" + flag + "]" > value = self.expand(value, cachename) File "/media/build/poky/bitbake/lib/bb/data_smart.py", line 436, in DataSmart.expand(s="${@bb.data.getVar('PV', d, 1).split('.')[0]}", varname='PV_MAJOR'): def expand(self, s, varname = None): > return self.expandWithRefs(s, varname).value File "/media/build/poky/bitbake/lib/bb/data_smart.py", line 426, in DataSmart.expandWithRefs(s="${@bb.data.getVar('PV', d, 1).split('.')[0]}", varname='PV_MAJOR'): except Exception as exc: > raise ExpansionError(varname, s, exc) from exc bb.data_smart.ExpansionError: Failure expanding variable PV_MAJOR, expression was ${@bb.data.getVar('PV', d, 1).split('.')[0]} which triggered exception AttributeError: module 'bb.data' has no attribute 'getVar'

das ist, weil die bb.data.getVar (‚PV‘, d, 1) d.getV sein muss ar ('PV', wahr). Dieses Rezept kann nicht unter Rocko analysiert werden, also glaube ich nicht, dass du das Rezept läufst, von dem du denkst, dass du es bist?

+0

Danke. Es funktionierte. Ich habe nichts getestet. Nur Yocto lernen und das ist der Code, der in dem Buch zur Verfügung gestellt wird. – flashburn