16

I am a very lazy person. While working on a HW/SW project the software changes permanently. In this development stage, changing the commit/reversion-tags in the recipes is very nasty. I want Yocto to fetch the latest git commit. Is this possible/How to do this? My example recipe:

SUMMARY = "my test"
SECTION = "test"
LICENSE = "CLOSED"

inherit cmake
SRCREV = "f9bdbd6c631f07e427c010086c7c26a95eb2924e"

SRC_URI = "gitsm://myGit/mytest;protocol=http;branch=develop"

S = "${WORKDIR}/git/"
Stefan Jaritz
  • 1,999
  • 7
  • 36
  • 60

1 Answers1

28

Sure, set SRCREV = "${AUTOREV}".

Furthermore, you need to reference SRCPV in PV in order to automatically update the version whenever the revision of the source code changes. Here is an example:

 PV = "1.0+git${SRCPV}"

Then it'll build the latest revision each time.

digby280
  • 879
  • 1
  • 7
  • 22
Anders
  • 8,541
  • 1
  • 27
  • 34
  • 8
    As it is, bitbake will not rebuild the package if the repo is updated. You must add *PV = "0.1+git${SRCPV}"* as well to enable this. https://www.yoctoproject.org/docs/2.5.1/dev-manual/dev-manual.html#automatically-incrementing-a-binary-package-revision-number – Jetski S-type Oct 04 '18 at 06:27
  • @JetskiS-type *"bitbake will not rebuild the package if the repo is updated. You must add PV = "0.1+git${SRCPV}" as well to enable this*" - this is false. The fetcher will re-fetch a branch HEAD every time `AUTOREV` is parsed. `PV` is only for output package name version number. *"in order to automatically update the version"* - read the spec again carefully :) – bloody Oct 06 '22 at 17:54
  • @bloody, late, but.. so you do think that bitbake will rebuild the package if the repo is updated without setting PV? 8 people agree with me (as of time of writing). Did you try it out before writing your comment? – Jetski S-type Jul 05 '23 at 10:34
  • @JetskiS-type Since Yocto ZEUS release yes, it does with `SRCREV = "${AUTOREV}"`, I have tried it. Btw. also quite old already (nowadays we use HARDKNOTT). "People" use old stuff apparently. – bloody Jul 05 '23 at 10:51
  • @bloody ah, good to know then. I can't find it in the release notes for Zeus. I ran into that problem in an older version for sure, but already updated all the recipes accordingly before updating the Yocto version, so I wasn't in a position to notice (and I don't actively use it now). – Jetski S-type Jul 05 '23 at 11:38