Changeset 409 in ProjectBuilder for devel/pb/lib/ProjectBuilder/CMS.pm


Ignore:
Timestamp:
Apr 25, 2008, 3:13:55 PM (16 years ago)
Author:
Bruno Cornec
Message:
  • Document all reusable functions in pb
  • remove the useless pbproj parameter from pb_filter functions
  • Addition and use of pb_conf_init and pb_conf_add in pb
  • Addition and use of pb_conf_fromfile_if in Conf.pm
  • preparation for 0.9.1
  • Update of pbinit files for mondo to support the new interface of pb_filter functions
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/lib/ProjectBuilder/CMS.pm

    r405 r409  
    2929 
    3030our @ISA = qw(Exporter);
    31 our @EXPORT = qw(pb_cms_init pb_cms_export pb_cms_get_uri pb_cms_copy pb_cms_checkout pb_cms_up pb_cms_checkin pb_cms_isdiff pb_cms_get_pkg pb_cms_compliant pb_cms_log pb_cms_create_authors);
     31our @EXPORT = qw(pb_cms_init pb_cms_export pb_cms_get_uri pb_cms_copy pb_cms_checkout pb_cms_up pb_cms_checkin pb_cms_isdiff pb_cms_get_pkg pb_cms_compliant pb_cms_log);
    3232
    3333=pod
     
    3535=head1 NAME
    3636
    37 ProjectBuilder::CMS, part of the project-builder.org - module dealing with configuration management system functions suitable for pbinit calls.
     37ProjectBuilder::CMS, part of the project-builder.org
    3838
    3939=head1 DESCRIPTION
     
    4141This modules provides configuration management system functions suitable for pbinit calls.
    4242
    43 =cut
    44 
    45 # Setup environment for CMS system for URL passed
     43=head1 USAGE
     44
     45=over 4
     46
     47=item B<pb_cms_init>
     48
     49This function setup the environment for the CMS system related to the URL given by the pburl configuration parameter.
     50The potential parameter indicates whether we should inititate the context or not.
     51It sets up environement variables (PBPROJDIR, PBDIR, PBREVISION, PBCMSLOGFILE)
     52
     53=cut
     54
    4655sub pb_cms_init {
    4756
     
    95104return($scheme,$pburl->{$ENV{'PBPROJ'}});
    96105}
     106
     107=item B<pb_cms_export>
     108
     109This function exports a CMS content to a directory.
     110The first parameter is the URL of the CMS content.
     111The second parameter is the directory in which it is locally exposed (result of a checkout).
     112The third parameter is the directory where we want to deliver it (result of export).
     113
     114=cut
    97115
    98116sub pb_cms_export {
     
    186204}
    187205
    188 # This function is only called with a real CMS system
     206=item B<pb_cms_get_uri>
     207
     208This function is only called with a real CMS system and gives the URL stored in the checked out directory.
     209The first parameter is the schema of the CMS systems (svn, cvs, svn+ssh, ...)
     210The second parameter is the directory in which it is locally exposed (result of a checkout).
     211
     212=cut
     213
    189214sub pb_cms_get_uri {
    190215
     
    234259}
    235260
     261=item B<pb_cms_copy>
     262
     263This function copies a CMS content to another.
     264The first parameter is the schema of the CMS systems (svn, cvs, svn+ssh, ...)
     265The second parameter is the URL of the original CMS content.
     266The third parameter is the URL of the destination CMS content.
     267
     268Only coded for SVN now.
     269
     270=cut
     271
    236272sub pb_cms_copy {
    237273my $scheme = shift;
     
    248284}
    249285
     286=item B<pb_cms_checkout>
     287
     288This function checks a CMS content out to a directory.
     289The first parameter is the schema of the CMS systems (svn, cvs, svn+ssh, ...)
     290The second parameter is the URL of the CMS content.
     291The third parameter is the directory where we want to deliver it (result of export).
     292
     293=cut
     294
    250295sub pb_cms_checkout {
    251296my $scheme = shift;
     
    264309}
    265310
     311=item B<pb_cms_up>
     312
     313This function updates a local directory with the CMS content.
     314The first parameter is the schema of the CMS systems (svn, cvs, svn+ssh, ...)
     315The second parameter is the directory to update.
     316
     317=cut
     318
    266319sub pb_cms_up {
    267320my $scheme = shift;
     
    272325} elsif ($scheme eq "flat") {
    273326} elsif ($scheme =~ /^cvs/) {
    274 } else {
    275     die "cms $scheme unknown";
    276 }
    277 }
     327    pb_system("cvs up $dir","Updating $dir");
     328} else {
     329    die "cms $scheme unknown";
     330}
     331}
     332
     333=item B<pb_cms_checkin>
     334
     335This function updates a CMS content from a local directory.
     336The first parameter is the schema of the CMS systems (svn, cvs, svn+ssh, ...)
     337The second parameter is the directory to update from.
     338
     339=cut
    278340
    279341sub pb_cms_checkin {
     
    286348} elsif ($scheme eq "flat") {
    287349} elsif ($scheme =~ /^cvs/) {
     350    pb_system("cvs ci -m \"updated to $ver\" $dir","Checking in $dir");
    288351} else {
    289352    die "cms $scheme unknown";
     
    291354pb_cms_up($scheme,$dir);
    292355}
     356
     357=item B<pb_cms_isdiff>
     358
     359This function returns a integer indicating the number f differences between the CMS content and the local directory where it's checked out.
     360The first parameter is the schema of the CMS systems (svn, cvs, svn+ssh, ...)
     361The second parameter is the directory to consider.
     362
     363=cut
    293364
    294365sub pb_cms_isdiff {
     
    318389}
    319390
    320 #
    321 # Return the list of packages we are working on in a CMS action
    322 #
     391=item B<pb_cms_isdiff>
     392
     393This function returns the list of packages we are working on in a CMS action.
     394The first parameter is the default list of packages from the configuration file.
     395The second parameter is the optional list of packages from the configuration file.
     396
     397=cut
     398
    323399sub pb_cms_get_pkg {
    324400
     
    340416}
    341417
    342 #
    343 # Check pbconf/project cms compliance
    344 #
     418=item B<pb_cms_compliant>
     419
     420This function checks the compliance of the project and the pbconf directory.
     421The first parameter is the key name of the value that needs to be read in the configuration file.
     422The second parameter is the environment variable this key will populate.
     423The third parameter is the location of the pbconf dir.
     424The fourth parameter is the URI of the CMS content related to the pbconf dir.
     425The fifth parameter indicates whether we should inititate the context or not.
     426
     427=cut
     428
    345429sub pb_cms_compliant {
    346430
     
    403487}
    404488
     489=item B<pb_cms_create_authors>
     490
     491This function creates a AUTHORS files for the project. It call it AUTHORS.pb if an AUTHORS file already exists.
     492The first parameter is the source file for authors information.
     493The second parameter is the directory where to create the final AUTHORS file.
     494The third parameter is the schema of the CMS systems (svn, cvs, svn+ssh, ...)
     495
     496=cut
     497
    405498sub pb_cms_create_authors {
    406499
     
    411504return if ($authors eq "/dev/null");
    412505open(SAUTH,$authors) || die "Unable to open $authors";
    413 # Save a potentially existing AUTHORS file and write instead toi AUTHORS.pb
     506# Save a potentially existing AUTHORS file and write instead to AUTHORS.pb
    414507my $ext = "";
    415508if (-f "$dest/AUTHORS") {
     
    438531}
    439532
     533=item B<pb_cms_log>
     534
     535This function creates a ChangeLog file for the project.
     536The first parameter is the schema of the CMS systems (svn, cvs, svn+ssh, ...)
     537The second parameter is the directory where the CMS content was checked out.
     538The third parameter is the directory where to create the final ChangeLog file.
     539The fourth parameter is unused.
     540The fifth parameter is the source file for authors information.
     541
     542It may use a tool like svn2cl or cvs2cl to generate it if present, or the log file from the CMS if not.
     543
     544=cut
     545
     546
    440547sub pb_cms_log {
    441548
     
    483590}
    484591
     592=back
     593
     594=head1 WEB SITES
     595
     596The main Web site of the project is available at L<http://www.project-builder.org/>. Bug reports should be filled using the trac instance of the project at L<http://trac.project-builder.org/>.
     597
     598=head1 USER MAILING LIST
     599
     600None exists for the moment.
     601
     602=head1 AUTHORS
     603
     604The Project-Builder.org team L<http://trac.project-builder.org/> lead by Bruno Cornec L<mailto:bruno@project-builder.org>.
     605
     606=head1 COPYRIGHT
     607
     608Project-Builder.org is distributed under the GPL v2.0 license
     609described in the file C<COPYING> included with the distribution.
     610
     611=cut
     612
    4856131;
Note: See TracChangeset for help on using the changeset viewer.