Changeset 91 for devel/pb/bin/pb


Ignore:
Timestamp:
Sep 3, 2007, 6:50:38 PM (12 years ago)
Author:
bruno
Message:

Remove DISTROS from pbconf and use .pbrc instead
Adds pbvi and pbg

File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r90 r91  
    4444my $pbdate = strftime("%Y-%m-%d", @date);
    4545
    46 getopts('hl:p:qr:tv',\%opts);
     46getopts('hl:m:p:qr:tv',\%opts);
    4747
    4848my ($projectbuilderver,$projectbuilderrev) = pb_version_init();
     
    7777    $ENV{'PBROOT'} = $opts{'r'};
    7878}
     79# Handle virtual machines if any
     80if (defined $opts{'m'}) {
     81    $ENV{'PBVM'} = $opts{'m'};
     82}
    7983# Handles project name if any
    8084if (defined $opts{'p'}) {
     
    8791print $LOG "Action: $action\n" if ($debug >= 0);
    8892
    89 # Keeps those project value to store at end each time
     93# Keep those project values to store them at the end each time
    9094my $pbprojtag = $ENV{'PBTAG'};
    9195my $pbprojver = $ENV{'PBVER'};
     
    103107} elsif ($action =~ /^pkg2ssh$/) {
    104108    pb_pkg2ssh();
     109} elsif ($action =~ /^build2vm$/) {
     110    pb_build2vm();
     111} elsif ($action =~ /^cms2vm$/) {
     112    pb_cms2build();
     113    pb_build2vm();
    105114} else {
    106115    print $LOG "'$action' is not available\n";
     
    158167
    159168        my %build;
    160         open(D,"$ENV{'PBCONF'}/DISTROS") || die "Unable to find $ENV{'PBCONF'}/DISTROS\n";
    161         while (<D>) {
    162             my $d = $_;
    163             my ($ndir,$ver) = split(/_/,$d);
     169
     170        my ($ptr) = pb_conf_get("vmlist");
     171        foreach my $d (split(/,/,$ptr->{$ENV{'PBPROJ'}})) {
     172            my ($name,$ver) = split(/_/,$d);
    164173            chomp($ver);
    165             my ($ddir, $dver, $dfam, $dtype, $dsuf) = pb_distro_init($ndir,$ver);
     174            my ($ddir, $dver, $dfam, $dtype, $dsuf) = pb_distro_init($name,$ver);
    166175            print $LOG "DEBUG: distro tuple: ".Dumper($ddir, $dver, $dfam, $dtype, $dsuf)."\n" if ($debug >= 1);
    167176            print $LOG "DEBUG Filtering PBDATE => $pbdate, PBTAG => $pbtag, PBVER => $pbver\n" if ($debug >= 1);
     
    238247            print $LOG "No Build files found for ".join(',',@notfound)."\n";
    239248        }
    240         close(D);
    241249        # Prepare the dest directory for archive
    242250        if (-x "$ENV{'PBCONF'}/$pbpkg/pbinit") {
     
    374382                $src="$ENV{'PBBUILDDIR'}/RPMS/*/$pbpkg$pbver-$pbtag$dsuf.*.rpm $ENV{'PBBUILDDIR'}/SRPMS/$pbpkg$pbver-$pbtag$dsuf.src.rpm"
    375383            } elsif ($dtype eq "deb") {
    376                 $src="$ENV{'PBBUILDDIR'}/$pbpkg_*.deb $ENV{'PBBUILDDIR'}/$pbpkg_*.dsc $ENV{'PBBUILDDIR'}/$pbpkg_*.tag.gz"
     384                my $tmp = "$ENV{'PBBUILDDIR'}/$pbpkg";
     385                $src="$tmp"."_*.deb $tmp"."_*.dsc $tmp"."_*.tar.gz"
    377386            } elsif ($dtype eq "ebuild") {
    378387                $src="$ENV{'PBBUILDDIR'}/portage/*/$pbpkg/$pbpkg$pbver.ebuild"
     
    424433}
    425434
     435sub pb_get_vm {
     436
     437my @vm;
     438
     439# Get VM list
     440if (not defined $ENV{'PBVM'}) {
     441    @vm = keys %defpkgdir;
     442} elsif ($ENV{'PBVM'} =~ /^all$/) {
     443    @vm = keys %defpkgdir;
     444    if (defined %extpkgdir) {
     445        my $k = keys %extpkgdir;
     446        if (defined $k) {
     447            push(@vm, keys %extpkgdir);
     448        }
     449    }
     450} else {
     451    @vm = $ENV{'PBVM'};
     452}
     453print $LOG "VMs: ".join(',',@vm)."\n" if ($debug >= 0);
     454return(\@vm);
     455}
     456
    426457sub pb_extract_build_files {
    427458
     
    449480    print "pb (aka project-builder) Version $projectbuilderver-$projectbuilderrev\n";
    450481    print "\n";
    451     print "Syntax: pb [-vhqt][-r pbroot][-p project] <action> [<params>...]\n";
     482    print "Syntax: pb [-vhqt][-r pbroot][-p project][-m \"mach-1...\"] <action> [<pkg1>...]\n";
    452483    print "\n";
    453484    print "-h : This help file\n";
     
    456487    print "-v : Verbose mode\n";
    457488    print "\n";
     489    print "-m machine : Name of the virtual Machines you want\n";
     490    print "             to build on (space separated)        \n";
     491    print "             (or use the env variable PBVM)       \n";
     492    print "\n";
     493    print "-p project : Name of the project you're working on\n";
     494    print "             (or use the env variable PBPROJ)     \n";
     495    print "\n";
    458496    print "-r pbroot  : Path Name of project under the CMS \n";
    459497    print "             (or use the env variable PBROOT)   \n";
    460     print "\n";
    461     print "-p project : Name of the project you're working on\n";
    462     print "             (or use the env variable PBPROJ)     \n";
    463498    print "\n";
    464499    print "<action> can be:\n";
Note: See TracChangeset for help on using the changeset viewer.