gitgithubyoctoyocto-recipehiredis

How can I create a bbappend file to force the Git Fetcher to download a specific version of a software from GitHub?


I'm using the zeus Yocto release as Linux build system. In this release the recipe for hiredis (hiredis is a minimalistic C client library for the Redis database) fetches and compiles the version 0.14.0 of this library.

I would like to use a more recent version of this library; in particular my goal is to fetch and compile the version 1.0.2 of hiredis.

The hiredis recipe in the zeus release of Yocto

The recipe hiredis_0.14.0.bb, stored in the folder meta-openembedded/meta-oe/recipes-extended/hiredis of the zeus release, is the following:

DESCRIPTION = "Minimalistic C client library for Redis"
HOMEPAGE = "http://github.com/redis/hiredis"
LICENSE = "BSD-3-Clause"
SECTION = "libs"
DEPENDS = "redis"

LIC_FILES_CHKSUM = "file://COPYING;md5=d84d659a35c666d23233e54503aaea51"
SRCREV = "685030652cd98c5414ce554ff5b356dfe8437870"
SRC_URI = "git://github.com/redis/hiredis;protocol=git \
           file://0001-Makefile-remove-hardcoding-of-CC.patch"

S = "${WORKDIR}/git"

inherit autotools-brokensep pkgconfig

EXTRA_OEMAKE = "PREFIX=${prefix} LIBRARY_PATH=${baselib}"

# By default INSTALL variable in Makefile is equal to 'cp -a', which preserves
# ownership and causes host-user-contamination QA issue.
# And PREFIX defaults to /usr/local.
do_install_prepend() {
  export INSTALL='cp -r'
}

With this recipe bitbake fetches the version 0.14.0 of hiredis from the GitHub repository. I suppose that the version 0.14.0 is selected by the version of the recipe contained in its name "hiredis_0.14.0".

Note: I don't want to modify the recipe hiredis_0.14.0.bb or add a new recipe (with the name hiredis_1.0.2.bb) in the folder meta-openembedded/meta-oe/recipes-extended/hiredis. I would like to create a .bbappend file in my meta layer without modify the official meta-openembedded layer of the zeus release.

Set SRC_URI not work

I have tried to create a file hiredis_%.bbappend with the following definition of the variable SRC_URI:

SRC_URI = "git://github.com/redis/hiredis;protocol=git;branch=1.0.2"

But the compilation with bitbake gives the following error message:

> bitbake hiredis
...
ERROR: hiredis-0.14.0-r0 do_fetch: Fetcher failure for URL: 'git://github.com/redis/hiredis;protocol=git;branch=1.0.2'. Unable to fetch URL from any source.

My question

How can I create a my-layer/recipes-extended/hredis/hredis_%.bbappend file to force the Git Fetcher to download a specific version of hredis (for example the version 1.0.2) from the GitHub repository?


Solution

  • I have found a solution by the creation of the following hiredis_%.bbappend file:

    PV="1.0.2"
    
    # In SRC_URI I have change values of the protocol and the branch parameters
    SRC_URI = "git://github.com/redis/hiredis;protocol=https;branch=master"
    
    # Commit Hash of version 1.0.2 of hiredis library
    SRCREV = "b731283245f3183af527237166261ad0768ba7d4"
    
    inherit cmake
    

    In this way the Git Fetcher downloads the version 1.0.2 from the GitHub repository and in the image is installed the dynamic library libhiredis.so.1.0.0 (the version showed by the name of the library is 1.0.0 instead 1.0.2).

    Description of the file hiredis_%.bbappend