Changes between Initial Version and Version 1 of Obsolete/Development/Build


Ignore:
Timestamp:
Mar 20, 2010, 10:27:00 PM (16 years ago)
Author:
loomis
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Obsolete/Development/Build

    v1 v1  
     1[[TracNav]]
     2
     3The quattor build tools aim to wrap up all the functions commonly used by developers to manage code in the quattor repository. They provide facilities for creating new releases of software modules, and include automatic checks for required elements. This page is a technical guide for developers who want to contribute code to quattor.
     4
     5Any part of quattor susceptible of being packaged in a software unit is called a ''product''. We distinguish two classes of products:
     6* '''NCM components''' which live in the subtrees <tt>{trunk/,tags/}ncm-components/</tt>;
     7* '''core modules''' all the others.
     8
     9Each core module has its own pointer to the build tools, which appears as a normal subdirectory named <tt>quattor-build-tools</tt> in the checkout directory. For NCM components there is instead a single pointer located at <tt>quattor/ncm-components/</tt>. '''In any case, please, refrain from making any change to the content of any <tt>quattor-build-tools</tt> directory!'''
     10
     11= System requirements =
     12The framework is based on GNU <tt>make</tt>, <tt>sed</tt>, <tt>grep</tt>, <tt>perl</tt>, etc. Please make sure you're using some version of GNU/Linux. MacOS, BSD and others are '''not''' supported. Then of course, you need a recent version (at least <tt>>= 1.4.4</tt>) of <tt>svn</tt>.
     13
     14= Workspace setup =
     15First, make sure your finger information is up-to-date. This is needed to fill the 'author' field in the change logs. If needed run the following command:
     16
     17  $ chfn -f <full-name> -o <email-address> <your-login>
     18
     19We recommend to check out repository directories with their original names, f.i.:
     20
     21  $ svn co https://quattor.svn.sourceforge.net/svnroot/quattor/foo/bar quattor/foo/bar
     22
     23The above command makes <tt>$PWD/quattor</tt> your working directory (a.k.a. the quattor checkout root).
     24If however you prefer to use a different checkout root as a working directory, you should set the following environment variable:
     25
     26  $ export QTTR_CO_ROOT=/your/quattor/working/dir
     27
     28Better off placing it in your <tt>~/.bashrc</tt>. Make sure you have write permission on <tt>/your/quattor/working/dir</tt>! The above variable will help the build tools to guess where to create the tags in your local system.
     29
     30== Core modules ==
     31In order to work with core modules, just check out the directory you're interested in, f.i.:
     32
     33  $ svn co https://quattor.svn.sourceforge.net/svnroot/quattor/trunk/ccm quattor/trunk/ccm
     34
     35then
     36
     37  $ cd quattor/trunk/ccm
     38  $ make ...
     39
     40== NCM components ==
     41In order to work with NCM components, you need to check out the '''whole''' components' tree, i.e., for the head revisions:
     42
     43  $ svn co https://quattor.svn.sourceforge.net/svnroot/quattor/trunk/ncm-components \
     44  quattor/trunk/ncm-components
     45
     46and for the tags:
     47
     48  $ svn co https://quattor.svn.sourceforge.net/svnroot/quattor/tags/ncm-components \
     49  quattor/tags/ncm-components
     50
     51then, f.i.:
     52
     53  $ cd quattor/tags/ncm-components/core/ncm-pakiti/1.0.0/
     54  $ make ...
     55
     56= Available targets =
     57From now we assume each ''target'' is called via <tt>make</tt>. For example, to invoke the help command inside a given product directory, f.i. <tt>ncm-components/core/ncm-grub/</tt>:
     58
     59 $ make help
     60 usage: make target [target...]
     61 most frequently used targets:
     62   buildtools   -- insert a pointer to the HEAD version of the build tools
     63   check        -- check for:
     64                   * 'obsolete' mark in config.mk
     65                   * mandatory files (defined in 'quattor.mk')
     66                   * deprecated files (defined in 'quattor.mk')
     67                   * mandatory comments in source files (needs _SRC_FILES to be defined)
     68                   * mandatory meta tags in 'config.mk'
     69                   * deprecated patterns in Pan template files - mainly for NCM components
     70                     (needs _DIRTY_TPL_FILES to be defined)
     71   clean        -- remove backup files and other garbage
     72   dist         --> pack
     73   header       -- add a header to all source files (needs _SRC_FILES to be defined)
     74   majorversion -- increase version X+1.y.z, commit and tag in SVN
     75   markobsolete -- add to config.mk an 'OBSOLETE' mark and commit in SVN (no tag is added)
     76   minorversion -- increase version x.Y+1.z, commit and tag in SVN
     77   pack         -- build a tar.gz package for distribution
     78   release      -- increase version x.y.Z+1, commit and tag in SVN
     79   rpm          -- build an RPM  package for distribution
     80   tagstable    -- tag in SVN the HEAD revision with 'STABLE'
     81   test         -- run the tests, if any, coming with the module
     82
     83
     84The build also include other targets for use by developers of the quattor build tools. For details, consult the file <tt>quattor-build-tools/quattor-buildtools.mk</tt>.
     85
     86Since "tags" are meant as read-only directories, many of the above tags will fail when called inside the <tt>tags/</tt> tree.
     87
     88
     89= Versioning =
     90Module versions are made up of a 3-digit ''version'' number and a 1-digit ''release'' number:
     91
     92 x.y.z-n
     93
     94The two strings are placed in the special file <tt>config.mk</tt> (mandatory for any Quattor module):
     95
     96 VERSION=x.y.z
     97 RELEASE=n
     98
     99The VERSION string <tt>x.y.z</tt> is ''automatically'' modified by the build tools, whereas the RELEAE string <tt>n</tt> must be modified ''manually'' in special situations, such as when back porting fixes to an old version.
     100
     101= Checking in releases =
     102After the initial check-in to add a module to the repository, subsequent releases are handled via the following <tt>make</tt> targets:
     103
     104{| border="1"
     105! Target !! Result !! Scope
     106|-
     107| <tt>release</tt> || commit and tag a release <tt>x.y.Z+1</tt> || a very minor change, such as bug fixes and new options
     108|-
     109| <tt>minorversion</tt> || commit and tag a minor version <tt>x.Y+1.0</tt> || minor changes, such as schema add-ons, support for new functionalities and status change from '''test''' to '''stable'''
     110|-
     111| <tt>majorversion</tt> || commit and tag a milestone <tt>X+1.0.0</tt> || major changes, such as whole rewrite or refactoring
     112|}
     113
     114'''Please, avoid direct usage of <tt>svn commit</tt>, since this bypasses the checks meant for improving code quality!'''
     115
     116The svn commands involved in these operations are silent, but if you like to see what's actually going on, just define the shell variable SVN_VERB, f.i.
     117
     118 $ make SVN_VERB=1 release
     119
     120The above targets create some subdirectories in your local working directory. If you followed the tips [[#Workspace setup|above]], you should see the result of your check-in in <tt>/your/quattor/working/dir/tags/</tt>.
     121
     122=Tagging a release as stable=
     123There are two kinds of release:
     124* '''Development''': a release which can be incomplete, non-functional, or under testing. Such a release is not suitable for use in a production environment
     125* '''Stable''': a release which has been well-tested, possibly in a production-like environment
     126
     127A ''stable'' release is unique for each module. When checking in a release via one of the above targets, you will be asked whether you would like to tag it as 'stable'. If the release has received sufficient testing, answer 'yes'.
     128If you answer 'no', you can tag the trunk revision of the component at a later stage as follows:
     129
     130  $ make tagstable
     131
     132This will cause a <tt>stable</tt> tag to be created with the contents of the current revision.
     133
     134= Checking code =
     135In order to improve the quality of our code base, the build framework runs some automatic checks when
     136performing checkins. You can run these checks manually using the <tt>check</tt> target. Further details of the checks performed may be found [[Build_Framework_Checks|here]].
     137
     138= Deprecating a module =
     139When a module or NCM component is deprecated for any reason, it should be marked as 'obsolete'.
     140The convention for obsolete modules is to have an <tt>OBSOLETE</tt> tag in <tt>config.mk</tt> with three possible values:
     141* <tt>1</tt>: default value, no special reason given;
     142* <tt><mod-name></tt>: where <tt>mod-name</tt> is the component/module to use instead of the deprecated one;
     143* <tt><another-particular-reason></tt>: where an appropriate explanation is given.
     144
     145You don't need to edit <tt>config.mk</tt> by hand, just call:
     146
     147  $ make OBSOLETE_MSG=<your reason or module name> markobsolete
     148
     149which will modify <tt>config.mk</tt> and commit it (no special tag is added).
     150
     151Once a module is marked as obsolete, unless you define the shell variable <tt>CHKOBS_OK</tt>, <tt>make check</tt> fails. Other targets depending on <tt>check</tt>, such as <tt>rpm</tt>, will also fail.
     152
     153= Running unit tests =
     154If your module comes with unit tests, you can call them via <tt>make test</tt>, provided that a test ''harness'' is found in your checkout. Further details may be found on [[https://twiki.cern.ch/twiki/bin/view/FIOgroup/SWDevUnitTestPerl CERN's Perl unit test page]].
     155
     156= Updating a core module's pointer to the build tools =
     157Normally, each core module has a pointer to a specific version of the build tools, set as an <tt>svn:externals</tt> property. You can query it by running <tt>svn pg svn:externals</tt>, f.i. for the <tt>aii</tt> core module:
     158
     159  $ cd <your-svn-co>/trunk/aii
     160  $ svn pg svn:externals
     161  quattor-build-tools -r15 https://quattor.svn.sourceforge.net/svnroot/quattor/quattor-build-tools
     162
     163
     164At any time, the developer of a given module can update its pointer to the ''head'' revision, by running
     165
     166  $ make buildtools
     167
     168Should the above command fail, you can proceed as follows.
     169* Get the head revision number of the build tools
     170
     171  $ svn info https://quattor.svn.sourceforge.net/svnroot/quattor/quattor-build-tools | egrep Revision
     172  Revision: 211
     173
     174* Update the "svn:externals" property on the local module checkout, commit and update:
     175
     176  $ svn ps svn:externals "quattor-build-tools -r211 \
     177  https://quattor.svn.sourceforge.net/svnroot/quattor/quattor-build-tools" ./
     178  $ svn ci -m "Updated pointer to the qbt"
     179  $ svn up
     180
     181'''<u>Note</u>: NCM components use always the head revision of the build tools''', thus the above procedure does not apply to them.
     182
     183== Updating all pointers to the build tools ==
     184From the top-level trunk directory it is possible to update all the pointers to the latest build tools in just one go:
     185
     186  $ cd <your-svn-co>/trunk/
     187  $ svn update
     188  $ make refreshbt
     189
     190'''<u>Note</u>.''' Only the modules/component listed in the "release" file <tt><your-svn-co>/trunk/release-list</tt> will be affected. Please, keep the list up-to-date.
     191