Ignore:
Timestamp:
2013-08-14T22:31:59+12:00 (11 years ago)
Author:
ak19
Message:
  1. Running a diff between model-collect (svn) and rebuilt collect at the end of regenerating the model collections to show the differences. 2. Minor fixes. 3. Better display of what's going on. 4. Updated comments. May still want a debug/testing mode in the future to see what's going to happen without actually committing. Useful for when you add a new tutorial for building but don't want to commit it until you've tested that diffcol runs perfectly on it.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • other-projects/nightly-tasks/diffcol/trunk/gen-model-colls.sh

    r28048 r28049  
    2020# rebuilt collection, overwriting their equivalents in the svn model collection,
    2121# 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
    2628# 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
    2932# 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!
    3233
    3334# Examples of usage:
     
    3738
    3839# 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.
    4749
    4850# Also valid examples:
     
    5658# Makes a copy
    5759# 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.
    6063# If --svnupdate was passed in: copies collect/archives/* into model-collect/archives/*, and copies collect/index/*
    6164# 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.
    6366
    6467# See earlier version of this script:
     
    9093
    9194
    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
    9396function svn_delete () {
    9497
     
    112115    # commit all the svn rm statements done above in one go:
    113116    # 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-collect
     117    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
    115118
    116119    # do an svn up to locally delete what was svn-removed above, BEFORE copying from the rebuilt archives and index folders
     
    128131
    129132    # 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
    131140}
    132141
     
    181190
    182191
    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
    184194function svn_process_single_collection () {
    185195    collection=$1
     
    235245}
    236246
    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
    238248function update_single_collection () {
    239249
     
    245255
    246256    # 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
    247263}
    248264
     
    261277    echo
    262278    echo "*********************"
    263     echo "Done processing $collection"
     279    echo "Done rebuilding model collection: $collection"
    264280    echo "*********************"
    265281    echo
     
    388404# (or if collections are specified in the cmdline arguments, copy just these over from model-collect into collect)
    389405# Then remove the copy's .svn folders
     406echo "***********************************************"
     407echo "Creating a copy of the model-collect folder as folder collect and removing the .svn subfolders from the copy:"
     408echo
    390409if [ -e collect_orig ]; then
    391410    if [ ! -e collect ]; then
     
    408427    fi
    409428fi
     429echo "***********************************************"
    410430
    411431# Set up the Greenstone environment for building
     
    424444
    425445    if [ "x$mode" != "x" ]; then
    426         svn_process_single_collection $collection
     446        #svn_process_single_collection $collection
    427447
    428448        if [ "x$mode" == "xsvnupdate" ]; then
     
    447467
    448468        if [ "x$mode" != "x" ]; then
    449         svn_process_single_collection $collection
    450 
    451         if [ "x$mode" != "x" ]; then
     469        #svn_process_single_collection $collection
     470
     471        if [ "x$mode" == "xsvnupdate" ]; then
    452472            update_single_collection $collection
    453473        fi
     
    468488echo
    469489echo "*****************************************"
     490echo
     491# NO LONGER NECESSARY: WE'RE DOING A DIFF BETWEEN collect AND model-collect AT THIS SCRIPT'S END
    470492# if we were svn updating/deleting collections, then mode was set
    471493# 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
     502if [ "x$mode" == "x" ]; then
     503    echo "* The model-collect folder has not been altered. Changes have only been made to collect"
     504elif [ "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:"   
     506elif [ "x$mode" == "xsvndelete" ]; then
     507    echo "* The model-collect folder's archives and index subfolders have been updated and committed to svn."
     508fi
    478509echo
    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
     511if [ "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
     518fi
     519
     520echo "* The original collect directory has been left renamed as collect_orig"
     521echo
    484522echo "*****************************************"
    485523echo
     
    496534# The following when put in a separate script file will delete all folders from model-collect that are
    497535# empty in the copied collection (all folders which contain only a .svn subfolder in model-collect)
     536# ---------------------------------------------
    498537#!/bin/bash
    499538
     
    531570
    532571#done
     572# ---------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.