Project

General

Profile

Beta re-factoring scripts

NOTE: before making a new snapshot, need to preserve files from the beta repositories
that will need to be installed in the new repositories, but cannot simply
be committed to svn prior to the snapshot (eg, would create duplicate file
names in the same area, such as the CMakeLists.txt files for uboonecode and
lbnecode.)
To do this, use the extract-files and extract-files-include-changes scripts
at the end of this page.

Create a new directory, clone all bare repositories with lbnecode and uboonecode empty.
(Should work even if they aren't, provided all content is orthogonal to the content
that is being moved.)


#########################################################################
# need to clone everything from scratch (since mrb is not available)
#########################################################################

export WORKDIR=`pwd`

git clone ssh://p-larcore@cdcvs.fnal.gov/cvs/projects/larcore
git clone ssh://p-lardata@cdcvs.fnal.gov/cvs/projects/lardata
git clone ssh://p-larevt@cdcvs.fnal.gov/cvs/projects/larevt

git clone ssh://p-larsim@cdcvs.fnal.gov/cvs/projects/larsim

git clone ssh://p-lbnecode@cdcvs.fnal.gov/cvs/projects/lbnecode
git clone ssh://p-uboonecode@cdcvs.fnal.gov/cvs/projects/uboonecode

#########################################################################
# extract and move (with histories) lbne-specific files
#########################################################################

# First gather all the files and histories in patch file
# Make a list of the files that are being used. We'll need this later.

