1

I'm new to bitbake and working on a tutorial. I know that bitbake often comes with Yocto project but here I'm trying to use it as a stand-alone tool. The tutorial is connected with fetching a nano release(the text terminal editor) and building it. Unfortunately, I'm not able to fetch a release of nano with bitbake version 2.2, but with 1.52.0 everything is working. In a nutshell, this is what I'm getting. wget: unable to resolve host address ‘www.nano-editor.org’

This is the error I'm getting.

...
DEBUG: Running export PSEUDO_DISABLED=1; export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus"; export SSH_AUTH_SOCK="/run/user/1000/keyring/ssh"; export PATH="/home/nikolay/linux_emb_prog/bitbake/bin:/home/nikolay/bin:~/bin:/home/nikolay/bin:~/bin:/home/nikolay/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin"; export HOME="/home/nikolay"; /usr/bin/env wget -t 2 -T 30 --passive-ftp -O /home/nikolay/linux_emb_prog/bbhello/tmp/downloads/nano-2.2.6.tar.gz.tmp -P /home/nikolay/linux_emb_prog/bbhello/tmp/downloads 'https://www.nano-editor.org/dist/v2.2/nano-2.2.6.tar.gz' --progress=dot -v
--2023-01-07 21:50:14--  https://www.nano-editor.org/dist/v2.2/nano-2.2.6.tar.gz
Resolving www.nano-editor.org (www.nano-editor.org)... failed: Name or service not known.
wget: unable to resolve host address ‘www.nano-editor.org’
WARNING: Failed to fetch URL https://www.nano-editor.org/dist/v2.2/nano-2.2.6.tar.gz, attempting MIRRORS if available
...

I get that it is something to do with my network configuration. What I can not understand is why I'm able to build Poky but not my project. This is my tree:

├── bitbake-cookerdaemon.log
├── classes
│   ├── base.bbclass
│   └── logging.bbclass
├── conf
│   ├── bblayers.conf
│   └── bitbake.conf
├── meta-hello
│   ├── conf
│   │   └── layer.conf
│   └── recipes-editor
│       └── nano
│           └── nano.bb

This is nano.bb

SUMMARY = "Recipe to build the 'nano' editor"
DESCRIPTION="nano is text terminal editor."
HOMEPAGE="www.nano-editor.org"
SUMMARY="text terminal editor"
LICENSE="GPL-3.0-or-later"

PN = "nano"
PV = "2.2.6"
P := "${PN}-${PV}"

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

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

inherit logging

python do_fetch() {
    src_uri = (d.getVar('SRC_URI', True) or "").split()
    bb.plain("Downloading source tarball from {} ...".format(src_uri))
    if len(src_uri) == 0:
        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

do_unpack() {
    bbplain "Unpacking source tarball ..."
    tar x -C ${WORKDIR} -f ${DL_DIR}/${P}.tar.gz
    bbplain "Unpacked source tarball."
}

addtask unpack before do_build after do_fetch

do_configure() {
    bbplain "Configure source package ..."
    cd ${WORKDIR}/${P} && ./configure
    bbplain "Configured source package."
}

addtask configure before do_build after do_unpack

do_compile() {
    bbplain "Compiling package ..."
    cd ${WORKDIR}/${P} && make
    bbplain "Compiled package."
}

addtask compile before do_build after do_configure

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

}

addtask clean

python do_testecho() {
    os.system("echo something ${WORKDIR}")
}

addtask testecho

I would appreciate any help, thanks.

niksan
  • 13
  • 2
  • This seems like a DNS issue, now, is this coming from somewhere in your project? or is it part of your network configuration?, you can find that out by manually executing `wget` trying to fetch the same URL as bitbake is doing, if you still see the problem its something related to your network, if you can successfully execute: `wget -t 2 -T 30 --passive-ftp -O -P 'https://www.nano-editor.org/dist/v2.2/nano-2.2.6.tar.gz'` Then I would take out the arguments from the full cmd including the exports one by one to see which one is causing this, fixing that later in the bitbake confs. – ah008a Jan 11 '23 at 05:50
  • Yes, tried and it worked. See the bellow answer. – niksan Jan 15 '23 at 14:52

1 Answers1

1

I think, I experienced a similar issue recently. For me, the solution was to add do_fetch[network] = "1" after my addtask fetch line in my bbclass file (where I had the fetch task defined - base.bbclass in my case).

To me, it looks like some kind of "network" permission got introduced into bitbake at some point. I would assume that any task that wants to access the network needs to have this property set. This would also explain why it works with an older version.

But I haven't found any information about it in the documentation and I'm too lazy to look through their source-code history to find out.

I tested your recipe with this solution using bitbake 2.2.1 on my machine and the fetch task worked, when I had the network property set.

For completeness here is how I defined the fetch task:

addtask fetch
do_fetch[dirs] = "${DL_DIR}"
do_fetch[vardeps] += "SRCREV"
do_fetch[network] = "1"
python base_do_fetch() {
    src_uri = (d.getVar('SRC_URI') or "").split()
    print("fetching: ", src_uri)
    fetcher = bb.fetch2.Fetch(src_uri, d)
    fetcher.download()
}
mkopfi
  • 36
  • 3
  • Yes, It worked. You are right it seems to be some "network" permission thing. I also tried with the same success with BB_ALLOWED_NETWORKS = "*.nano-editor.org". I need to look into that more. – niksan Jan 15 '23 at 15:05