How to check source version 17.01 (rxxxx revision vs. git commit hash)

With buildroot I build the latest 17.01 version, but with the latest commit I don't know if that is included.

How can I compare the 17.01 snapshot version with the source on github.

your question is a bit vague. I am not sure what you actually mean. Sounds like basic git knowledge, but is there some LEDE-specific that you are looking for?

But some answers in any case. hopefully some of those will match your needs:

  • in your 17.01 buildroot, do "git log" or "git log --oneline". It shows you the most recent commits in your repo:
perus@uxx:/r7800-lede1701$ git log --oneline

47bf110cbb mac80211: backport an upstream fix for queue start/stop handling
a49503bbc7 sysntpd: restore support for peer-less (standalone) mode
1bdd23231b ar71xx: fix Wallys DR344 ethernet MAC addresses offsets
0cb669b469 ugps: fix and improve init script
...
  • "git branch -v" will also show you the current commit:
perus@uxx:/r7800-lede1701$ git branch -v

* lede-17.01 47bf110cbb mac80211: backport an upstream fix for queue start/stop handling
  • If you want to check the version based on the built firmware files, you can do also that. Check that build's bin/targets/.../.../packages directory for the "base-files" package. Its version contains the most recent commit's hash. (the same works also firmware downloads from the LEDE repo)
perus@uxx:/r7800-lede1701$ ls bin/targets/ipq806x/generic/packages/base-files*

bin/targets/ipq806x/generic/packages/base-files_172-r3298-47bf110cbb_arm_cortex-a15_neon-vfpv4.ipk
  • Inside a running firmware, the easiest place to see the exact version is either /etc/banner or /etc/os-release files, which both contain the exact release. See os-release:

root@LEDE2:~# cat /etc/os-release
NAME="LEDE"
VERSION="17.01-SNAPSHOT, Reboot"
ID="lede"
ID_LIKE="lede openwrt"
PRETTY_NAME="LEDE Reboot 17.01-SNAPSHOT"
VERSION_ID="17.01-snapshot"
HOME_URL="http://lede-project.org/"
BUG_URL="http://bugs.lede-project.org/"
SUPPORT_URL="http://forum.openwrt.org/"
BUILD_ID="r3298-47bf110cbb"
...

@hnyman sorry to e a little bit vague.

Thank you for your anwsers.

What I'm pointing at is that in the past with OpenWRT the revision of the latest source on the website was the same you could find in LuCI. For example r49000.

In github the latest commit doesn't show the latest revision which is in your example the BUILD_ID (for example "r3298-47bf110cbb". So I couldn't compare if I am using the latest BUILD_ID in the firmware I created.

That is the drawback of using git.

SVN had sequential revision numbering like "r3298" as its main revisioning system, but git doesn't have that. The commit hash is the only important thing in git. For that reason the LEDE revision should preferably be handled as "r3298-47bf110cbb", so that also the git commit hash is included. You need to look at the git history to find that hash, but there is no direct way to count the "r32xx" revision from the hash in a simple way.

The current r32xx style revision in LEDE is just the number of commits since the commit used for the "reboot" tag at LEDE launch in April 2016.

And the r32xx revisioining in master and 17.01 has already deviated.

@hnyman thank you for clarifying that.

I will use the git history from now on.
Good to know that its not only counting up like the next revision will be r3299.

One more useful thing that I just noticed regarding the shell script that is used to calculate the revision during the build process. Functionality for conversion between git hash and rxxxx revision has been added a few months ago:

You can use ./scripts/getver.sh in your buildroot in three ways:

  • without arguments, it gives you current HEAD revision as "r3xxx-hash". That is the normal use.

    $ ./scripts/getver.sh
    r3298-47bf110cbb

  • If you give a version like "r3298" as an argument, if fetches you the git hash:

    $ ./scripts/getver.sh r3298
    47bf110cbbfbb425d7538c566332d2058fb45248

  • If you give a git hash as argument, it calculates the rxxxx revision for it:

    $ ./scripts/getver.sh 9d84accea1
    r3279-9d84accea1

I added that to wiki: https://lede-project.org/docs/guide-developer/source-revision-calculation

3 Likes

@hnyman Thank you for the update and putting it in the wiki. I think more people will have use to this.

git fetch origin --tags
git tag
will show

reboot
v17.01.0
v17.01.0-rc1
v17.01.0-rc2

The new wiki link for the one @hnyman gave is now https://openwrt.org/docs/guide-developer/source-code/source-revision-calculation

Not completely clear from reading the script that it can take its own obscure output (the git hash seems to be something to do with a merge base, not the current commit), and return the git commit. (wiki now updated)

lede_source$ git describe
v17.01.4-215-g05f0fac

lede_source$ ./scripts/getver.sh 
r2993+783-b9a408c

lede_source$ ./scripts/getver.sh r2993+783-b9a408c
05f0fac189984981e3f28288e44d9afdd088dd77

I'm still at a loss as to why the git hash isn't at least part of the version string.

1 Like