Cleanup step required for local builds when switching branches?

Hi,

Just set up a new MSYS2 environment and an initial build of the source at tag v6.0.1 succeeded without any issues.

Then I switched to HEAD of origin/maintenance/gramps60 branch, followed by python setup.py build and ran python Gramps.py -v, but I am not sure whether the build updated for the updated code. The reason I am not sure if because of the version info from Gramps -v (and the about box) don’t match the code on disk:

The branches I’m switching between are gramps601 and maintenance/gramps60 with the commits shown below:

$ git branch -vv
  gramps601            e8a208475 Release Gramps 6.0.1
* maintenance/gramps60 96f2b6bc0 [origin/maintenance/gramps60] Repackage Gramps 6.0.1 for macOS
  master

Current branch is maintenance/gramps60, and the version output shows a commit which doesn’t match the HEAD commit:

$ python ./Gramps.py -v
Two Gramps application data directories exist.
Gramps Settings:
----------------
 gramps    : 6.0.1-e18076eeb
 o.s.      : Windows
...

When switching branches, is python3 setup.py build sufficient to ensure the change is recognized, or are any additional steps needed?

Actually when I switched back to the v6.0.1 branch, version shows as 6.0.1 so I guess the code change is recognized. I’m just not sure why the version information for gramps60 branch doesn’t match the HEAD commit.

$ python ./Gramps.py -v
Two Gramps application data directories exist.
Gramps Settings:
----------------
 gramps    : 6.0.1
 o.s.      : Windows
1 Like

git revision is computed here, and the commit SHA is different based on the directory path provided:

Here is where the “incorrect” value comes from, because the SHA corresponds to the gramps/gramps folder:

Directory of __file__ is C:/msys64/home/username/dev/gramps-project/gramps/gramps/gen
__file__'s parent is C:/msys64/home/username/dev/gramps-project/gramps/gramps/gen/..

ROOT_DIR is C:/msys64/home/username/dev/gramps-project/gramps/gramps
git_revision on ROOT_DIR is -e18076eeb

The value I expect should come from the actual root directory, i.e.

ROOT_DIR is C:/msys64/home/username/dev/gramps-project/gramps
git_revision on ROOT_DIR is -96f2b6bc0

Does that make sense? Perhaps I’m not understanding the logic behind the code that’s in the repo currently, could someone tell me what I’m missing?

Thanks.

The version is set in the gramps/version.py file.

If DEV_VERSION is True then we append a git revision. It should be set to False for the releases only.

Understood, and that’s reflected in the output I posted for tag v6.0.1 v/s gramps60 HEAD. The issue is that the revision displayed is based on the folder gramps/gramps as opposed to the gramps folder.

My expectation was that for gramps60 HEAD revision, I should see version 6.0.1-96f2b6bc0 however gramps -v reports 6.0.1-e18076eeb which is unexpected. What would be your expectation?

I agree.

Why do we use a path when we get the git revision? The command git log -1 --format=%h without a path gives the correct result for me.

1 Like