ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/doc/tex/manual/CreatingProjects.tex
Revision: 1.4.2.1
Committed: Thu Nov 2 15:01:02 2006 UTC (18 years, 6 months ago) by sashby
Content type: application/x-tex
Branch: v103_with_xml
CVS Tags: forV1_1_0, v103_xml_071106, V110p2, V110p1
Changes since 1.4: +45 -49 lines
Log Message:
update manual for V1_1_0 XML

File Contents

# Content
1 %%____________________________________________________________________
2 %% File: CreatingProjects.tex
3 %%____________________________________________________________________
4 %%
5 %% Author: Shaun ASHBY <Shaun.Ashby@cern.ch>
6 %% Update: 2005-11-02 17:05:54+0100
7 %% Revision: $Id: CreatingProjects.tex,v 1.4 2006/09/11 13:37:36 sashby Exp $
8 %%
9 %% Copyright: 2005 (C) Shaun ASHBY
10 %%
11 %%--------------------------------------------------------------------
12 \chapter{Creating SCRAM-Managed Projects}\label{ch:creatingprojects}
13 \index{SCRAM!creating projects}
14 \index{creating SCRAM projects}
15
16 A \scram\ project is a releasable unit covering a particular software
17 domain, for example an analysis framework, event simulation or reconstruction.
18 Libraries and binary executables are the typical basic build products and these
19 can have separate storage areas. A configuration directory contains all the
20 files necessary to allow \scram\ to configure a dedicated project
21 release area for a version of the project. External requirements are
22 configured automatically.
23 The structure of a project can be freely chosen since \scram\ does not
24 impose restrictions on project structure: it is
25 easy to modify \scram\ build behaviour according to site conventions.
26
27 \ni Generally, a project is subdivided into \texttt{subsystems} and
28 \texttt{packages} according to the tree structure of the source code
29 directory. Dependencies are expressed in terms of packages
30 where a package is typically built into a shared library: in fact,
31 the build products that correspond to a certain set of source files in
32 a certain location can be freely modified to suit the project.
33 The principal reason for assuming (or enforcing in some cases) that
34 packages map to libraries is to enable proper dependency tracking and
35 automatic ordering of build operations. From Version 1.0 of \scram,
36 this feature is fully supported both internally (to establish correct library
37 ordering in linker information) and via \texttt{gmake} which controls
38 the build ordering once the dependency information is correctly
39 obtained by \scram.
40
41 \ni Source files and header files have separate directories appearing under
42 \texttt{src} and \texttt{interface} or \texttt{include} respectively.
43 An additional directory called \texttt{test} can be used as a location
44 to build binary executables for testing. Likewise, other directories
45 can be used as locations to define other build products, for example
46 \texttt{bin} or \texttt{app} for binary executables and applications
47 which should be released as project deliverables.
48
49 \begin{figure}[htb]\index{project structure!recommended}
50 \begin{center}
51 \leavevmode \epsfig{file=images/projectstructure.eps, width=\linewidth}
52 \caption{Recommended \scram\ project structure. The directories
53 \texttt{tmp} and \texttt{logs} are created
54 automatically and directories for build products
55 like \texttt{lib} and \texttt{bin}
56 are created as appropriate given instructions
57 read from a project build file.}
58 \label{fig:recprojstruct}
59 \end{center}
60 \end{figure}
61
62 \ni The corresponding \scram\ project structure consists of a directory
63 tree like that shown in Figure~\ref{fig:recprojstruct}.
64
65 \ni This chapter describes some of the important internal configuration aspects of
66 \scram\ that are used to define projects and should provide all the
67 information required for administrators and developers alike to
68 configure a \scram-managed project.
69
70 \section{SCRAM Project Components}
71
72 Every \scram\ project has documents to describe it and a code
73 repository from where these documents, and project source code, can be
74 accessed using a version management system.
75 The two elements are described in the following sections.
76
77 \subsection{Configuration Documents}\label{sec:scramconfigdocs}
78 \index{SCRAM!project configuration files}
79
80 \ni There are two types of project areas:
81 \begin{itemize}
82 \item \texttt{Releases} which are normally installed in a central location.
83 \item \texttt{Developer Areas} which are areas that are cloned from
84 centrally installed releases but allow private access for software
85 development with the same controlled configuration as the release.
86 \end{itemize}
87
88 \ni The processes for initialising areas in each of these cases is different.
89 Each project must have a unique version, a name and a tool
90 configuration from which interfaces to external software can be
91 established. These interfaces express external dependencies in the
92 same way as individual packages in the project or release area of the
93 project. Their definitions are contained inside a toolbox and
94 list all settings needed by the \scram\ build or runtime environments (for
95 example, \texttt{INCLUDE} paths, libraries provided by the tools or \texttt{PATH} elements
96 which should be added to the user environment).
97
98 \ni Configuration instructions for \scram\ are passed using documents called
99 \texttt{ActiveDocs} which are \texttt{XML} files (the support for
100 \texttt{XML} document parsing is a new feature in this release).
101 These are web-enabled mark-up documents, each being associated with a
102 download and cacheing mechanism that is accessed using a \texttt{URL}. This
103 \texttt{URL} can behave like a normal \texttt{WWW} \texttt{URL} or can be a file or a
104 path to a \texttt{CVS} server. A number of \texttt{ActiveDoc} markup tags are
105 defined, some of which are common to all types of document; some tags
106 are specific for their application and only used in a particular class
107 of document. An \texttt{ActiveDoc} document must begin with a special
108 statement that informs \scram\ what sort of document it is and how it
109 should be parsed; each type of statement is specific to a class of
110 functionality. The parent tag
111 \begin{tagprint}
112 \lbkt\texttt{doc} type=\textit{type} version=\textit{version}\rbkt
113 \end{tagprint}
114 \ni is always the first line of the document after the \texttt{XML}
115 document header
116 \begin{tagprint}
117 \xmldocheader
118 \end{tagprint}
119
120 \ni The \texttt{doc} type is set according to the \scram\ parsing
121 class and all \scram\ \texttt{XML} documents must end with a corresponding
122 \lbkt$/$\texttt{doc}\rbkt tag.
123
124 \ni There are three main different classes of \texttt{ActiveDoc} document
125 that are needed to configure a project: \texttt{BootStrapProject},
126 \texttt{RequirementsDoc} and \texttt{ToolDoc}. These classes are
127 described next.
128
129 \subsubsection{The BootStrapProject Class}\label{sec:bootstrapclass}
130 \index{\texttt{BootStrapProject} class}
131 A single document describes how the project should be structured and
132 which tools should be configured. Usually referred to as a \texttt{bootstrap} file, it must start with
133 the statement\index{project \texttt{BootStrapFile}}
134 \index{bootstrap file}
135 \begin{tagprint}
136 \lbkt\texttt{doc} type=\texttt{"Configuration::BootStrapProject"}
137 version=\textit{"1.0"}\rbkt
138 \end{tagprint}
139 \ni The name of this file is completely arbitrary. The function of
140 the bootstrap document is to define the name and version of a project
141 and to tell \scram\ from where it can download the configuration and
142 source code files, and where to put them inside the project release
143 area. There must be a bootstrap file in every \scram\ project.
144
145 \ni The markup tags specify a path to a \texttt{CVS} server, the name of the
146 project requirements document and the location of the project
147 configuration directory within the project area. The available markup
148 tags are as follows--
149 \index{\texttt{BootStrapProject} markup tags}
150 \index{\texttt{BootStrapFile} markup tags}
151 \begin{description}
152 \item[\lbkt\texttt{project} name=\textit{"name"} version=\textit{"version"}\rbkt~\tagend{project}]\mbox{}\\
153 Specify the name an version of the project. The version should be a
154 valid \texttt{CVS} symbolic tag which must exist on all files in the
155 configuration directory and the project source code. Explanatory
156 text can be put between the \lbkt\texttt{project}\dots\rbkt tags: this
157 text will be printed to the screen when bootstrapping the project.
158 \item[\lbkt\texttt{config} dir=\textit{"dirname"}$/$\rbkt]\mbox{}\\
159 Specify the name of a directory relative to the top of the project
160 area where the configuration files can be found.
161 \item[\lbkt\texttt{base} url=\textit{"baseurl"}\rbkt~\tagend{base}]\mbox{}\\
162 A common element in multiple \texttt{URL}s, such as a \texttt{CVS} server name, is
163 supplied using the base tag. The \texttt{URL} type can be \texttt{cvs:}
164 (using a \texttt{CVS} repository) or \texttt{file:} (a standalone file). Any
165 \texttt{URL} specified between the start and end base tags will be merged
166 with the \texttt{URL} \textit{baseurl} according to the following merge
167 rules:
168 \begin{itemize}
169 \item A merge will only take place if the \texttt{URL} and \textit{baseurl}
170 types match, \eg both have type \texttt{cvs:} or \texttt{file:}
171 \item The base server name is taken if it isn't already defined
172 \item The \textit{baseurl} path is prepended to any \texttt{URL} specified
173 \item Variables provided in the base parameter list are only added
174 if not already defined, \eg definition of the directory name when
175 downloading the configuration files
176 \end{itemize}
177 \item[\lbkt\texttt{download} url=\textit{"url"} name=\textit{"dirname"}$/$\rbkt]\mbox{}\\
178 Each \texttt{URL} will be merged with the base \texttt{URL} defined in a
179 \tagstart{base} tag and treated as a download location which is
180 passed to \texttt{CVS} for checking out files from a repository. The name of
181 the destination directory will be \textit{dirname}, and will be
182 located relative to the top of the project area.
183 \item[\lbkt\texttt{requirementsdoc} name=\textit{"docname"}$/$\rbkt]\mbox{}\\
184 Specify the name of the project requirements document. The path is
185 relative to the top of the project area.
186 \end{description}
187
188 \subsubsection{The RequirementsDoc Class}\label{sec:requirementsdocclass}
189 \index{\texttt{RequirementsDoc} class}
190
191 To make external products available in a project area and be able to
192 link against external libraries, a requirements file is used. This
193 file starts with the statement\index{requirements file}
194 \begin{tagprint}
195 \lbkt\texttt{doc} type=\texttt{"BuildSystem::Requirements"}
196 version=\textit{"2.0"}\rbkt
197 \end{tagprint}
198 \ni and specifies the external tools and their corresponding versions
199 that should be configured. The requirements file provides information
200 for \scram\ to use when downloading the tool descriptions from the
201 toolbox \texttt{CVS} repository. If more than one version of a tool is defined,
202 the first one is taken as the default.
203 The following tags are available:
204
205 \begin{description}
206 \item[\lbkt\texttt{require} name=\textit{"name"} version=\textit{"version"} url=\textit{"url"}$/$\rbkt]\mbox{}\\
207 Specify the name and version of a required tool. The \texttt{URL} should
208 point to a \texttt{ToolDoc} that describes the tool. Base \texttt{URL} tags
209 (\lbkt\texttt{base}\rbkt\ldots) can be used to modify the \texttt{URL}.
210 \item[\lbkt\texttt{include} url=\textit{"url"}$/$\rbkt]\mbox{}\\
211 This is for \texttt{URL} document preprocessing.\texttt{ActiveDocs} provide
212 an equivalent of the \texttt{C}-preprocessor
213 \texttt{\#include}
214 \index{\texttt{include} directive}
215 directive that is web-aware. In this way, it is possible to assemble
216 a document from many components that are maintained at different
217 locations. A common configuration file containing multiple tool
218 \lbkt\texttt{require}\rbkt statements can be included in this way.
219 \item[\lbkt\texttt{architecture} name=\textit{"arch"}\rbkt~\tagend{architecture}]\mbox{}\\
220 \index{architecture tags}
221 \index{SCRAM!architecture}
222 \index{\texttt{SCRAM\_ARCH}}
223 \ni The \textit{arch} is an architecture tag which limits certain
224 functionality only to a specific operating system. This
225 architecture is determined automatically by \scram. Unlike previous
226 versions, the mechanism to determine the architecture name is
227 defined in \texttt{Installation/SCRAM\_SITE.pm} and is fully
228 customisable. Internally, \scram\ sets a variable called \texttt{SCRAM\_ARCH} to
229 whatever is determined as the architecture string. This string can
230 then be used as \textit{arch} (either the full architecture name or an
231 abbreviation will match).
232
233 \item[\lbkt\texttt{download} url=\textit{"url"}$/$\rbkt]\mbox{}\\
234 Specify a link to download information for the tool.
235 \item[\lbkt\texttt{select} name=\textit{"name"}$/$\rbkt]\mbox{}\\
236 Select a tool from a list of available tools.
237 \end{description}
238
239 \subsubsection{The ToolDoc Class}\label{sec:tooldocclass}
240 \index{\texttt{ToolDoc}!class}
241 An external tool is described using a tool description file called a
242 \texttt{ToolDoc}. When a tool is required, a certain version of that
243 tool is configured by \scram\ in the project area. A tool description
244 begins with the statement\index{\texttt{ToolDoc}}
245 \begin{tagprint}
246 \lbkt\texttt{doc} type=\texttt{"BuildSystem::ToolDoc"} version=\textit{"1.0"}\rbkt
247 \end{tagprint}
248 \ni The \texttt{ToolDoc} describes such things as the default location
249 of the tool on the system, the names of libraries to be used when
250 linking against the tool and environment variables that must be set at
251 runtime. The external dependencies of the tool are also declared.
252
253 \ni The following tags are available in \texttt{ToolDoc}s:
254 \index{\texttt{ToolDoc}!valid markup tags}
255 \begin{description}
256 \item[\lbkt\texttt{tool} name=\textit{"name"} version=\textit{"version"}\rbkt\tagend{tool}]\mbox{}\\
257 Specify the name and the version of the tool that is being
258 described. Everything between these tags relates to version
259 \textit{version} of the tool.
260 \item[\mbox{\lbkt\texttt{environment} name=\textit{"variable"}
261 {[}default=`\textit{"def"}' \textbf{or} value=`\textit{"value"}'{]}
262 type=\textit{"type"}$/$\rbkt}]
263 Set up a variable in the \scram\ environment for this tool.
264 Either `value' or `default' can be set
265 to provide the appropriate path for the variable but not both.
266 \item[\mbox{\lbkt\texttt{runtime} name=\textit{"variable"}
267 {[}type=`\textit{"path"}'{]}
268 {[}handler=`\textit{"warn","error"}'{]} $/$\rbkt}]\mbox{}\\
269 Define a runtime variable which should be set in the users' shell
270 environment. The optional variable type \textit{type} can be set
271 to \texttt{path} for a path-like variable, \eg
272 \texttt{\$PATH} or \texttt{\$LD\_LIBRARY\_PATH}, at runtime.
273 If the handler option \textit{handler} is set to \texttt{warn},
274 \scram\ will not pause and prompt for a value for the runtime
275 variable if the value is incorrect (for example, if the path is
276 missing because the directory has not yet been created).
277 \item[\lbkt\texttt{use} name=\textit{"tool name"}$/$\rbkt]\mbox{}\\
278 Specify that the tool has a dependency on another external tool.
279 \item[\lbkt\texttt{lib} name=\textit{"libname"}$/$\rbkt]\mbox{}\\
280 Specify the name of a library belonging to the tool. Note that the
281 preceding `lib' or extension are not required.
282 \item[\tagstart{client}~\tagend{client}]\mbox{}\\
283 Any \inbrackets{environment} definition between these tags will be
284 checked as a directory location on the client machine.
285 The presence of all libraries defined by \lbkt\texttt{lib}\rbkt tags
286 will be checked for automatically. The \texttt{client} tags should
287 only contain \texttt{environment} tags: if an environment is
288 architecture-specific, the \texttt{client} block must be included in
289 the architecture block and not the other way around.
290 \item[\tagstart{makefile}~\tagend{makefile}]\mbox{}\\
291 These tags delimit \texttt{gmake} makefile content intended for
292 inclusion in the build system associated with the tool. It is preferable to use
293 text templates (or modify existing templates) if the content to be
294 added is more than a single line (\eg a variable definition).
295 \item[\lbkt\texttt{flags} \texttt{NAME}="definition"\rbkt]\mbox{}\\
296 Extra compiler flags can be specified which will be added to the
297 global compiler flags if the tool defining them is required
298 globally, or added to the compiler flags for a package if the tool
299 is required there.
300 \end{description}
301
302 \ni Note that all environment variables can be referred to by others in
303 addition to internal \scram\ variables like \texttt{\$SCRAM\_ARCH}, the
304 tool name \texttt{\$SCRAMtoolname} and the version
305 \texttt{\$SCRAMtoolversion}.
306
307 \subsection{The CVS Infrastructure}\label{sec:configuringCVSinf}
308 \index{CVS repositories}
309 \index{CVS repositories!setting up for a new project}
310 All code management within \scram\ uses \texttt{CVS}, a versioning system
311 derived from \texttt{RCS}.\footnote{However, \scram\ does
312 not fully depend on CVS: another tool could be used instead if
313 required at a later date.}
314 Every project consists of source code and \scram\ project
315 configuration files which are imported into a \texttt{CVS} repository which
316 has a directory structure mirroring the structure of the project itself.
317 \begin{figure}[ht]\index{CVS repositories!recommended structure}\index{CVSROOT}
318 \begin{center}
319 \leavevmode \epsfig{file=images/projectCVSstructure.eps, width=\linewidth}
320 \caption{Recommended CVS repository structure for a \scram\
321 project. The directory \texttt{CVSROOT} contains CVS information
322 and is created automatically when initialising the CVS repository.}
323 \label{fig:recprojstructCVS}
324 \end{center}
325 \end{figure}
326 The typical repository structure, based on the project structure
327 described earlier, is illustrated in Figure~\ref{fig:recprojstructCVS}.
328 %
329 \subsubsection{CVS Authentication}\label{sec:CVSauth}
330 \index{CVSROOT!authentication settings and}
331 \index{CVS authentication options}
332 To access the CVS repository, an authentication method must be chosen
333 and specified in the \texttt{CVSROOT} environment variable. There are
334 currently two supported methods for file checkout in \scram:
335 \texttt{pserver:}, standard anonymous checkout, and \texttt{local:},
336 using a CVS repository on a local filesystem on the current machine
337 rather than a dedicated server accessible only via a network
338 connection.
339
340 \subsubsection{Importing the Code for New Projects}\label{sec:importingcode}
341 \index{CVS repositories!importing files to}
342 \ni Moving source code into a repository when creating a new project
343 is explained in detail in the CVS manual but a brief description is
344 given here. Once project source code exists in a suitable directory tree, the
345 whole project can be imported into a CVS repository using
346 the \texttt{cvs import} command. Initially, the \texttt{CVSROOT}
347 environment variable must be set and
348 the repository created using the command \texttt{cvs init}.
349 To make life easier when defining download paths in bootstrap
350 files, the \texttt{CVSROOT} for project \texttt{MyProject} on a local
351 filesystem would look like
352
353 \begin{list}{}
354 \item\texttt{/local/path/cvs\_repository/MyProject}
355 \end{list}
356
357 \ni and would be set before importing the code. Import the
358 configuration directory (and contents) first
359
360 \begin{indentprint}\texttt{cd config}\end{indentprint}
361 \vspace{-3mm}
362 \begin{indentprint}
363 \texttt{cvs import -m "First import of my project config" config V1-0 V1-0}
364 \end{indentprint}
365
366 \ni and then repeat this step for the project sources:
367
368 \begin{indentprint}\texttt{cd MyProject}\end{indentprint}
369 \vspace{-3mm}
370 \begin{indentprint}
371 \texttt{cvs import -m "First import of my project src" MyProject V1-0 V1-0}
372 \end{indentprint}
373
374 \ni Once this has been done and assuming that the import was
375 successful, the original sources can be removed and then restored from \texttt{CVS}
376 using \texttt{cvs co MyProject}.
377
378 \subsection{The SCRAM Toolbox}\label{sec:toolboxrep}
379 \index{SCRAM!toolbox CVS repository}
380 \index{CVS repositories!for tool descriptions}
381 A separate \texttt{CVS} repository must exist which contains
382 documents describing external tools: these are components of a {\em toolbox}.
383 This is referred to as the \scram\ toolbox.
384 Each tool has a \texttt{ToolDoc} in which every
385 version of the tool that can be used in a project environment is
386 described. Any environment or makefile variable needed to use the
387 external software is declared in the file and interpreted by \scram\ as
388 a variable to be set up when creating the project area for the first
389 time, or installing a new version of the tool into an existing area.
390 A global configuration file (called
391 `the configuration') indicates which tools and the corresponding versions that can
392 be downloaded by \scram\ and used in project-space. The toolbox is
393 tagged with a \texttt{CVS} symbolic tag which is used to \textit{freeze} the
394 configuration: this tag is then specified in the project
395 \texttt{RequirementsDoc} as the version to download.
396 There is no requirement for a particular structure for the toolbox
397 but including at least the following is recommended:
398
399 \begin{description}
400 \item[\textbf{Compiler Tools}]\mbox{}\\
401 Any number of programming languages can be supported (for example \texttt{C},
402 \texttt{C++}, \texttt{Java} or \texttt{Fortran}). The top-level
403 \texttt{BuildFile} for the project should select the compilers that should
404 be configured globally (compilers can also be selected for use only at
405 the package level where they are required).
406 \item[\textbf{External Software}]\mbox{}\\
407 Each external software package to be used by a project should have a
408 unique tool description file which defines the required version of
409 the tool.
410 \item[\textbf{Project Software Releases}]\mbox{}\\
411 Tool descriptions for all projects that provide libraries to be used
412 by other projects or tools should be created.
413 \item[\textbf{A Configuration File}]\mbox{}\\
414 The most important element in the toolbox. The
415 configuration describes the available tools and
416 versions of these tools that are to be used in a
417 project area.
418 \end{description}
419
420 \section{Creating a Project Release Area}\label{sec:creatProjArea}
421 \index{Project areas!creating new}
422
423 The starting point in a software development cycle is to create a project
424 release to estabish a baseline for further development.
425 A \scram\ project must have, at least, the following configuration
426 files in a configuration directory to properly define the project:
427 \begin{description}
428 \item[\texttt{BootStrapFile}]\mbox{}\\
429 For bootstrapping the project. This will relate a specific project
430 version with the relevant source code version and define a
431 requirements file to be read to select external products.
432 \item[\texttt{RequirementsDoc}]\mbox{}\\
433 The requirements file containing information to be passed to the
434 configuration manager for setting up external tools. A \texttt{CVS}
435 symbolic tag for a released configuration specifies which tools and
436 version should be downloaded from the toolbox repository.
437 \item[\texttt{BuildFile}]\mbox{}\\
438 The top-level \texttt{BuildFile}, containing project-wide default settings for
439 export of external tools, build product storage and global compiler settings.
440 \end{description}
441
442 \ni These files are normally kept in a directory called
443 \index{\texttt{config} directory}
444 \index{project configuration directory}
445 \texttt{config} (the name of the directory can be changed using a
446 directive in the boot file). A \scram\ command exists
447 which can be used to grab basic template files for a new project.
448 Typing
449
450 \begin{scramcmd}{project -template}\end{scramcmd}
451
452 \ni will download some basic project configuration files to a
453 directory called \texttt{config} in the current directory. These
454 should be edited to suit and imported into the project CVS repository
455 (see Section~\ref{sec:configuringCVSinf}). Once these configuration
456 files exist, they must be tagged with a \texttt{CVS} symbolic tag that matches the name
457 and version of the project (for example \texttt{myProject\_1\_0}).
458 All project source code must have the same global \texttt{CVS} tag (this is
459 especially important if you want the bootstrap mechanism to also
460 download source code).
461
462 \ni Creating the project area is very easy- just type the command
463
464 \begin{scramcmd}{project -b config/boot}\end{scramcmd}
465
466 \ni indicating the location of the bootstrap file after the \texttt{-b}
467 option, and that's it. \scram\ will set up the tools automatically
468 using the settings in the default lookup file \texttt{tools-X.conf}
469 found in \texttt{config/site}, or whichever lookup file is
470 specified on the command line.
471
472 \ni Two subdirectories are created in the project area as part of the
473 initialisation: \texttt{config} and \texttt{.SCRAM}. All files used
474 for bootstrapping and the build system are contained in
475 \texttt{config}, downloaded directly from the \texttt{CVS} repository. The
476 important project information is contained in the \texttt{.SCRAM}
477 subdirectory
478 \label{sec:dotSCRAMcontents}
479 \index{\texttt{.SCRAM} directory} so this must not be renamed or
480 deleted. A closer look at the contents of the \texttt{.SCRAM}
481 directory reveals the following subdirectories and files:
482
483 \small{
484 \begin{verbatim}
485 ObjectDB/
486 Environment
487 cache/
488 InstalledTools/
489 slc3_ia32_gcc323/
490 DirCache.db
491 \end{verbatim}
492 }\normalsize
493
494 \ni The directories \texttt{ObjectDB}, \texttt{cache} and
495 \texttt{InstalledTools} store tool description files as they are downloaded
496 from the \texttt{CVS} repository prior to being parsed by the setup mechanism.
497 Once each tool has been configured for use in the current environment,
498 the tool information is stored in the tool cache in
499 a directory for the architecture (in this example,
500 the architecture is \texttt{slc3\_ia32\_gcc323}). The file
501 \texttt{Environment} contains information required about the project
502 by \scram. The file content for a typical project \texttt{TEST} version
503 \texttt{TEST\_1\_0} looks like this:
504
505 \small{
506 \begin{verbatim}
507 SCRAM_PROJECTNAME=TESTING
508 SCRAM_PROJECTVERSION=1.0
509 SCRAM_TOOLBOXVERSION=CMS_112_3
510 SCRAM_PROJECT_TIMESTAMP=Fri-5-Feb-2005 14:10:22
511 LOCALTOP=/home/t/work/projects/TESTING_1.0
512 \end{verbatim}}\normalsize
513 %
514 \ni These entries are also defined as environment variables, visible in
515 the runtime and build environments. There will also be content like
516 \index{\texttt{RELEASETOP} settings}
517 \small{
518 \begin{verbatim}
519 RELEASETOP=/home/t/work/releases/TESTING_1.0
520 SCRAM_PROJECT_RELEASE_TIMESTAMP=Tues-1-Feb-2005 16:12:28
521 \end{verbatim}
522 }\normalsize
523
524 \ni in a developer area, informing \scram\ that the central area containing libraries and
525 header files should be used first, before any of the contents of the
526 current area. The timestamp of the release is also shown.
527
528 \ni The file \texttt{DirCache.db} is the timestamp cache file and
529 contains timestamp information for each file and directory in the
530 project source tree and configuration directory (\texttt{config}).
531 This will only exist when a build has run for the project.
532
533 \subsection{The Project Boot Process}
534 The principle of both the bootstrapping and tool setup is the same as
535 with previous versions of \scram. However, in the current version there is a fundamental
536 difference in the way that the tool data, before and after being set
537 up, is stored in the project.
538 All tool data is now cached in a file called \texttt{ToolCache.db} which is
539 stored in an architecture-dependent location inside the
540 project (\ie under \texttt{.SCRAM/\$SCRAM\_ARCH}).
541
542 \begin{description}
543 \item[Tool downloading:]\mbox{}\\
544 After tools have been downloaded to the local \scram\ cache (usually
545 \texttt{.SCRAM/cache}), those tools selected in the \texttt{RequirementsDoc} will be
546 set up. For each tool, a file \texttt{.SCRAM/InstalledTools/}\textit{toolname} will
547 be created. At the same time, the contents of this file will be
548 parsed and stored in the tool cache file. The order in which the
549 \lbkt\texttt{select}\rbkt statements appear in the \texttt{RequirementsDoc} will be the order
550 in which the tools are set up \textit{and} the order in which they appear in
551 any path-like runtime variables. This is completely independent of the
552 order in which tool files are downloaded (that is, the order in
553 which the \lbkt\texttt{require}\rbkt statements appear in the tool
554 configuration file, \ie \texttt{CMSconfiguration}).
555
556 \item[Tool Storage:]\mbox{}\\
557 The cache file \texttt{ToolCache.db} replaces the numerous \texttt{*.dat} files that were previously
558 located in the architecture-dependent directories under \texttt{.SCRAM}.
559
560 \item[Tool Parse:]\mbox{}\\ Once the tool is parsed and set up (using input from
561 \texttt{tools-CERN.conf}), a \texttt{ToolData} object holds the
562 data within the cache. The tool object provides the methods to access the
563 tool metadata.
564
565 %% Skip this part for now, since it's not particularly reliable!
566 %%
567 % \item[Other Project Setup:]\mbox{}\\
568 % Setting up a project area which depends on another SCRAM-managed
569 % project is now quicker and less prone to error since the entire tool
570 % setup is copied to the new area. Only additional tools are set up in
571 % the traditional way. Note that the SCRAM projects used in the
572 % current project configuration must be installed in the scram database.
573 %%
574 \end{description}
575
576 \subsection{Standalone Project Areas}
577
578 Project areas can also be bootstrapped without having access to a
579 \texttt{CVS} repository or a version control system by using only local copies of the project
580 configuration files (and toolbox files, if required). This is ideal for fast prototyping.
581 There are two possible methods:
582
583 \begin{description}
584 \item[Method 1:]\mbox{}\\
585 Use a standalone configuration directory which be copied directly to
586 the new project area, with \texttt{CVS} used only in the requirements
587 file to specify where the tool configuration and tools should be
588 downloaded from.
589 In this context, "standalone" means that the download \texttt{URL} is
590 of type \texttt{file:}, rather than \texttt{cvs:}.
591 The requirements file does specify \texttt{cvs:} with the path to the
592 toolbox repository.
593
594 \item[Method 2:]\mbox{}\\
595 Use a standalone configuration directory and toolbox. Both the config
596 and the toolbox are normal directories on a local filesystem and only
597 the \texttt{file:} type of \texttt{URL} is used.
598 \end{description}
599
600 \ni Examples of the content of boot files, requirements files and a
601 standalone toolbox are given in Chapter~\ref{ch:examples}.
602
603 \section{Creating a Developer Area}\label{sec:SCRAMdevareas}
604 \index{using SCRAM developer areas}
605 \index{SCRAM developer area}
606
607 \ni A developer area is an isolated area where a developer can work on a
608 given project without affecting other developers. This area is
609 associated with a particular version of a project available centrally
610 from which it can use resources (\eg \texttt{\#include} files, libraries or
611 environment files and settings). Software developers can check out source code
612 from \texttt{CVS} and \scram\ will build the products defined locally
613 and use these in place of those available in the
614 central release. All other products are transparently taken from the central project
615 release.
616
617 \ni To develop on a given project a copy of the project must be installed
618 at the developer site. Available projects can be viewed using the
619 command \texttt{scram list}. To create the developer space, the command
620
621 \begin{scramcmd}{project}
622 \inbrackets{project\_name}~\inbrackets{project\_version}
623 \end{scramcmd}
624
625 \ni should be issued. The project name and version above are taken
626 from the list of \scram\ projects. The development area has the
627 structure and the same build environment as the base project.
628 Alternatively, a developer can bootstrap a project by first
629 checking out the \texttt{config} directory that matches the version of
630 the project that the developer are is to be based on and following the
631 steps described in Section~\ref{sec:creatProjArea}.
632 This can be implemented via a web interface such that a
633 source code distribution of the project can be obtained via a \scram\
634 download mechanism which can be enabled using any web browser. Follow
635 the instructions in Section~\ref{sec:webbootstrap} on page
636 p\pageref{sec:webbootstrap} to do this. Once
637 correctly configured, a project can be installed using a single-click
638 operation in a browser window.
639
640 \subsection{Using the Developer Area}\label{sec:usingscramdevarea}
641 \index{SCRAM developer area!using a}
642
643 Once the area has been created, the \texttt{src} directory can be
644 populated with the source code of interest. This step
645 involves \texttt{CVS} alone; usually, a module corresponds to a package and so
646 the whole module would be checked out from the \texttt{CVS} repository. This
647 would be achieved using the command
648
649 \texttt{cd src;}~\texttt{cvs co}~\textit{module}
650
651 \ni Note that the above command will check out the development
652 \texttt{HEAD}. To check out a fixed tagged version or the head of
653 another development branch, specify a \texttt{CVS} revision using the {\bf -r}
654 option:
655
656 \texttt{cd src;}~\texttt{cvs co -r}~\textit{version}~\textit{module}
657
658 \ni Once the sources are checked out, they can be edited as required
659 and committed to \texttt{CVS}.
660
661
662 \subsection{Obtaining Help}\label{sec:gettinghelp}
663 \index{getting help}
664 \index{\texttt{scram help}}
665 \index{\texttt{scram help} for specific commands}
666 Help can be obtained directly using the \scram\ global \texttt{help}
667 command, or by using the \texttt{help} option of a specific command.
668 For example,
669
670 \begin{description}
671 \item[\texttt{scram help} or \texttt{scram -help}]\mbox{}\\
672 will list all available \scram\ commands
673 \item[\texttt{scram} \textit{command} \texttt{-help}]\mbox{}\\
674 will print the help for a specific command
675 \item[\texttt{scram build -help}]\mbox{}\\
676 will print the help available for the current build location.
677 Normally, this will show the available types of build that can be
678 performed in the current directory.
679 \end{description}
680
681 \ni The short versions of the help command can also be used (\ie
682 \texttt{-h} instead of \texttt{--help}).
683
684 \ni A summary of the \scram\ commands is available in Chapter~\ref{ch:quickhelpguide}.
685
686
687 \section{The SCRAM Runtime Environment}\label{sec:scramruntimeenv}
688 \index{SCRAM!runtime environment}
689 \index{runtime environment}
690 Each development area has an environment associated with it which is
691 related to the tools used at build-time (the \textit{configuration
692 environment}) or project-wide defaults used at runtime (the
693 \textit{application environment}). \scram\ establishes the build-time
694 environment through the parsing of the \texttt{ToolDocs} of the tools
695 in the configuration environment. The values of any variables that
696 describe paths to header files or required libraries are passed
697 automatically to the build system at build-time. Project-wide defaults
698 can be specified using a document called \texttt{Self}, which is
699 located in project configuration directory and contains default
700 settings for variables that should be available globally in the
701 project area.
702 \index{SCRAM!runtime environment!viewing and setting}
703 \ni The current environment can be viewed using the command
704
705 \begin{scramcmd}{runtime}
706 \marg{-sh}~(\textit{or}~\marg{-csh} for \texttt{tcsh} users)
707 \end{scramcmd}
708
709 \ni choosing the appropriate shell type flag according to the type of
710 shell in use. The runtime environment is not set automatically. To set
711 it, evaluate the command above using the shell \texttt{eval} function:
712
713 \begin{tagprint}
714 \texttt{eval} `\texttt{scram runtime}~\texttt{-sh}` (\textit{or} \texttt{-csh})
715 \end{tagprint}
716
717 \ni This must be set manually when running an executable since it
718 sets the \texttt{LD\_LIBRARY\_PATH} and other environment
719 variables, as defined in the configuration documents of the
720 project. All variables that are set also have an associated
721 \texttt{SCRAMRT\_xxxx} variable. This allows \scram\ to undo any
722 changes to the environment and facilitates the switching between
723 project areas without interference. The consistency checking is done
724 automatically.
725
726 \subsection{Constructing Runtime Environment Documents}\label{sec:constructingruntimedocs}
727 \index{SCRAM!runtime environment!constructing}
728 \index{constructing a runtime environment document}
729 A runtime document can be created for any application with the purpose
730 of defining any environment variables that might be required to run
731 the application properly. These might be special switches that control
732 how an application runs or settings of internal debugging or verbosity
733 levels. A variable can be defined in a runtime document using the tag
734
735 \begin{tagprint}
736 \lbkt\texttt{runtime} name=\textit{"variable"} value=\textit{"value"}
737 {[}type=\textit{"type"}{]} {[}handler=\textit{"warn","error"}{]}$/$\rbkt\mbox{}\\
738 \end{tagprint}
739
740 % \ni A good practise is to include some usage information between the
741 % \lbkt\texttt{runtime}\rbkt tags in the definition of the variable.
742 \ni All variables defined in a runtime document \texttt{filename} can be viewed using the command
743
744 \begin{scramcmd}{runtime}
745 \marg{-sh}~(\textit{or}~\marg{-csh})~\marg{-f filename}
746 \end{scramcmd}
747
748 \ni or for a specific variable only using
749
750 \begin{scramcmd}{runtime}
751 \marg{-sh}~(\textit{or}~\marg{-csh})~\marg{-f filename}~\marg{-info varname}
752 \end{scramcmd}
753
754 \ni The file \texttt{filename} is assumed to be located in the current directory.
755
756 \section{Interacting with the Configuration Environment}\label{sec:configurationtools}
757 \index{configuration tools}
758 Although all required external tools are automatically set up by the
759 \scram\ configuration manager in every project area, a developer may
760 want to change settings to suit a local system like a laptop computer.
761 \scram\ provides several commands to allow developers to easily view
762 the configuration environment and also to change it. The list of
763 configured tools available can be obtained using the command
764
765 \begin{scramcmd}{tool}
766 \texttt{list}
767 \end{scramcmd}
768
769 \ni This will present a list like the one shown below: \footnotesize{
770 \begin{verbatim}
771 Tool list for location /home/t/work/projects/TESTING_1.0
772 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
773
774 cxxcompiler 3.2.3
775 f77compiler 3.2.3
776 ccompiler 3.2.3
777 clhep 1.9.1.2
778 aida 3.2.1
779
780 \end{verbatim}
781 }\normalsize
782
783 \ni The settings for a tool can be viewed using the command
784
785 \begin{scramcmd}{tool}
786 \texttt{info} \texttt{tool\_name}
787 \end{scramcmd}
788
789 \ni For example, the settings of the tool \texttt{zlib} would look like
790 this: \small{
791 \begin{verbatim}
792 Tool info as configured in location /home/t/work/projects/TESTING_1.0
793 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
794
795 Name : zlib
796 Version : 1.1.4
797 ++++++++++++++++++++
798 SCRAM_PROJECT=no
799 ZLIB_BASE=/opt/lcg/external/zlib/1.1.4/slc3_ia32_gcc323
800 LIB=z
801 LIBDIR=/opt/lcg/external/zlib/1.1.4/slc3_ia32_gcc323/lib
802 INCLUDE=/opt/lcg/external/zlib/1.1.4/slc3_ia32_gcc323/include
803 LD_LIBRARY_PATH=/opt/lcg/external/zlib/1.1.4/slc3_ia32_gcc323/lib
804 \end{verbatim}
805 }\normalsize
806
807 \ni Another useful command can be used to extract the settings of
808 individual variables for a tool:
809
810 \begin{scramcmd}{tool}
811 \texttt{tag} \texttt{tool\_name} \option{tag\_name}
812 \end{scramcmd}
813
814 \ni where \textit{tag\_name} is the name of a variable relevant for
815 the tool \textit{tool\_name}. If no tag name is given then all
816 variable names will be printed. If this command is used in the
817 following way
818
819 \begin{scramcmd}{tool}
820 \texttt{tag} \texttt{zlib} \marg{INCLUDE}
821 \end{scramcmd}
822
823 \ni then \texttt{/opt/lcg/external/zlib/1.1.4/slc3\_ia32\_gcc323/include} will be printed. This
824 is especially useful within shell scripts and avoids the need for
825 parsing the command output with shell utilities like \texttt{sed} or
826 \texttt{awk}.
827
828 \subsection{Changing Settings of Tools}\label{sec:changingtoolsettings}
829 \index{changing settings of tools}
830
831 The default settings of the installation can be changed at any time.
832 There are two modes available for setting up the tools: automatic and
833 interactive. The automatic mode is the default and will be used to set
834 up tools after a \texttt{scram project} command using a bootstrap file
835 has been issued. In this automatic mode, the \scram\ configuration
836 manager attempts to determine the correct values of the tool variables
837 using default locations, environment variables or checking other
838 already installed projects. Failing this, the user will be prompted to
839 enter a value using interactive mode. Once a value has been chosen
840 for a path it will be checked to make sure that it exists. If it does
841 not, the user will be prompted to try again.
842
843 \ni Many of the common external tools used at CERN are installed in
844 single locations. The automated setup mechanism can use a variable to
845 define a search path. This is the purpose of the tool lookup file (usually a file
846 called \texttt{tools-SITENAME.conf} where sitename is site-specific
847 and can be set when \scram\ is installed \footnote{Some examples of
848 site names area CERN, LAPTOP, STANDALONE etc.}).
849
850 The variable called \texttt{SCRAM\_BASEPATH} can be set to
851 point to the base directory of an external installation area as in the example
852 below. Variable expansion occurs automatically so this variable can be
853 used anywhere in a tool lookup file.
854 A lookup file for a system with \texttt{SCRAM\_ARCH} set to
855 \texttt{slc3\_ia32\_gcc323} starts with the following entries:
856
857 \small{
858 \begin{verbatim}
859 ARCHITECTURE:slc3_ia32_gcc323
860 SCRAM_BASEPATH:/opt/cms/external
861 \end{verbatim}
862 }\normalsize
863
864 An entry for a tool then looks like this:
865
866 \small{
867 \begin{verbatim}
868 TOOL:cxxcompiler:
869 +CXX:/usr/bin/c++
870 +CC:/usr/bin/gcc
871 TOOL:clhep:
872 +CLHEP_BASE:$SCRAM_BASEPATH/clhep/1.9.2.2/slc3_ia32_gcc323
873 \end{verbatim}
874 }\normalsize
875
876 \ni When \scram\ tries to set up a particular tool, it will search the
877 lookup file first for a variable name that matches the one that is
878 being set up: if there is a value set, it will be used. Using the
879 command
880
881 \begin{scramcmd}{setup}
882 \flag{-i}~\option{tool\_name}~\optionwflag{-f}{tools.conf}
883 \end{scramcmd}
884
885 \ni the setup of a specific tool that is already installed is rerun.
886 The \textbf{-f} flag causes setup to read the tool lookup file given.
887 This filename must end in `.conf' but can have any name. Supplying a
888 tool lookup file on the command-line like this overrides any other
889 \scram\ variables that point to lookup files. All automatic mechanisms
890 that \scram\ uses to install a tool can be overidden with the
891 \textbf{-i} option giving the user complete control.
892
893 \subsection{Removing Tools from a Project Area}\label{sec:removingtools}
894 \index{removing tools from a project area}
895 A tool can be removed from a project area using the command
896
897 \begin{scramcmd}{tool}
898 \texttt{remove} \texttt{tool\_name}
899 \end{scramcmd}
900
901 \ni This completely removes all references to the tool. To re-install
902 the default version, the setup must be re-run. Before installing a new
903 version of a tool it is best to remove the old version.
904
905 \subsection{Installing New Tools into a Project Area}\label{sec:cvsrootbreakdown}
906 \index{installing new tools in a project area}
907 A new tool is installed using the command
908
909 \begin{scramcmd}{setup}
910 \flag{-i}~\marg{tool\_name}~\marg{tool\_version}~\marg{url}~\optionwflag{-f}{tools.conf}
911 \end{scramcmd}
912
913 \ni where the \texttt{url} is either a tool description file or a
914 valid CVS location (that is, the URL types are \texttt{file:},
915 \texttt{http:} or \texttt{url:}). A tool description template can be created using the
916 command \texttt{scram tool template}: this will create a template in
917 your current directory. Edit this to suit, ensuring that it has a tool
918 name and version. Define any variables that need to be set, and
919 libraries that are required. Then just run
920
921 \begin{scramcmd}{setup}
922 \flag{-i}~\marg{tool\_name}
923 ~\marg{tool\_version}~\marg{file:./tool\_template}~\optionwflag{-f}{tools.conf}
924 \end{scramcmd}
925
926 \ni and supply the settings as required. Using \texttt{http:} and a
927 path to a tool document, transfer using the HTTP protocol can be used
928 to download the document to the local directory where it will be parsed.
929
930 %% FIXME: This whole section needs updating!
931 \ni The third URL type refers to download locations on a CVS server. A
932 typical URL can be broken down into six parts that are combined as a
933 single string. These components, for a typical URL, are--
934
935 \begin{description}
936 \item[\texttt{cvs://lcgapp.cern.ch/cvs/SPITOOLS}]\mbox{}\\
937 The path to to the \texttt{ToolBox} repository on a CVS server. This
938 example is for a regular CVS server allowing at least \texttt{pserver}
939 anonymous access. If the authentication type is \texttt{local} then
940 the path will point directly to a directory:\mbox{}\\
941 \begin{center}
942 \small{
943 \begin{verbatim}
944 cvs:/fs/local/cvs_repositories/ToolBox
945 \end{verbatim}}\normalsize
946 \vspace{-5mm}
947 \end{center}
948 \index{CVSROOT!elements}
949 \index{CVSROOT!setting for a new tool}
950 \item[\texttt{{?}auth=pserver}]\mbox{}\\
951 The authentication type. This can be \texttt{pserver} for anonymous
952 checkouts or \texttt{local} for a repository on a local filesystem
953 instead of a dedicated server.
954 \item[\texttt{\&module=SCRAMToolBox/Tools/TOOLNAME}]\mbox{}\\
955 The location of the module (the tool document for \texttt{TOOLNAME})
956 to be checked out.
957 \item[\texttt{passkey=Ah<Z}]\mbox{}\\
958 The passkey needed for anonymous checkout. This is the password entry
959 in the file \texttt{.cvspass} usually found in a user home directory
960 after a \texttt{cvs login} command has been run.
961 \item[\texttt{user=anonymous}]\mbox{}\\
962 The user name for anonymous checkout. This can sometimes be
963 \texttt{anon}. Check with local CVS administrators to see how your
964 site repository has been set up.
965 \item[\texttt{version=LCG\_06}]\mbox{}\\
966 The configuration version.
967 \end{description}
968
969 % % \subsection{The SCRAM Graphical Interface}\label{sec:scramgui}
970 % % \textit{still work in progress!!!!}\mbox{}
971 % % A graphical interface to the tool metadata allows direct interaction
972 % % with tool settings. This is especially useful for modifying compiler
973 % % flags. The command
974
975 % % \begin{scramcmd}{ui}
976 % % \optionwflag{-edit}{compiler}
977 % % \end{scramcmd}
978
979 % % will show a window in which compiler information for each configured
980 % % compiler can be seen. Another option \texttt{tool} can be used to
981 % % modify tool settings.
982
983
984 %%% Local Variables:
985 %%% mode: latex
986 %%% TeX-master: "SCRAM-manual"
987 %%% End:
988
989 %%____________________________________________________________________
990 %% End of CreatingProjects.tex
991 %%____________________________________________________________________
992 %%