Changeset 1381


Ignore:
Timestamp:
Dec 23, 2011, 3:50:34 AM (8 years ago)
Author:
bruno
Message:
  • Fix #93 by recoding newver partly and remove the fixed loading of a pb profile in KVM and put it in option
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r1374 r1381  
    22792279            # Always redirect the network and always try to use a 'pb' snapshot
    22802280            #$cmd = "$vmcmd $ENV{'PBVMOPT'} -net user,hostfwd=tcp:$nport:10.0.2.15:22 -loadvm pb $vmm"
    2281             $cmd = "$vmcmd $ENV{'PBVMOPT'} -redir tcp:$nport:10.0.2.15:22 -loadvm pb $vmm"
     2281            $cmd = "$vmcmd $ENV{'PBVMOPT'} -redir tcp:$nport:10.0.2.15:22 $vmm"
    22822282        } elsif ($vmtype eq "xen") {
    22832283        } elsif ($vmtype eq "vmware") {
     
    25622562    # we want to get for the root of the new URL
    25632563
    2564     my $tmp = $ENV{'PBROOTDIR'};
    2565     $tmp =~ s|^$ENV{'PBCONFDIR'}||;
    2566 
    2567     my $newurl = "$uri/".dirname($tmp)."/$newver";
     2564    my $oldver = $ENV{'PBROOTDIR'};
     2565    $oldver =~ s|^$ENV{'PBCONFDIR'}||;
     2566
     2567    pb_log(2, "PBCONFDIR: $ENV{'PBCONFDIR'}\nPBROOTDIR: $ENV{'PBROOTDIR'}\n");
     2568
     2569    my $newurl = "$uri/$newver";
    25682570    # Should probably use projver in the old file
    2569     my $oldver= basename($tmp);
     2571    my $oldvertxt= basename($oldver);
     2572    my $newvertxt = basename($newver);
    25702573
    25712574    # Duplicate and extract project-builder part
    2572     pb_log(2,"Copying $uri/$tmp to $newurl\n");
    2573     pb_cms_copy($scheme,"$uri/$tmp",$newurl);
    2574     pb_log(2,"Checkout $newurl to $ENV{'PBROOTDIR'}/../$newver\n");
    2575     pb_cms_up($scheme,"$ENV{'PBCONFDIR'}/..");
     2575    pb_log(2,"Copying $uri/$oldver to $newurl\n");
     2576    pb_cms_copy($scheme,"$uri/$oldver",$newurl);
     2577    pb_log(2,"Checkout $newurl to $ENV{'PBCONFDIR'}/$newver\n");
     2578    pb_cms_up($scheme,"$ENV{'PBCONFDIR'}");
    25762579
    25772580    # Duplicate and extract project
    2578     my $newurl2 = "$pburl->{$ENV{'PBPROJ'}}/".dirname($tmp)."/$newver";
    2579 
    2580     pb_log(2,"Copying $pburl->{$ENV{'PBPROJ'}}/$tmp to $newurl2\n");
    2581     pb_cms_copy($scheme2,"$pburl->{$ENV{'PBPROJ'}}/$tmp",$newurl2);
    2582     pb_log(2,"Checkout $newurl2 to $ENV{'PBDIR'}/../$newver\n");
    2583     pb_cms_up($scheme2,"$ENV{'PBDIR'}/..");
     2581    my $newurl2 = "$pburl->{$ENV{'PBPROJ'}}/$newver";
     2582
     2583    pb_log(2,"Copying $pburl->{$ENV{'PBPROJ'}}/$oldver to $newurl2\n");
     2584    pb_cms_copy($scheme2,"$pburl->{$ENV{'PBPROJ'}}/$oldver",$newurl2);
     2585
     2586    my $tmp = $ENV{'PBDIR'};
     2587    $tmp =~ s|$oldver$||;
     2588    pb_log(2,"Checkout $newurl2 to $tmp/$newver\n");
     2589    pb_cms_up($scheme2,"$tmp");
    25842590
    25852591    # Update the .pb file
    2586     open(FILE,"$ENV{'PBROOTDIR'}/../$newver/$ENV{'PBPROJ'}.pb") || die "Unable to open $ENV{'PBROOTDIR'}/../$newver/$ENV{'PBPROJ'}.pb";
    2587     open(OUT,"> $ENV{'PBROOTDIR'}/../$newver/$ENV{'PBPROJ'}.pb.new") || die "Unable to write to $ENV{'PBROOTDIR'}/../$newver/$ENV{'PBPROJ'}.pb.new";
     2592    open(FILE,"$ENV{'PBCONFDIR'}/$newver/$ENV{'PBPROJ'}.pb") || die "Unable to open $ENV{'PBCONFDIR'}/$newver/$ENV{'PBPROJ'}.pb";
     2593    open(OUT,"> $ENV{'PBCONFDIR'}/$newver/$ENV{'PBPROJ'}.pb.new") || die "Unable to write to $ENV{'PBCONFDIR'}/$newver/$ENV{'PBPROJ'}.pb.new";
    25882594    while(<FILE>) {
    2589         s/^projver\s+$ENV{'PBPROJ'}\s*=\s*$oldver/projver $ENV{'PBPROJ'} = $newver/;
    2590         pb_log(0,"Changing projver from $oldver to $newver in $ENV{'PBROOTDIR'}/../$newver/$ENV{'PBPROJ'}.pb\n") if (/^projver\s+$ENV{'PBPROJ'}\s*=\s*$oldver/);
    2591         pb_log(0,"Commenting testver in $ENV{'PBROOTDIR'}/../$newver/$ENV{'PBPROJ'}.pb\n") if (/^testver/);
    2592         s/^testver/#testver/;
     2595        if (/^projver\s+$ENV{'PBPROJ'}\s*=\s*$oldvertxt/) {
     2596            s/^projver\s+$ENV{'PBPROJ'}\s*=\s*$oldvertxt/projver $ENV{'PBPROJ'} = $newvertxt/;
     2597            pb_log(0,"Changing projver from $oldvertxt to $newvertxt in $ENV{'PBCONFDIR'}/$newver/$ENV{'PBPROJ'}.pb\n");
     2598        }
     2599        if (/^testver/) {
     2600            s/^testver/#testver/;
     2601            pb_log(0,"Commenting testver in $ENV{'PBCONFDIR'}/$newver/$ENV{'PBPROJ'}.pb\n") if (/^testver/);
     2602        }
     2603        if (/^delivery/) {
     2604            pb_log(0,"Please check delivery (".chomp($_).") in $ENV{'PBCONFDIR'}/$newver/$ENV{'PBPROJ'}.pb\n");
     2605        }
    25932606        print OUT $_;
    2594         pb_log(0,"Please check delivery (".chomp($_).") in $ENV{'PBROOTDIR'}/../$newver/$ENV{'PBPROJ'}.pb\n") if (/^delivery/);
    25952607    }
    25962608    close(FILE);
    25972609    close(OUT);
    2598     rename("$ENV{'PBROOTDIR'}/../$newver/$ENV{'PBPROJ'}.pb.new","$ENV{'PBROOTDIR'}/../$newver/$ENV{'PBPROJ'}.pb");
     2610    rename("$ENV{'PBCONFDIR'}/$newver/$ENV{'PBPROJ'}.pb.new","$ENV{'PBCONFDIR'}/$newver/$ENV{'PBPROJ'}.pb");
    25992611
    26002612    # Checking pbcl files
     
    26022614        # Compute new pbcl file
    26032615        my $f2 = $f;
    2604         $f2 =~ s|$ENV{'PBROOTDIR'}|$ENV{'PBROOTDIR'}/../$newver/|;
     2616        $f2 =~ s|$ENV{'PBROOTDIR'}|$ENV{'PBCONFDIR'}/$newver/|;
    26052617        open(PBCL,$f) || die "Unable to open $f";
    26062618        my $foundnew = 0;
    26072619        while (<PBCL>) {
    2608             $foundnew = 1 if (/^$newver \(/);
     2620            $foundnew = 1 if (/^$newvertxt \(/);
    26092621        }
    26102622        close(PBCL);
     
    26122624        open(PBCL,$f) || die "Unable to open $f";
    26132625        while (<PBCL>) {
    2614             print OUT "$_" if (not /^$oldver \(/);
    2615             if ((/^$oldver \(/) && ($foundnew == 0)) {
    2616                 print OUT "$newver ($pbdate)\n";
     2626            print OUT "$_" if (not /^$oldvertxt \(/);
     2627            if ((/^$oldvertxt \(/) && ($foundnew == 0)) {
     2628                print OUT "$newvertxt ($pbdate)\n";
    26172629                print OUT "- TBD\n";
    26182630                print OUT "\n";
    2619                 pb_log(0,"WARNING: version $newver not found in $f so added to $f2...\n") if ($foundnew == 0);
     2631                pb_log(0,"WARNING: version $newvertxt not found in $f so added to $f2...\n") if ($foundnew == 0);
    26202632            }
    26212633        }
     
    26242636    }
    26252637
    2626     pb_log(2,"Checkin $ENV{'PBROOTDIR'}/../$newver\n");
    2627     pb_cms_checkin($scheme,"$ENV{'PBROOTDIR'}/../$newver",undef);
     2638    pb_log(2,"Checkin $ENV{'PBCONFDIR'}/$newver\n");
     2639    pb_cms_checkin($scheme,"$ENV{'PBCONFDIR'}/$newver",undef);
    26282640}
    26292641
Note: See TracChangeset for help on using the changeset viewer.