Bug 15255 - bitbake explodes when there is a typo SRC_URL instead of SRC_URI
Summary: bitbake explodes when there is a typo SRC_URL instead of SRC_URI
Status: RESOLVED FIXED
Alias: None
Product: BitBake
Classification: Build System, Metadata & Runtime
Component: bitbake (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: High normal
Target Milestone: 5.0 M2
Assignee: Pavel Zhukov
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2023-10-26 22:52 UTC by Nick Owens
Modified: 2023-12-09 08:34 UTC (History)
6 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Owens 2023-10-26 22:52:54 UTC
my coworker who is new to bitbake was writing a recipe and it didn't work. we discovered that a typo in SRC_URL will lead to bitbake exploding with an obtuse error and will also create a bunch of directories in $PWD that are named after code fragments from bbclasses.

i think this situation can probably be improved so that other people aren't scratching their heads when this happens.

repro recipe at the bottom.

mischief@beast:~/src/poky $ bitbake x-native
WARNING: Host distribution "gentoo-2.14" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.
Loading cache: 100% |################################################################################################################################################################| Time: 0:00:00
Loaded 3065 entries from dependency cache.
Parsing recipes: 100% |##############################################################################################################################################################| Time: 0:00:00
Parsing of 1814 .bb files complete (1813 cached, 1 parsed). 3066 targets, 89 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION           = "2.4.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "x86_64-poky-linux"
MACHINE              = "qemux86-64"
DISTRO               = "poky"
DISTRO_VERSION       = "4.2.3"
TUNE_FEATURES        = "m64 core2"
TARGET_FPU           = ""
meta
meta-poky
meta-yocto-bsp       = "mickledore:6c3c62ebc171e16a45f55f276a83a32db075794e"
meta-oe              = "mickledore:57c516973978ca2667339bf1aae7dc722b5bcac7"

Initialising tasks: 100% |###########################################################################################################################################################| Time: 0:00:00
Sstate summary: Wanted 99 Local 9 Mirrors 83 Missed 7 Current 20 (92% match, 94% complete)
NOTE: Executing Tasks
ERROR: x-native-1.0+${SRCPV}-r0 do_populate_lic: Error executing a python function in exec_func_python() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
     0001:
 *** 0002:sstate_hardcode_path(d)
     0003:
File: '/home/mischief/src/poky/meta/classes-global/sstate.bbclass', lineno: 654, function: sstate_hardcode_path
     0650:    bb.note("Removing hardcoded paths from sstate package: '%s'" % (sstate_hardcode_cmd))
     0651:    subprocess.check_output(sstate_hardcode_cmd, shell=True, cwd=sstate_builddir)
     0652:
     0653:        # If the fixmefn is empty, remove it..
 *** 0654:    if os.stat(fixmefn).st_size == 0:
     0655:        os.remove(fixmefn)
     0656:    else:
     0657:        bb.note("Replacing absolute paths in fixmepath file: '%s'" % (sstate_filelist_relative_cmd))
     0658:        subprocess.check_output(sstate_filelist_relative_cmd, shell=True)
Exception: FileNotFoundError: [Errno 2] No such file or directory: '/home/mischief/src/poky/build/tmp/work/core2-64-poky-linux/x-native/1.0+${SRCPV}-r0/sstate-build-populate_lic/fixmepath'

ERROR: Logfile of failure stored in: /home/mischief/src/poky/build/tmp/work/core2-64-poky-linux/x-native/1.0+${SRCPV}-r0/temp/log.do_populate_lic.1507434
ERROR: Task (/home/mischief/src/poky/meta/recipes-devtools/x/x-native.bb:do_populate_lic) failed with exit code '1'
ERROR: x-native-1.0+${SRCPV}-r0 do_deploy_source_date_epoch: Error executing a python function in exec_func_python() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
     0001:
 *** 0002:sstate_hardcode_path(d)
     0003:
File: '/home/mischief/src/poky/meta/classes-global/sstate.bbclass', lineno: 654, function: sstate_hardcode_path
     0650:    bb.note("Removing hardcoded paths from sstate package: '%s'" % (sstate_hardcode_cmd))
     0651:    subprocess.check_output(sstate_hardcode_cmd, shell=True, cwd=sstate_builddir)
     0652:
     0653:        # If the fixmefn is empty, remove it..
 *** 0654:    if os.stat(fixmefn).st_size == 0:
     0655:        os.remove(fixmefn)
     0656:    else:
     0657:        bb.note("Replacing absolute paths in fixmepath file: '%s'" % (sstate_filelist_relative_cmd))
     0658:        subprocess.check_output(sstate_filelist_relative_cmd, shell=True)
Exception: FileNotFoundError: [Errno 2] No such file or directory: '/home/mischief/src/poky/build/tmp/work/core2-64-poky-linux/x-native/1.0+${SRCPV}-r0/sstate-build-deploy_source_date_epoch/fixmepath'

ERROR: Logfile of failure stored in: /home/mischief/src/poky/build/tmp/work/core2-64-poky-linux/x-native/1.0+${SRCPV}-r0/temp/log.do_deploy_source_date_epoch.1507433
ERROR: Task (/home/mischief/src/poky/meta/recipes-devtools/x/x-native.bb:do_deploy_source_date_epoch) failed with exit code '1'
NOTE: Tasks Summary: Attempted 510 tasks of which 504 didn't need to be rerun and 2 failed.

Summary: 2 tasks failed:
  /home/mischief/src/poky/meta/recipes-devtools/x/x-native.bb:do_populate_lic
  /home/mischief/src/poky/meta/recipes-devtools/x/x-native.bb:do_deploy_source_date_epoch
Summary: There was 1 WARNING message.
Summary: There were 2 ERROR messages, returning a non-zero exit code.
mischief@beast:~/src/poky $ ls
'!='                       contrib         LICENSE                Makefile            meta-poky        oe-init-build-env                             ''\''patches'\'')}'   README.poky.md   tools
'${@d.getVar('\''S'\'')'   documentation   LICENSE.GPL-2.0-only   MEMORIAM            meta-selftest   'os.path.join('\'''                             README.hardware.md   README.qemu.md
 bitbake                   else            LICENSE.MIT            meta                meta-skeleton   'os.path.normpath(d.getVar('\''S'\''))'         README.md            scripts
 build                     if              MAINTAINERS.md         meta-openembedded   meta-yocto-bsp  'os.path.normpath(d.getVar('\''WORKDIR'\''))'   README.OE-Core.md    SECURITY.md
