Changeset 340 in ProjectBuilder for devel/pb/bin
- Timestamp:
- Mar 29, 2008, 6:24:36 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb/bin/pb
r337 r340 48 48 my @date = pb_get_date(); 49 49 my $pbdate = strftime("%Y-%m-%d", @date); 50 51 # ---------------------------------------------------------------------------52 50 53 51 =pod … … 294 292 # Old syntax 295 293 #getopts('a:fhi:l:m:P:p:qr:s:vV:',\%opts); 294 getopts('a:fhi:l:m:P:p:qr:s:tvV:',\%opts); 296 295 297 296 my ($projectbuilderver,$projectbuilderrev) = pb_version_init(); … … 338 337 # Handle root of the project if defined 339 338 if (defined $opts{'r'}) { 340 $ENV{'PBROOT '} = $opts{'r'};339 $ENV{'PBROOTDIR'} = $opts{'r'}; 341 340 } 342 341 # Handle virtual machines if any … … 439 438 my ($scheme, $account, $host, $port, $path) = pb_get_uri($uri->{$ENV{'PBPROJ'}}); 440 439 441 #442 # Check project cms compliance443 #444 pb_cms_compliant("pbdir",'PBDIR',"$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}",$uri->{$ENV{'PBPROJ'}},$pbinit);445 446 440 # Some variable initialization depending on CMS type 447 pb_cms_init($scheme);441 my ($scheme,$uri)=pb_cms_init($pbinit); 448 442 449 443 my ($pkgv, $pkgt) = pb_conf_get_if("pkgver","pkgtag"); … … 487 481 pb_log(2,"def:".Dumper($defpkgdir)." ext: ".Dumper($extpkgdir)." \n"); 488 482 489 # If it isn't a flat CMS, then we have the choice to export subdir490 pb_cms_export($uri ->{$ENV{'PBPROJ'}},"$ENV{'PBDIR'}/$pbprojver/$dir",$dest);483 # Exporting from CMS 484 pb_cms_export($uri,"$ENV{'PBDIR'}/$dir",$dest); 491 485 492 486 # Get project info on authors and log file 493 my $chglog = "$ENV{'PBROOT '}/$pbpkg/pbcl";494 $chglog = "$ENV{'PBROOT '}/pbcl" if (! -f $chglog);487 my $chglog = "$ENV{'PBROOTDIR'}/$pbpkg/pbcl"; 488 $chglog = "$ENV{'PBROOTDIR'}/pbcl" if (! -f $chglog); 495 489 $chglog = undef if (! -f $chglog); 496 490 497 my $authors = "$ENV{'PBROOT '}/$pbpkg/pbauthors";498 $authors = "$ENV{'PBROOT '}/pbauthors" if (! -f $authors);491 my $authors = "$ENV{'PBROOTDIR'}/$pbpkg/pbauthors"; 492 $authors = "$ENV{'PBROOTDIR'}/pbauthors" if (! -f $authors); 499 493 $authors = "/dev/null" if (! -f $authors); 500 494 … … 504 498 copy($chglog,"$dest/NEWS") || die "Unable to create $dest/NEWS"; 505 499 } 506 pb_cms_log($scheme,"$ENV{'PBDIR'}/$ pbprojver/$dir",$dest,$chglog,$authors);500 pb_cms_log($scheme,"$ENV{'PBDIR'}/$dir",$dest,$chglog,$authors); 507 501 508 502 my %build; … … 510 504 my @pt; 511 505 @pt = pb_conf_get_if("vmlist","velist"); 512 foreach my $d (split(/,/,$pt[0]->{$ENV{'PBPROJ'}}),split(/,/,$pt[1]->{$ENV{'PBPROJ'}})) { 506 my $tmpl = ""; 507 if (defined $pt[0]->{$ENV{'PBPROJ'}}) { 508 $tmpl .= $pt[0]->{$ENV{'PBPROJ'}}; 509 } 510 if (defined $pt[1]->{$ENV{'PBPROJ'}}) { 511 # the 2 lists needs to be grouped with a ',' separated them 512 if ($tmpl ne "") { 513 $tmpl .= ","; 514 } 515 $tmpl .= $pt[1]->{$ENV{'PBPROJ'}} 516 } 517 foreach my $d (split(/,/,$tmpl)) { 513 518 my ($name,$ver,$arch) = split(/-/,$d); 514 519 chomp($arch); … … 520 525 # Filter all files found, keeping the name, and generating in dest 521 526 522 # Find all build files first relatively to PBROOT 527 # Find all build files first relatively to PBROOTDIR 523 528 # Find also all specific files referenced in the .pb conf file 524 529 my %bfiles = (); … … 526 531 $build{"$ddir-$dver"} = "yes"; 527 532 528 if (-d "$ENV{'PBROOT '}/$pbpkg/$dtype") {529 pb_list_bfiles("$ENV{'PBROOT '}/$pbpkg/$dtype",$pbpkg,\%bfiles,\%pkgfiles,$supfiles);530 } elsif (-d "$ENV{'PBROOT '}/$pbpkg/$dfam") {531 pb_list_bfiles("$ENV{'PBROOT '}/$pbpkg/$dfam",$pbpkg,\%bfiles,\%pkgfiles,$supfiles);532 } elsif (-d "$ENV{'PBROOT '}/$pbpkg/$ddir") {533 pb_list_bfiles("$ENV{'PBROOT '}/$pbpkg/$ddir",$pbpkg,\%bfiles,\%pkgfiles,$supfiles);534 } elsif (-d "$ENV{'PBROOT '}/$pbpkg/$ddir-$dver") {535 pb_list_bfiles("$ENV{'PBROOT '}/$pbpkg/$ddir-$dver",$pbpkg,\%bfiles,\%pkgfiles,$supfiles);533 if (-d "$ENV{'PBROOTDIR'}/$pbpkg/$dtype") { 534 pb_list_bfiles("$ENV{'PBROOTDIR'}/$pbpkg/$dtype",$pbpkg,\%bfiles,\%pkgfiles,$supfiles); 535 } elsif (-d "$ENV{'PBROOTDIR'}/$pbpkg/$dfam") { 536 pb_list_bfiles("$ENV{'PBROOTDIR'}/$pbpkg/$dfam",$pbpkg,\%bfiles,\%pkgfiles,$supfiles); 537 } elsif (-d "$ENV{'PBROOTDIR'}/$pbpkg/$ddir") { 538 pb_list_bfiles("$ENV{'PBROOTDIR'}/$pbpkg/$ddir",$pbpkg,\%bfiles,\%pkgfiles,$supfiles); 539 } elsif (-d "$ENV{'PBROOTDIR'}/$pbpkg/$ddir-$dver") { 540 pb_list_bfiles("$ENV{'PBROOTDIR'}/$pbpkg/$ddir-$dver",$pbpkg,\%bfiles,\%pkgfiles,$supfiles); 536 541 } else { 537 542 $build{"$ddir-$dver"} = "no"; … … 547 552 if (defined $ptr) { 548 553 foreach my $f (values %bfiles,values %pkgfiles) { 549 pb_filter_file_pb("$ENV{'PBROOT '}/$f",$ptr,"$dest/pbconf/$ddir-$dver/".basename($f),$dtype,$pbsuf,$ENV{'PBPROJ'},$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$defpkgdir,$extpkgdir,$pbpackager,$chglog);554 pb_filter_file_pb("$ENV{'PBROOTDIR'}/$f",$ptr,"$dest/pbconf/$ddir-$dver/".basename($f),$dtype,$pbsuf,$ENV{'PBPROJ'},$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$defpkgdir,$extpkgdir,$pbpackager,$chglog); 550 555 } 551 556 } … … 576 581 577 582 # Prepare the dest directory for archive 578 if (-x "$ENV{'PBROOT '}/$pbpkg/pbinit") {579 pb_filter_file("$ENV{'PBROOT '}/$pbpkg/pbinit",$ptr,"$ENV{'PBTMP'}/pbinit",$ENV{'PBPROJ'},$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$pbpackager);583 if (-x "$ENV{'PBROOTDIR'}/$pbpkg/pbinit") { 584 pb_filter_file("$ENV{'PBROOTDIR'}/$pbpkg/pbinit",$ptr,"$ENV{'PBTMP'}/pbinit",$ENV{'PBPROJ'},$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$pbpackager); 580 585 chmod 0755,"$ENV{'PBTMP'}/pbinit"; 581 pb_system("cd $dest ; $ENV{'PBTMP'}/pbinit","Executing init script from $ENV{'PBROOT '}/$pbpkg/pbinit");586 pb_system("cd $dest ; $ENV{'PBTMP'}/pbinit","Executing init script from $ENV{'PBROOTDIR'}/$pbpkg/pbinit"); 582 587 } 583 588 … … 590 595 # Keep track of what is generated by default 591 596 open(LAST,"> $ENV{'PBDESTDIR'}/pbrc") || die "Unable to create $ENV{'PBDESTDIR'}/pbrc"; 592 #print LAST "pbroot $pbprojver-$pbprojtag = $ENV{'PBROOT '}\n";597 #print LAST "pbroot $pbprojver-$pbprojtag = $ENV{'PBROOTDIR'}\n"; 593 598 # Why not use pbproj ? 594 print LAST "pbroot $ENV{'PBPROJ'} = $ENV{'PBROOT '}\n";599 print LAST "pbroot $ENV{'PBPROJ'} = $ENV{'PBROOTDIR'}\n"; 595 600 close(LAST); 596 601 … … 828 833 } 829 834 if (($cmt eq "vm") || ($cmt eq "ve")) { 830 $src="$src $ENV{'PBDESTDIR'}/pbscript $ENV{'PBROOT '}/$ENV{'PBPROJ'}.pb $ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb $ENV{'PBETC'}";835 $src="$src $ENV{'PBDESTDIR'}/pbscript $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb $ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb $ENV{'PBETC'}"; 831 836 } elsif ($cmt eq "Script") { 832 837 $src="$src $ENV{'PBDESTDIR'}/pbscript"; … … 1161 1166 1162 1167 die "-V Version parameter needed" if ((not defined $newver) || ($newver eq "")); 1163 my $scheme=pb_cms_init($ENV{'PBPROJ'}); 1164 if ($scheme ne "svn") { 1168 1169 my ($scheme,$uri)=pb_cms_init($pbinit); 1170 1171 if ($scheme !~ /^svn/) { 1165 1172 die "Only SVN is supported at the moment"; 1166 1173 } 1167 1174 my $res = pb_cms_isdiff($scheme); 1168 1175 die "You need to have no differences before creating a new version" if ($res != 0); 1169 my $cmsurl = pb_cms_get _uri($scheme,$ENV{'PBROOT'});1176 my $cmsurl = pb_cms_getinfo($scheme,$ENV{'PBROOTDIR'},"URL:"); 1170 1177 my $newurl = dirname($cmsurl)."/$newver"; 1171 1178 pb_cms_copy($scheme,$cmsurl,$newurl); 1172 pb_cms_checkout($scheme,$newurl,"$ENV{'PBROOT '}/../$newver");1179 pb_cms_checkout($scheme,$newurl,"$ENV{'PBROOTDIR'}/../$newver"); 1173 1180 my $oldver=basename($cmsurl); 1174 open(FILE,"$ENV{'PBROOT '}/../$newver/pbconf/$ENV{'PBPROJ'}.pb") || die "Unable to open $ENV{'PBROOT'}/../$newver/pbconf/$ENV{'PBPROJ'}.pb";1175 open(OUT,"> $ENV{'PBROOT '}/../$newver/pbconf/$ENV{'PBPROJ'}.pb.new") || die "Unable to write to $ENV{'PBROOT'}/../$newver/pbconf/$ENV{'PBPROJ'}.pb.new";1181 open(FILE,"$ENV{'PBROOTDIR'}/../$newver/pbconf/$ENV{'PBPROJ'}.pb") || die "Unable to open $ENV{'PBROOTDIR'}/../$newver/pbconf/$ENV{'PBPROJ'}.pb"; 1182 open(OUT,"> $ENV{'PBROOTDIR'}/../$newver/pbconf/$ENV{'PBPROJ'}.pb.new") || die "Unable to write to $ENV{'PBROOTDIR'}/../$newver/pbconf/$ENV{'PBPROJ'}.pb.new"; 1176 1183 while(<FILE>) { 1177 1184 s/projver\s+$ENV{'PBPROJ'}\s*=\s*$oldver/projver $ENV{'PBPROJ'} = $newver/; … … 1180 1187 close(FILE); 1181 1188 close(OUT); 1182 rename("$ENV{'PBROOT '}/../$newver/pbconf/$ENV{'PBPROJ'}.pb.new","$ENV{'PBROOT'}/../$newver/pbconf/$ENV{'PBPROJ'}.pb");1183 pb_cms_checkin($scheme,"$ENV{'PBROOT '}/../$newver");1189 rename("$ENV{'PBROOTDIR'}/../$newver/pbconf/$ENV{'PBPROJ'}.pb.new","$ENV{'PBROOTDIR'}/../$newver/pbconf/$ENV{'PBPROJ'}.pb"); 1190 pb_cms_checkin($scheme,"$ENV{'PBROOTDIR'}/../$newver"); 1184 1191 } 1185 1192 … … 1395 1402 next if ($f =~ /^\./); 1396 1403 $bfiles->{$f} = "$dir/$f"; 1397 $bfiles->{$f} =~ s~$ENV{'PBROOT '}~~;1404 $bfiles->{$f} =~ s~$ENV{'PBROOTDIR'}~~; 1398 1405 if (defined $supfiles->{$pbpkg}) { 1399 1406 $pkgfiles->{$f} = "$dir/$f" if ($f =~ /$supfiles->{$pbpkg}/); … … 1402 1409 closedir(BDIR); 1403 1410 } 1404 1405 1411 1406 1412 sub pb_syntax { … … 1418 1424 -output => $filehandle } ); 1419 1425 } 1420 1421
Note:
See TracChangeset
for help on using the changeset viewer.