Changeset 361 in ProjectBuilder


Ignore:
Timestamp:
Apr 7, 2008, 11:42:10 PM (16 years ago)
Author:
Bruno Cornec
Message:

Should fix #20

File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r360 r361  
    11631163
    11641164    my ($scheme,$uri)=pb_cms_init($pbinit);
     1165
     1166    # Checking CMS repositories status
    11651167    my ($pburl) = pb_conf_get("pburl");
    11661168    my ($scheme2, $account, $host, $port, $path) = pb_get_uri($pburl->{$ENV{'PBPROJ'}});
     
    11701172    }
    11711173    my $res = pb_cms_isdiff($scheme,$ENV{'PBROOTDIR'});
    1172     die "You need to have no differences in $ENV{'PBROOTDIR'} before creating a new version" if ($res != 0);
     1174    die "ERROR: No differences accepted in CMS for $ENV{'PBROOTDIR'} before creating a new version" if ($res != 0);
    11731175
    11741176    $res = pb_cms_isdiff($scheme2,$ENV{'PBDIR'});
    1175     die "You need to have no differences in $ENV{'PBDIR'} before creating a new version" if ($res != 0);
     1177    die "ERROR: No differences accepted in CMS for $ENV{'PBDIR'} before creating a new version" if ($res != 0);
    11761178
    11771179    # Tree identical between PBCONFDIR and PBROOTDIR. The delta is what
     
    11821184
    11831185    my $newurl = "$uri/".dirname($tmp)."/$newver";
    1184     pb_log(2,"Copying $uri to $newurl\n");
     1186    my $oldver= basename("$uri/$tmp");
     1187
     1188    # Checking pbcl files
     1189    foreach my $f (<$ENV{'PBCONFDIR'}/*/pbcl>) {
     1190        open(PBCL,$f) || die "Unable to open $f";
     1191        my $foundnew = 0;
     1192        while (<PBCL>) {
     1193            $foundnew = 1 if (/^$newver (/);
     1194        }
     1195        close(PBCL);
     1196        die "ERROR: version $newver not found in $f\n") if ($foundnew == 0);
     1197    }
     1198
     1199    pb_log(2,"Copying $uri/$tmp to $newurl\n");
    11851200    #pb_cms_copy($scheme,$uri,$newurl);
    11861201    pb_log(2,"Checkout $newurl to $ENV{'PBDIR'}/../$newver\n");
    11871202    #pb_cms_checkout($scheme,$newurl,"$ENV{'PBDIR'}/../$newver");
    1188     my $oldver=basename($uri);
     1203
     1204    # Update the .pb file
     1205    # Should probably use projver in the old file
    11891206    open(FILE,"$ENV{'PBROOTDIR'}/../$newver/$ENV{'PBPROJ'}.pb") || die "Unable to open $ENV{'PBROOTDIR'}/../$newver/$ENV{'PBPROJ'}.pb";
    11901207    open(OUT,"> $ENV{'PBROOTDIR'}/../$newver/$ENV{'PBPROJ'}.pb.new") || die "Unable to write to $ENV{'PBROOTDIR'}/../$newver/$ENV{'PBPROJ'}.pb.new";
    11911208    while(<FILE>) {
    1192         s/projver\s+$ENV{'PBPROJ'}\s*=\s*$oldver/projver $ENV{'PBPROJ'} = $newver/;
     1209        s/^projver\s+$ENV{'PBPROJ'}\s*=\s*$oldver/projver $ENV{'PBPROJ'} = $newver/;
     1210        pb_log(0,"Changing projver from $oldver to $newver in $ENV{'PBROOTDIR'}/../$newver/$ENV{'PBPROJ'}.pb\n") if (/^projver\s+$ENV{'PBPROJ'}\s*=\s*$oldver/);
     1211        s/^testver/#testver/;
     1212        pb_log(0,"Commenting testver in $ENV{'PBROOTDIR'}/../$newver/$ENV{'PBPROJ'}.pb\n") if (/^testver/);
    11931213        print OUT $_;
    11941214    }
     
    11971217    rename("$ENV{'PBROOTDIR'}/../$newver/$ENV{'PBPROJ'}.pb.new","$ENV{'PBROOTDIR'}/../$newver/$ENV{'PBPROJ'}.pb");
    11981218    pb_log(2,"Checkin $ENV{'PBROOTDIR'}/../$newver\n");
     1219
    11991220    #pb_cms_checkin($scheme,"$ENV{'PBROOTDIR'}/../$newver");
    12001221}
Note: See TracChangeset for help on using the changeset viewer.