®
IBM Software Group
Essentials of Rational ClearCase Module 10: Managing Builds in ClearCase
1
Objectives Upon completing this module, you should be able to: Describe the advantages of building software with clearmake and omake (on Windows) Explain build auditing Explain build avoidance Execute builds using clearmake and omake (on Windows) View and compare configuration records Add derived objects to source control 2
Building Software
3
What Is make? An industry-standard, non-proprietary tool that controls the generation of executables and other non-source files from the program's source files It prevents unnecessary re-building among interdependent source files Guarantees consistency of build process Requires a makefile to specify build instructions and dependencies via rules in the following format: : <dependency, …> 4
A makefile Example
Dependencies Target Command
5
ClearCase Build Utilities: clearmake and omake Both are stand-alone executables, not cleartool subcommands
Compatible with makefiles constructed for use with other make variants
6
clearmake and omake Advantages Build auditing Creating a complete configuration record that documents the build process, its inputs, and its results Build-avoidance algorithms Sharing of binaries (derived objects) among views Distributing a build across concurrent parallel processes, on a single host or on multiple hosts
7
Building within Views Builds are executed within the context of a view View configuration selects versions for the build Advantages of ClearCase build utilities are only available if you build in dynamic views
8
Invoking Build Utilities from the Command Line clearmake [ -f makefile ] ... [ -ukinservwdpqUNR ] [ -C compat-mode ] [ -V | -M ] [ -O | -T | -F ] [ -A BOS-file ] ... [ macro=value ... ] [ target-name ... ]
Lowercase options are “standard” make options Uppercase options are clearmake- and omakespecific options Options that do not take arguments can be grouped (for example, -VOi) Versions used in the build are selected by the config spec of the view where the build is performed 9
Derived Objects The build process creates derived objects (DO) Derived objects can be reused
During the build with clearmake or omake, this makefile produces the derived objects: util.obj hello.obj hello.exe
10
Derived Objects (cont.) The ClearCase Explorer displays information about derived objects.
Derived objects
11
Derived Objects (cont.) Each DO has a unique identifier (DO-ID)
Example: hello.exe@@14-Jan.09:54.617 By default, DOs are shareable; they can be reused by other views Shareable DOs are held in the view storage area, and a DO catalog entry is stored in the VOB
12
Build Auditing During a build, MVFS monitors system calls Stores data in a configuration record, the bill of materials for a DO or set of DOs The configuration record is associated with the DOs
13
Configuration Record: Example M:\Pats_R2_Dev\Hardware\src>cleartool catcr hello.exe Derived object: \Hardware\src\hello.exe@@02-Dec.08:57.643
Information about the build itself
Target hello.exe built by pat.ccusers Host "ruwkstn" running NT 5.0 (i586) Reference Time 02-Dec-02.08:57:50, this audit started 02-Dec-02.08:57:51 View was ruwkstn:C:\clearcase\viewstore\RUWKSTN\pat\Pat_R2_Dev.vws Initial working directory was M:\Pat_R2_Dev\Hardware\src ---------------------------MVFS objects:
ClearCase objects included in the build
---------------------------\Hardware\src\hello.exe@@02-Dec.08:57.643 \Hardware\src\hello.obj@@02-Dec.08:57.641 \Hardware\src\util.obj@@02-Dec.08:57.642 ----------------------------
Macros and variables set by makefile
Variables and Options: ---------------------------MKTUT_LK=link ---------------------------Build Script:
Build script executed
---------------------------link -out:hello.exe hello.obj util.obj
14
Build Avoidance Build avoidance is the ability to build using existing DOs instead of creating new DOs Configuration lookup compares the configuration record of DO candidates with the build configuration of the current view to determine whether to: Reuse a DO that already exists in the current view Use an existing DO from another view Rebuild a DO by executing the build script
15
Build Avoidance within a View: Reuse When you rebuild, clearmake reuses any matching DOs stored in the view.
16
Build Avoidance Among Views: Wink In If no DO match in the view, configuration lookup checks the VOB DO catalog for DO matches Wink in is the process of reusing a DO that was created by another view Wink in process: Matching DOs are promoted, or migrated from view storage to VOB storage DO configuration records are moved to VOB database A pointer is created from the second view to the data container in VOB storage
17
Wink In Process
18
Build Avoidance Flow Chart
19
Build Reproducibility Configuration lookup ensures consistent rebuilds by enabling clearmake and omake to detect source dependencies not declared in the makefile Makefile: hello.exe: hello.obj util.obj link -out:hello.exe hello.obj util.obj hello.obj: cl -c hello.c util.obj: cl -c util.c
hello.c:
If hello.h changes, clearmake or omake recognizes the dependency, even if it is not declared in the makefile.
#include “hello.h” int main() { ... 20
Comparing Configuration Records Use cleartool diffcr to compare configuration records of two derived objects.
diffcr [-recurse | -flat] [-select do-leaf-pattern] [-ci] [-type {f|d|l}...] [-element_only] [-view_only] [-wd] [-name tail-pattern] [-nxname] [-long | -short] do-pname do-pname2
21
Comparing Configuration Records: Example Z:\Hardware\src>cleartool diffcr hello.exe hello.exe@@13-Jan.13:44.78 < Target hello.exe built by pat.ccusers > Target hello.exe built by alex.ccusers < Reference Time 20-Jan-01.12:37:51, this audit started 20-Jan-01.12:37:53 > Reference Time 13-Jan-01.13:44:21, this audit started 13-Jan-01.13:44:23 < View was flyer:E:\views\pat_view.vws [uuid f6a4e0d0f.00:80:c7:59:b5:d5] > View was flyer:E:\views\alex.vws [uuid 7bff4840.ca0211d0:80:c7:59:b5:d5] < Initial working directory was Z:\Hardware\src > Initial working directory was M:\view2\Hardware\src ----------------------------
Different versions of hello.c were used
MVFS objects: ---------------------------< \Hardware\hello.c@@\main\4
<20-Jan-01.12:37:53>
> \Hardware\hello.c@@\main\2
<13-Jan-01.13:44:22>
---------------------------< \Hardware\src\hello.exe@@20-Jan.12:37.2147483658 > \Hardware\src\hello.exe@@13-Jan.13:44.78 ...
22
Express Builds Express builds create DOs, but do not write information to the VOB Create nonshareable DOs — may be reused by view in which they are created, but are not shareable Advantages: Scalability: write access to the VOB is not blocked by DO write operations, so more users can build Performance: faster because they do not write DO information to the VOB Isolation: sharing is disabled until build quality is evaluated 23
Express Builds (cont.)
To run express builds, clear the Create shareable derived objects check box on the Advanced tab of View Properties.
24
Versioning DOs and Configuration Records You can add derived objects and configuration records to source control Can still access the configuration record of DO versions Use the -from option of the cleartool checkin command
25
Checking in a DO: Example J:\project_hw\bin>cleartool checkout -nc hello.exe Checked out “hello.exe” from version “\main\2” J:\project_hw\bin>cleartool checkin -from ..\src\hello.exe hello.exe Checkin comments for “hello.exe”: (“.” to accept default) Release 3. . Save private copy of "hello.exe"? [yes] no Checked in "hello.exe" version "\main\3".
26
Checking in Configuration Records To check in only the configuration record of a DO, use the -cr option to cleartool checkin J:\project_hw\bin>cleartool checkin -c "CR only" -cr -from ..\src\hello.exe hello.exe Save private copy of "hello.exe"? [yes] no cleartool: Warning: Version checked in is not selected by view. Checked in "hello.exe" version "\main\4".
To check in DOs with this method, you cannot access the data of the DOs; however, they can be displayed with dir and cleartool ls J:\project_hw\bin>dir hello.exe hello.exe J:\project_hw\bin>hello.exe The system cannot execute the specified program. 27
Module Review List the distinguishing features of clearmake (and omake on Windows). What is a build audit? What is build avoidance? What does it mean to promote a derived object? What does it mean to wink in a derived object? What is an express build and why might you want to perform one? How do you version a derived object?
28
Module Lab In this lab, you will: View a makefile Execute clearmake in view1 List derived objects View a configuration record Rebuild in view2 Compare configuration records Add DO to source control
29
30