Changeset 452 in ProjectBuilder


Ignore:
Timestamp:
May 27, 2008, 1:46:52 AM (16 years ago)
Author:
Bruno Cornec
Message:
  • Make newproj action work again
  • Add pb_cms_add function
  • Change interface of pb_cms_checkin (third param)
Location:
devel/pb
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r450 r452  
    13311331
    13321332    pb_log(2,"Checkin $ENV{'PBROOTDIR'}/../$newver\n");
    1333     pb_cms_checkin($scheme,"$ENV{'PBROOTDIR'}/../$newver");
     1333    pb_cms_checkin($scheme,"$ENV{'PBROOTDIR'}/../$newver",undef);
    13341334}
    13351335
  • devel/pb/lib/ProjectBuilder/CMS.pm

    r448 r452  
    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);
     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 pb_cms_add);
    3232
    3333=pod
     
    336336The first parameter is the schema of the CMS systems (svn, cvs, svn+ssh, ...)
    337337The second parameter is the directory to update from.
     338The third parameter indicates if we are in a new version creation (undef) or in a new project creation (1)
    338339
    339340=cut
     
    342343my $scheme = shift;
    343344my $dir = shift;
     345my $pbinit = shift || undef;
    344346
    345347my $ver = basename($dir);
    346 if ($scheme =~ /^svn/) {
    347     pb_system("svn ci -m \"updated to $ver\" $dir","Checking in $dir");
     348my $msg = "updated to $ver";
     349$msg = "Project $ENV{PBPROJ} creation" if (defined $pbinit);
     350
     351if ($scheme =~ /^svn/) {
     352    pb_system("svn ci -m \"$msg\" $dir","Checking in $dir");
    348353} elsif ($scheme eq "flat") {
    349354} elsif ($scheme =~ /^cvs/) {
    350     pb_system("cvs ci -m \"updated to $ver\" $dir","Checking in $dir");
     355    pb_system("cvs ci -m \"$msg\" $dir","Checking in $dir");
    351356} else {
    352357    die "cms $scheme unknown";
    353358}
    354359pb_cms_up($scheme,$dir);
     360}
     361
     362=item B<pb_cms_add>
     363
     364This function adds to a CMS content from a local directory.
     365The first parameter is the schema of the CMS systems (svn, cvs, svn+ssh, ...)
     366The second parameter is the directory/file to add.
     367
     368=cut
     369
     370sub pb_cms_add {
     371my $scheme = shift;
     372my $f = shift;
     373
     374if ($scheme =~ /^svn/) {
     375    pb_system("svn add $f","Adding $f to SVN");
     376} elsif ($scheme eq "flat") {
     377} elsif ($scheme =~ /^cvs/) {
     378    pb_system("cvs add $f","Adding $f to CVS");
     379} else {
     380    die "cms $scheme unknown";
     381}
     382pb_cms_up($scheme,$f);
    355383}
    356384
  • devel/pb/lib/ProjectBuilder/Env.pm

    r430 r452  
    168168
    169169pb_log(2,"PBDEFDIR: $ENV{'PBDEFDIR'}\n");
     170
     171# Put under CMS the PBPROJ dir
     172if (defined $pbinit) {
     173    if (! -d "$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}") {
     174        pb_mkdir_p("$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}") || die "Unable to recursively create $ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}";
     175    }
     176    pb_cms_add($pbconf{$ENV{'PBPROJ'}},"$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}");
     177}
     178
    170179#
    171180# Set delivery directory
     
    212221# return values in that case are useless
    213222#
    214 if (($action =~ /^cms2/) || ($action =~ /^newver$/) || ($action =~ /^pbinit$/)) {
     223if (($action =~ /^cms2/) || ($action =~ /^newver$/) || ($action =~ /pbinit/) || ($action =~ /^newproj$/)) {
    215224
    216225    #
     
    240249            }
    241250            closedir(DIR);
    242             die "No directory found under $ENV{'PBCONFDIR'}" if (not defined $ENV{'PBROOTDIR'});
    243251            pb_log(1,"WARNING: no pbroot defined, using $ENV{'PBROOTDIR'}\n");
    244252            pb_log(1,"         Please use -r release if you want to use another release\n");
     253            die "No directory found under $ENV{'PBCONFDIR'}" if (not defined $ENV{'PBROOTDIR'});
    245254        } else {
    246255            my ($pbroot) = pb_conf_read_if("$ENV{'PBDESTDIR'}/pbrc","pbroot");
     
    318327    } else {
    319328        if (defined $pbinit) {
    320             my $ptr = pb_get_pkg();
    321             my @pkgs = @$ptr;
     329            my @pkgs = @ARGV;
    322330            @pkgs = ("pkg1") if (not @pkgs);
    323331   
     
    837845                pb_mkdir_p("$ENV{'PBROOTDIR'}/$pp/pbfilter") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/pbfilter";
    838846   
    839                 pb_log(0,"\nDo not to forget to commit the pbconf directory in your CMS if needed\n");
    840847            }
     848            pb_cms_add($pbconf{$ENV{'PBPROJ'}},$ENV{'PBCONFDIR'});
     849            pb_cms_checkin($pbconf{$ENV{'PBPROJ'}},"$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}",$pbinit);
    841850        } else {
    842851            die "Unable to open $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";
Note: See TracChangeset for help on using the changeset viewer.