BOSS 开开开开 开开开 2005-06-21
BOSS 开发环境
马秋梅
2005-06-21
纲要
BESIII 离线软件的简单介绍 CMT 的简单介绍 如何在 boss 中使用 CMT CVS 的简单介绍
BESIII 离线软件的简单回顾
Besf/v1 : The original version completely based on belle Besf/v2 : The version improving with other frameworks like babar, gaudi, etc. Offline/3.0.0 : The version with the new building tools—CMT Boss/1.0.0 : The testing version based on Gaudi Boss/2.0.0 : The modified version based on Gaudi Boss/2.1.0 、 2.2.0 、 2.3.0 、 3.0.0 、 4.0.0 、 4.1.0 、 4.2.
0
注: boss 是 BESIII Offline software system 的缩写。
BESIII 离线软件的开发环境 Machine: koala.ihep.ac.cn(PC server) OS : Linux-7.2 Compiler : gcc-2.95 ; gcc-3.2 Framework :Based on Gaudi framework External Libs: CERNLIB 、 ROOT 、 CLHEP 、 Geant4 、 and etc. Developing language : C++ , some FORTRAN Database : PostgreSql,MySql Version management tool : CVS Browsing files in CVS repository : ViewCVS Configuration management tool : CMT
BOSS 的软件结构 The boss packages in boss/4.2.0 /BesPolicy -- define some standard patterns /BesCxxPolicy -- define standard patterns for c++ compilier /BesFortranPolicy -- define standard patterns for fortran compilier /BesRelease -- for all packages release /Analysis -- 物理分析软件 /BesExamples -- 一些入门级的例子/BesROOT --root 的一些服务/Control --boss 的主程序/Calibration -- 刻度相关的软件 /Database -- the data IO of database /DetectorDescription -- for detectors’ description/emc -- 量能器/Event -- for every type event
接上页:/EventFilter --for event filter/Eventdisplay -- 事例显示/External -- enviroments for external libs/Generator -- 各个产生子/MagneticField /MDC -- for main drift chamber/Muc --for muon counter /PhyTool -- some tools for physics analysis /Reconstruction -- for reconstruction/Simulation -- for simulation/TestRelease -- for some test release/Tof -- 时间飞行器 /Trigger -- for trigger/Utilities -- for some utilities
More details please see the website: http://koala.ihep.ac.cn/cgi-bin/viewcvs.cgi/BossC
vs
What is CMT ( Configuration management tool )
A set of tools and conventions structures software development or
production concepts of areas, packages, versions, constituents
organises software into packages describes package properties describes package constituents operates the software production
(management, build, import/export, etc...) by transparently configuring and driving the various
conventional tools (CVS, make, MSDev, Web, tar, compilers, linkers, archivers, etc...)
The goals
Organise software development from a single person up to teams in large projects (scalability)
Organise relationships between entire software bases or between simple packages (scalability)
Manage site, platform or product specific properties
Automate complex production tools for non software experts (simplicity)
Factor out know-how from project to project, from package to package or from team to team (process improvement)
Who are using CMT
The physics research experiments using CMT as the following:
a.. Virgo b.. LHCb c.. GLAST d.. Atlas
e.. Nemo f.. Opera g.. Planck h.. Auger i.. GANIL j.. GAM
The concepts...
Package search path
The minimal entity
Describes the backward compatibility
Induces inheritance-like properties and version constraints
Applications, libraries, documents
Macros, environment variables, include search path, etc...
Open architecture for any non-standard configuration action
Area
Package
Version
Use relationships .
Constituents
Configuration parameters
Document generators
Types of Package
Packages may have particular semantics
Normal packages provide software or documents
Container packages manage other packages
Policy packages hold Atlas specific conventions, policies, patterns
Interface convert conventions and policies of external packages
Global software organization
use
use useuse
use
use
use use
Release area
User area MDCGeomSvcMDCGeomSvc-01-00-01
BesReleaseBesRelease-00-00-01
MDCGeomSvcMDCGeomSvc-00-00-01
BesGeoMdc BesGeoMdc-00-*
External/CLHEPCLHEP-00-01-*
BesPolicyBesPolicy-01-*
CLHEP
External area
use
Area in boss On Koala machine : release area located in: /bes/sw/dist/boss/4.2.0
External area located in: /bes/sw/boss/sw/packages
User area locted in: /home/user/**
Examples… The simplest one
One new application with (some) source file(s)
> cmt create A A-00-00-01> cd A/A-00-00-01/cmt> vi requirements
> vi A.cxx B.cxx C.cxx> gmake> source setup.sh>./ ../${CMTCONFIG}/A.exe
package Ause BesPolicy BesPolicy-01-*application A A.cxx B.cxx C.cxx
1) Create a new packageand move to it
2) Describe the package
3) Create the package items
and build them
4) set the environment
and run
The directory structure of a package
A-00-00-01A-01-00-02A-03-01-01
area / package-name / version-tag / cmt / requirements src / sources (*.CXX) package-name / headers (*.h) linux-i686 / Linux binaries test /test application ……
Public releasePrivate dev.
Common softwareInter-project com.
Domain specific dev.
Search list defined in CMTPATH
•Specified at package creation
•Obtained by cmt checkout
Automatically created at build time and on demand
according to cmt system
The requirements file
The requirements file
The requirements file centralizes all configuration parametersAuthor(s),
manager(s)
Structural information •specialized directory structure •used packages•links to external packages
Constituents•Libraries•Applications•generated documents
Make macros and environment variables
and their possible values on various platforms, sites, environments Customization for
new languages, or document generators
Definition of conventional behavioural
patterns
Sufficient for transparently generating all required makefiles and setup scripts, or for
launching test procedures. They are the sources of all queries.
The version tag Version specification accepts a
semantics based on a 3-level identifier scheme:
<name>-**-**-** e.g. test-00-00-01 major or version id
minor or revision id patch id
Use relationships Set a dependency between two
package-version duets. Public configuration parameters are
inherited through the use. The use specification defines a graph of
links (possible redundancy) cmt provides the reduction algorithm of
the tree (search path is taken into account)> cmt show uses
Standard Patterns A simple installed library
apply_pattern installed_library library=<pkg> A component library
apply_pattern component_library library=<pkg> A dual_use library apply_pattern dual_use_library files=<list of files> Declare run-time files
apply_pattern declare_runtime extras=*.data Declares *.txt *.py and *.data files in share directory
Install run-time filesapply_pattern install_runtime
Copies declared files to run directory
How to use patterns
1. Packages that create Algorithms or AlgTools should use the dual_use_library pattern.
2. Packages that create utility classes that are designed to be used directly or as base classes should use the installed_library pattern.
3. Packages that create a Service should use the component_library pattern. In general a single package should not create multiple services.
Useful variables and commands (1)
The CVSROOT environment variable Default is: :pserver:[email protected]:/bes/bes
The CMTCONFIG environment variable - Default is :Linux-i686 The CMTPATH environment variable
Locations that CMT looks in to locate packages The CMT command itself
cmt [arguments]
Useful variables and commands (2)
Basic syntaxcmt <verb> [ -<option>=<value> <parameters…> ]
Main commands cmt config re-configure a package cmt create … create a new package cmt show … monitors configuration parameters cmt broadcast … launch shell command over several packages
cmt co … interface to CVS’ checkout operation
cmt help get the list of possible commands source cleanup.sh undo the source setup source setup.sh do the source setup
How to use CMT in boss
How to setup CMT
Working on packages
How to run a simple example
How to setup CMT(1)
How to connect with CMT
Call the setup script of CMT itself. Select one version of CMT
$ source /bes/tool/CMT/v1r14p20031120/mgr/setup(c).shOr$source setupCMT.(c)sh ref: /home/maqm/cmt/setupCMT.sh
How to setup CMT(2) --login requirements
CMT itself can establish a login environment You don’t have to use it, but it makes life easier
A template is available Koala:/home/maqm/cmt/requirements
Needs to be modified to suit your needs Works with any supported shell (tcsh, zsh, bash, etc.) Copy the template file to your home directory and edit
it Comments give guidance
Login requirementsauthor Li Weidong <[email protected]> # set the SITEROOTset SITEROOT "/bes/sw" # set the offset in cvs repositoryset CMTCVSOFFSET "BossCvs" # Set release numbermacro GAUDI_RELEASE "0.12.1.4" # Set the location of Gaudimacro GaudiArea "$(SITEROOT)/Gaudi/rh72-gcc3.2/GAUDI_v12r0"# Setup the CMT search pathpath_remove CMTPATH "$(GaudiArea)"path_prepend CMTPATH "$(GaudiArea)" # Set the base location of all release for your site:macro BES_DIST_AREA “$( SITEROOT)/dist/boss“# Set release numbermacro BES_RELEASE “4.2.0“# Setup the CMT search pathset BesArea "$(BES_DIST_AREA)/$(BES_RELEASE)"path_remove CMTPATH "${BesArea}"path_prepend CMTPATH "${BesArea}"
Set Gaudiarea
Set releasearea
macro WorkArea "${HOME}/workarea" # Setup the CMT search pathmacro home_dir "${HOME}"path_remove CMTPATH "${home_dir}"path_prepend CMTPATH "$(WorkArea)" # Setup compiler-specific search pathsmacro GCC_DIR "${SITEROOT}/gcc-3.2“path_remove PATH "$(GCC_DIR)"path_prepend PATH "$(GCC_DIR)/bin"path_remove LD_LIBRARY_PATH "$(GCC_DIR)"path_prepend LD_LIBRARY_PATH "$(GCC_DIR)/lib"
Set user area
Setup compilerpath
setting your enviroment >source setupCMT.sh >jed requirements >cmt config >source setup.sh
Creatting a package Choosing a location
i.e. Which container? … Choosing a name
Must be a unique package name in boss (should not either just differentiate by case of letters)
The version The command
>cmt create test test-00-00-01
Modifying and Building a package
The basic development cycle Write your file
> vi <file> Build
> cd cmt > vi requirements > cmt config > source setup.sh > gmake
Test (if available)
Checking in to CVS
Checking in to CVS cvs import –m “First import of test” BossCvs/test Bes test-00-00-01
Note: set the right CVSROOT
e.g. export CVSROOT=“:pserver:[email protected]:/bes/bes” cvs login
Checking out a package Getting a package out from CVS to modify it
Go to your private development area Checkout the package (installing the proper
CMT directory structure)cmt co Database/DBBesGeoMUC
Get the HEAD revision, and make use of the most recent tag
cmt co –r DBBesGeoMUC-00-00-01 Database/DBBesGeoMUC Get the required revision, and make use of that tag
The directory version is created with the appropriate CVS tag applied to the package
Checking out several packages
Checking out a complete containercmt co Databasecmt co –requirements Database/*/cmt/requirements
Checking out all packages cmt co BesRelease cmt co –requirements
BesRelease/*/cmt/requirements
Applying a command to all checked out packages
cmt broadcast cmt configCmt broadcast gmake
Modifying and Building a package
The basic development cycle Modify
> vi <file> Build
> cd cmt > vi requirements > cmt config > source setup.sh > gmake
Test (if available)
Update CVS
cvs –n updatecvs commit –m “”cvs tag test-00-00-02
Working with boss The principle of the TestRelease package
This package is the basic interface to the release Running boss only requires to “select” a set of
already built components and to locally install a set of runtime files
Checking out TestRelease > cmt co TestRelease Customizing it : selecting components Before running : install runtime files
This generally creates symlinks towards runtime files (shared libraries, jobOptions, data files, …)
Running boss(see next screen)
Running boss #running a simple example -- ExHelloWorld cd <yourworkarea> cmt co TestRelease cd Testrelease/*/cmt jed requirements Add “use ExHelloWorld ExHelloWorld-* BesExamples” to requirements cmt broadcast cmt config cmt broadcast gmake source setup.sh cd ../run source ../share/TestRelease_links.csh boss.exe HelloWorldOptions.txt
CVS 是什么 ? 1989 年 4 月, Brian Berliner 设计了 CVS 并
编写了代码,之后 Jeff Polk 帮助 Brian 设计了 CVS 模块发行分支。
CVS(Concurrent Versions System ) 版本控制系统是一种 GNU 软件包,主要用于在多人开发环境下的源码的维护。 它可以记录源文件开发的历史。
CVS 记录源文件历史的方式
当然,你可以把所有版本的所有文件都保存下来。但这会浪费大量的磁盘空间。 CVS 则采用了一种聪明的办法来保存一个文件的所有版本——仅仅把不同版本之间的区别——保存在一个文件里。
CVS 的工作原理 在一台服务器上建立一个源代码库,库里可
以存放许多不同项目的源程序。由源代码库管理员统一管理这些源程序。每个用户在使用源代码库之前,首先要把源代码库里的项目文件下载到本地,然后用户可以在本地任意修改,最后用 CVS命令进行提交,由 CVS 源代码库统一管理修改。这样,就好象只有一个人在修改文件一样,既避免了冲突,又可以做到跟踪文件变化等。
为什么使用 CVS 明确地将源文件的存储和用户的工作空间独立开来,
并使其并行操作。 CVS基于客户端 / 服务器的行为使其可容纳多个用户,构成网络也很方便。这一特性使得 CVS成为位于不同地点的人同时处理数据文件(特别是程序的源代码)时的首选。(提供一种方法,能够协调对源代码的更改,并能集成这些更改 )
修改软件时可能会产生一些 bug ,而且可能过了很久你才会察觉到它们的存在。有了 CVS ,你可以很容易地恢复旧版本,并从中看出到底是哪个修改导致了这个 bug 。(拥有团队所提交工作的历史记录 )
我们如何使用 CVS? 首先,你需要申请一个 CVS账号 然后,需要设置变量: export CVSROOT=':pserver:[email protected]:/bes/bes'
或 setenv CVSROOT ‘:pserver:[email protected]:/bes/bes‘
最后,你需要知道一些常用的 CVS命令(见下页)
常用的 CVS命令 (1) Checking in to CVS cvs import –m “**” test Bes test-00-00-01 查看源程序的变化 cvs –n update 添加一个源文件 cvs add 源文件名(路径要正确) 删除一个源文件 cvs remove 源文件名(路径要正确)
常用的 CVS命令 (2) 提交所作的修改 cvs commit –m “**” 给一个包做 tag cvs tag 版本号 查看当前工作的源文件与 cvs 库里源文件的区
别 cvs diff
常用的 CVS命令 (3) Checkout a package
cmt co test
or
cmt co –r test-00-00-01 test Checking out a complete container
cmt co Databasecmt co –requirements Database/*/cmt/requirements
Checking out all packages cmt co BesRelease cmt co –requirements BesRelease/*/cmt/requirements
如何查看 CVS 库中的源代码?
在 windows浏览器地址栏输入地址: http://koala.ihep.ac.cn/cgi-bin/viewcvs.cgi/
Documents
http://www.cmtsite.org
http://atlas.web.cern.ch/Atlas/Groups/software/oo/tools/cmt
Thank you!