mischief@beast:~/src/poky $ cat meta/recipes-devtools/x/x-native.bb
SUMMARY = "broken"
HOMEPAGE = "https://github.com/"
LICENSE = "CLOSED"

SRC_URL = "git://gist.github.com/mischief/74d8d99ca3b6c299242717a05af1401b.git;protocol=https"
SRCREV = "${AUTOREV}"
PV:append = "+${SRCPV}"

INHIBIT_DEFAULT_DEPS = "1"

S = "${WORKDIR}/git"

mischief@beast:~/src/poky $
Comment 1 Pavel Zhukov 2023-12-07 23:16:15 UTC
This issue is not caused by SRC_URI => SRC_URL typo directly (to be honest I made same mistake in the past). 
Nevertheless this was fixed in 62afa02d01794376efab75623f42e7e08af08526 (oe-core a8e7b0f932b9ea69b3a218fca18041676c65aba0 )

commit 62afa02d01794376efab75623f42e7e08af08526
Author: Richard Purdie <richard.purdie@linuxfoundation.org>
Date:   Fri Aug 11 13:52:59 2023 +0100

    base/package: Move source revision information from PV to PKGV
Comment 2 Pavel Zhukov 2023-12-08 10:37:00 UTC
Reopen the bug because it was not fixed but masked by mentioned commit.
Comment 3 Yoann Congal 2023-12-08 22:58:54 UTC
FYI, the commit 62afa02d01794376efab75623f42e7e08af08526 was also mentioned as a fix for #14918 (See https://bugzilla.yoctoproject.org/show_bug.cgi?id=14918#c2)
Though it look like a coincidence, I thought it would be better to mention it.