- Timestamp:
- Feb 10, 2008, 2:36:32 PM (16 years ago)
- Location:
- devel/pb
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb/bin/pb
r315 r316 23 23 use ProjectBuilder::Distribution qw (pb_distro_init); 24 24 use ProjectBuilder::Version qw (pb_version_init); 25 use ProjectBuilder::Base qw (pb_conf_read pb_conf_get pb_cms_init pb_mkdir_p pb_system pb_rm_rf pb_get_filters pb_filter_file pb_filter_file_pb pb_filter_file_inplace pb_cms_export pb_cms_log pb_cms_isdiff pb_cms_copy pb_cms_checkout pb_get_date pb_log pb_log_init );25 use ProjectBuilder::Base qw (pb_conf_read pb_conf_get pb_cms_init pb_mkdir_p pb_system pb_rm_rf pb_get_filters pb_filter_file pb_filter_file_pb pb_filter_file_inplace pb_cms_export pb_cms_log pb_cms_isdiff pb_cms_copy pb_cms_checkout pb_get_date pb_log pb_log_init pb_get_pkg); 26 26 27 27 my %opts; # CLI Options … … 857 857 } 858 858 859 #860 # Return the list of packages we are working on861 #862 sub pb_get_pkg {863 864 my @pkgs;865 my $defpkgdir = shift;866 my $extpkgdir = shift;867 868 # Get packages list869 if (not defined $ARGV[0]) {870 @pkgs = keys %$defpkgdir;871 } elsif ($ARGV[0] =~ /^all$/) {872 @pkgs = keys %$defpkgdir;873 push(@pkgs, keys %$extpkgdir);874 } else {875 @pkgs = @ARGV;876 }877 pb_log(2,"Packages: ".join(',',@pkgs)."\n");878 return(\@pkgs);879 }880 881 859 # 882 860 # Return the list of VMs we are working on -
devel/pb/lib/ProjectBuilder/Base.pm
r315 r316 52 52 $proj = (keys %pbconf)[0]; 53 53 if (defined $proj) { 54 pb_log( 2,"WARNING: using $proj as default project as none has been specified\n");55 pb_log( 2,"Please create a pbconf reference for project $proj in $ENV{'PBETC'}\nif you want to use another project\n");54 pb_log(0,"WARNING: using $proj as default project as none has been specified\n"); 55 pb_log(0,"Please create a pbconf reference for project $proj in $ENV{'PBETC'}\nif you want to use another project\n"); 56 56 } 57 57 } … … 101 101 102 102 if (not defined $ENV{'PBDIR'}) { 103 if (not defined ($pbdir{$ENV{'PBPROJ'}})) { 104 pb_log(2,"WARNING: no pbdir defined, using /var/cache\n"); 105 pb_log(2,"Please create a pbdir reference for project $ENV{'PBPROJ'} in $ENV{'PBETC'}\nif you want to use another directory\n"); 106 } 107 # That's always the environment variable that will be used 108 $ENV{'PBDIR'} = $pbdir{$ENV{'PBPROJ'}}; 103 if ((not defined $pbdir) || (not defined $pbdir{$ENV{'PBPROJ'}})) { 104 pb_log(0,"WARNING: no pbdir defined, using /var/cache\n"); 105 pb_log(0,"Please create a pbdir reference for project $ENV{'PBPROJ'} in $ENV{'PBETC'}\nif you want to use another directory\n"); 106 $ENV{'PBDIR'} = "/var/cache"; 107 } else { 108 # That's always the environment variable that will be used 109 $ENV{'PBDIR'} = $pbdir{$ENV{'PBPROJ'}}; 110 } 109 111 } 110 112 # Expand potential env variable in it … … 160 162 161 163 if ((not -d "$ENV{'PBCONF'}") || (defined $pbinit)) { 164 pb_log(1,"Checking out pbconf\n"); 162 165 pb_cms_checkout($scheme,$pbconf{$ENV{'PBPROJ'}},$ENV{'PBCONF'}); 163 166 } else { 167 pb_log(1,"pbconf found, checking content\n"); 164 168 my $cmsurl = pb_cms_getinfo($scheme,$ENV{'PBCONF'},"URL:"); 165 169 if ($cmsurl !~ /^$scheme/) { 170 pb_log(1,"Content irrelevant, cleaning up and checking it out\n"); 166 171 pb_rm_rf("$ENV{'PBCONF'}"); 167 172 pb_cms_checkout($scheme,$pbconf{$ENV{'PBPROJ'}},$ENV{'PBCONF'}); 168 173 } elsif ($cmsurl ne $pbconf{$ENV{'PBPROJ'}}) { 169 174 # The local content doesn't correpond to the repository 170 pb_log( 2,"ERROR: Inconsistency detected:\n");171 pb_log( 2,"* $ENV{'PBCONF'} refers to $cmsurl but\n");172 pb_log( 2,"* $ENV{'PBETC'} refers to $pbconf{$ENV{'PBPROJ'}}\n");175 pb_log(0,"ERROR: Inconsistency detected:\n"); 176 pb_log(0,"* $ENV{'PBCONF'} refers to $cmsurl but\n"); 177 pb_log(0,"* $ENV{'PBETC'} refers to $pbconf{$ENV{'PBPROJ'}}\n"); 173 178 die "Project $ENV{'PBPROJ'} is not Project-Builder compliant."; 174 179 } else { 180 pb_log(1,"Content correct - doing nothing - you may want to update your repository however\n"); 175 181 # they match - do nothing - there may be local changes 176 182 } … … 194 200 } 195 201 closedir(DIR); 196 pb_log(2,"WARNING: no pbroot defined, using $ENV{'PBROOT'}\n"); 197 pb_log(2,"Please -r release if you want to use another release\n"); 202 die "No directory found under $ENV{'PBCONF'}" if (not defined $ENV{'PBROOT'}); 203 pb_log(0,"WARNING: no pbroot defined, using $ENV{'PBROOT'}\n"); 204 pb_log(0,"Please use -r release if you want to use another release\n"); 198 205 } else { 199 206 my ($pbroot) = pb_conf_read_if("$ENV{'PBDESTDIR'}/pbrc","pbroot"); 200 207 # That's always the environment variable that will be used 208 die "Please remove inconsistent $ENV{'PBDESTDIR'}/pbrc" if ((not defined $pbroot) || (not defined $pbroot->{$ENV{'PBPROJ'}})); 201 209 $ENV{'PBROOT'} = $pbroot->{$ENV{'PBPROJ'}}; 202 210 } 203 211 } else { 204 212 # transform in full path if relative 205 $ENV{'PBROOT'} = "$ENV{'PBCONF'}/$ENV{'PBROOT'}" if ($ENV{'PBROOT'} !~ /\//); 213 $ENV{'PBROOT'} = "$ENV{'PBCONF'}/$ENV{'PBROOT'}" if ($ENV{'PBROOT'} !~ /^\//); 214 die "$ENV{'PBROOT'} is not a directory" if (not -d $ENV{'PBROOT'}); 206 215 } 207 216 … … 253 262 } else { 254 263 if (defined $pbinit) { 264 my $ptr = pb_get_pkg(); 265 @pkgs = @$ptr; 266 @pkgs = ("pkg1") if (not @pkgs); 267 255 268 open(CONF,"> $ENV{'PBROOT'}/$ENV{'PBPROJ'}.pb") || die "Unable to create $ENV{'PBROOT'}/$ENV{'PBPROJ'}.pb"; 256 269 print CONF << "EOF"; … … 263 276 264 277 # 265 # Which CMS system is used (Subversion, CVS or tar file content extracted) 266 # 267 #cms $ENV{'PBPROJ'} = svn 268 #cms $ENV{'PBPROJ'} = cvs 269 #cms $ENV{'PBPROJ'} = flat 278 # What is the project URL 279 # 280 #pbproj $ENV{'PBPROJ'} = svn://svn.$ENV{'PBPROJ'}.org/$ENV{'PBPROJ'}/devel 281 #pbproj $ENV{'PBPROJ'} = svn://svn+ssh.$ENV{'PBPROJ'}.org/$ENV{'PBPROJ'}/devel 282 #pbproj $ENV{'PBPROJ'} = cvs://cvs.$ENV{'PBPROJ'}.org/$ENV{'PBPROJ'}/devel 283 #pbproj $ENV{'PBPROJ'} = http://www.$ENV{'PBPROJ'}.org/src/$ENV{'PBPROJ'}-devel.tar.gz 284 #pbproj $ENV{'PBPROJ'} = ftp://ftp.$ENV{'PBPROJ'}.org/src/$ENV{'PBPROJ'}-devel.tar.gz 285 #pbproj $ENV{'PBPROJ'} = file:///src/$ENV{'PBPROJ'}-devel.tar.gz 270 286 271 287 # … … 319 335 #projtag $ENV{'PBPROJ'} = 1 320 336 337 # Hash of valid version names 338 #version $ENV{'PBPROJ'} = devel,stable 339 321 340 # Adapt to your needs: 322 341 # Optional if you need to overwrite the global values above 323 342 # 324 #pkgver pkg1 = stable 325 #pkgtag pkg1 = 3 326 #pkgver nil 327 #pkgtag nil 328 343 EOF 344 345 foreach my $pp (@pkgs) { 346 print CONF << "EOF"; 347 #pkgver $pp = stable 348 #pkgtag $pp = 3 349 EOF 350 } 351 foreach my $pp (@pkgs) { 352 print CONF << "EOF"; 329 353 # Hash of default package/package directory 330 354 #defpkgdir pkg1 = pkg1dir 331 355 EOF 356 } 357 358 print CONF << "EOF"; 332 359 # Hash of additional package/package directory 333 #extpkgdir pkg1-doc = pkg1-docdir 334 335 # Hash of valid version names 336 #version devel 337 #version stable 360 #extpkgdir minor-pkg = minor-pkg-dir 338 361 339 362 # List of files per pkg on which to apply filters 340 363 # Files are mentioned relatively to pbroot/defpkgdir 341 #filteredfiles pkg1 = Makefile.PL 342 #filteredfiles pkg1-doc = configure.in 343 #supfiles pkg1 = pkg1.init 344 EOF 364 EOF 365 foreach my $pp (@pkgs) { 366 print CONF << "EOF"; 367 #filteredfiles $pp = Makefile.PL,configure.in,install.sh,$pp.8 368 #supfiles $pp = $pp.init 369 EOF 370 } 345 371 close(CONF); 346 372 pb_mkdir_p("$ENV{'PBROOT'}/pbfilter") || die "Unable to create $ENV{'PBROOT'}/pbfilter"; … … 395 421 #filter PBGRP = Applications/Archiving 396 422 423 # PBLIC is replaced by the license of the application 424 # Cf: http://fedoraproject.org/wiki/Licensing 425 #filter PBLIC = GPL 426 397 427 # PBDEP is replaced by the list of dependencies 398 428 #filter PBDEP = … … 415 445 # PBGRP is replaced by the group of apps 416 446 #filter PBGRP = utils 447 448 # PBLIC is replaced by the license of the application 449 # Cf: 450 #filter PBLIC = GPL 417 451 418 452 # PBVER is replaced by the version (\$pbver in code) … … 442 476 print CONF << "EOF"; 443 477 # Specific group for Mandriva for $ENV{'PBPROJ'} 478 # Cf: http://wiki.mandriva.com/en/Development/Packaging/Groups 444 479 filter PBGRP = Archiving/Backup 480 481 # PBLIC is replaced by the license of the application 482 # Cf: http://wiki.mandriva.com/en/Development/Packaging/Licenses 483 #filter PBLIC = GPL 484 445 485 EOF 446 486 close(CONF); … … 448 488 print CONF << "EOF"; 449 489 # Specific group for SuSE for $ENV{'PBPROJ'} 490 # Cf: http://en.opensuse.org/SUSE_Package_Conventions/RPM_Groups 450 491 filter PBGRP = Productivity/Archiving/Backup 492 493 # PBLIC is replaced by the license of the application 494 # Cf: http://en.opensuse.org/Packaging/SUSE_Package_Conventions/RPM_Style#1.6._License_Tag 495 #filter PBLIC = GPL 496 451 497 EOF 452 498 close(CONF); 453 pb_mkdir_p("$ENV{'PBROOT'}/pkg1/deb") || die "Unable to create $ENV{'PBROOT'}/pkg1/deb"; 454 open(CONF,"> $ENV{'PBROOT'}/pkg1/deb/control") || die "Unable to create $ENV{'PBROOT'}/pkg1/deb/control"; 455 print CONF << "EOF"; 499 foreach my $pp (@pkgs) { 500 pb_mkdir_p("$ENV{'PBROOT'}/$pp/deb") || die "Unable to create $ENV{'PBROOT'}/$pp/deb"; 501 open(CONF,"> $ENV{'PBROOT'}/$pp/deb/control") || die "Unable to create $ENV{'PBROOT'}/$pp/deb/control"; 502 print CONF << "EOF"; 456 503 Source: PBPKG 457 504 Section: PBGRP … … 474 521 475 522 EOF 476 close(CONF);477 open(CONF,"> $ENV{'PBROOT'}/pkg1/deb/copyright") || die "Unable to create $ENV{'PBROOT'}/pkg1/deb/copyright";478 print CONF << "EOF";523 close(CONF); 524 open(CONF,"> $ENV{'PBROOT'}/$pp/deb/copyright") || die "Unable to create $ENV{'PBROOT'}/$pp/deb/copyright"; 525 print CONF << "EOF"; 479 526 This package is debianized by PBPACKAGER 480 527 `date` … … 505 552 506 553 EOF 507 close(CONF);508 open(CONF,"> $ENV{'PBROOT'}/pkg1/deb/changelog") || die "Unable to create $ENV{'PBROOT'}/pkg1/deb/changelog";509 print CONF << "EOF";554 close(CONF); 555 open(CONF,"> $ENV{'PBROOT'}/$pp/deb/changelog") || die "Unable to create $ENV{'PBROOT'}/$pp/deb/changelog"; 556 print CONF << "EOF"; 510 557 PBLOG 511 558 EOF 512 close(CONF);513 open(CONF,"> $ENV{'PBROOT'}/pkg1/deb/compat") || die "Unable to create $ENV{'PBROOT'}/pkg1/deb/compat";514 print CONF << "EOF";559 close(CONF); 560 open(CONF,"> $ENV{'PBROOT'}/$pp/deb/compat") || die "Unable to create $ENV{'PBROOT'}/$pp/deb/compat"; 561 print CONF << "EOF"; 515 562 4 516 563 EOF 517 close(CONF);518 open(CONF,"> $ENV{'PBROOT'}/pkg1/deb/pkg1.dirs") || die "Unable to create $ENV{'PBROOT'}/pkg1/deb/pkg1.dirs";519 print CONF << "EOF";520 EOF 521 close(CONF);522 open(CONF,"> $ENV{'PBROOT'}/pkg1/deb/pkg1.docs") || die "Unable to create $ENV{'PBROOT'}/pkg1/deb/pkg1.docs";523 print CONF << "EOF";564 close(CONF); 565 open(CONF,"> $ENV{'PBROOT'}/$pp/deb/pkg1.dirs") || die "Unable to create $ENV{'PBROOT'}/$pp/deb/$pp.dirs"; 566 print CONF << "EOF"; 567 EOF 568 close(CONF); 569 open(CONF,"> $ENV{'PBROOT'}/$pp/deb/$pp.docs") || die "Unable to create $ENV{'PBROOT'}/$pp/deb/$pp.docs"; 570 print CONF << "EOF"; 524 571 INSTALL 525 572 COPYING … … 528 575 README 529 576 EOF 530 close(CONF);531 open(CONF,"> $ENV{'PBROOT'}/pkg1/deb/rules") || die "Unable to create $ENV{'PBROOT'}/pkg1/deb/rules";532 print CONF << 'EOF';577 close(CONF); 578 open(CONF,"> $ENV{'PBROOT'}/$pp/deb/rules") || die "Unable to create $ENV{'PBROOT'}/$pp/deb/rules"; 579 print CONF << 'EOF'; 533 580 #!/usr/bin/make -f 534 581 # -*- makefile -*- … … 665 712 666 713 EOF 667 close(CONF);668 pb_mkdir_p("$ENV{'PBROOT'}/pkg1/rpm") || die "Unable to create $ENV{'PBROOT'}/pkg1/rpm";669 open(CONF,"> $ENV{'PBROOT'}/pkg1/rpm/pkg1.spec") || die "Unable to create $ENV{'PBROOT'}/pkg1/rpm/pkg1.spec";670 print CONF << 'EOF';714 close(CONF); 715 pb_mkdir_p("$ENV{'PBROOT'}/$pp/rpm") || die "Unable to create $ENV{'PBROOT'}/$pp/rpm"; 716 open(CONF,"> $ENV{'PBROOT'}/$pp/rpm/$pp.spec") || die "Unable to create $ENV{'PBROOT'}/$pp/rpm/$pp.spec"; 717 print CONF << 'EOF'; 671 718 # 672 719 # $Id$ … … 679 726 Version: PBVER 680 727 Release: PBTAGPBSUF 681 License: GPL728 License: PBLIC 682 729 Group: PBGRP 683 730 Url: PBURL … … 715 762 716 763 EOF 717 close(CONF);718 pb_mkdir_p("$ENV{'PBROOT'}/pkg1/pbfilter") || die "Unable to create $ENV{'PBROOT'}/pkg1/pbfilter";719 720 pb_log(2,"\nDo not to forget to commit the pbconf directory in your CMS if needed\n");721 pb_log(2,"After having renamed the pkg1 directory to your package's name \n\n");764 close(CONF); 765 pb_mkdir_p("$ENV{'PBROOT'}/$pp/pbfilter") || die "Unable to create $ENV{'PBROOT'}/$pp/pbfilter"; 766 767 pb_log(0,"\nDo not to forget to commit the pbconf directory in your CMS if needed\n"); 768 } 722 769 } else { 723 770 die "Unable to open $ENV{'PBROOT'}/$ENV{'PBPROJ'}.pb"; … … 1331 1378 my $msg = shift; 1332 1379 1333 print $LOG "$msg\n" if ($dlevel >= $debug); 1380 print $LOG "$msg\n" if ($dlevel <= $debug); 1381 } 1382 1383 # 1384 # Return the list of packages we are working on 1385 # 1386 sub pb_get_pkg { 1387 1388 my @pkgs = (); 1389 my $defpkgdir = shift || undef; 1390 my $extpkgdir = shift || undef; 1391 1392 # Get packages list 1393 if (not defined $ARGV[0]) { 1394 @pkgs = keys %$defpkgdir if (defined $defpkgdir); 1395 } elsif ($ARGV[0] =~ /^all$/) { 1396 @pkgs = keys %$defpkgdir if (defined $defpkgdir; 1397 push(@pkgs, keys %$extpkgdir) if (defined $extpkgdir); 1398 } else { 1399 @pkgs = @ARGV; 1400 } 1401 pb_log(0,"Packages: ".join(',',@pkgs)."\n"); 1402 return(\@pkgs); 1334 1403 } 1335 1404
Note:
See TracChangeset
for help on using the changeset viewer.