Move to v05 - LArSoft/larsoft_docs GitHub Wiki
{{>TOC}}
v05_00_00 is a major change
- use recommended directory structure
- use complete library names
- update_sources.sh
- found in larsoft
- manages the header and library name changes
- argoneutcode geometry_iterator_loop_argoneut_test
- This test uses geometry_microboone.fcl, which is found in uboonecode
- The test passes only if you build and test argoneutcode and uboonecode at the same time.
- larcore larevt larpandora larsoft larana lardata larexamples larreco lareventdisplay larsim
- v05_00_00 tag
- branch v05_00_branch
- argoneutcode dunetpc lariatsoft uboonecode lar1ndcode
- branch v05_00_branch
Now merge v05_00_00_rc with v05_00_branch.
Requires careful checking.
Summary of the branches:
| develop | based on v04_36_01 | it contains “all the new commits” |
| v05_00_branch | based on v04_36_01 | it contains “all the new commits” and the refactoring |
| v05_00_00_rc | based on v04_30_00 | has core service changes |
| v05_00_refactor | based on v05_00_branch | has a bad name; and will have core service changes |
This pass 2 is about creating the branch v05_00_refactor.
Once created, the v05_00_refactor branch was merged with v05_00_branch and removed.
- working area set up with package
larXXXand its dependencies only (first justlarcore, thenlarcoreandlardata, etc.):- add new package
mrb uc
cd "${MRB_SOURCES}/larXXX"-
git checkout v05_00_branch# has latest and greatest commits from LArSoft community, plus refactoring -
git checkout -b v05_00_refactor# new (target) branch based onv05_00_branch: has a bad name -
git merge v05_00_00_rc# merge in the core service changes -
git status# admire the (unnecessarily large) number of unresolved conflicts
First thing: restore the product_deps file from v05_00_branch: it's newer, and v05_00_00_rc is not supposed to have touched dependencies anyway
bq. git checkout v05_00_batch -- ups/product_deps
mrbsetenv
The last step should work seamlessly.
Interpretation of git status (the example is from the merge of lardata):
| @ modified: lardata/AnalysisAlg/CalorimetryAlg.cxx@ | core service changes happened on top of the refactored file: this implies the file has not changed since v05_00_00_rc used it to apply core service changes |
| @ new file: lardata/DetectorInfo/DetectorClocksException.h@ | the file was added by the core service changes (or moved by them, that for git is a new file and a file detection; see next item) |
| @ both deleted: Utilities/timeservice.fcl@ | the file was deleted in both branches, likely an effect of the refactoring (or moved: as above) |
| @ both modified: lardata/AnalysisAlg/CMakeLists.txt@ | a conflict on an existing file: file needs editing |
| @ both added: lardata/CMakeLists.txt@ | a conflict on a “new” file: file needs editing |
| @ added by them: lardata/DetectorInfo/ClockConstants.h@ | added (or moved) by the core service changes; see lessons learned! |
| @ added by us: lardata/DetectorInfo/DetectorPropertiesStandard.h@ | new file, likely from addition to develop after v04_30_00 |
Sometimes there will be pairs of untracked files (e.g., timeservice.fcl~HEAD and timeservice.fcl~v05_00_00_rc), that seems to be the case where git does not really know what to do.
- it's time to fix
CMakeLists.txtfiles.
Usually the content fromv05_00_00_rcis correct, but in most of the casesv05_00_branchdiffers from it only by the removal of unused/unnecessary libraries (e.g.,LArProperties_service/LArPropertiesService_service). - remove all the files that
both deletedand the files amongadded by usandadded by themthat should actually be deleted; usegit rm Filefor that purpose - at this point,
mrb build -Cshould succeed, withcmakedoing all the right things - then, time to resolve the conflicts where
bothmodified or added files; most often, the conflict is just in#includedirectives. - finally, address the hidden conflicts of files that
gitmistreated (see lessons learned below)
After conflict solution, the usual @mrb@ery and @git@tery:
-
cd "$MRB_BUILDDIR" ; make -j41# yes, I am using that kind of machine ctest -j41-
git commit# (and accept the message, or add the explanation of what the branch names mean)
Not clear yet if the files
modifiedare correct beyond doubt.
-
do use a target branch rather than working on
v05_00_branchdirectly (and possibly use a better name thanv05_00_refactor) -
gitcan get very confused, and the lines likeadded by them: lardata/RawData/ExternalTrigger.hmust be checked: in this case, there is no reason why core services would have added that file, not to mention the fact that it actually existed already before. It might be that an existing file was changed indevelopafterv04_30_00andgitthinks the best solution is to forget the newer file and use the one inv05_00_00_rcinstead; the correct solution isgit checkout v05_00_batch -- lardata/RawData/ExternalTrigger.hand then apply the core service changes manually (or via update script). Note that the core service changes on source files have the nice feature that if you forget them you get a compilation or a linker error (not sure if that's on 100% of the cases though); missing changes toFHiCLfiles have a fair chance to appear at run time, but that assumes that somebody is actually running the FHiCL files…
The replacement script (larsoft/bin/UpdateCoreServices.py) is a dumb script that replaces text matching patterns.
It will change a class member art::ServiceHandle<util::DetectorProperties> fDetProp; into auto const* fDetProp = lar::providerFrom<detinfo::DetectorPropertiesService>(); (because it's too stupid to know that the line is a class member declaration rather than a code statement, since it has no context); exceptions apply (module sources have a different set of replacements than headers).
The same is true for other core service members.
The recommended solution is to turn the declaration into detinfo::DetectorProperties const* fDetProp; and add an entry in the initializer list of the class constructor that says fDetProp(lar::providerFrom<detinfo::DetectorPropertiesService>()); you'll have to #include the proper headers (lardata/DetectorInfo/DetectorProperties.h in the header, lardata/DetectorInfoService/DetectorPropertiesService.h in the implementation file.
But keep in mind that the good solution is to have your algorithm receive that service provider in a setup phase (void Setup(detinfo::DetectorProperties const* detprop) { fDetProp = detprop; } – or you can use a ProviderPack) from the controlling module or algorithm.
Another known “feature” is that it can't determine how to fix an expression like larprop->Efield(): Efield() belongs to DetectorProperties, but the script does not know if larprop points to an instance of DetectorProperties or not, and even less about what to replace larprop with (detp? detProp? detprop? foo?). The script will always warn when it sees these instances, and then one has to check manually (and remember it was fixed: the script will warn also on a fixed or correct source). That's better than nothing.
A known bug is that sometimes substitutions to module sources in the “pretend” mode appear to be double, as in:
INFO: pattern '\bUtilities/DetectorProperties.h\b' matched at larreco/TrackFinder/PMAlgTrackMaker_module.cc@50:
OLD| #include “lardata/Utilities/DetectorProperties.h”
NEW| #include “lardata/DetectorInfoServices/DetectorPropertiesService.h”
INFO: Processor 'modules' would change file 'larreco/TrackFinder/PMAlgTrackMaker_module.cc'
INFO: pattern '\bUtilities/DetectorProperties.h\b' matched at larreco/TrackFinder/PMAlgTrackMaker_module.cc@50:
OLD| #include “lardata/Utilities/DetectorProperties.h”
NEW| #include “lardata/DetectorInfo/DetectorProperties.h”
INFO: Processor 'code' would change file 'larreco/TrackFinder/PMAlgTrackMaker_module.cc'
INFO: 2 file would be changed under 'larreco/TrackFinder/PMAlgTrackMaker_module.cc'
This happens because module source files are subject to a module-specific substitution first (that's the first one in the example), and then to a more generic one. Both deal with some
#include pattern. The second substitution would not happen because the pattern does not match any more after the first substitution is performed. But in the pretend mode that first substitution is not really performed, and so the second one is engaged (and it will not be performed as well, since it's still pretend mode).