Bug 752

Summary: Unable to build with BB_NO_NETWORK=1
Product: [Build System, Metadata & Runtime] Meta-yocto Reporter: Gary Thomas <gary>
Component: meta-yoctoAssignee: Richard Purdie <richard.purdie>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: poky.bs.watcher, poky.watcher, sgw
Version: unspecified   
Target Milestone: 1.0 M4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: ---

Description Gary Thomas 2011-02-22 13:15:43 UTC
Using mainline 9a28ad6b0291e0d4c4aae6ba25a9f7752d5c2e11 (2011-02-22)

I get this error immediately.  If I disable BB_NO_NETWORK, the parsing completes
and no gypsy stuff is ever downloaded.

ERROR: Error parsing /home/local/poky-amltd/meta/recipes-connectivity/gypsy/gypsy_git.bb: Network access disabled through BB_NO_NETWORK but access rquested with command git ls-remote anongit.freedesktop.org/gypsy master (for url None)
ERROR: Command execution failed: Exited with 1

Is this because of this line in the recipe?
  PV = "0.8+git${SRCPV}"

The problem seems to be because of this line:
  ./meta/conf/distro/include/poky-default-revisions.inc:SRCREV_pn-gypsy ??= "3652e1f37e82b8e63983e30fda3482cd099a8cf5"

Changing the ??= to ?= lets it work with BB_NO_NETWORK=1
Comment 1 Richard Purdie 2011-02-23 02:21:40 UTC
Does:
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py
index 83e6f70..e76fbbf 100644
--- a/bitbake/lib/bb/data_smart.py
+++ b/bitbake/lib/bb/data_smart.py
@@ -298,6 +298,8 @@ class DataSmart(MutableMapping):
         if local_var:
             if flag in local_var:
                 value = copy.copy(local_var[flag])
+            elif flag == "content" and "defaultval" in local_var:
+                value = copy.copy(local_var["defaultval"])
         if expand and value:
             value = self.expand(value, None)
         return value

fix this?
Comment 2 Richard Purdie 2011-02-23 03:51:12 UTC
I've pushed some changes into master regarding this, please try http://git.pokylinux.org/cgit.cgi/poky/commit/?id=6ea24f04cd635295d826f03d9c7d8a08cc1d5b31

