Changeset 106 in ProjectBuilder for devel/pb/lib
- Timestamp:
- Sep 5, 2007, 1:21:18 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb/lib/ProjectBuilder/Base.pm
r105 r106 98 98 %filteredfiles = (); 99 99 %filteredfiles = %$filteredfiles if (defined $filteredfiles); 100 # 101 # Get global Version/Tag 102 # 103 104 if (not defined $ENV{'PBVER'}) { 105 if ((defined $pkgv) && (defined $pkgv->{$proj})) { 106 $ENV{'PBVER'}=$pkgv->{$proj}; 107 } else { 108 die "No projver found in $ENV{'PBCONF'}/$proj.pb"; 109 } 110 } 111 die "Invalid version name $ENV{'PBVER'} in $ENV{'PBCONF'}/$proj.pb" if (($ENV{'PBVER'} !~ /[0-9.]+/) && (not exists $version{$ENV{'PBVER'}})); 112 113 if (not defined $ENV{'PBTAG'}) { 114 if ((defined $pkgt) && (defined $pkgt->{$proj})) { 115 $ENV{'PBTAG'}=$pkgt->{$proj}; 116 } else { 117 die "No projtag found in $ENV{'PBCONF'}/$proj.pb"; 118 } 119 } 120 die "Invalid tag name $ENV{'PBTAG'} in $ENV{'PBCONF'}/$proj.pb" if ($ENV{'PBTAG'} !~ /[0-9.]+/); 100 121 } else { 101 122 die "Unable to open $ENV{'PBCONF'}/$proj.pb"; 102 123 } 103 104 #105 # Get global Version/Tag106 #107 108 if (not defined $ENV{'PBVER'}) {109 if ((defined $pkgv) && (defined $pkgv->{$proj})) {110 $ENV{'PBVER'}=$pkgv->{$proj};111 } else {112 die "No projver found in $ENV{'PBCONF'}/$proj.pb";113 }114 }115 die "Invalid version name $ENV{'PBVER'} in $ENV{'PBCONF'}/$proj.pb" if (($ENV{'PBVER'} !~ /[0-9.]+/) && (not exists $version{$ENV{'PBVER'}}));116 117 if (not defined $ENV{'PBTAG'}) {118 if ((defined $pkgt) && (defined $pkgt->{$proj})) {119 $ENV{'PBTAG'}=$pkgt->{$proj};120 } else {121 die "No projtag found in $ENV{'PBCONF'}/$proj.pb";122 }123 }124 die "Invalid tag name $ENV{'PBTAG'} in $ENV{'PBCONF'}/$proj.pb" if ($ENV{'PBTAG'} !~ /[0-9.]+/);125 124 126 125 # … … 183 182 184 183 print $LOG "$cmt... "; 185 system("$cmd ");184 system("$cmd 2>&1 > $ENV{'PBTMP'}/system.log"); 186 185 if ($? == -1) { 187 print $LOG "failed to execute: $!\n" if ($debug >= 0); 186 print $LOG "failed to execute ($cmd) : $!\n" if ($debug >= 0); 187 pb_display_file("$ENV{'PBTMP'}/system.log"); 188 188 } elsif ($? & 127) { 189 printf $LOG "child died with signal %d, %s coredump\n", ($? & 127), ($? & 128) ? 'with' : 'without' if ($debug >= 0); 190 } else { 189 printf $LOG "child ($cmd) died with signal %d, %s coredump\n", ($? & 127), ($? & 128) ? 'with' : 'without' if ($debug >= 0); 190 pb_display_file("$ENV{'PBTMP'}/system.log"); 191 } elsif ($? == 0) { 191 192 print $LOG "OK\n" if ($debug >= 0); 192 } 193 } else { 194 printf "child ($cmd) exited with value %d\n", $? >> 8; 195 pb_display_file("$ENV{'PBTMP'}/system.log"); 196 } 197 } 198 199 sub pb_display_file { 200 201 my $file=shift; 202 203 open(FILE,"$file") || die "Unable to open $file"; 204 while (<FILE>) { 205 print $LOG; 206 } 207 close(FILE); 193 208 } 194 209 … … 260 275 $ENV{'PBCMSLOG'}="svn log"; 261 276 $ENV{'PBCMSLOGFILE'}="svn.log"; 262 $ENV{'PBCMSEXP'}="svn export";263 277 } elsif ($cms->{$proj} eq "cvs") { 264 $ENV{'PBREVISION'}=`(cd "$ENV{'PBROOT'}" ; cvs rannotate -f . 2>&1 | awk '{print \$1}' | grep -E '^[0-9]' | cut -d. -f2 |sort -nu | tail -1)`; 265 chomp($ENV{'PBREVISION'}); 278 # Way too slow 279 #$ENV{'PBREVISION'}=`(cd "$ENV{'PBROOT'}" ; cvs rannotate -f . 2>&1 | awk '{print \$1}' | grep -E '^[0-9]' | cut -d. -f2 |sort -nu | tail -1)`; 280 #chomp($ENV{'PBREVISION'}); 281 $ENV{'PBREVISION'}="CVS"; 266 282 $ENV{'PBCMSLOG'}="cvs log"; 267 283 $ENV{'PBCMSLOGFILE'}="cvs.log"; 268 $ENV{'PBCMSEXP'}="cvs export";269 284 # 270 285 # Export content if needed … … 274 289 die "cms $cms->{$proj} unknown"; 275 290 } 276 } 291 return($cms); 292 } 293 294 sub pb_cms_export { 295 my $cms = shift; 296 my $pbdate = shift || undef; 297 my $pkgdir = shift; 298 my $destdir = shift; 299 300 if ($cms->{$ENV{'PBPROJ'}} eq "svn") { 301 pb_system("svn export $pkgdir $destdir","Exporting $pkgdir from SVN"); 302 } elsif ($cms->{$ENV{'PBPROJ'}} eq "cvs") { 303 my $dir=dirname($destdir); 304 my $base=basename($destdir); 305 my $tmp=basename($pkgdir); 306 # CVS needs a relative path ! 307 pb_system("cd $dir ; cvs export -D $pbdate -d $base $tmp","Exporting $pkgdir from CVS"); 308 } else { 309 die "cms $cms->{$ENV{'PBPROJ'}} unknown"; 310 } 311 } 312 313 sub pb_cms_log { 314 my $cms = shift; 315 my $pkgdir = shift; 316 my $destfile = shift; 317 318 if ($cms->{$ENV{'PBPROJ'}} eq "svn") { 319 pb_system("svn log $pkgdir > $destfile","Extracting log info from SVN"); 320 } elsif ($cms->{$ENV{'PBPROJ'}} eq "cvs") { 321 my $tmp=basename($pkgdir); 322 # CVS needs a relative path ! 323 pb_system("cvs log $tmp > $destfile","Extracting log info from CVS"); 324 } else { 325 die "cms $cms->{$ENV{'PBPROJ'}} unknown"; 326 } 327 } 328 329 277 330 278 331 # Get all filters to apply
Note:
See TracChangeset
for help on using the changeset viewer.