Hello Markus
I don’t have real-world experience with this, but I am not sure if changing branches and
distcleaning/recompiling is the most convenient workflow. I think I would prefer to have
multiple local repositories with different branches checked out. Thankfully git makes it
rather easy to have this. E.g.:
- You create two root directories. One for Python2 and one for Python3:
mkdir /home/user/git/grass-p{2,3}
- Create a virtualenv inside grass-p2 and grass-p3. E.g.:
cd /home/user/git/grass-p2
virtualenv -p python2 venv
cd /home/user/git/grass-p2
python3 -m venv venv
- Clone the remote GRASS repo and name the local repo
dev
. You will only do this forgrass-p3
:
cd /home/user/git/grass-p3
git clone https://github.com/neteler/grass dev
- For python 2 and for each release branch you will make a local git clone. This way
you won’t be wasting disk space. Read more about this
here.
cd /home/user/git/grass-p2
git clone …/grass-p3/dev dev
git clone …/grass-p3/dev r72
git clone …/grass-p3/dev r74
git clone …/grass-p3/dev r76
- The dir structure should look like this:
$ tree grass*
grass-p2
├── dev
├── r72
├── r74
├── r76
└── venv
grass-p3
├── dev
└── venv
- On each release clone you need to checkout the respective branch:
cd /home/user/git/grass-p2/r72 && git checkout releasebranch_7_2
cd /home/user/git/grass-p2/r74 && git checkout releasebranch_7_4
cd /home/user/git/grass-p2/r76 && git checkout releasebranch_7_6
-
Each directory is a full blown git repo. It is only by convention that 7.6 backports
will happen inr76
etc. If you want to directly pull/push from/to github from the release
directories, you will probably need to setup remotes. Regardless, setting up remotes
etc should only be done once. -
Obviously, when 7.8 gets released, two more directories will need to be added (one
for python2 and one for python 3).
The benefit of this approach is that at least for trivial backports, you will not need
to recompile everything and, perhaps more importantly, you will not need to recompile
“master” in order to test a fix in 7.2.
all the best,
Panos
PS1. There are other ways to achieve something like this, e.g.
--singlebranch
but I don’t see much
benefit.
PS2. You can optionally use something like direnv to
automatically activate the virtualenvs when you cd into the corresponding directory.
This way there is no confusion WRT which python is active. I use this and it works
marvellously.