Changeset 28049 for other-projects/nightly-tasks
- Timestamp:
- 2013-08-14T22:31:59+12:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
other-projects/nightly-tasks/diffcol/trunk/gen-model-colls.sh
r28048 r28049 20 20 # rebuilt collection, overwriting their equivalents in the svn model collection, 21 21 # but not removing any extraneous HASH folders already present. 22 23 # Pass in --svndelete to remove what's in archives and index from svn and replace 24 # the contents of archives and index with the matching contents from the rebuild 25 # collection. Useful for when the HASH directory naming has changed and everything 22 # !!!!! IMPORTANT: if you pass in svnupdate, it leaves you to do the final commit on 23 # the (svn) model-collect folder! 24 25 # Pass in --svndelete to remove the archives and index from svn in the model-collect 26 # and replace this with the rebuilt archives and index 27 # The --svndelete is useful for when the HASH directory naming has changed and everything 26 28 # in archives and index has to be wiped out and moved back in from the rebuilt col. 27 28 # If neither is passed in, then the collections are rebuilt but the svn model-collect 29 # Passing in --svndelete will do the final commits on the model-collect folder. 30 31 # If neither flag is passed in, then the collections are rebuilt but the svn model-collect 29 32 # is not updated and the repository is not updated. 30 31 # This program leaves you to do the final commit on the (svn) model-collect folder!32 33 33 34 # Examples of usage: … … 37 38 38 39 # The first just rebuilds all the collections in a new folder called collect and stops there 39 # The second rebuilds all the collections and then removes all contents of the archives and the 40 # index folders from the svn checked-out model-collect and removes them from svn. Then it copies 41 # across all the contents of the rebuilt archives and index into model-collect and svn adds them. 42 # The third example checks out all the model-collections again, but rebuilds only the 3 collections 43 # specified in the new collect folder. Then it copies across the contents of the archives and index 44 # folders of those 3 collections into their model-collect equivalents. 45 46 # You then still have to do the final svn commit on the model-collect folder. 40 41 # The second rebuilds all the collections in collect and svn removes the archives and the index 42 # folders in model-collect. Then it copies across the rebuilt archives and index into model-collect 43 # and svn adds them. 44 45 # The third example checks out all the model-collections again, but rebuilds only the 2 collections 46 # specified in the new collect folder. Then it copies across the *contents* of the archives and 47 # index folders of those 2 collections into their model-collect equivalents. You then still have to 48 # do the final svn commit on the model-collect folder after looking over the differences. 47 49 48 50 # Also valid examples: … … 56 58 # Makes a copy 57 59 # In the copy: gets rid of their .svn folders, and builds each collection in turn, moving building to index once done 58 # If --svndelete was passed in: svn removes model-collect/archives/* and model-collect/index/*, copies over index/* 59 # and archives/* from collect into model-collect and svn adds model-collect/archives/* and model-collect/index/* 60 # If --svndelete was passed in: svn removes model-collect/archives and model-collect/index, copies over collect/index 61 # and collect/archives into model-collect and svn adds model-collect/archives and model-collect/index. Then SVN COMMITS 62 # model-collect/archives and model-collect/index. 60 63 # If --svnupdate was passed in: copies collect/archives/* into model-collect/archives/*, and copies collect/index/* 61 64 # into model-collect/index/*, overwriting files that already existed but have now been updated upon rebuild. However, 62 # --svnupdate will leave untouched any files and folders unique to model-collect. 65 # --svnupdate will leave untouched any files and folders unique to model-collect. No SVN commit, that's LEFT UP TO YOU. 63 66 64 67 # See earlier version of this script: … … 90 93 91 94 92 # Function that handles the --svndelete flag (mode) of this script 95 # Function that handles the --svndelete flag (mode) of this script for a single collection 93 96 function svn_delete () { 94 97 … … 112 115 # commit all the svn rm statements done above in one go: 113 116 # don't do `svn up` here, as this will then retrieve all the folders that were svn-removed 114 svn commit -m " Clean rebuild of model collections 1/2. Clearing out deprecated archives and index." model-collect117 svn commit -m "AUTOCOMMIT by gen-model-colls.sh script. Clean rebuild of model collections 1/2. Clearing out deprecated archives and index." model-collect 115 118 116 119 # do an svn up to locally delete what was svn-removed above, BEFORE copying from the rebuilt archives and index folders … … 128 131 129 132 # commit all the svn add statements done just above in one go 130 svn commit -m "Clean rebuild of model collections 2/2. Adding rebuilt archives and index." model-collect 133 svn commit -m "AUTOCOMMIT by gen-model-colls.sh script. Clean rebuild of model collections 2/2. Adding rebuilt archives and index." model-collect 134 135 echo 136 echo "*********************" 137 echo "Done svn-deleting rebuilt model-collection: $collection" 138 echo "*********************" 139 echo 131 140 } 132 141 … … 181 190 182 191 183 # svn update/delete a single collection 192 # UNUSED, but useful for spotting differences between the collect and model-collect 193 # after rebuild, before svn updating/deleting, as opposed to at the end of the script 184 194 function svn_process_single_collection () { 185 195 collection=$1 … … 235 245 } 236 246 237 # Function that takes care of the --svnupdate flag mode of this script 247 # Function that takes care of the --svnupdate flag mode of this script for a single collection 238 248 function update_single_collection () { 239 249 … … 245 255 246 256 # if etc/collect.cfg is different, copy it across too? 257 258 echo 259 echo "*********************" 260 echo "Done updating the rebuilt LOCAL model-collection: model-collect/$collection" 261 echo "*********************" 262 echo 247 263 } 248 264 … … 261 277 echo 262 278 echo "*********************" 263 echo "Done processing$collection"279 echo "Done rebuilding model collection: $collection" 264 280 echo "*********************" 265 281 echo … … 388 404 # (or if collections are specified in the cmdline arguments, copy just these over from model-collect into collect) 389 405 # Then remove the copy's .svn folders 406 echo "***********************************************" 407 echo "Creating a copy of the model-collect folder as folder collect and removing the .svn subfolders from the copy:" 408 echo 390 409 if [ -e collect_orig ]; then 391 410 if [ ! -e collect ]; then … … 408 427 fi 409 428 fi 429 echo "***********************************************" 410 430 411 431 # Set up the Greenstone environment for building … … 424 444 425 445 if [ "x$mode" != "x" ]; then 426 svn_process_single_collection $collection446 #svn_process_single_collection $collection 427 447 428 448 if [ "x$mode" == "xsvnupdate" ]; then … … 447 467 448 468 if [ "x$mode" != "x" ]; then 449 svn_process_single_collection $collection450 451 if [ "x$mode" != "x" ]; then469 #svn_process_single_collection $collection 470 471 if [ "x$mode" == "xsvnupdate" ]; then 452 472 update_single_collection $collection 453 473 fi … … 468 488 echo 469 489 echo "*****************************************" 490 echo 491 # NO LONGER NECESSARY: WE'RE DOING A DIFF BETWEEN collect AND model-collect AT THIS SCRIPT'S END 470 492 # if we were svn updating/deleting collections, then mode was set 471 493 # if in that case a report was generated with additional differences, point the user to it 472 if [ -f report.txt ] && [ "x$mode" != "x" ]; then 473 echo "Some files outside of archives and index folders were different. See report.txt" 474 echo 475 fi 476 477 echo "The original collect directory has been left renamed as collect_orig" 494 #if [ -f report.txt ] && [ "x$mode" != "x" ]; then 495 # echo "Some files or folders outside of archives and index directories were different. See report.txt" 496 # echo 497 #fi 498 499 # if not svnupdating or svndeleting, then inform the user that model-collect is unchanged 500 # if svnupdating, then warn the user that model-collect still needs committing 501 # if svndeleting, then inform the user that model-collect has been changed and committed 502 if [ "x$mode" == "x" ]; then 503 echo "* The model-collect folder has not been altered. Changes have only been made to collect" 504 elif [ "x$mode" == "xsvnupdate" ]; then 505 echo "* TO DO: You still need to run svn status and then svn commit on the model-collect folder. Besides that:" 506 elif [ "x$mode" == "xsvndelete" ]; then 507 echo "* The model-collect folder's archives and index subfolders have been updated and committed to svn." 508 fi 478 509 echo 479 if [ "x$mode" == "x" ]; then 480 echo "The model-collect folder has not been altered. Changes have only been made to collect" 481 else 482 echo "You still need to run svn status and svn commit on the model-collect folder" 483 fi 510 511 if [ "x$mode" != "x" ]; then 512 echo "* DIFFERENCES REMAINING BETWEEN model-collect AND collect (skipping .svn folders):" 513 echo 514 echo "---START DIFF---" 515 diff -rq model-collect collect | grep -v ".svn" 516 echo "---END DIFF---" 517 echo 518 fi 519 520 echo "* The original collect directory has been left renamed as collect_orig" 521 echo 484 522 echo "*****************************************" 485 523 echo … … 496 534 # The following when put in a separate script file will delete all folders from model-collect that are 497 535 # empty in the copied collection (all folders which contain only a .svn subfolder in model-collect) 536 # --------------------------------------------- 498 537 #!/bin/bash 499 538 … … 531 570 532 571 #done 572 # ---------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.