(and you'll need the previous commit too to avoid parsing failures)
Comment 3 Gary Thomas 2011-02-23 05:10:48 UTC
This worked well (although I did have to add the change made for bug #753 which
is not yet checked in), up to this point:

ERROR: Function 'Network access disabled through BB_NO_NETWORK but access rquested with command git ls-remote git.infradead.org/mtd-utils.git master (for url None)' failed
ERROR: Build of do_fetch failed
ERROR: Traceback (most recent call last):
  File "/home/local/poky-amltd/bitbake/lib/bb/build.py", line 361, in exec_task
    return _exec_task(fn, task, d, quieterr)
  File "/home/local/poky-amltd/bitbake/lib/bb/build.py", line 324, in _exec_task
    event.fire(TaskFailed(exc.name, logfn, localdata), localdata)
  File "/home/local/poky-amltd/bitbake/lib/bb/event.py", line 122, in fire
    fire_class_handlers(event, d)
  File "/home/local/poky-amltd/bitbake/lib/bb/event.py", line 71, in fire_class_handlers
    ret = bb.utils.better_eval("tmpHandler(e)", locals)
  File "/home/local/poky-amltd/bitbake/lib/bb/utils.py", line 387, in better_eval
    return eval(source, _context, locals)
  File "<string>", line 1, in <module>
  File "tmpHandler(e)", line 112, in tmpHandler
  File "/usr/lib/python2.6/posixpath.py", line 65, in join
    if b.startswith('/'):
AttributeError: 'NetworkAccess' object has no attribute 'startswith'

ERROR: Task 84 (virtual:native:/home/local/poky-amltd/meta/recipes-devtools/mtd/mtd-utils_1.4.1.bb, do_fetch) failed with exit code '1'

That recipe has not changed and the git tarball for it is in the mirror.

Ideas?
Comment 4 Richard Purdie 2011-02-23 07:10:42 UTC
The annoying traceback in this bug is fixed in http://git.pokylinux.org/cgit.cgi/poky/commit/?id=91c0b3a2e6d006224d8d2b661ca7528e9d036f1b
Comment 5 Gary Thomas 2011-02-23 07:18:54 UTC
I've traced the rest of the issue like this:

Richard has made some changes which nearly fixes that bug, except
for the mtd-utils_1.4.1.bb recipe.  The problem with this recipe
is that it specifies a git tag, not a fixed revision.  The fetcher
fails in this case as it has to interrogate the git tree to find
the tag and that's not allowed because of BB_NO_NETWORK=1

I tried to move this to a fixed revision which corresponds to tag v1.4.1
like this:

diff --git a/meta/recipes-devtools/mtd/mtd-utils_1.4.1.bb b/meta/recipes-devtools/mtd/mtd-utils_1.4.1.bb
index 5e6db0e..2c4e276 100644
--- a/meta/recipes-devtools/mtd/mtd-utils_1.4.1.bb
+++ b/meta/recipes-devtools/mtd/mtd-utils_1.4.1.bb
@@ -6,11 +6,12 @@ LICENSE = "GPLv2+"
 LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \
                     file://include/common.h;beginline=1;endline=17;md5=ba05b07912a44ea2bf81ce409380049c"
 
-SRC_URI = "git://git.infradead.org/mtd-utils.git;protocol=git;tag=v${PV} \
+SRC_URI = "git://git.infradead.org/mtd-utils.git;protocol=git \
                file://add-exclusion-to-mkfs-jffs2-git-2.patch;patch=1"
 
 S = "${WORKDIR}/git/"
 
+PV = "1.4.1${SRCPV}"
 PR = "r1"
 
 EXTRA_OEMAKE = "'CC=${CC}' 'CFLAGS=${CFLAGS} -I${S}/include -DWITHOUT_XATTR' 'BUILDDIR=${S}'"

I also added this to my fixed-revisions.inc
SRCREV_pn-mtd-utils ??= "3c3674a6e1d3f59554b0ff68ca59be2fd4134e0c"

Finally, I had to move recipes-devtools/mtd/mtd-utils-1.4.1/add-exclusion-to-mkfs-jffs2-git-2.patch
to recipes-devtools/mtd/mtd-utils or else it could not be found.

Is there an easier way to solve these issues?  Once I understand the whole process, I can
propose a patch.
Comment 6 Richard Purdie 2011-02-23 07:21:49 UTC
I came to the same conclusion locally and found this patch worked too:
diff --git a/meta/recipes-devtools/mtd/mtd-utils_1.4.1.bb b/meta/recipes-devtools/mtd/mtd-utils_1.4.1.bb
index 5e6db0e..f2de74d 100644
--- a/meta/recipes-devtools/mtd/mtd-utils_1.4.1.bb
+++ b/meta/recipes-devtools/mtd/mtd-utils_1.4.1.bb
@@ -6,7 +6,7 @@ LICENSE = "GPLv2+"
 LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \
                     file://include/common.h;beginline=1;endline=17;md5=ba05b07912a44ea2bf81ce409380049c"
 
-SRC_URI = "git://git.infradead.org/mtd-utils.git;protocol=git;tag=v${PV} \
+SRC_URI = "git://git.infradead.org/mtd-utils.git;protocol=git;tag=3c3674a6e1d3f59554b0ff68ca59be2fd4134e0c \
                file://add-exclusion-to-mkfs-jffs2-git-2.patch;patch=1"
 
 S = "${WORKDIR}/git/"
Comment 7 Richard Purdie 2011-02-23 07:23:06 UTC
Incidentally the reason you had to move the patch was because you changed PV.
Comment 8 Gary Thomas 2011-02-23 07:27:14 UTC
Changing PV was necessary for the SRCREV_pn-mtd-utils to be used.  Without it,
that line seems to be ignored.  Is that expected?
Comment 9 Richard Purdie 2011-02-23 15:44:23 UTC
Fix pushed in 982955ec922a0ecc649f7cbfb1e79fc95d0bd833