将行添加到ClearCase配置 [英] Add line to ClearCase config

查看:85
本文介绍了将行添加到ClearCase配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Jenkins上运行一个作业,该作业用于在ClearCase上创建视图,并且ClearCase视图创建默认的配置规范。

I am running a job on Jenkins which is used to create a view on ClearCase and the ClearCase view creates the default config spec.

我要编辑配置通过向其添加更多行来规范,但我不想每次都手动对其进行编辑。因此,我希望向Jenkins添加一些脚本,以便它每次运行作业时都可以编辑configspec。

I want to edit the config spec by adding some more lines to it but I don't want to edit it manually every time. So I am looking to add some script to Jenkins so that it can edit the configspec every time when it runs the job.

有没有人知道如何清除案例专家?

Is there anyone how is clear case expert who can task it out.

推荐答案

创建ClearCase视图后,您需要使用 cleartool edcs

Once your ClearCase view is created you need to get its config spec as a file with cleartool edcs

cd /path/to/view
cleartool catcs > cs

您需要添加选择规则之前默认项:as在配置规范

You need to adds your selection rules before the default one: as mentioned in config spec


由于配置规范中的规则是按顺序处理的,因此更改顺序可能会影响版本选择。例如,假设此规则出现在配置规范的开头附近:

Because the rules in a config spec are processed in order, varying the order may affect version selection. For example, suppose this rule appears near the beginning of a config spec:



element * /main/LATEST




配置规范中的任何后续规则将永远不会使用,因为规则总是提供匹配项;每个元素的主分支上都具有最新版本。

Any subsequent rules in the config spec will never be used, because the rule always provides a match; every element has a most recent version on its main branch.

注意:

为快照视图指定加载规则的顺序为不重要。

Note:
The order in which the load rules for a snapshot view are specified is not important.

要编写脚本,请参阅 使用 sed ,在模式下方(或上方)插入一行吗?

另一种选择:请参见 如何在模式(标记)之前将文件内容插入另一个文件?

将其他行放入名为 othercs 的文件中。

To script that, please see "Using sed, Insert a line below (or above) the pattern?".
Another option: see "How to insert the content of a file into another file before a pattern (marker)?".
Put your additional lines into a file named othercs.

#!/bin/bash
while IFS= read -r line
do
    if [[ "$line" =~ .*CHECKEDOUT.*$ ]]
    then
        cat othercs
    fi
    echo "$line"
done < cs

完成后,您可以追加所需的任何其他加载规则(如果使用的是快照视图,因为动态视图没有加载规则)

Once that is done, you can append any additional load rules you want (if you are using a snapshot view, since a dynamic view has no load rules)

最后,一旦cs文件具有正确的选择/加载规则,您可以使用以下命令将其设置回当前视图 cleartool setcs

Finally, once the cs file has the right selection/load rules, you set it back to the current view with cleartool setcs.

cleartool setcs -tag view-tag  cs
                              ^
                              |
                     name of the file you have modified

这篇关于将行添加到ClearCase配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