Changeset 340


Ignore:
Timestamp:
Mar 29, 2008, 6:24:36 PM (11 years ago)
Author:
bruno
Message:

Version allowing build of pb and mondorescue. Target for 0.9.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r337 r340  
    4848my @date = pb_get_date();
    4949my $pbdate = strftime("%Y-%m-%d", @date);
    50 
    51 # ---------------------------------------------------------------------------
    5250
    5351=pod
     
    294292# Old syntax
    295293#getopts('a:fhi:l:m:P:p:qr:s:vV:',\%opts);
     294getopts('a:fhi:l:m:P:p:qr:s:tvV:',\%opts);
    296295
    297296my ($projectbuilderver,$projectbuilderrev) = pb_version_init();
     
    338337# Handle root of the project if defined
    339338if (defined $opts{'r'}) {
    340     $ENV{'PBROOT'} = $opts{'r'};
     339    $ENV{'PBROOTDIR'} = $opts{'r'};
    341340}
    342341# Handle virtual machines if any
     
    439438    my ($scheme, $account, $host, $port, $path) = pb_get_uri($uri->{$ENV{'PBPROJ'}});
    440439
    441     #
    442     # Check project cms compliance
    443     #
    444     pb_cms_compliant("pbdir",'PBDIR',"$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}",$uri->{$ENV{'PBPROJ'}},$pbinit);
    445 
    446440    # Some variable initialization depending on CMS type
    447     pb_cms_init($scheme);
     441    my ($scheme,$uri)=pb_cms_init($pbinit);
    448442
    449443    my ($pkgv, $pkgt) = pb_conf_get_if("pkgver","pkgtag");
     
    487481        pb_log(2,"def:".Dumper($defpkgdir)." ext: ".Dumper($extpkgdir)." \n");
    488482
    489         # If it isn't a flat CMS, then we have the choice to export subdir
    490         pb_cms_export($uri->{$ENV{'PBPROJ'}},"$ENV{'PBDIR'}/$pbprojver/$dir",$dest);
     483        # Exporting from CMS
     484        pb_cms_export($uri,"$ENV{'PBDIR'}/$dir",$dest);
    491485
    492486        # 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);
    495489        $chglog = undef if (! -f $chglog);
    496490
    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);
    499493        $authors = "/dev/null" if (! -f $authors);
    500494
     
    504498            copy($chglog,"$dest/NEWS") || die "Unable to create $dest/NEWS";
    505499        }
    506         pb_cms_log($scheme,"$ENV{'PBDIR'}/$pbprojver/$dir",$dest,$chglog,$authors);
     500        pb_cms_log($scheme,"$ENV{'PBDIR'}/$dir",$dest,$chglog,$authors);
    507501
    508502        my %build;
     
    510504        my @pt;
    511505        @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)) {
    513518            my ($name,$ver,$arch) = split(/-/,$d);
    514519            chomp($arch);
     
    520525            # Filter all files found, keeping the name, and generating in dest
    521526
    522             # Find all build files first relatively to PBROOT
     527            # Find all build files first relatively to PBROOTDIR
    523528            # Find also all specific files referenced in the .pb conf file
    524529            my %bfiles = ();
     
    526531            $build{"$ddir-$dver"} = "yes";
    527532
    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);
    536541            } else {
    537542                $build{"$ddir-$dver"} = "no";
     
    547552            if (defined $ptr) {
    548553                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);
    550555                }
    551556            }
     
    576581
    577582        # 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);
    580585            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");
    582587        }
    583588
     
    590595        # Keep track of what is generated by default
    591596        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";
    593598        # Why not use pbproj ?
    594         print LAST "pbroot $ENV{'PBPROJ'} = $ENV{'PBROOT'}\n";
     599        print LAST "pbroot $ENV{'PBPROJ'} = $ENV{'PBROOTDIR'}\n";
    595600        close(LAST);
    596601
     
    828833    }
    829834    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'}";
    831836    } elsif ($cmt eq "Script") {
    832837        $src="$src $ENV{'PBDESTDIR'}/pbscript";
     
    11611166
    11621167    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/) {
    11651172        die "Only SVN is supported at the moment";
    11661173    }
    11671174    my $res = pb_cms_isdiff($scheme);
    11681175    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:");
    11701177    my $newurl = dirname($cmsurl)."/$newver";
    11711178    pb_cms_copy($scheme,$cmsurl,$newurl);
    1172     pb_cms_checkout($scheme,$newurl,"$ENV{'PBROOT'}/../$newver");
     1179    pb_cms_checkout($scheme,$newurl,"$ENV{'PBROOTDIR'}/../$newver");
    11731180    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";
    11761183    while(<FILE>) {
    11771184        s/projver\s+$ENV{'PBPROJ'}\s*=\s*$oldver/projver $ENV{'PBPROJ'} = $newver/;
     
    11801187    close(FILE);
    11811188    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");
    11841191}
    11851192
     
    13951402    next if ($f =~ /^\./);
    13961403    $bfiles->{$f} = "$dir/$f";
    1397     $bfiles->{$f} =~ s~$ENV{'PBROOT'}~~;
     1404    $bfiles->{$f} =~ s~$ENV{'PBROOTDIR'}~~;
    13981405    if (defined $supfiles->{$pbpkg}) {
    13991406        $pkgfiles->{$f} = "$dir/$f" if ($f =~ /$supfiles->{$pbpkg}/);
     
    14021409closedir(BDIR);
    14031410}
    1404 
    14051411
    14061412sub pb_syntax {
     
    14181424             -output  => $filehandle } );
    14191425}
    1420 
    1421 
Note: See TracChangeset for help on using the changeset viewer.