clearcase: Backup for only modified checked-out elements in all views

大城市里の小女人 提交于 2019-12-24 17:22:32

问题


Having a regular size-efficient backup for only the modified checkedout elements in all views would be a great thing for us, since a great deal of the defined dynamic/snapshot views cannot be included in the daily backup policy.

The following ksh code is near to what we would need for a dynamic view, but it trivially assumes that the first line in the config-spec file for the view always selects the checked-out element first ( *element * CHECKEDOUT* ). It will not work well in general.

For each versioned file in the view we would like to be able to add it to the backup list only if it is different from the last corresponding versioned element in the VOB that is selected for that view. (Only if it has been developed in the view).

[The solution would have to be valid for snapshot views also]

for CHECKEDOUT_FILE_IN_THE_VIEW in $( /usr/atria/bin/cleartool lsco -cview -avobs -short  )
do

  VERSIONED_FILE_NAME=$( /usr/atria/bin/cleartool describe -short ${CHECKEDOUT_FILE_IN_THE_VIEW} \
                        | sed -e's/CHECKEDOUT/LATEST/' )

    if [ -f ${VERSIONED_FILE_NAME} ]; then

       if [ -f ${CHECKEDOUT_FILE_IN_THE_VIEW} ]; then

        diff -b ${CHECKEDOUT_FILE_IN_THE_VIEW}  ${VERSIONED_FILE_NAME} > /dev/null

        if [ $? -ne 0 ]; then

           ##-- The checked-out file in the view is different from the corresponding
           ##-- versioned element in the VOB. So it has to be added to the backup list.

           echo "${VERSIONED_FILE_NAME}" >> ${F_LOG}
        fi
       fi
    fi

 done

Any idea(s) ?. TIA. Javier C.


回答1:


Frankly, for dynamic views, a simpler backup strategy would be to just zip and backup the view storage associated with said dynamic view (after a 'cleartool endivew -server aDynViewTag):

  • all the checked-out and private files are stored in the view storage (only for dynamic view)
  • but it won't take into account checked-out file with (yet) no modifications compared to their versioned counterpart.

If you need a generic solution both for dynamic and snaphot views, then you can refer to:
'How to find all checkedout files with ClearCase cleartool?' (a 'cleartool lsco' you are using), but you don't need to compute the LATEST version to make a system-based diff.
You can simply:

cleartool diff -pred ${CHECKEDOUT_FILE_IN_THE_VIEW}

If any modification exists between the checked-out version and its previous version, it will return something (for versions in snapshot or dynamic views).
See cleartool diff.



来源:https://stackoverflow.com/questions/3652854/clearcase-backup-for-only-modified-checked-out-elements-in-all-views

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!