clearcase:仅备份所有视图中已修改的签出元素

发布于 2024-09-17 09:09:51 字数 1110 浏览 11 评论 0原文

所有视图中修改后的签出元素定期进行大小高效的备份对我们来说是一件好事,因为大量定义的动态/快照视图无法包含在每日备份策略中。

以下 ksh 代码接近我们动态视图所需的代码,但它简单地假设视图的配置规范文件中的第一行始终首先选择签出的元素 ( *element * CHECKEDOUT* )。一般来说,它不会很好地工作。

对于视图中的每个版本化文件,我们希望能够将其添加到备份列表中,如果它与为该视图选择的 VOB 中最后一个对应的版本化元素不同。 (仅当它已在视图中开发时)。

[该解决方案也必须对快照视图有效]

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

有什么想法吗? TIA。 哈维尔·C.

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

千笙结 2024-09-24 09:09:51

坦率地说,对于动态视图,更简单的备份策略是仅压缩和备份与所述动态视图关联的视图存储(在“cleartool endivew -server aDynViewTag”之后):

  • 所有签出和私有的文件存储在视图存储中(仅适用于动态视图),
  • 但它不会考虑与版本化对应文件相比尚未进行任何修改的签出文件。

如果您需要通用解决方案 动态视图和快照视图,那么您可以参考:
'如何使用 ClearCasecleartool 查找所有签出文件?'(您正在使用的“cleartool lsco”),但您不需要计算最新版本来进行基于系统的差异。
您可以简单地:

cleartool diff -pred ${CHECKEDOUT_FILE_IN_THE_VIEW}

如果签出版本与其先前版本之间存在任何修改,它将返回一些内容(对于快照或动态视图中的版本)。
请参阅cleartool diff

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文