Changeset 1140


Ignore:
Timestamp:
01/08/11 02:13:21 (2 years ago)
Author:
bruno
Message:
  • Adds 2 new functions sbx2setupve|vm to update an in VE|VM incompatible version of pb to latest needed to dialog correctly.
  • Fix a now incorrect call to pbscript in pb_setup2v
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r1139 r1140  
    259259 
    260260Setup a virtual environment for pb usage 
     261 
     262=item B<sbx2setupvm> 
     263 
     264Setup a virtual machine for pb usage using the sandbox version of pb instead of the latest stable 
     265Reserved to dev team. 
     266 
     267=item B<sbx2setupve> 
     268 
     269Setup a virtual environment for pb usage using the sandbox version of pb instead of the latest stable 
     270Reserved to dev team. 
    261271 
    262272=item B<snapvm> 
     
    595605} elsif ($action =~ /^setupvm$/) { 
    596606    pb_setup2v("vm"); 
     607} elsif ($action =~ /^sbx2setupve$/) { 
     608    die "This feature is limited to the pb project" if ($ENV{'PBPROJ'} ne $appname); 
     609    pb_cms2build("SandBox"); 
     610    pb_setup2v("ve","SandBox"); 
     611} elsif ($action =~ /^sbx2setupvm$/) { 
     612    die "This feature is limited to the pb project" if ($ENV{'PBPROJ'} ne $appname); 
     613    pb_cms2build("SandBox"); 
     614    pb_setup2v("vm","SandBox"); 
    597615} elsif ($action =~ /^updateve$/) { 
    598616    pb_update2v("ve"); 
     
    17181736    } 
    17191737 
    1720     pb_system("$shcmd \"echo \'cd $tdir ; if [ -x pbscript ]; then ./pbscript; fi ; rm -f ./pbscript\' | bash\"","Executing pbscript on $cptarget if needed","verbose"); 
     1738    # Use the right script name depending on context 
     1739    my $pbscript; 
     1740    if ($cmt =~ /^V[EM]/) { 
     1741        $pbscript = "pbscript.$$"; 
     1742    } else { 
     1743        $pbscript = "pbscript"; 
     1744    } 
     1745 
     1746    pb_system("$shcmd \"echo \'cd $tdir ; if [ -x $pbscript ]; then ./$pbscript; fi ; rm -f ./$pbscript\' | bash\"","Executing pbscript on $cptarget if needed","verbose"); 
    17211747    if ($cmt =~ /^V[EM]build/) { 
    17221748        # Get back info on pkg produced, compute their name and get them from the VM 
     
    20592085                        my ($rbsconf) = pb_conf_get("rbsconf"); 
    20602086 
    2061                         pb_system("sudo /usr/sbin/rinse --directory \"$vepath->{$ENV{'PBPROJ'}}/$ddir/$dver/$darch\" --arch \"$darch\" --distribution \"$ddir-$dver\" --config \"$rbsconf->{$ENV{'PBPROJ'}}\" $b4post $postinstall $rbsopt $addpkgs $rinseverb","Creating the rinse VE for $ddir-$dver ($darch)", "verbose"); 
     2087                        my $command = pb_check_req("rinse",0); 
     2088                        pb_system("sudo $command --directory \"$vepath->{$ENV{'PBPROJ'}}/$ddir/$dver/$darch\" --arch \"$darch\" --distribution \"$ddir-$dver\" --config \"$rbsconf->{$ENV{'PBPROJ'}}\" $b4post $postinstall $rbsopt $addpkgs $rinseverb","Creating the rinse VE for $ddir-$dver ($darch)", "verbose"); 
    20622089                    } elsif ($verpmstyle eq "rpmbootstrap") { 
    20632090                        my $rbsverb = ""; 
     
    24662493 
    24672494my $vtype = shift; 
     2495my $sbx = shift || undef; 
    24682496 
    24692497my ($vm,$all) = pb_get2v($vtype); 
     
    24982526 
    24992527# We should not need in this script more functions than what is provided  
    2500 # by Base and Distribution to avoid problems at exec time. 
     2528# by Base, Conf and Distribution to avoid problems at exec time. 
    25012529# They are appended at the end. 
    25022530 
     
    27442772    my ($instype) = pb_conf_get("pbinstalltype"); 
    27452773    my $itype = pb_distro_get_param($ddir,$dver,$darch,$instype,$dfam,$dtype,$dos); 
     2774    if (defined $sbx) { 
     2775        # Install from sandbox mean a file base install 
     2776        $itype = "file"; 
     2777    } 
    27462778    if ($itype =~ /^file/) { 
     2779        my $cmdget; 
     2780        if (defined $sbx) { 
     2781            # Install from sandbox mean using the result of the just passed sbx2build command 
     2782            # Get content saved in cms2build 
     2783            my ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb","pbpkg"); 
     2784            die "Unable to get package list" if (not defined $pkg); 
     2785            my ($vepath) = pb_conf_get("vepath"); 
     2786 
     2787            # We consider 2 specific packages 
     2788            my $vertag1 = $pkg->{"ProjectBuilder"}; 
     2789            my $vertag2 = $pkg->{"project-builder"}; 
     2790            # get the version of the current package - maybe different 
     2791            my ($pbver1,$tmp1) = split(/-/,$vertag1); 
     2792            my ($pbver2,$tmp2) = split(/-/,$vertag2); 
     2793            # Copy inside the VM 
     2794            copy("$ENV{'PBDESTDIR'}/ProjectBuilder-$pbver1.tar.gz","$vepath->{$ENV{'PBPROJ'}}/$ddir/$dver/$darch/tmp"); 
     2795            copy("$ENV{'PBDESTDIR'}/project-builder-$pbver2.tar.gz","$vepath->{$ENV{'PBPROJ'}}/$ddir/$dver/$darch/tmp"); 
     2796            $cmdget = "mv /tmp/ProjectBuilder-$pbver1.tar.gz ProjectBuilder-latest.tar.gz ; mv /tmp/project-builder-$pbver2.tar.gz project-builder-latest.tar.gz"; 
     2797        } else { 
     2798            $cmdget = "wget --passive-ftp ftp://ftp.project-builder.org/src/ProjectBuilder-latest.tar.gz; wget --passive-ftp ftp://ftp.project-builder.org/src/project-builder-latest.tar.gz"; 
     2799        } 
    27472800        print SCRIPT << 'EOF'; 
    27482801# Then install manually the missing perl modules 
     
    27572810    pb_system("echo \"rm -rf $m* ; wget http://search.cpan.org/CPAN/modules/by-module/$dir/$m-$osperlver->{$m}.tar.gz ; gzip -cd $m-$osperlver->{$m}.tar.gz | tar xf - ; cd $m* ; if [ -f Build.PL ]; then perl Build.PL; ./Build ; ./Build install ; else perl Makefile.PL; make ; make install ; fi; cd .. ; rm -rf $m*\" | bash" ,"Installing perl module $m-$osperlver->{$m}"); 
    27582811} 
    2759  
    2760 pb_system("rm -rf ProjectBuilder-* ; wget --passive-ftp ftp://ftp.mondorescue.org/src/ProjectBuilder-latest.tar.gz ; gzip -cd ProjectBuilder-latest.tar.gz | tar xf - ; cd ProjectBuilder-* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf ProjectBuilder-* ; rm -rf project-builder-* ; wget --passive-ftp ftp://ftp.mondorescue.org/src/project-builder-latest.tar.gz ; gzip -cd project-builder-latest.tar.gz | tar xf - ; cd project-builder-* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf project-builder-* ;","Building Project-Builder"); 
     2812EOF 
     2813 
     2814        print SCRIPT << "EOF"; 
     2815pb_system("rm -rf ProjectBuilder-* ; rm -rf project-builder-* ; $cmdget ; gzip -cd ProjectBuilder-latest.tar.gz | tar xf - ; cd ProjectBuilder-* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf ProjectBuilder-* ; gzip -cd project-builder-latest.tar.gz | tar xf - ; cd project-builder-* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf project-builder-* ;","Building Project-Builder"); 
    27612816EOF 
    27622817    } elsif ($itype =~ /^pkg/) { 
Note: See TracChangeset for help on using the changeset viewer.