- Timestamp:
- Feb 7, 2011, 2:24:11 PM (14 years ago)
- Location:
- devel/pb
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb/bin/pb
r1174 r1176 13 13 14 14 # The modules mentioned here are required by pb when used both 15 # locally or inside a VE/VM 15 # locally or inside a VE/VM/RM 16 16 # Additional required modules only used locally are called with a require 17 17 # in their respective section … … 51 51 my %pbtag; # per package 52 52 my $pbrev; # Global REVISION variable 53 my $pbaccount; # Login to use to connect to the VM 53 my $pbaccount; # Login to use to connect to the VM/RM 54 54 my $pbtarget; # Target os-ver-arch you want to build for 55 my $pbport; # Port to use to connect to the VM 55 my $pbport; # Port to use to connect to the VM/RM 56 56 my $newver; # New version to create 57 57 my $iso = undef; # ISO image for the VM to create … … 113 113 =item B<-m|--machine os-ver-arch[,os-ver-arch,...]> 114 114 115 Name of the Virtual Machines (VM) or Virtual Environments (VE) you want to build on (coma separated). 115 Name of the Virtual Machines (VM), Virtual Environments (VE) or Remote Machines (RM) 116 you want to build on (coma separated). 116 117 All if none precised (or use the env variable PBV). 117 118 118 119 =item B<-s|--script script> 119 120 120 Name of the script you want to execute on the related VMs or VEs.121 Name of the script you want to execute on the related VMs/VEs/RMs. 121 122 122 123 =item B<-g|--nographic> … … 130 131 =item B<-a|--account account> 131 132 132 Name of the account to use to connect on the related VMs .133 Name of the account to use to connect on the related VMs/RMs. 133 134 134 135 =item B<-P|--port port_number> 135 136 136 Port number to use to connect on the related VMs .\n";137 Port number to use to connect on the related VMs/RMs."; 137 138 138 139 =item B<-p|--project project_name> … … 204 205 Create packages in VMs, launching them if needed 205 206 and send those packages to a SSH host once built 206 VM type supported are QEMU 207 VM type supported are QEMU and KVM 207 208 208 209 =item B<build2ve> … … 211 212 and send those packages to a SSH host once built 212 213 214 =item B<build2rm> 215 216 Create packages in RMs, which should pre-exist, 217 and send those packages to a SSH host once built 218 RM means Remote Machine, and could be a physical or Virtual one. 219 This is one buildfarm integration for pb. 220 213 221 =item B<sbx2vm> 214 222 … … 219 227 sbx2build + build2ve 220 228 229 =item B<sbx2rm> 230 231 sbx2build + build2rm 232 221 233 =item B<cms2vm> 222 234 … … 226 238 227 239 cms2build + build2ve 240 241 =item B<cms2rm> 242 243 cms2build + build2rm 228 244 229 245 =item B<launchvm> … … 244 260 Execute a script in a virtual environment 245 261 262 =item B<script2rm> 263 264 Execute a script on a remote machine 265 246 266 =item B<newvm> 247 267 … … 259 279 260 280 Setup a virtual environment for pb usage 281 282 =item B<setuprm> 283 284 Setup a remote machine for pb usage 261 285 262 286 =item B<sbx2setupvm> … … 270 294 Reserved to dev team. 271 295 296 =item B<sbx2setuprm> 297 298 Setup a remote machine for pb usage using the sandbox version of pb instead of the latest stable 299 Reserved to dev team. 300 272 301 =item B<snapvm> 273 302 … … 286 315 Update the distribution in the virtual environment 287 316 317 =item B<updaterm> 318 319 Update the distribution in the remote machine 320 288 321 =item B<test2pkg> 289 322 … … 297 330 298 331 Test a package in a virtual environment 332 333 =item B<test2rm> 334 335 Test a package in a remote machine 299 336 300 337 =item B<newver> … … 569 606 } elsif ($action =~ /^pkg2ssh$/) { 570 607 pb_pkg2ssh(); 608 } elsif ($action =~ /^build2rm$/) { 609 pb_build2v("rm","build"); 571 610 } elsif ($action =~ /^build2ve$/) { 572 611 pb_build2v("ve","build"); 573 612 } elsif ($action =~ /^build2vm$/) { 574 613 pb_build2v("vm","build"); 614 } elsif ($action =~ /^cms2rm$/) { 615 pb_cms2build("CMS"); 616 pb_build2v("rm","build"); 575 617 } elsif ($action =~ /^cms2ve$/) { 576 618 pb_cms2build("CMS"); 577 619 pb_build2v("ve","build"); 620 } elsif ($action =~ /^sbx2rm$/) { 621 pb_cms2build("SandBox"); 622 pb_build2v("rm","build"); 578 623 } elsif ($action =~ /^sbx2ve$/) { 579 624 pb_cms2build("SandBox"); … … 593 638 } elsif ($action =~ /^script2ve$/) { 594 639 pb_script2v($pbscript,"ve"); 640 } elsif ($action =~ /^script2rm$/) { 641 pb_script2v($pbscript,"rm"); 595 642 } elsif ($action =~ /^newver$/) { 596 643 pb_newver(); … … 604 651 pb_log(0, "and perl, sudo, ntpdate and scp/ssh installed\n"); 605 652 pb_log(0, "You should then be able to login with ssh -p VMPORT root\@localhost (if VM started with pb)\n"); 653 } elsif ($action =~ /^setuprm$/) { 654 pb_setup2v("rm"); 606 655 } elsif ($action =~ /^setupve$/) { 607 656 pb_setup2v("ve"); 608 657 } elsif ($action =~ /^setupvm$/) { 609 658 pb_setup2v("vm"); 659 } elsif ($action =~ /^sbx2setuprm$/) { 660 die "This feature is limited to the pb project" if ($ENV{'PBPROJ'} ne $appname); 661 pb_cms2build("SandBox"); 662 pb_setup2v("rm","SandBox"); 610 663 } elsif ($action =~ /^sbx2setupve$/) { 611 664 die "This feature is limited to the pb project" if ($ENV{'PBPROJ'} ne $appname); … … 616 669 pb_cms2build("SandBox"); 617 670 pb_setup2v("vm","SandBox"); 671 } elsif ($action =~ /^updaterm$/) { 672 pb_update2v("rm"); 618 673 } elsif ($action =~ /^updateve$/) { 619 674 pb_update2v("ve"); … … 626 681 } elsif ($action =~ /^test2pkg$/) { 627 682 pb_test2pkg(); 683 } elsif ($action =~ /^test2rm$/) { 684 pb_build2v("rm","test"); 628 685 } elsif ($action =~ /^test2ve$/) { 629 686 pb_build2v("ve","test"); … … 827 884 pb_log(0,"Build files are being generated for ...\n"); 828 885 my %virt; 829 # De-duplicate similar VM and VE886 # De-duplicate similar VM/VE/RM 830 887 foreach my $d (split(/,/,$tmpl)) { 831 888 # skip ill-formatted vms (name-ver-arch) … … 835 892 836 893 # Try to use // processing here 837 my $pm = new Parallel::ForkManager($pbparallel) if (defined $pbparallel); 894 my $pm; 895 $pm = new Parallel::ForkManager($pbparallel) if (defined $pbparallel); 838 896 839 897 foreach my $d (keys %virt) { … … 1080 1138 chdir "$ENV{'PBBUILDDIR'}"; 1081 1139 my $made = ""; # pkgs made during build 1082 my $pm = new Parallel::ForkManager($pbparallel) if (defined $pbparallel); 1140 my $pm; 1141 $pm = new Parallel::ForkManager($pbparallel) if (defined $pbparallel); 1083 1142 1084 1143 # We need to communicate info back from the children if parallel so prepare a dir for that … … 1348 1407 } 1349 1408 1350 # Keep track of what is generated so that we can get them back from VMs 1409 # Keep track of what is generated so that we can get them back from VMs/RMs 1351 1410 open(KEEP,"> $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}") || die "Unable to create $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}"; 1352 1411 print KEEP "$made\n"; … … 1384 1443 1385 1444 # By default deliver to the the public site hosting the 1386 # ftp structure (or whatever) or a VM/VE 1445 # ftp structure (or whatever) or a VM/VE/RM 1387 1446 sub pb_send2target { 1388 1447 … … 1409 1468 $host = "vmhost"; 1410 1469 $port = "vmport"; 1470 } elsif ($cmt =~ /^RM/) { 1471 $login = "rmlogin"; 1472 $dir = "pbdefdir"; 1473 # Specific RM 1474 $tmout = "rmtmout"; 1475 $path = "rmpath"; 1476 $host = "rmhost"; 1477 $port = "rmport"; 1411 1478 } elsif ($cmt =~ /^VE/) { 1412 1479 $login = "velogin"; … … 1464 1531 } 1465 1532 1466 if ($cmt =~ / V[EM]build/) {1533 if ($cmt =~ /(V[EM]|RM)build/) { 1467 1534 $src="$src $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb $ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb $ENV{'PBETC'} $ENV{'PBDESTDIR'}/pbrc $ENV{'PBDESTDIR'}/pbscript.$$"; 1468 } elsif ($cmt =~ / V[EM]Script/) {1535 } elsif ($cmt =~ /(V[EM]|RM)Script/) { 1469 1536 $src="$src $ENV{'PBDESTDIR'}/pbscript.$$"; 1470 } elsif ($cmt =~ / V[EM]test/) {1537 } elsif ($cmt =~ /(V[EM]|RM)test/) { 1471 1538 $src="$src $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb $ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb $ENV{'PBETC'} $ENV{'PBDESTDIR'}/pbrc $ENV{'PBDESTDIR'}/pbscript.$$ $ENV{'PBDESTDIR'}/pbtest"; 1472 1539 } elsif (($cmt eq "Announce") || ($cmt eq "Web")) { … … 1498 1565 ($vepath) = pb_conf_get($path); 1499 1566 } 1500 if ($cmt =~ /^ VM/) {1567 if ($cmt =~ /^(V|R)M/) { 1501 1568 ($vtmout) = pb_conf_get($tmout); 1569 } 1570 my $sshmachine = $sshhost->{$ENV{'PBPROJ'}}; 1571 if ($cmt =~ /^RM/) { 1572 # In that case our real host is in the rmhost with the OS as key, not project as above 1573 $sshmachine = pb_distro_get_param($ddir,$dver,$darch,$sshhost,$dfam,$dtype,$dos); 1502 1574 } 1503 1575 pb_log(2,"ssh: ".Dumper(($sshhost,$sshlogin,$sshdir,$sshport,$vtmout,$vepath,$rbsconf))."\n"); … … 1505 1577 my $mac; 1506 1578 if ($cmt !~ /^VE/) { 1507 $mac = "$sshlogin->{$ENV{'PBPROJ'}}\@$ssh host->{$ENV{'PBPROJ'}}";1579 $mac = "$sshlogin->{$ENV{'PBPROJ'}}\@$sshmachine"; 1508 1580 # Overwrite account value if passed as parameter 1509 $mac = "$pbaccount\@$ssh host->{$ENV{'PBPROJ'}}" if (defined $pbaccount);1581 $mac = "$pbaccount\@$sshmachine" if (defined $pbaccount); 1510 1582 pb_log(2, "DEBUG: pbaccount: $pbaccount => mac: $mac\n") if (defined $pbaccount); 1511 1583 } else { … … 1518 1590 my $tdir; 1519 1591 my $bdir; 1520 if (($cmt eq "Sources") || ($cmt =~ / V[EM]Script/)) {1592 if (($cmt eq "Sources") || ($cmt =~ /(V[EM]|RM)Script/)) { 1521 1593 $tdir = "$sshdir->{$ENV{'PBPROJ'}}/$delivery->{$ENV{'PBPROJ'}}/src"; 1522 } elsif ( ($cmt =~ /V[EM]build/) || ($cmt =~ /V[EM]test/)) {1594 } elsif ($cmt =~ /(V[EM]|RM)(build|test)/) { 1523 1595 $tdir = $sshdir->{$ENV{'PBPROJ'}}."/$ENV{'PBPROJ'}/delivery"; 1524 1596 $bdir = $sshdir->{$ENV{'PBPROJ'}}."/$ENV{'PBPROJ'}/build"; … … 1714 1786 1715 1787 my $tm = undef; 1716 if ($cmt =~ /^ VM/) {1788 if ($cmt =~ /^(V|R)M/) { 1717 1789 $tm = $vtmout->{$ENV{'PBPROJ'}}; 1718 1790 } … … 1726 1798 $cpcmd = "scp -i $keyfile -p -o UserKnownHostsFile=/dev/null -P $nport"; 1727 1799 $cptarget = "$mac:$tdir"; 1728 if ($cmt =~ /^ VMbuild/) {1800 if ($cmt =~ /^(V|R)Mbuild/) { 1729 1801 $cp2target = "$mac:$bdir"; 1730 1802 } … … 1773 1845 # Use the right script name depending on context 1774 1846 my $pbscript; 1775 if ($cmt =~ /^ V[EM]/) {1847 if ($cmt =~ /^(V[EM]|RM)/) { 1776 1848 $pbscript = "pbscript.$$"; 1777 1849 } else { … … 1780 1852 1781 1853 pb_system("$shcmd \"echo \'cd $tdir ; if [ -x $pbscript ]; then ./$pbscript; fi ; rm -f ./$pbscript\' | bash\"","Executing pbscript on $cptarget if needed","verbose"); 1782 if ($cmt =~ /^ V[EM]build/) {1783 # Get back info on pkg produced, compute their name and get them from the VM 1854 if ($cmt =~ /^(V[EM]|RM)build/) { 1855 # Get back info on pkg produced, compute their name and get them from the VM/RM 1784 1856 pb_system("$cpcmd $cp2target/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'} $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.$$ 2> /dev/null","Get package names in $cp2target"); 1785 1857 # For VE we need to change the owner manually … … 1788 1860 } 1789 1861 if (not -f "$ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.$$") { 1790 pb_log(0,"Problem with VM $v on $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.$$");1862 pb_log(0,"Problem with VM/RM $v on $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.$$"); 1791 1863 } else { 1792 1864 open(KEEP,"$ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.$$") || die "Unable to read $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.$$"; … … 1801 1873 my $made = ""; 1802 1874 1803 # For VM we don't want shell expansion to hapen locally but remotely1875 # For VM/RM we don't want shell expansion to hapen locally but remotely 1804 1876 my $delim = '\''; 1805 1877 if ($cmt =~ /^VEbuild/) { … … 1834 1906 } 1835 1907 } 1836 unlink("$ENV{'PBDESTDIR'}/pbscript.$$") if ($cmt =~ /^ V[ME]/);1908 unlink("$ENV{'PBDESTDIR'}/pbscript.$$") if ($cmt =~ /^(V[ME]|RM)/); 1837 1909 1838 1910 pb_log(2,"Before halt, vmexist: $vmexist, vmpid: $vmpid\n"); … … 1884 1956 my $vtype=shift; 1885 1957 my $pbforce=shift || 0; # Force stop of VM. Default not. 1886 my $vm1=shift || undef; # Only that VM to treat. Default all.1958 my $vm1=shift || undef; # Only that VM/VE/RM to treat. Default all. 1887 1959 my $snapme=shift || 0; # Do we have to create a snapshot. Default not. 1888 1960 my $vm; … … 1890 1962 1891 1963 pb_log(2,"DEBUG: pb_script2v($pbscript,$vtype,$pbforce,".Dumper($vm1).",$snapme)\n"); 1892 # Prepare the script to be executed on the VM 1964 # Prepare the script to be executed on the VM/VE/RM 1893 1965 # in $ENV{'PBDESTDIR'}/pbscript.$$ 1894 1966 if ((defined $pbscript ) && ($pbscript ne "$ENV{'PBDESTDIR'}/pbscript.$$")) { … … 1911 1983 pb_log(2,"DEBUG: After pb_launchv, vmexist: $vmexist, vmpid: $vmpid\n"); 1912 1984 1913 # Skip that VM if something went wrong1985 # Skip that VM/RM if something went wrong 1914 1986 next if (($vmpid == 0) && ($vmexist == 0)); 1915 1987 … … 1925 1997 } 1926 1998 1927 # Gather all required files to send them to the VM 1999 # Gather all required files to send them to the VM/VE/RM 1928 2000 # and launch the build through pbscript 1929 2001 pb_log(2,"DEBUG: Before send2target, vmexist: $vmexist, vmpid: $vmpid\n"); … … 1936 2008 my $vtype = shift; 1937 2009 my $v = shift; 1938 my $create = shift || 0; # By default do not create a VM/VE 1939 my $snapme = shift || 0; # By default do not snap a VM/VE 1940 my $usesnap = shift || 1; # By default study the usage of the snapshot feature of VM/VE 2010 my $create = shift || 0; # By default do not create a VM/VE/RM 2011 my $snapme = shift || 0; # By default do not snap a VM/VE/RM 2012 my $usesnap = shift || 1; # By default study the usage of the snapshot feature of VM/VE/RM 1941 2013 1942 2014 # If creation or snapshot creation mode, no snapshot usable … … 1946 2018 1947 2019 pb_log(2,"DEBUG: pb_launchv($vtype,$v,$create,$snapme,$usesnap)\n"); 1948 die "No VM/VE defined, unable to launch" if (not defined $v);2020 die "No VM/VE/RM defined, unable to launch" if (not defined $v); 1949 2021 # Keep only the first VM in case many were given 1950 2022 $v =~ s/,.*//; … … 2075 2147 pb_log(2,"DEBUG: pb_launchv returns ($vmexist,$vmpid)\n"); 2076 2148 return($vmexist,$vmpid); 2077 # VE here2078 } else {2149 } elsif ($vtype eq "ve") { 2150 # VE here 2079 2151 # Get distro context 2080 2152 my ($name,$ver,$darch) = split(/-/,$v); … … 2244 2316 die "VE of type $vetype not supported. Report to the dev team"; 2245 2317 } 2318 } else { 2319 # RM here 2320 # Get distro context 2321 my ($name,$ver,$darch) = split(/-/,$v); 2322 chomp($darch); 2323 my ($ddir, $dver, $dfam, $dtype, $dos, $pbsuf) = pb_distro_init($name,$ver,$darch); 2324 2325 # Get RM context 2326 my ($ptr,$rmpath) = pb_conf_get("rmtype","rmpath"); 2327 2328 # Nothing more to do for RM. No real launch 2329 # For the moment we support the RM is already running 2330 # For ProLiant may be able to power them on if needed later on as an example. 2246 2331 } 2247 2332 } … … 2294 2379 2295 2380 my ($vmexist,$vmpid) = (undef,undef); 2296 my $pm = new Parallel::ForkManager($pbparallel) if (defined $pbparallel); 2297 2298 # Set which port the VM will use to communicate 2299 $pm->run_on_start(\&pb_set_port); 2381 my $pm; 2382 if (defined $pbparallel) { 2383 $pm = new Parallel::ForkManager($pbparallel); 2384 2385 # Set which port the VM/RM will use to communicate 2386 $pm->run_on_start(\&pb_set_port); 2387 } 2300 2388 2301 2389 my $counter = 0; … … 2303 2391 $counter++; 2304 2392 # Modulo 2 * pbparallel (to avoid synchronization problems) 2305 $counter = 1 if ( $counter > 2 * $pbparallel);2393 $counter = 1 if ((defined $pbparallel) && ($counter > 2 * $pbparallel)); 2306 2394 $pm->start($counter) and next if (defined $pbparallel); 2307 # Prepare the script to be executed on the VM/VE 2395 # Prepare the script to be executed on the VM/VE/RM 2308 2396 # in $ENV{'PBDESTDIR'}/pbscript.$$ 2309 2397 open(SCRIPT,"> $ENV{'PBDESTDIR'}/pbscript.$$") || die "Unable to create $ENV{'PBDESTDIR'}/pbscript.$$"; … … 2402 2490 chmod 0755,"$ENV{'PBDESTDIR'}/pbscript.$$"; 2403 2491 2404 # Launch the VM/VE 2492 # Launch the VM/VE/RM 2405 2493 ($vmexist,$vmpid) = pb_launchv($vtype,$v,0); 2406 2494 … … 2413 2501 } 2414 2502 } else { 2415 # VE 2503 # VE/RM 2416 2504 $vmexist = 0; 2417 2505 $vmpid = 0; … … 2423 2511 $pm->finish if (defined $pbparallel); 2424 2512 } 2425 if (defined $pbparallel) { 2426 $pm->wait_all_children; 2427 } 2513 $pm->wait_all_children if (defined $pbparallel); 2428 2514 } 2429 2515 … … 2534 2620 2535 2621 # 2536 # Return the list of VMs/VEs we are working on2622 # Return the list of VMs/VEs/RMs we are working on 2537 2623 # $all is a flag to know if we return all of them 2538 2624 # or only some (if all we publish also tar files in addition to pkgs … … 2543 2629 my @v; 2544 2630 my $all = 0; 2545 my $vlist;2546 2631 my $pbv = 'PBV'; 2547 2548 if ($vtype eq "vm") { 2549 $vlist = "vmlist"; 2550 } elsif ($vtype eq "ve") { 2551 $vlist = "velist"; 2552 } 2632 my $vlist = $vtype."list"; 2633 2553 2634 # Get VM/VE list 2554 2635 if ((not defined $ENV{$pbv}) || ($ENV{$pbv} =~ /^all$/)) { … … 2562 2643 } 2563 2644 2564 # Function to create a potentialy missing pb account on the VM/VE , and adds it to sudo2565 # Needs to use root account to connect to the VM/VE 2645 # Function to create a potentialy missing pb account on the VM/VE/RM, and adds it to sudo 2646 # Needs to use root account to connect to the VM/VE/RM 2566 2647 # pb will take your local public SSH key to access 2567 # the pb account in the VM later on if needed2648 # the pb account in the VM/VE/RM later on if needed 2568 2649 sub pb_setup2v { 2569 2650 … … 2579 2660 $pbparallel = pb_set_parallel($vtype); 2580 2661 2581 my $pm = new Parallel::ForkManager($pbparallel) if (defined $pbparallel); 2582 2583 # Set which port the VM will use to communicate 2584 $pm->run_on_start(\&pb_set_port); 2662 my $pm; 2663 if (defined $pbparallel) { 2664 $pm = new Parallel::ForkManager($pbparallel); 2665 2666 # Set which port the VM/RM will use to communicate 2667 $pm->run_on_start(\&pb_set_port); 2668 } 2585 2669 2586 2670 my $counter = 0; … … 2588 2672 $counter++; 2589 2673 # Modulo pbparallel 2590 $counter = 1 if ( $counter > $pbparallel);2674 $counter = 1 if ((defined $pbparallel) && ($counter > $pbparallel)); 2591 2675 $pm->start($counter) and next if (defined $pbparallel); 2592 2676 … … 2599 2683 my ($ddir, $dver, $dfam, $dtype, $dos, $pbsuf, $pbupd, $pbins) = pb_distro_init($name,$ver,$darch); 2600 2684 2601 # Name of the account to deal with for VM/VE 2685 # Name of the account to deal with for VM/VE/RM 2602 2686 # Do not use the one passed potentially with -a 2603 2687 my ($pbac) = pb_conf_get($vtype."login"); … … 2605 2689 my ($vmexist,$vmpid); 2606 2690 2607 # Prepare the script to be executed on the VM/VE 2691 # Prepare the script to be executed on the VM/VE/RM 2608 2692 # in $ENV{'PBDESTDIR'}/setupv 2609 2693 open(SCRIPT,"> $pbscript") || die "Unable to create $pbscript"; … … 2630 2714 EOF 2631 2715 2632 # Launch the VM/VE - Usage of snapshot disabled2716 # Launch the VM/VE/RM - Usage of snapshot disabled 2633 2717 ($vmexist,$vmpid) = pb_launchv($vtype,$v,0,0,0); 2634 2718 … … 2637 2721 my $vmhost; 2638 2722 2639 if ($vtype eq "vm") {2723 if ($vtype =~ /(v|r)m/) { 2640 2724 # Prepare the key to be used and transfered remotely 2641 2725 $keyfile = pb_ssh_get(1); 2642 2726 2643 2727 my ($vmport,$vmntp); 2644 ($vmhost,$vmport,$vmntp) = pb_conf_get( "vmhost","vmport","vmntp");2728 ($vmhost,$vmport,$vmntp) = pb_conf_get($vtype."host",$vtype."port",$vtype."ntp"); 2645 2729 $nport = pb_get_port($vmport->{$ENV{'PBPROJ'}}); 2646 2730 2647 # Skip that VM if something went wrong2731 # Skip that VM/RM if something went wrong 2648 2732 next if (($vmpid == 0) && ($vmexist == 0)); 2649 2733 … … 2657 2741 # We call true to avoid problems if SELinux is not activated, but chcon is present and returns in that case 1 2658 2742 pb_system("cat $keyfile.pub | ssh -q -o UserKnownHostsFile=/dev/null -p $nport -i $keyfile root\@$vmhost->{$ENV{'PBPROJ'}} \"mkdir -p .ssh ; chmod 700 .ssh ; cat >> .ssh/authorized_keys ; chmod 600 .ssh/authorized_keys ; if [ -x /usr/bin/chcon ]; then /usr/bin/chcon -Rt home_ssh_t .ssh 2> /dev/null; /bin/true; fi\"","Copying local keys to $vtype. This may require the root password"); 2659 # once this is done, we can do what we want on the VM remotely2743 # once this is done, we can do what we need on the VM/RM remotely 2660 2744 } elsif ($vtype eq "ve") { 2661 2745 print SCRIPT << "EOF"; … … 2670 2754 } 2671 2755 2672 if ($vtype eq "vm") {2756 if ($vtype =~ /(v|r)m/) { 2673 2757 print SCRIPT << 'EOF'; 2674 2758 # Removes duplicate in .ssh/authorized_keys of our key if needed … … 2713 2797 EOF 2714 2798 2799 # TODO: use an external parameter 2715 2800 my $home = "/home"; 2716 2801 # Solaris doesn't like that we use /home … … 2726 2811 } 2727 2812 EOF 2813 # TODO: Level of portability of these cmds ? 2728 2814 print SCRIPT << "EOF"; 2729 2815 pb_system("/usr/sbin/groupadd $pbac->{$ENV{'PBPROJ'}}","Adding group $pbac->{$ENV{'PBPROJ'}}"); … … 2732 2818 EOF 2733 2819 2734 # Copy the content of our local conf file to the VM/VE 2820 # Copy the content of our local conf file to the VM/VE/RM 2735 2821 my $content = pb_get_content(pb_distro_conffile()); 2736 2822 print SCRIPT << "EOF"; … … 2746 2832 EOF 2747 2833 2748 if ($vtype eq "vm") {2834 if ($vtype =~ /(v|r)m/) { 2749 2835 print SCRIPT << "EOF"; 2750 2836 # allow ssh entry to build … … 2825 2911 close(PBFILE); 2826 2912 EOF 2913 # TODO: To be refined for RM 2827 2914 print SCRIPT << "EOF"; 2828 2915 # Some distro force requiretty at compile time, so disable here … … 2867 2954 my ($instype) = pb_conf_get("pbinstalltype"); 2868 2955 my $itype = pb_distro_get_param($ddir,$dver,$darch,$instype,$dfam,$dtype,$dos); 2869 if (defined $sbx) { 2870 # Install from sandbox mean a file base install 2871 $itype = "file"; 2872 } 2956 # Install from sandbox mean a file base install 2957 $itype = "file" if (defined $sbx); 2873 2958 if ($itype =~ /^file/) { 2874 2959 my $cmdget; … … 2989 3074 $pm->finish if (defined $pbparallel); 2990 3075 } 2991 if (defined $pbparallel) { 2992 $pm->wait_all_children; 2993 } 3076 $pm->wait_all_children if (defined $pbparallel); 2994 3077 return; 2995 3078 } … … 3038 3121 } 3039 3122 3040 # Function to update a VMs or VEs with the latest distribution content3123 # Function to update VMs/VEs/RMs with the latest distribution content 3041 3124 sub pb_update2v { 3042 3125 … … 3056 3139 my ($ddir, $dver, $dfam, $dtype, $dos, $pbsuf, $pbupd, $pbins) = pb_distro_init($name,$ver,$darch); 3057 3140 3058 # Prepare the script to be executed on the VM/VE 3141 # Prepare the script to be executed on the VM/VE/RM 3059 3142 # in $ENV{'PBDESTDIR'}/updatev 3060 3143 open(SCRIPT,"> $pbscript") || die "Unable to create $pbscript"; … … 3540 3623 } 3541 3624 3542 # Manages VM SSH port communication3625 # Manages VM/RM SSH port communication 3543 3626 sub pb_get_port { 3544 3627 … … 3605 3688 } 3606 3689 } 3607 pb_log(2,"pb_set_parallel returns: $pbparallel\n") ;3690 pb_log(2,"pb_set_parallel returns: $pbparallel\n") if (defined $pbparallel); 3608 3691 return($pbparallel); 3609 3692 } -
devel/pb/lib/ProjectBuilder/CMS.pm
r1174 r1176 227 227 228 228 # Check whether the file is well formed 229 (containing already a directory with the project-version name)229 # (containing already a directory with the project-version name) 230 230 # 231 231 # If it's not the case, we try to adapt, but distro needing … … 711 711 my $cmsurl = pb_cms_get_uri($scheme,$ENV{$envar}); 712 712 my ($scheme2, $account2, $host2, $port2, $path2) = pb_get_uri($cmsurl); 713 # For svk, scheme doesn't appear in svk info so remove it here in uri coming from conf file 714 # which needs it to trigger correct behaviour 715 $uri =~ s/^svk://; 713 716 if ($cmsurl ne $uri) { 714 717 # The local content doesn't correpond to the repository -
devel/pb/lib/ProjectBuilder/Env.pm
r1156 r1176 95 95 # where to find Build System infos: 96 96 #vmpath default = /home/qemu 97 #vepath default = /home/rinse 97 #vepath default = /home/rpmbootstrap 98 #rmpath default = /home/remote 98 99 99 100 # Overwrite generic setup … … 168 169 # Adds a potential conf file now as it's less 169 170 # important than the project conf file 170 my ($vmpath,$vepath ) = pb_conf_get_if("vmpath","vepath");171 my ($vmpath,$vepath,$rmpath) = pb_conf_get_if("vmpath","vepath","rmpath"); 171 172 pb_conf_add("$vmpath->{$ENV{'PBPROJ'}}/.pbrc") if ((defined $vmpath) && (-f "$vmpath->{$ENV{'PBPROJ'}}/.pbrc")); 172 173 pb_conf_add("$vepath->{$ENV{'PBPROJ'}}/.pbrc") if ((defined $vepath) && (-f "$vepath->{$ENV{'PBPROJ'}}/.pbrc")); 174 pb_conf_add("$rmpath->{$ENV{'PBPROJ'}}/.pbrc") if ((defined $rmpath) && (-f "$rmpath->{$ENV{'PBPROJ'}}/.pbrc")); 173 175 174 176 # … … 282 284 pb_log(2,"PBBUILDDIR: $ENV{'PBBUILDDIR'}\n"); 283 285 284 # 285 # The following part is only useful when in cms2something or newsomething 286 # In VMs/VEs we want to skip that by providing good env vars. 286 return if ($action =~ /^clean$/); 287 # 288 # The following part is only useful when in sbx|cms2something or newsomething 289 # In VMs/VEs/RMs we want to skip that by providing good env vars. 287 290 # return values in that case are useless 288 291 # 289 return if ($action =~ /^clean$/);290 292 291 293 if (($action =~ /^cms2/) || ($action =~ /^sbx2/) || ($action =~ /^newver$/) || ($action =~ /pbinit/) || ($action =~ /^newproj$/) || ($action =~ /^announce/)) {
Note:
See TracChangeset
for help on using the changeset viewer.