Two months before the release (example: DIRAC14), a release branch (example: release-14) is created from master. This is a feature freeze and from this moment on the release branch ideally only receives cosmetics and bugfixes, no major new features, no merges from master or other branches (except cherry-picks; more about it later). You as developer are responsible to commit or merge the to-be-released code to master, before the release branch is created.
Can I commit bleeding edge code to master after the feature freeze?¶
Yes you can! This is one of the reasons we have the release branch and exactly for this reason we will never merge from master to the release branch, only from the release branch to master.
How to check out the release branch (example release-14 for DIRAC14)¶
Check out the release branch:
$ git checkout release-14
Now you have it next to master (verify this):
$ git branch
You can switch back to master:
$ git checkout master
And then switch back to the release branch:
$ git checkout release-14
How to commit changes and bugfixes that are relevant for the released code¶
Commit all such changes to the release branch, not to master. This way no commit or bugfix will get lost. Please do not transfer commits from the release branch to master manually. This is not only unnecessary work but it is harmful (conflicts)! Again, do not commit to master, commit to the release branch:
$ git checkout release-14 $ git pull # update the local release-14 branch $ git commit # commit your modifications $ git push # push your changes to release-14 branch $ git checkout master # switch to the master branch $ git merge --no-ff release-14 # merge changes to master, fix conflicts if any $ git push # push your changes to master
Note that by merging your changes to master you might get conflicts. Git points them out clearly. In such cases open conflicting file(s) and fix discrepancies inside manually. They are marked with “<<<<<<” and “>>>>>>” strings.
What if you accidentally committed something to master which belongs to the release? In this case do not merge master to the release branch, but rather cherry-pick the individual commit(s) to the release branch:
$ git checkout release-14 $ git cherry-pick [hash] # with [hash] that corresponds # to the commit
How to exclude code from being released¶
You as the developer are responsible for removing your code from the release branch that you do not wish to be released. This is not done by actually removing the code but by using pamadm in combination with CPP statements. So again, do not actually delete code lines, use CPP statements as demonstrated below:
Modules can be excluded from the release version by surrounding the appropriate parts of code by preprocessor statements, e.g.:
#ifdef MOD_KRMC CALL TKRMCORB CALL SETDC2(0) CALL PSIOPT('MCSCF',WFCONV,WORK,LWORK) IF(DOANA) CALL PAMANA(WORK,LWORK) #else CALL QUIT( & 'Second order KMCSCF optimization not included in this version') #endif
This means that the calls are included only if MOD_KRMC is defined. Look in pamadm for existing modules and how they define their CPP flags and directories. If your pamadm module is not part of pamadm –release, then the code will be automatically removed by the release script. In the above example, the script would remove the actual MOD_KRMC code and what would be left is:
CALL QUIT('Second order KMCSCF optimization not included in this version')
If you want to protect code from being released which is not part of any pamadm module, you can use MOD_UNRELEASED:
#ifdef MOD_UNRELEASED ! secret code; this will not end up in the release tarball #endif
To summarize, you can remove code using either existing CPP filters or using MOD_UNRELEASED. Do this on the release branch and merge to the master.
How to “remove” tests?¶
Look in pamadm and search for “unreleased”. All the tests listed there will be removed by the release preparation script. All tests listed under modules which are not part of:
are removed as well.
How to release or export the code¶
Most important rule: treat unpublished code of others with respect. Do not release code of others without asking.
- Verify copyright headers.
- Verify logo (list of authors).
- Bump the version (the version number is kept in file VERSION; but also git grep -i for “orphaned” version numbers in the source code).
As a final step create the tarball:
$ ./pamadm --release $ cd build $ cmake .. $ make release
Copyright statements and markers¶
In the development source code you can find the following copyright statement markers:
!dirac_copyright_start !dirac_copyright_end !dalton_copyright_start !dalton_copyright_end \* dirac_copyright_start \* \* dirac_copyright_end \* \* dalton_copyright_start \* \* dalton_copyright_end \*
They are there so that we do not have to update copyrights manually. You can update them with the maintenance/update_copyright.py script. This script will overwrite whatever is between these markers so it is a bad idea to modify text between the markers manually.
These markers are removed by “make release” which runs maintenance/remove_copyright_tags in the background (see cmake/ConfigPackaging.cmake).