cd larcore
ls  Geometry/gdml/lbne?* Geometry/gdml/*lbne*pl Geometry/gdml/lbne/* > $WORKDIR/larcore-lbne-moved-files.txt
git log --pretty=email --patch-with-stat --reverse --full-index --binary \
    `ls  Geometry/gdml/lbne?* Geometry/gdml/*lbne*pl Geometry/gdml/lbne/*` \
    > $WORKDIR/patch-larcore-lbne
cd ..

###### (this was performed later...)
cd larcore
ls Geometry/ChannelMap35Alg.* Geometry/ChannelMapAPA* Geometry/GeoObjectSorter35* Geometry/GeoObjectSorterAPA* > $WORKDIR/larcore-lbne-moved-files-channelmap.txt
git log --pretty=email --patch-with-stat --reverse --full-index --binary \
    `ls Geometry/ChannelMap3d` \
    > $WORKDIR/patch-larcore-lbne-channelmap
cd ..
###### end of late change
###### THIS ONE WAS MISSED during the first transition!!
#      THIS HAS NOT YET BEEN PERFORMED!!!
#export WORKDIR=`pwd`
#ls Geometry/*lbne* > larcore-lbne-moved-files-geometry-fcl.txt
#git log --pretty=email --patch-with-status --reverse --fullindex --binary \
#         `ls Geometry/*lbne*` \ 
#         > $WORKDIR/patch-larcore-lbne-geometry-fcl.txt
#  ls Geometry/*lbne*fcl
######################## need to add the other bits below. Also for uboone.

cd lardata
ls Utilities/*LBNE* Utilities/*lbne* Utilities/test/*LBNE* Utilities/test/*lbne* > $WORKDIR/lardata-lbne-moved-files.txt
git log --pretty=email --patch-with-stat --reverse --full-index --binary \
    `ls Utilities/*LBNE* Utilities/*lbne* Utilities/test/*LBNE* Utilities/test/*lbne*` \
    > $WORKDIR/patch-lardata-lbne
cd ..

cd larevt
ls CalData/*lbne* CalData/*LBNE* > $WORKDIR/larevt-lbne-moved-files.txt
git log --pretty=email --patch-with-stat --reverse --full-index --binary \
    `ls CalData/*lbne* CalData/*LBNE*` \
    > $WORKDIR/patch-larevt-lbne
cd ..

cd larsim
ls DetSim/*LBNE* DetSim/*lbne* EventGenerator/*lbne* EventGenerator/CRY/*lbne* EventGenerator/GENIE/*lbne* LArG4/*lbne* PhotonPropagation/*lbne* Simulation/*lbne* > $WORKDIR/larsim-lbne-moved-files.txt 
git log --pretty=email --patch-with-stat --reverse --full-index --binary \
    `ls DetSim/*LBNE* DetSim/*lbne* EventGenerator/*lbne* EventGenerator/CRY/*lbne* EventGenerator/GENIE/*lbne* LArG4/*lbne* PhotonPropagation/*lbne* Simulation/*lbne*` \
    > $WORKDIR/patch-larsim-lbne
cd ..

# Now apply the patches to the new repository and move the resulting parent 
# sub-directory down one level without affecting any history

cd lbnecode
git am < $WORKDIR/patch-larcore-lbne
git am < $WORKDIR/patch-larcore-lbne-channelmap
git filter-branch --tree-filter 'test -e Geometry && mkdir lbne && mv Geometry lbne/Geometry' HEAD

git am < $WORKDIR/patch-lardata-lbne
git filter-branch -f  --tree-filter 'test -e Utilities && mv Utilities lbne/Utilities || echo "nothing to do"' HEAD

git am < $WORKDIR/patch-larevt-lbne
git filter-branch -f  --tree-filter 'test -e CalData && mv CalData lbne/CalData || echo "nothing to do"' HEAD

git am < $WORKDIR/patch-larsim-lbne
git filter-branch -f  --tree-filter 'test -e DetSim && mv DetSim lbne/DetSim || echo "nothing to do"' HEAD
git filter-branch -f  --tree-filter 'test -e EventGenerator && mv EventGenerator lbne/EventGenerator || echo "nothing to do"' HEAD
git filter-branch -f  --tree-filter 'test -e LArG4 && mv LArG4 lbne/LArG4 || echo "nothing to do"' HEAD
git filter-branch -f  --tree-filter 'test -e PhotonPropagation && mv PhotonPropagation lbne/PhotonPropagation || echo "nothing to do"' HEAD
git filter-branch -f  --tree-filter 'test -e Simulation && mv Simulation lbne/Simulation || echo "nothing to do"' HEAD

##### this was performed later
git am < $WORKDIR/patch-larcore-lbne-channelmap
git filter-branch -f  --tree-filter 'test -e Geometry && mv Geometry/* lbne/Geometry || echo "nothing to do"' HEAD
##### end of later work

cd ..

#########################################################################
# Now extract and move (with histories) uboone-specific files
#########################################################################

# First gather the files and histories in a patch file
# Make a list of the files that are being moved. We'll need that later.

cd larcore
ls  Geometry/gdml/microboone?* Geometry/gdml/microboone/G* Geometry/gdml/microboone/g* Geometry/gdml/microboone/m* Geometry/gdml/microboone/ScriptFragments/?* > $WORKDIR/larcore-uboone-moved-files.txt
git log --pretty=email --patch-with-stat --reverse --full-index --binary \
    `ls  Geometry/gdml/microboone?* Geometry/gdml/microboone/G* Geometry/gdml/microboone/g* Geometry/gdml/microboone/m* Geometry/gdml/microboone/ScriptFragments/?*` \
    > $WORKDIR/patch-larcore-uboone
cd ..

cd lardata
ls RawData/utils/*UBooNE* Utilities/*micro* Utilities/*uboone* Utilities/*Micro* Utilities/test/*Micro* Utilities/test/*uboone* > $WORKDIR/lardata-uboone-moved-files.txt
git log --pretty=email --patch-with-stat --reverse --full-index --binary \
    `ls RawData/utils/*UBooNE* Utilities/*micro* Utilities/*uboone* Utilities/*Micro* Utilities/test/*Micro* Utilities/test/*uboone*` \
    > $WORKDIR/patch-lardata-uboone
cd ..
##### this was performed later
cd lardata
ls RawData/uboone_datatypes/*.cpp RawData/uboone_datatypes/*.cc RawData/uboone_datatypes/*.h RawData/uboone_datatypes/GNUmakefile RawData/uboone_datatypes/CMakeLists.txt RawData/uboone_datatypes/gps/* RawData/uboone_datatypes/share/* > $WORKDIR/lardata-uboone-moved-files-uboone_datatypes.txt
git log --pretty=email --patch-with-stat --reverse --full-index --binary \
    `ls RawData/uboone_datatypes/*.cpp RawData/uboone_datatypes/*.cc RawData/uboone_datatypes/*.h RawData/uboone_datatypes/GNUmakefile RawData/uboone_datatypes/CMakeLists.txt RawData/uboone_datatypes/gps/* RawData/uboone_datatypes/share/*` \
    > $WORKDIR/patch-lardata-uboone-uboone_datatypes
cd ..
####### end of later work

cd larevt
ls CalData/?*Micro* CalData/*micro* CalData/test/*uboone* > $WORKDIR/larevt-uboone-moved-files.txt
git log --pretty=email --patch-with-stat --reverse --full-index --binary \
    `ls CalData/?*Micro* CalData/*micro* CalData/test/*uboone*` \
    > $WORKDIR/patch-larevt-uboone
cd ..    

cd larsim
ls EventGenerator/*uboone* EventGenerator/*micro* DetSim/*micro* EventGenerator/GENIE/*micro* LArG4/*micro* PhotonPropagation/*micro* Simulation/*micro* DetSim/*Micro* TriggerAlgo/*Micro* > $WORKDIR/larsim-uboone-moved-files.txt
git log --pretty=email --patch-with-stat --reverse --full-index --binary \
    `ls EventGenerator/*uboone* EventGenerator/*micro* DetSim/*micro* EventGenerator/GENIE/*micro* LArG4/*micro* PhotonPropagation/*micro* Simulation/*micro* DetSim/*Micro* TriggerAlgo/*Micro*` \
    > $WORKDIR/patch-larsim-uboone
cd ..

##########
# Not moved for v0_02_01, but should be moved in production:
# larpandora/LArPandoraInterface/scripts/PandoraSettings_MicroBooNE_Standard.xml
# Destination to be determined
##########

# Then apply the patch to the new repository and move the resulting parent
# sub-directory down one level without affecting the history

cd uboonecode
git am < $WORKDIR/patch-larcore-uboone
git filter-branch --tree-filter 'test -e Geometry && mkdir uboone && mv Geometry uboone/Geometry' HEAD

git am < $WORKDIR/patch-lardata-uboone
git filter-branch -f --tree-filter 'test -e RawData && mv RawData uboone/RawData || echo "nothing to do"' HEAD
git filter-branch -f --tree-filter 'test -e Utilities && mv Utilities uboone/Utilities || echo "nothing to do"' HEAD

git am < $WORKDIR/patch-larevt-uboone
git filter-branch -f --tree-filter 'test -e CalData && mv CalData uboone/CalData || echo "nothing to do"' HEAD

git am < $WORKDIR/patch-larsim-uboone
git filter-branch -f --tree-filter 'test -e DetSim && mv DetSim uboone/DetSim || echo "nothing to do"' HEAD
git filter-branch -f --tree-filter 'test -e EventGenerator && mv EventGenerator uboone/EventGenerator || echo "nothing to do"' HEAD
git filter-branch -f --tree-filter 'test -e LArG4 && mv LArG4 uboone/LArG4 || echo "nothing to do"' HEAD
git filter-branch -f --tree-filter 'test -e PhotonPropagation && mv PhotonPropagation uboone/PhotonPropagation || echo "nothing to do"' HEAD
git filter-branch -f --tree-filter 'test -e Simulation && mv Simulation uboone/Simulation || echo "nothing to do"' HEAD
git filter-branch -f --tree-filter 'test -e TriggerAlgo && mv TriggerAlgo uboone/TriggerAlgo || echo "nothing to do"' HEAD

##### this was performed later
git am < $WORKDIR/patch-lardata-uboone-uboone_datatypes
git filter-branch -f --tree-filter 'test -e RawData && mv RawData/* uboone/RawData/ || echo "nothing to do"' HEAD
###### end of later work

cd ..

#########################################################################
# The original copy of all the files we just moved are still in
# their original locations.
# So, use the list of moved files created earlier to rename all these
# files so that they will not be accidentally picked up by the build system
# or any users.
#########################################################################

cat > move-old-files << eof
#!/bin/bash
# Assumes WORKDIR points to directory with move file lists

repos="larcore lardata larevt larsim" 
for repo in \$repos ; do
  cd \$repo
  if [[ -e \$WORKDIR/\${repo}-lbne-moved-files.txt && -e \$WORKDIR/\${repo}-uboone-moved-files.txt ]] ; then
    cat \${WORKDIR}/\${repo}-lbne-moved-files.txt \${WORKDIR}/\${repo}-uboone-moved-files.txt | xargs -I{} git mv {} {}.sample
  else
    echo ERROR!!  Move lists not found for \${repo}. Skipping \${repo}
  fi
  cd ..
done
eof

chmod +x move-old-files
./move-old-files >& move-old-files.log

##### and performed later...
cat > move-old-files-channelmap << eof
repos="larcore" 
for repo in \$repos ; do
  cd \$repo
  if [[ -e \$WORKDIR/\${repo}-lbne-moved-files-channelmap.txt ]] ; then
    cat \${WORKDIR}/\${repo}-lbne-moved-files-channelmap.txt | xargs -I{} git mv {} {}.sample
  else
    echo ERROR!!  Move lists not found for \${repo}. Skipping \${repo}
  fi
  cd ..
done
eof

chmod +x move-old-files-channelmap
./move-old-files-channelmap
######

##### and performed still later...
cat > move-old-files-uboone_datatypes << eof
repos="lardata" 
for repo in \$repos ; do
  cd \$repo
  if [[ -e \$WORKDIR/\${repo}-uboone-moved-files-uboone_datatypes.txt ]] ; then
    cat \${WORKDIR}/\${repo}-uboone-moved-files-uboone_datatypes.txt | xargs -I{} git mv {} {}.sample
  else
    echo ERROR!!  Move lists not found for \${repo}. Skipping \${repo}
  fi
  cd ..
done
eof

chmod +x move-old-files-uboone_datatypes
./move-old-files-uboone_datatypes

#########################################################################
# Now commit all the above changes. Will deal with #include directives
# separately
#########################################################################

cat > commit-changes << eof
#!/bin/bash
# 

repos="larcore lardata larevt larsim" 
for repo in \$repos ; do
  cd \$repo
  git commit -m "Re-name files as part of re-factoring" 
  cd ..
done
eof

chmod +x commit-changes
./commit-changes

#########################################################################
# Push the changes
#########################################################################

cd larcore ; git push origin develop ; cd ..

cd lardata 
git checkout -b develop 
git fetch origin
git merge origin/develop
git push origin develop
cd ..

cd larevt
git checkout -b develop
git pull origin develop
git push origin develop
cd ..

cd larsim
git checkout -b develop
git pull origin develop
git push origin develop
cd ..

cd lbnecode
git checkout -b develop
git push origin develop
cd ..

cd uboonecode
git checkout -b develop
git push origin develop
cd ..

#########################################################################
# Now work in a release working-area to create the LBNE and uBoone products, 
# and make the changes needed to build the repositories
# CREATE A NEW WORKING AREA, cd there
# (Assume this directory exists)
#########################################################################

cd <new area>
setup larsoft v0_00_09 -q debug:e2
mrb newDev
. localProducts_larsoft_v0_00_09_debug_e2/setup
cd srcs

# First get the existing LArSoft packages

mrb gitCheckout larcore
mrb gitCheckout lardata
mrb gitCheckout larevt
mrb gitCheckout larsim

# Now create the new experiment product and merge in the migration
# work that we've already done

mrb newProduct lbnecode
cd lbnecode
git remote add origin ssh://p-lbnecode@cdcvs.fnal.gov/cvs/projects/lbnecode
git pull origin develop
cd ..

mrb newProduct uboonecode
cd uboonecode
git remote add origin ssh://p-uboonecode@cdcvs.fnal.gov/cvs/projects/uboonecode
git pull origin develop
cd ..

#########################################################################
####### working on lbnecode first...
#
# Now modify top-level CMakeLists.txt and import those that are missing
# Steal them from their parent packages.
#########################################################################

cd lbnecode
<modify CMakeLists.txt to fill in blank add_subdirectory with "lbne">

cd lbne
cat > CMakeLists.txt << eof
add_subdirectory(Geometry)
add_subdirectory(Utilities)
add_subdirectory(Simulation)
add_subdirectory(LArG4)
add_subdirectory(PhotonPropagation)
add_subdirectory(DetSim)
add_subdirectory(EventGenerator)
add_subdirectory(CalData)

# Respect the order specified in lar_build, which is:
#
#     "SoftRelTools",
#     "SRT_LAR",
#     "SimpleTypesAndConstants",
#     "Geometry",
#     "SummaryData",
#     "RawData",
#     "RecoBase",
#     "OpticalDetectorData",
#     "AnalysisBase",
#     "Utilities",
#     "Simulation",
#     "MCCheater",
#     "AnalysisAlg",
#     "RecoObjects",
#     "RecoAlg",
#     "LArG4",
#     "PhotonPropagation",
#     "DetSim",
#     "EventGenerator",
#     "Filters",
#     "CalData",
#     "ClusterFinder",
#     "Genfit",
#     "HitFinder",
#     "TrackFinder",
#     "VertexFinder",
#     "EventFinder",
#     "TriggerAlgo",
#     "OpticalDetector",
#     "Calorimetry", 
#     "ShowerFinder",
#     "EventDisplay",
#     "ParticleIdentification",
#     "AnalysisExample",
#     "LArPandoraAlgorithms",
#     "LArPandoraInterface" 
eof

cd CalData
cp $MRB_SOURCE/larevt/CalData/CMakeLists.txt .
<added single art_make clause, removing t simple_plugin macros
 Link against Geometry, lbne_Geometry, Filters, RawData, RecoBase (from 
 survey of includes>

cd ..

cd DetSim
cp ../CalData/CMakeLists.txt .
<modified to link against Geometry, Geometry_service, lbne_Geometry, Simulation,
 RawData >
cd ..

cd EventGenerator
cp ../../../larsim/EventGenerator/CMakeLists.txt .
<only fcl files left, so just leave the install and add_subdirectory's>

cd CRY
cp ../CMakeLists.txt .
<only install_fhicl() needed>
cd ..

cd GENIE
cp ../CRY/CMakeLists.txt .
<only install_fhicl() here too>
cd ..
cd ..

cd Geometry
cat > CMakeLists.txt << eof
add_subdirectory(gdml)
eof
# this is true until we install the newly de-coupled modules
# will re-visit it then

cd gdml
# cp $MRB_SOURCE/larcore/Geometry/gdml/CMakeLists.txt .
# nothing there yet...
cat > CMakeLists.txt << eof
add_subdirectory(lbne)
eof

cd lbne
cat > CMakeLists.txt << eof
# empty for now
eof

cd $MRB_SOURCE

cd LArG4
cat > CMakeLists.txt << eof
install_fhicl()
install_source()
eof
cd ..

cd Simulation
cat > CMakeLists.txt << eof
install_fhicl()
install_source()
eof
cd ..

cd Utilities
cp $MRB_SOURCE/lardata/Utilities/CMakeLists.txt .
<added MODULE_LIBRARIES section, which was copied from the list in DetSim CMakeLists.txt>

cd test
cp ../CMakeLists.txt .
<modified modules to link against Utilities, removed LIB_LIBRARIES section
 removed add_subdirectory...
>

cd $MRB_SOURCE

# Modify the product_deps
<replace product dependencies w larcore, lardata, larevt, larsim>

#  Commit everything so far

git add -A
git add test/* ups/*

#
#
# Now move LBNEGeoHelper

cd $MRB_SOURCE
cp larcore/Geometry/LBNEGeometryHelper* lbnecode/lbne/Geometry/

cd larcore
git rm Geometry/LBNEGeometryHelper*
git commit "Move LBNEGeometryHelper service to LBNE repository" 
git pull origin develop
git push origin develop

cd lbnecode/lbne/Geometry

#########################################################################
# Change include directives to point to lbne/<package> rather than <package>
# Lynn made these changes, plus changes to four CMakeLists.txt files.
# Here is the complete list of files changed:
# CMakeLists.txt                                     |    5 ++-
#  lbne/CalData/CalGausHFLBNE10kt_module.cc           |    2 +-
#  lbne/CalData/CalWireLBNE10kt_module.cc             |    2 +-
#  lbne/CalData/DeconvGausHFLBNE10kt_module.cc        |    2 +-
#  lbne/CalData/DeconvGausHFLBNE35t_module.cc         |    2 +-
#  lbne/DetSim/CMakeLists.txt                         |    2 +
#  lbne/DetSim/SimWireLBNE10kt_module.cc              |    2 +-
#  lbne/DetSim/SimWireLBNE35t_module.cc               |    2 +-
#  lbne/Geometry/CMakeLists.txt                       |    1 +
#  lbne/Geometry/ChannelMap35Alg.cxx                  |    2 +-
#  lbne/Geometry/ChannelMap35Alg.h                    |    2 +-
#  lbne/Geometry/ChannelMapAPAAlg.cxx                 |    2 +-
#  lbne/Geometry/ChannelMapAPAAlg.h                   |    2 +-
#  lbne/Geometry/GeoObjectSorter35.cxx                |    2 +-
#  lbne/Geometry/GeoObjectSorterAPA.cxx               |    2 +-
#  lbne/Geometry/LBNEGeometryHelper_service.cc        |    6 +-
#  lbne/Utilities/CMakeLists.txt                      |   51 +++++++++-----------
#  .../SignalShapingServiceLBNE10kt_service.cc        |    2 +-
#  .../SignalShapingServiceLBNE34kt_service.cc        |    2 +-
#  .../SignalShapingServiceLBNE35t_service.cc         

# Added lbne/ to include directives here:
#    modified:   lbne/CalData/CalGausHFLBNE35t_module.cc
#    modified:   lbne/CalData/CalWireLBNE35t_module.cc
#    modified:   lbne/Utilities/CMakeLists.txt
#    modified:   lbne/Utilities/test/SignalShapingLBNE10ktTest_module.cc
#    modified:   lbne/Utilities/test/SignalShapingLBNE35tTest_module.cc
#
# In lbneCMakeLists.txt:  used order of sub-directories specified in lar_build, so:
# add_subdirectory(Geometry)
# add_subdirectory(Utilities)
# add_subdirectory(Simulation)
# add_subdirectory(LArG4)
# add_subdirectory(PhotonPropagation)
# add_subdirectory(DetSim)
# add_subdirectory(EventGenerator)
# add_subdirectory(CalData)

# Need to check all the CMakeLists.txt and ups directories into svn somewhere so that
# the content for each migration does not need to be replicated. Could check in copies 
# that have renamed to indicate the experiments, so for file <experiment_repo>/<expt>/<package>/<thing>,
# the name preserved in svn could be <package>/<thing>.<expt> .
#########################################################################

cd ..

#########################################################################
#  Now work on uboonecode
#########################################################################

cd uboonecode
<modify CMakeLists.txt "add_subdirectory(  )" --> "add_subdirectory(uboone)" 

cd uboone
cat > CMakeLists.txt << eof
add_subdirectory(Geometry)
add_subdirectory(RawData)
add_subdirectory(Utilities)
add_subdirectory(Simulation)
add_subdirectory(LArG4)
add_subdirectory(PhotonPropagation)
add_subdirectory(DetSim)
add_subdirectory(EventGenerator)
add_subdirectory(CalData)
add_subdirectory(TriggerAlgo)

# Respect the order specified in lar_build, which is:
#
#     "SoftRelTools",
#     "SRT_LAR",
#     "SimpleTypesAndConstants",
#     "Geometry",
#     "SummaryData",
#     "RawData",
#     "RecoBase",
#     "OpticalDetectorData",
#     "AnalysisBase",
#     "Utilities",
#     "Simulation",
#     "MCCheater",
#     "AnalysisAlg",
#     "RecoObjects",
#     "RecoAlg",
#     "LArG4",
#     "PhotonPropagation",
#     "DetSim",
#     "EventGenerator",
#     "Filters",
#     "CalData",
#     "ClusterFinder",
#     "Genfit",
#     "HitFinder",
#     "TrackFinder",
#     "VertexFinder",
#     "EventFinder",
#     "TriggerAlgo",
#     "OpticalDetector",
#     "Calorimetry", 
#     "ShowerFinder",
#     "EventDisplay",
#     "ParticleIdentification",
#     "AnalysisExample",
#     "LArPandoraAlgorithms",
#     "LArPandoraInterface" 
eof

cd CalData
cp ${MRB_SOURCE}/lbnecode/lbne/CalData/CMakeLists.txt .
vi CMakeLists.txt
:s/lbne_Geometry/uboone_Geometry/
:s/SignalShapingServiceLBNE35t_service/SignalShapingServiceMicroBooNE_service/
ZZ

vi CalWireMicroBooNE_module.cc
s/Utilities\/SignalShapingServiceMicroBooNE.h/lbne\/Utilities\/SignalShapingServiceMicroBooNE.h/
ZZ

cd test
cat > CMakeLists.txt << eof
install_fhicl()
install_source()
eof

cd ../..

cd DetSim
cp $MRB_SOURCE/lbnecode/lbne/DetSim/CMakeLists.txt .
vi CMakeLists.txt
/lbne_Geometry
:s/lbne_Geometry/uboone_Geometry/
/SignalShapingServiceLBNE35t_service
:s/SignalShapingServiceLBNE35t_service/SignalShapingServiceMicroBooNE_service/
ZZ

cd ..

cd Geoemtry
cp $MRB_SOURCE/lbnecode/lbne/Geometry/CMakeLists.txt 
vi CMakeLists.txt
/lbne_Geometry
:s/lbne_Geometry/uboone_Geometry/
n
:s
ZZ

cd gdml
cat > CMakeLists.txt << eof
add_subdirectory(microboone)
eof

cd microboone
cat > CMakeLists.txt << eof
#empty for now
eof

../../..

cd PhotonPropagation
cat > CMakeLists.txt << eof
install_fhicl()
install_source()
eof
cd ..

cd Simulation
cat > CMakeLists.txt << eof
install_fhicl()
install_source()
eof

cd Utilities
cp $MRB_SOURCE/Utilities/CMakeLists.txt .
vi CMakeLists.txt
/LBNE10kt
:s/LBNE10kt/MicroBooNE/
n
:s
/lbne
:s/lbne/uboone/
n
:s
<remove LBNE34kt and LBNE35t simple plugins...>
ZZ

cd test
cp $MRB_SOURCE/lbnecode/lbne/Utilities/test/CMakeLists.txt .
vi CMakeLists.txt
/lbne
:s/lbne/uboone/
ZZ

cd ../..

cd EventGenerator
cat > CMakeLists.txt << eof
install_fhicl()
install_source()

add_subdirectory(GENIE)
eof

cd GENIE
cat > CMakeLists.txt << eof
install_fhicl()
install_source()
eof

cd ../..

cd LArG4
cat > CMakeLists.txt << eof
install_fhicl()
install_source()
eof

cd ..

cd RawData
cat > CMakeLists.txt << eof
add_subdirectory(uboone_datatypes)
add_subdirectory(utils)
eof

cd utils

cat > CMakeListst.txt << eof

art_make( BASENAME_ONLY
      LIBRARY_NAME uboone_RawData
      LIB_LIBRARIES Geometry
                        OpticalDetectorData
                        RawData
                        SummaryData
          MODULE_LIBRARIES Geometry
                    OpticalDetectorData
                        RawData
            uboone_RawData
                        SummaryData
                        ${ART_FRAMEWORK_CORE}
                        ${ART_FRAMEWORK_PRINCIPAL}
            ${ART_FRAMEWORK_SERVICES_REGISTRY}
                        ${ART_FRAMEWORK_SERVICES_OPTIONAL}
                        ${ART_FRAMEWORK_SERVICES_OPTIONAL_TFILESERVICE_SERVICE}
                        ${ART_PERSISTENCY_COMMON}
                        ${ART_PERSISTENCY_PROVENANCE}
                        ${ART_UTILITIES}
                        ${MF_MESSAGELOGGER}
                        ${MF_UTILITIES}
                        ${FHICLCPP}
                        ${CETLIB}
                        ${ROOT_GEOM}
                        ${ROOT_XMLIO}
                        ${ROOT_GDML}
                        ${ROOT_BASIC_LIB_LIST}
      SERVICE_LIBRARIES Geometry
                        lbne_Geometry
                        ${ART_FRAMEWORK_CORE}
            ${ART_FRAMEWORK_PRINCIPAL}
            ${ART_FRAMEWORK_SERVICES_REGISTRY}
                        ${ART_FRAMEWORK_SERVICES_OPTIONAL}
            ${ART_FRAMEWORK_SERVICES_OPTIONAL_TFILESERVICE_SERVICE}
                        ${ART_PERSISTENCY_COMMON}
            ${ART_PERSISTENCY_PROVENANCE}
            ${ART_UTILITIES}
            ${MF_MESSAGELOGGER}
            ${MF_UTILITIES}
                    ${FHICLCPP}
            ${CETLIB}
                        ${ROOT_GEOM}
                        ${ROOT_XMLIO}
                        ${ROOT_GDML}
            ${ROOT_BASIC_LIB_LIST}
        )                               

install_headers()
install_source()
eof

cd ../..

cd TriggerAlgo
cat > CMakeLists.txt << eof

art_make( BASENAME_ONLY
          MODULE_LIBRARIES
                        ${ART_FRAMEWORK_CORE}
                        ${ART_FRAMEWORK_PRINCIPAL}
                        ${ART_FRAMEWORK_SERVICES_REGISTRY}
                        ${ART_FRAMEWORK_SERVICES_OPTIONAL}
                        ${ART_FRAMEWORK_SERVICES_OPTIONAL_TFILESERVICE_SERVICE}
                        ${ART_PERSISTENCY_COMMON}
                        ${ART_PERSISTENCY_PROVENANCE}
                        ${ART_UTILITIES}
                        ${MF_MESSAGELOGGER}
                        ${MF_UTILITIES}
                        ${FHICLCPP}
                        ${CETLIB}
            ${ROOT_BASIC_LIB_LIST}
          SERVICE_LIBRARIES
                        ${ART_FRAMEWORK_CORE}
                        ${ART_FRAMEWORK_PRINCIPAL}
                        ${ART_FRAMEWORK_SERVICES_REGISTRY}
                        ${ART_FRAMEWORK_SERVICES_OPTIONAL}
                        ${ART_FRAMEWORK_SERVICES_OPTIONAL_TFILESERVICE_SERVICE}
                        ${ART_PERSISTENCY_COMMON}
                        ${ART_PERSISTENCY_PROVENANCE}
                        ${ART_UTILITIES}
                        ${MF_MESSAGELOGGER}
                        ${MF_UTILITIES}
                        ${FHICLCPP}
                        ${CETLIB}
            ${ROOT_BASIC_LIB_LIST}
        )

install_headers()
install_fhicl()
install_source()
eof

cd ..

#########################################################################
# Add "uboone/" to include paths here: (files in uboonecode/uboone)
#  (grep -ri "include.*uboone" ; grep -ri "include.*micro")
#
#  RawData/utils/LArRawInputDriverUBooNE.cxx
#  RawData/utils/LArRawInputSource_source.cc
#  Utilities/SignalShapingServiceMicroBooNE_service.cc
#  CalData/CalWireMicroBooNE_module.cc
#  DetSim/SimWireMicroBooNE_module.cc
#  TriggerAlgo/TrigAnaMicroBoone_module.cc
#  TriggerAlgo/TriggerAlgoMicroBoone.h
#  TriggerAlgo/TriggerAlgoMicroBoone_service.cc
#  Utilities/SignalShapingServiceMicroBooNE_service.cc
#  Utilities/test/SignalShapingMicroBooNETest_module.cc
#
# After fixes to CMakeLists.txt files in various places and in product_deps,
# uboonecode builds.
#########################################################################

# Save everything
#
git add .
git commit -m "Initial build configuration" 
git push origin develop

#########################################################################
# Scripts to extract interesting files from the srcs area and save them somewhere
# else so that they can be restored in a new snapshot. These scripts need to be
# run immediately prior to making a snapshot.
#
# Extracting interesting files:  extract-files
#!/bin/bash
# Extract CMakeLists.txt and other files of interest from specified 
# repository, save them somewhere, so that they can be used in a 
# svn-to-git transition.
#########################################################################

source=$1
target=$2

[[ -z $target ]] && list_only=true

# make sure the target exists

if [[ -n $list_only ]] ; then
  echo "OK:  just listing the files to be moved" 
elif [[ -d $target ]] ; then
  echo "OK:  target directory $target exists" 
else [[ -n $target ]]
  echo "OK: making $target" 
  mkdir -p $target
fi

files=`find $source \
     -name CMakeLists.txt \
     -o -name Geometry.h \
     -o -name Geometry_service.cc \
     -o -name LBNEGeoHelper\* \
     -o -wholename *uboonecode*product_deps \
     -o -wholename *lbnecode*product_deps \
     `
if [[ -z list_only ]] ; then
  echo "Copying files from $source to $target" 
else
  echo "List of files that would be moved from $source" 
fi

for f in $files ; do
  target_filename=`echo $f|sed -e "s/$source\///"`
  echo $target_filename
done

[[ -n $list_only ]] && exit

for f in $files ; do
  target_filename=`echo $f|sed -e "s/$source\///"`
  dir=`dirname $target_filename`
  [[ -d $target/$dir ]] || mkdir -p $target/$dir 
  cp -p $f $target/$target_filename
done

exit

# Now a script to extract files that have had include changes:
# extract-files-include-changes
#!/bin/bash
# Extract files that had include path changes from specified 
# repository, save them somewhere, so that they can be used in a 
# svn-to-git transition.

source=$1
first_include_path_element=$2
target=$3

[[ -z $target ]] && list_only=true

# make sure the target exists

if [[ -n $list_only ]] ; then
  echo "OK:  just listing the files to be moved" 
elif [[ -d $target ]] ; then
  echo "OK:  target directory $target exists" 
else [[ -n $target ]]
  echo "OK: making $target" 
  mkdir -p $target
fi

files=`grep -l -r "\#include.*\"$first_include_path_element\/" $source `

if [[ -z list_only ]] ; then
  echo "Copying files with first include path element $first_include_path_element from $source to $target
else
  echo "List of files with first include path element $first_include_path_element that would be moved from $source 
fi

for f in $files ; do
  target_filename=`echo $f|sed -e "s/$source\///"`
  echo $target_filename
done

[[ -n $list_only ]] && exit

for f in $files ; do
  target_filename=`echo $f|sed -e "s/$source\///"`
  dir=`dirname $target_filename`
  [[ -d $target/$dir ]] || mkdir -p $target/$dir 
  cp -p $f $target/$target_filename
done

exit