Building rpm with sfdk results in wrong version

Hi,

I thought i’d use git tags to determine the version for my rpm packages, but that seems broken. According to https://sailfishos.org/wiki/Application_SDK_Packaging_Apps#Version_.28required.29, setting Version to 0 should result in a version determined by the git tag. In particular, when the current HEAD is the same as the last tag, and the working directory is clean, this should give me version 0.4. However, it gets me something like 0.4+master.20201106191248.8562336.

So since that is broken, I changed the Version field in the yaml file back to 0.4. This is picked up by the build in qtcreater, but sfdk builds keep setting version to something with the suffix appended. Before I changed it to 0, it would correctly use the version as specified in the yaml file. How can I go back to the old behaviour that correctly uses the version specified in yaml? Also, why doesn’t setting it to 0 work as advertised?

gmc@coltrane:~/src/sailfish/tasks/build$ grep Version ../tasks/rpm/harbour-tasks.*
../tasks/rpm/harbour-tasks.spec:Version:    0.4
../tasks/rpm/harbour-tasks.yaml:Version: 0.4
gmc@coltrane:~/src/sailfish/tasks/build$ sfdk build ../tasks/

NOTICE: Appending changelog entries to the .spec file…
Setting version: 0.4+master.20201106191949.ef2bef8
Building target platforms: i486-meego-linux-gnu
  ...

Note: when I ssh into the build vm, and execute mb2 myself, things work as expected. So what is sfdk caching that should not be cached?

2 Likes

I had a similar thing happen when i had dirty submodules… maybe that’s what you have?

Oh, so it is only supposed to happen when the spec says 0?
That makes so much more sense, I have it happening all the time too.

Nope, no git submodules in this project. I think there’s two issues here:

  • when setting Version to 0 and then back to 0.4 (or something fixed), sfdk keeps thinking it is set to 0
  • there is a known issue with the sdk where sharing files with the vm via vboxsf messes up the permissions of the files, which makes the build process inside the vm think there are local changes (permissions don’t match the permissions in git)

Try to deactivate version fixing in sfdk via sfdk config --global --push no-fix-version. It is analogous to -X flag of mb2.

3 Likes

Thanks, that did the trick!

This is most probably caused by the file permission mismatch as you pointed out. Namely the executable permission bit. Try to compare the output of git-status executed on host and under the build engine:

$ git status
$ sfdk engine exec git status

If git-status executed under the build engine shows more files changed, check their executable permissions recorded under Git and possibly adjust those (on host).

Similar issue happens when CRLF line endings are used in sources, but that should only affect Windows users. (See https://sailfishos.org/wiki/Application_SDK_FAQ#How_can_I_avoid_issues_with_incompatible_line_endings.3F).