Search code examples
yoctobitbake

Listing SRC_URI of all packages/files needed to build Yocto image


I would like to list all files that bitbake will fetch when I bake an image.

Currently, I am able to get the SRC_URI of all files needed to bake a Yocto image by executing bitbake core-image-minimal -c fetchall and then parse log files.

Is there is a simpler way to get the same result without the need to download files ?

I am not sure bitbake supports such feature. Ideally, I am looking for a command that prints out the package name and lists all files with corresponding URL

> bitbake core-image-minimal -c fetchall --print-only

Solution

  • Generally bitbake doesn't provides such functionality.

    But I was able to create a simple solution witch creating simple .bbclass file which is inherited in all recipes, by adding it into local.conf file, please see my steps in order to archive that:

    Steps:

    1. let's create a class print-src.bbclass file used to get and print SRC_URI variable (remember to store this class file in layer which is available in conf/bblayers.conf):

      $ cat print-src.bbclass
      
      python do_print_src () {
          # should probably be indented
          srcuri = d.getVar('SRC_URI', True).split()
          bb.warn("SRC_URI look like: %s" % srcuri)
      }
      
      addtask do_print_src before do_fetch
      
    2. Add INHERIT += "print-src" into Your conf/local.conf file

    Edit: it is important to use bitbake --runonly option, that allows to run specific task of the taskgraph for the specified target (with --runonly option do_print_src needs to be used as print_src),

    Edit: Please note that --runall=RUNALL and --runonly=RUNONLY was introduced with Yocto Sumo release 2.5,

    $ bitbake core-image-minimal --runonly print_src
    Loaded 1236 entries from dependency cache.
    NOTE: Resolving any missing task queue dependencies
    
    Build Configuration:
    BB_VERSION           = "1.37.0"
    BUILD_SYS            = "x86_64-linux"
    NATIVELSBSTRING      = "universal-4.8"
    TARGET_SYS           = "i586-poky-linux"
    MACHINE              = "qemux86"
    DISTRO               = "poky"
    DISTRO_VERSION       = "2.5"
    TUNE_FEATURES        = "m32 i586"
    TARGET_FPU           = ""
    meta                 
    meta-poky            
    meta-yocto-bsp       = "master:13cc30cd7de4841990b600e83e1249c81a5171dd"
    
    Initialising tasks: 100% |##########################################################################################################################################################################| Time: 0:00:00
    NOTE: Executing RunQueue Tasks
    WARNING: ptest-runner-2.2+gitAUTOINC+49956f65bb-r0 do_print_src: SRC_URI look like: ['git://git.yoctoproject.org/ptest-runner2']
    WARNING: grep-3.1-r0 do_print_src: SRC_URI look like: ['http://ftp.gnu.org/gnu/grep/grep-3.1.tar.xz', 'file://0001-Unset-need_charset_alias-when-building-for-musl.patch']
    ...
    ... 
    NOTE: Tasks Summary: Attempted 201 tasks of which 0 didn't need to be rerun and all succeeded.
    
    Summary: There were 202 WARNING messages shown.
    

    Please see sample warning output log line:

    WARNING: ptest-runner-2.2+gitAUTOINC+49956f65bb-r0 do_print_src: SRC_URI look like: ['git://git.yoctoproject.org/ptest-runner2'].