VegCSV subfolders¶
- Table of contents
- VegCSV subfolders
Move src files into subfolders¶
- Move files on your local machine:
shopt -s nullglob for table in plots organisms stems specimens; do for map in inputs/*/src/{,.}*.$table.{csv,tsv,txt,xml}{,.last_cleanup}; do dir="$(dirname "$map")/$table" file="$(basename "$map")" test -e "$dir" || { svn mkdir "$dir"; svn propset svn:ignore "*" "$dir"; } mv "$map" "$dir/${file/$table./}" done done
- Manually
svn mv
header override files (containing the wordheader
) that were under version control:svn mv inputs/Madidi/src/+header.plots.csv inputs/Madidi/src/plots/+header.csv svn mv inputs/REMIB/src/node.0.header.specimens.csv inputs/REMIB/src/specimens/node.0.header.csv svn mv inputs/GBIF/src/GBIF.0.header.specimens.txt inputs/GBIF/src/specimens/GBIF.0.header.txt svn mv inputs/SpeciesLink/src/specieslink.0.header.specimens.csv inputs/SpeciesLink/src/specimens/specieslink.0.header.csv
- Add svn:ignores:
for dir in inputs/*/src/{plots,organisms,stems,specimens}/; do svn propset svn:ignore "*" "$dir"; done
- Change input.Makefile to use the new paths
make inputs/remake
make test
- Test reinstalling:
make inputs/MT/reinstall
- Check diffs
- Commit
svn up
on vegbiendev and nimoy- Move files on vegbiendev and nimoy as above
Rename subfolders with import order¶
Do the following for each table of plots, organisms, stems, and specimens.
When multiple command blocks are listed, use the block that corresponds to the current table.
shopt -s nullglob
- Add new subfolders
Important: Can not usesvn mv
because this "is equivalent to a 'copy' and 'delete'" (`svn help mv`
), which will copy all the large source filesfor dir in inputs/*/src/plots/; do svn mkdir "${dir/plots/0.plots}"; done
for dir in inputs/*/src/organisms/; do svn mkdir "${dir/organisms/1.organisms}"; done
for dir in inputs/*/src/stems/; do svn mkdir "${dir/stems/2.stems}"; done
- Manually
svn mv
header override files (containing the wordheader
) that were under version control:svn mv inputs/Madidi/src/plots/+header.csv inputs/Madidi/src/0.plots/+header.csv
# organisms: N/A
# stems: N/A
- Move source files
(shopt -u nullglob; for dir in inputs/*/src/plots/; do (set -x; mv "$dir"* "${dir/plots/0.plots}"); done)
(shopt -u nullglob; for dir in inputs/*/src/organisms/; do (set -x; mv "$dir"* "${dir/organisms/1.organisms}"); done)
(shopt -u nullglob; for dir in inputs/*/src/stems/; do (set -x; mv "$dir"* "${dir/stems/2.stems}"); done)
- Add svn:ignores:
for dir in inputs/*/src/0.plots/; do svn propset svn:ignore "*" "$dir"; done
for dir in inputs/*/src/1.organisms/; do svn propset svn:ignore "*" "$dir"; done
for dir in inputs/*/src/2.stems/; do svn propset svn:ignore "*" "$dir"; done
- Rename mapping files: (Warning: This command is not idempotent!)
for file in inputs/*/{maps,test}/{,.}*plots*.{csv{,.last_cleanup},ref}; do (set -x; svn mv "$file" "${file/.plots/.0.plots}"); done
for file in inputs/*/{maps,test}/{,.}*organisms*.{csv{,.last_cleanup},ref}; do (set -x; svn mv "$file" "${file/.organisms/.1.organisms}"); done
for file in inputs/*/{maps,test}/{,.}*stems*.{csv{,.last_cleanup},ref}; do (set -x; svn mv "$file" "${file/.stems/.2.stems}"); done
- Rename installed staging tables:
ALTER TABLE "Madidi".plots RENAME TO "0.plots"; ALTER TABLE "Madidi"."plots.errors" RENAME TO "0.plots.errors"; ALTER TABLE "SALVIAS-CSV".plots RENAME TO "0.plots"; ALTER TABLE "SALVIAS-CSV"."plots.errors" RENAME TO "0.plots.errors"; ALTER TABLE "SALVIAS".plots RENAME TO "0.plots"; ALTER TABLE "SALVIAS"."plots.errors" RENAME TO "0.plots.errors";
ALTER TABLE "CVS".organisms RENAME TO "1.organisms"; ALTER TABLE "CVS"."organisms.errors" RENAME TO "1.organisms.errors"; ALTER TABLE "Madidi".organisms RENAME TO "1.organisms"; ALTER TABLE "Madidi"."organisms.errors" RENAME TO "1.organisms.errors"; ALTER TABLE "SALVIAS-CSV".organisms RENAME TO "1.organisms"; ALTER TABLE "SALVIAS-CSV"."organisms.errors" RENAME TO "1.organisms.errors"; ALTER TABLE "SALVIAS".organisms RENAME TO "1.organisms"; ALTER TABLE "SALVIAS"."organisms.errors" RENAME TO "1.organisms.errors";
ALTER TABLE "SALVIAS".stems RENAME TO "2.stems"; ALTER TABLE "SALVIAS"."stems.errors" RENAME TO "2.stems.errors";
- Change the
input.Makefile
$(tablesSort)
entry:- plots -> 0.plots
- organisms -> 1.organisms
- stems -> 2.stems
- Remove old subfolders
for dir in inputs/*/src/plots/; do svn rm "$dir"; done
for dir in inputs/*/src/organisms/; do svn rm "$dir"; done
for dir in inputs/*/src/stems/; do svn rm "$dir"; done
- Test the inputs that have changed: (Not all of these inputs will change for all tables.)
make inputs/{CVS,Madidi,SALVIAS-CSV,SALVIAS}/test/
- Check diffs
- Commit
- On vegbiendev, immediately do the following, using the corresponding steps above:
svn up
- Move source files
- Rename the installed staging tables
- Test the inputs that have changed
- Remove old, empty dirs:
rmdir inputs/*/src/organisms/ rmdir inputs/*/src/plots/ rmdir inputs/*/src/stems/
Replace Veg+
prefix with map
on via maps¶
Veg+
prefix with map
on via maps- Rename the maps using svn mv: (order matters)
for map in inputs/*/maps/{,.}Veg+.*.csv{,.last_cleanup}; do svn mv "$map" "${map/Veg+/map}"; done
- In input.Makefile, change
$(via)
tomap
when it applies to something in the maps subdir make inputs/remake
make test
- Check diffs
- Commit
svn up
on vegbiendev and nimoy
Move maps into subfolders¶
- Move files on your local machine:
shopt -s nullglob for table in 0.plots 1.organisms 2.stems specimens; do for map in inputs/*/maps/{,.}*.$table{,.full}.csv{,.last_cleanup}; do dir="$(dirname "$map")/../src/$table" file="$(basename "$map")" (set -x; svn mv "$map" "$dir/${file/$table./}") done done
- Manually move disabled CTFS maps
- Change input.Makefile to use the new paths:
- Replace regexp
maps/(\.?\w+)\.([^.]+)((?:\.full)?\.csv(?:\.last_cleanup)?)
withsrc/$2/$1$3
- Replace string
maps/%.csv
withsrc/%/map.csv
- Replace string
maps/%.full.csv
withsrc/%/map.full.csv
- Replace string
maps/src.%
withsrc/%/src.csv
- Replace string
maps/map.%
withsrc/%/map.csv
- Replace string
maps/.%.last_cleanup
withsrc/%/.map.csv.last_cleanup
- Manually change occurrences of
maps/%
- Check that there are no occurrences of
maps/
- Change
$(inputFiles)
and$(srcs)
to filter out maps
- Replace regexp
make inputs/remake
make test
- Test reinstalling:
make inputs/MT/reinstall
- Remove
maps
subdirs:svn rm inputs/*/maps/
- Check diffs
- Commit
svn up
on vegbiendev and nimoy
Move test outputs into subfolders¶
- Move files on your local machine:
shopt -s nullglob for table in 0.plots 1.organisms 2.stems specimens; do for map in inputs/*/test/import.$table.xml.ref; do dir="$(dirname "$map")/../src/$table" file="$(basename "$map")" file="${file/import/test}" (set -x; svn mv "$map" "$dir/${file/$table./}") done for map in inputs/*/test/import.$table{,.staging}.xml; do dir="$(dirname "$map")/../src/$table" file="$(basename "$map")" file="${file/import/test}" (set -x; mv "$map" "$dir/${file/$table./}") done done
- Change input.Makefile to use the new paths:
- Replace regexp
test/import\.%(\.staging)?\.xml
withsrc/%/test$1.xml
- Manually change occurrences of
test/%
- Check that there are no occurrences of
test/
- Change
$(srcsOnly)
to filter out test outputs
- Replace regexp
- Remove
test
subdirs:svn rm inputs/*/test/
make test
- Check diffs
- Commit
- On vegbiendev and nimoy, do the following, using the corresponding steps above:
svn up
- Remove old, empty dirs:
rmdir inputs/*/test/
make inputs/download-logs test=1
Move log files into subfolders¶
- Move files on your local machine:
shopt -s nullglob for file in inputs/*/import/*.log; do (set -x; mv "$file" "${file/%.log/.log.sql}"); done (set -x; mv inputs/SALVIAS-CSV/import/install.log.sql inputs/SALVIAS/import/install-organisms.log.sql) (set -x; mv inputs/SALVIAS/import/install.log.sql inputs/SALVIAS/import/install-stems.log.sql) for file in inputs/*/import/install.log.sql; do (set -x; mv "$file" "${file/install/install-specimens}"); done for file in inputs/*/import/{,install-}plots*.log.sql; do (set -x; mv "$file" "${file/plots/0.plots}"); done for file in inputs/*/import/{,install-}organisms*.log.sql; do (set -x; mv "$file" "${file/organisms/1.organisms}"); done for file in inputs/*/import/{,install-}stems*.log.sql; do (set -x; mv "$file" "${file/stems/2.stems}"); done for table in 0.plots 1.organisms 2.stems specimens; do for file in inputs/*/import/{,install-}$table*.log.sql; do dir="$(dirname "$file")/../src/$table/logs" filename="$(basename "$file")" filename="${filename/install-/install.}" test -e "$dir" || { svn mkdir "$dir"; svn propset svn:ignore "*.log.sql *.trace" "$dir"; } (set -x; mv "$file" "$dir/${filename/$table./}") done done
- Manually move
inputs/QMOR/import/steps.by_col.sql
and updateREADME.TXT
- Change
inputs/input.Makefile
andinputs/Makefile
to use the new paths:- Change each occurrence of
import/
tosrc/<table>/logs/
- Update
$(srcsOnly)
to filter out logs - Check that there are no occurrences of
import/
- Change each occurrence of
- Remove
import
subdirs:ls -d inputs/*/import/ # Check that dirs are empty svn rm inputs/*/import/
make inputs/QMOR/src/specimens/logs/steps.by_col.sql
make inputs/download-logs test=1
- Check diffs
- Commit
svn up
on vegbiendev and nimoy- On vegbiendev and nimoy, do the following, using the corresponding steps above:
svn up
- Move files
- Remove old, empty dirs:
rmdir inputs/*/import/
make inputs/download-logs test=1
Determine import order dynamically¶
- Add an
"_"
prefix to non-source-file-related subfolders ofsrc
subdirs:mv inputs/CTFS/src/CTFS_Files_22Feb/ inputs/CTFS/src/_CTFS_Files_22Feb/ svn mv inputs/CTFS/src/scripts_to_drop_extra_tables/ inputs/CTFS/src/_scripts_to_drop_extra_tables/
Also do themv
command on vegbiendev and nimoy - Commit
- Change input.Makefile to determine import order from subfolders:
- Change
$(tablesSort)
and$(tables)
- Check that there are no occurrences of
0.plots 1.organisms 2.stems specimens
- Change
make inputs/remake
make test
- Check diffs
- Commit
svn up
on vegbiendev and nimoy
Move src subdir into main dir¶
- Make a clean checkout of the repository, which doesn't contain any unversioned files
- Move files in the clean checkout:
shopt -s nullglob (slash=/; for item in inputs/*/src/*; do svn mv "$item" "${item/src${slash}/}"; done)
- Add svn:ignores:
for dir in inputs/*/; do svn propset svn:ignore "*" "$dir"; done
- Change
inputs/input.Makefile
,inputs/Makefile
, andREADME.TXT
to use the new paths:- Remove each occurrence of
src/
- Replace
$(call addDirWithIgnore,src,'*')
with$(call setSvnIgnore,.,'*')
- Update
$(tables)
to filter outsrc
andverify
- Check that there are no occurrences of
src/
- Remove each occurrence of
- Remove
src
subdirs:ls -d inputs/*/src/ # Check that dirs are empty svn rm inputs/*/src/
make inputs/QMOR/specimens/logs/steps.by_col.log.sql
make inputs/download-logs test=1
- Check diffs
- Commit
- Immediately do the following on your main local checkout, vegbiendev, and nimoy:
svn up
- Move unversioned files:
(slash=/; for item in $(find inputs -path "*/src/*" -and ! -path "*/.*"|xargs echo) inputs/Madidi/src/*.xls; do (set -x; mv "$item" "${item/src${slash}/}"); done) (slash=/; for name in specimens 0.plots 1.organisms 2.stems; do for item in inputs/*/$name/$name/*; do (set -x; mv "$item" "${item/$name${slash}/}"); done; done) (slash=/; for name in specimens 0.plots 1.organisms 2.stems; do for item in inputs/*/$name/logs/logs/*; do (set -x; mv "$item" "${item/logs${slash}/}"); done; done) mv inputs/CTFS/_1.organisms.disabled/_1.organisms.disabled/* inputs/CTFS/_1.organisms.disabled/
- Remove old, empty dirs:
for name in specimens 0.plots 1.organisms 2.stems; do rm inputs/*/$name/$name/{.DS_Store,.~*}; rmdir inputs/*/$name/$name/ inputs/*/$name/logs/logs/; done rmdir inputs/CTFS/_1.organisms.disabled/_1.organisms.disabled inputs/CTFS/_1.organisms.disabled/logs/logs rm inputs/*/src/{.DS_Store,.~*} rmdir inputs/*/src/
- On your main local checkout:
make inputs/download test=1
make inputs/download-logs test=1
make test
Rename subfolders to VegCSV names¶
- Make a clean checkout of the repository, which doesn't contain any unversioned files
- Move files in the clean checkout:
shopt -s nullglob for item in inputs/*/specimens/; do svn mv "$item" "${item/specimens/Specimen}"; done for item in inputs/*/0.plots/; do svn mv "$item" "${item/0.plots/Plot}"; done for item in inputs/*/1.organisms/; do svn mv "$item" "${item/1.organisms/Organism}"; done for item in inputs/*/2.stems/; do svn mv "$item" "${item/2.stems/Stem}"; done
- Change names in the following datasources'
import_order.txt
(only found in datasources with multiple tables):
Madidi, SALVIAS-CSV, SALVIAS - Rename installed staging tables:
ALTER TABLE "ACAD".specimens RENAME TO "Specimen"; ALTER TABLE "ARIZ".specimens RENAME TO "Specimen"; ALTER TABLE "GBIF".specimens RENAME TO "Specimen"; ALTER TABLE "MO".specimens RENAME TO "Specimen"; ALTER TABLE "MT".specimens RENAME TO "Specimen"; ALTER TABLE "NCU-NCSC".specimens RENAME TO "Specimen"; ALTER TABLE "NY".specimens RENAME TO "Specimen"; ALTER TABLE "QMOR".specimens RENAME TO "Specimen"; ALTER TABLE "REMIB".specimens RENAME TO "Specimen"; ALTER TABLE "SpeciesLink".specimens RENAME TO "Specimen"; ALTER TABLE "U".specimens RENAME TO "Specimen"; ALTER TABLE "UNCC".specimens RENAME TO "Specimen"; ALTER TABLE "ACAD"."specimens.errors" RENAME TO "Specimen.errors"; ALTER TABLE "ARIZ"."specimens.errors" RENAME TO "Specimen.errors"; ALTER TABLE "GBIF"."specimens.errors" RENAME TO "Specimen.errors"; ALTER TABLE "MO"."specimens.errors" RENAME TO "Specimen.errors"; ALTER TABLE "MT"."specimens.errors" RENAME TO "Specimen.errors"; ALTER TABLE "NCU-NCSC"."specimens.errors" RENAME TO "Specimen.errors"; ALTER TABLE "NY"."specimens.errors" RENAME TO "Specimen.errors"; ALTER TABLE "QMOR"."specimens.errors" RENAME TO "Specimen.errors"; ALTER TABLE "REMIB"."specimens.errors" RENAME TO "Specimen.errors"; ALTER TABLE "SpeciesLink"."specimens.errors" RENAME TO "Specimen.errors"; ALTER TABLE "U"."specimens.errors" RENAME TO "Specimen.errors"; ALTER TABLE "UNCC"."specimens.errors" RENAME TO "Specimen.errors";
ALTER TABLE "Madidi"."0.plots" RENAME TO "Plot"; ALTER TABLE "Madidi"."0.plots.errors" RENAME TO "Plot.errors"; ALTER TABLE "SALVIAS-CSV"."0.plots" RENAME TO "Plot"; ALTER TABLE "SALVIAS-CSV"."0.plots.errors" RENAME TO "Plot.errors"; ALTER TABLE "SALVIAS"."0.plots" RENAME TO "Plot"; ALTER TABLE "SALVIAS"."0.plots.errors" RENAME TO "Plot.errors";
ALTER TABLE "CVS"."1.organisms" RENAME TO "Organism"; ALTER TABLE "CVS"."1.organisms.errors" RENAME TO "Organism.errors"; ALTER TABLE "Madidi"."1.organisms" RENAME TO "Organism"; ALTER TABLE "Madidi"."1.organisms.errors" RENAME TO "Organism.errors"; ALTER TABLE "SALVIAS-CSV"."1.organisms" RENAME TO "Organism"; ALTER TABLE "SALVIAS-CSV"."1.organisms.errors" RENAME TO "Organism.errors"; ALTER TABLE "SALVIAS"."1.organisms" RENAME TO "Organism"; ALTER TABLE "SALVIAS"."1.organisms.errors" RENAME TO "Organism.errors";
ALTER TABLE "SALVIAS"."2.stems" RENAME TO "Stem"; ALTER TABLE "SALVIAS"."2.stems.errors" RENAME TO "Stem.errors";
- Check diffs
- Commit
- Immediately do the following on your main local checkout, vegbiendev, and nimoy, using the corresponding steps above:
svn up
- Move unversioned files:
for item in inputs/*/specimens/logs/*; do (set -x; mv "$item" "${item/specimens/Specimen}"); done for item in inputs/*/0.plots/logs/*; do (set -x; mv "$item" "${item/0.plots/Plot}"); done for item in inputs/*/1.organisms/logs/*; do (set -x; mv "$item" "${item/1.organisms/Organism}"); done for item in inputs/*/2.stems/logs/*; do (set -x; mv "$item" "${item/2.stems/Stem}"); done for item in inputs/*/specimens/*; do (set -x; mv "$item" "${item/specimens/Specimen}"); done for item in inputs/*/0.plots/*; do (set -x; mv "$item" "${item/0.plots/Plot}"); done for item in inputs/*/1.organisms/*; do (set -x; mv "$item" "${item/1.organisms/Organism}"); done for item in inputs/*/2.stems/*; do (set -x; mv "$item" "${item/2.stems/Stem}"); done
- Remove old, empty dirs:
rmdir inputs/*/specimens/logs/ inputs/*/specimens/ rmdir inputs/*/0.plots/logs/ inputs/*/0.plots/ rmdir inputs/*/1.organisms/logs/ inputs/*/1.organisms/ rmdir inputs/*/2.stems/logs/ inputs/*/2.stems/ rmdir inputs/*/*/logs/logs
- Rename the installed staging tables (don't need to do again on your main local checkout)
- On your main local checkout:
make inputs/download test=1
make inputs/download-logs test=1
make test