Changeset 1111 in ProjectBuilder for devel/pb/bin
- Timestamp:
- Nov 18, 2010, 2:06:01 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb/bin/pb
r1109 r1111 257 257 258 258 Snapshot a virtual environment for pb usage 259 260 =item B<updatevm> 261 262 Update the distribution in the virtual machine 263 264 =item B<updateve> 265 266 Update the distribution in the virtual environment 259 267 260 268 =item B<test2pkg> … … 530 538 } elsif ($action =~ /^setupvm$/) { 531 539 pb_setup2v("vm"); 540 } elsif ($action =~ /^updateve$/) { 541 pb_update2v("ve"); 542 } elsif ($action =~ /^updatevm$/) { 543 pb_update2v("vm"); 532 544 } elsif ($action =~ /^snapve$/) { 533 545 pb_snap2v("ve"); … … 670 682 my %build; 671 683 # We want to at least build for the underlying distro 672 my ($ddir, $dver, $dfam, $dtype, $dos, $pbsuf, $pbupd, $ arch) = pb_distro_init();684 my ($ddir, $dver, $dfam, $dtype, $dos, $pbsuf, $pbupd, $pbins, $arch) = pb_distro_init(); 673 685 my $tmpl = "$ddir-$dver-$arch,"; 674 686 my %patches; … … 929 941 sub pb_test2pkg { 930 942 # Get the running distro to test on 931 my ($ddir, $dver, $dfam, $dtype, $dos, $pbsuf, $pbupd, $ arch) = pb_distro_init();932 pb_log(2,"DEBUG: distro tuple: ".join(',',($ddir, $dver, $dfam, $dtype, $pbsuf, $pbupd, $ arch))."\n");943 my ($ddir, $dver, $dfam, $dtype, $dos, $pbsuf, $pbupd, $pbins, $arch) = pb_distro_init(); 944 pb_log(2,"DEBUG: distro tuple: ".join(',',($ddir, $dver, $dfam, $dtype, $pbsuf, $pbupd, $pbins, $arch))."\n"); 933 945 934 946 # Get list of packages to test … … 941 953 foreach my $pbpkg (@pkgs) { 942 954 # We need to install the package to test, and deps brought with it 943 pb_distro_installdeps(undef,$dtype,$pb upd,$pbpkg);955 pb_distro_installdeps(undef,$dtype,$pbins,$pbpkg); 944 956 pb_system("$ENV{'PBDESTDIR'}/pbtest","Launching test for $pbpkg","verbose"); 945 957 } … … 949 961 950 962 # Get the running distro to build on 951 my ($ddir, $dver, $dfam, $dtype, $dos, $pbsuf, $pbupd, $ arch) = pb_distro_init();952 pb_log(2,"DEBUG: distro tuple: ".join(',',($ddir, $dver, $dfam, $dtype, $pbsuf, $pbupd, $ arch))."\n");963 my ($ddir, $dver, $dfam, $dtype, $dos, $pbsuf, $pbupd, $pbins, $arch) = pb_distro_init(); 964 pb_log(2,"DEBUG: distro tuple: ".join(',',($ddir, $dver, $dfam, $dtype, $pbsuf, $pbupd, $pbins, $arch))."\n"); 953 965 954 966 # Get list of packages to build … … 1002 1014 foreach my $f (@specfile) { 1003 1015 if ($f =~ /\.spec$/) { 1004 pb_distro_installdeps($f,$dtype,$pb upd);1016 pb_distro_installdeps($f,$dtype,$pbins); 1005 1017 pb_system("rpmbuild $specialdef --define \"packager $ENV{'PBPACKAGER'}\" --define \"_topdir $ENV{'PBBUILDDIR'}\" -ba $f","Building package with $f under $ENV{'PBBUILDDIR'}","verbose"); 1006 1018 last; … … 1028 1040 1029 1041 pb_distro_setuprepo($ddir,$dver,$arch,$dtype); 1030 pb_distro_installdeps("debian/control",$dtype,$pb upd);1042 pb_distro_installdeps("debian/control",$dtype,$pbins); 1031 1043 pb_system("dpkg-buildpackage -us -uc -rfakeroot","Building package","verbose"); 1032 1044 # Get the name of the generated packages … … 1081 1093 foreach my $f (@ebuildfile) { 1082 1094 if ($f =~ /\.ebuild$/) { 1083 pb_distro_installdeps($f,$dtype,$pb upd);1095 pb_distro_installdeps($f,$dtype,$pbins); 1084 1096 move($f,"$tmpd/$pbpkg-$pbver.ebuild"); 1085 1097 pb_system("cd $tmpd ; ebuild $pbpkg-$pbver.ebuild clean ; ebuild $pbpkg-$pbver.ebuild digest ; ebuild $pbpkg-$pbver.ebuild package","verbose"); … … 1101 1113 symlink "pbconf/$ddir-$dver-$arch","install" || die "Unable to symlink to pbconf/$ddir-$dver-$arch"; 1102 1114 if (-x "install/pbslack") { 1103 pb_distro_installdeps("./install/pbslack",$dtype,$pb upd);1115 pb_distro_installdeps("./install/pbslack",$dtype,$pbins); 1104 1116 pb_system("./install/pbslack","Building software"); 1105 1117 pb_system("sudo /sbin/makepkg -p -l y -c y $pbpkg","Packaging $pbpkg","verbose"); … … 1257 1269 my $src = ""; 1258 1270 my ($odir,$over,$oarch) = (undef, undef, undef); 1259 my ($ddir, $dver, $dfam, $dtype, $dos, $pbsuf, $pbupd, $ darch);1271 my ($ddir, $dver, $dfam, $dtype, $dos, $pbsuf, $pbupd, $pbins, $darch); 1260 1272 1261 1273 if ($cmt ne "Announce") { … … 1268 1280 ($odir,$over,$oarch) = split(/-/,$v); 1269 1281 } 1270 ($ddir, $dver, $dfam, $dtype, $dos, $pbsuf, $pbupd, $ darch) = pb_distro_init($odir,$over,$oarch);1271 pb_log(2,"DEBUG: distro tuple: ".join(',',($ddir, $dver, $dfam, $dtype, $pbsuf, $ darch))."\n");1282 ($ddir, $dver, $dfam, $dtype, $dos, $pbsuf, $pbupd, $pbins, $darch) = pb_distro_init($odir,$over,$oarch); 1283 pb_log(2,"DEBUG: distro tuple: ".join(',',($ddir, $dver, $dfam, $dtype, $pbsuf, $pbupd, $pbins, $darch))."\n"); 1272 1284 1273 1285 # Get list of packages to build … … 2315 2327 my ($name,$ver,$darch) = split(/-/,$v); 2316 2328 chomp($darch); 2317 my ($ddir, $dver, $dfam, $dtype, $dos, $pbsuf, $pbupd ) = pb_distro_init($name,$ver,$darch);2329 my ($ddir, $dver, $dfam, $dtype, $dos, $pbsuf, $pbupd, $pbins) = pb_distro_init($name,$ver,$darch); 2318 2330 2319 2331 # Name of the account to deal with for VM/VE … … 2514 2526 # And we now need the conf file required for this to work created above 2515 2527 2516 my ($ddir, $dver, $dfam, $dtype, $dos, $pbsuf, $pbupd, $ darch) = pb_distro_init();2517 print "distro tuple: ".join(',',($ddir, $dver, $dfam, $dtype, $pbsuf, $ darch))."\n";2528 my ($ddir, $dver, $dfam, $dtype, $dos, $pbsuf, $pbupd, $pbins, $darch) = pb_distro_init(); 2529 print "distro tuple: ".join(',',($ddir, $dver, $dfam, $dtype, $pbsuf, $pbupd, $pbins, $darch))."\n"; 2518 2530 2519 2531 # Adapt sudoers … … 2575 2587 2576 2588 my $pkgdep = pb_distro_get_param($ddir,$dver,$darch,$ospkgdep,$dfam,$dtype,$dos); 2577 pb_distro_installdeps(undef,$dtype,$pb upd,pb_distro_only_deps_needed($dtype,join(' ',split(/,/,$pkgdep))));2589 pb_distro_installdeps(undef,$dtype,$pbins,pb_distro_only_deps_needed($dtype,join(' ',split(/,/,$pkgdep)))); 2578 2590 2579 2591 EOF … … 2602 2614 my $pkgforpb = pb_distro_get_param($ddir,$dver,$darch,$pbpkg,$dfam,$dtype,$depdos); 2603 2615 pb_distro_setuprepo($ddir,$dver,$darch,$dtype); 2604 pb_distro_installdeps(undef,$dtype,$pb upd,pb_distro_only_deps_needed($dtype,join(' ',split(/,/,$pkgforpb))));2616 pb_distro_installdeps(undef,$dtype,$pbins,pb_distro_only_deps_needed($dtype,join(' ',split(/,/,$pkgforpb)))); 2605 2617 EOF 2606 2618 } else { … … 2653 2665 $pbaccount = "root"; 2654 2666 2655 # Force shutdown of VM ex ept if it was already launched2667 # Force shutdown of VM except if it was already launched 2656 2668 my $pbforce = 0; 2657 2669 if ((! $vmexist) && ($vtype eq "vm")) { … … 2688 2700 pb_system("sudo rm -f $vepath->{$ENV{'PBPROJ'}}/$ddir-$dver-$darch.tar.gz","Removing previous snapshot $ddir-$dver-$darch.tar.gz"); 2689 2701 } 2690 2691 # Name of the account to deal with for VM/VE2692 # Do not use the one passed potentially with -a2693 my ($vmexist,$vmpid);2694 2702 2695 2703 # Prepare the script to be executed on the VM/VE … … 2707 2715 # Force snapshot of VM/VE 2708 2716 pb_script2v($pbscript,$vtype,1,$v,1); 2717 } 2718 return; 2719 } 2720 2721 # Function to update a VMs or VEs with the latest distribution content 2722 sub pb_update2v { 2723 2724 my $vtype = shift; 2725 2726 my ($vm,$all) = pb_get2v($vtype); 2727 2728 # Script generated 2729 my $pbscript = "$ENV{'PBDESTDIR'}/updatev"; 2730 2731 my ($pbac) = pb_conf_get($vtype."login"); 2732 2733 foreach my $v (@$vm) { 2734 # Get distro context 2735 my ($name,$ver,$darch) = split(/-/,$v); 2736 chomp($darch); 2737 my ($ddir, $dver, $dfam, $dtype, $dos, $pbsuf, $pbupd, $pbins) = pb_distro_init($name,$ver,$darch); 2738 2739 # Prepare the script to be executed on the VM/VE 2740 # in $ENV{'PBDESTDIR'}/updatev 2741 open(SCRIPT,"> $pbscript") || die "Unable to create $pbscript"; 2742 2743 print SCRIPT << 'EOF'; 2744 #!/bin/bash 2745 sleep 2 2746 EOF 2747 # VE needs a good /proc 2748 if ($vtype eq "ve") { 2749 print SCRIPT "sudo mount -t proc /proc /proc\n"; 2750 } 2751 print SCRIPT "$pbupd\n"; 2752 if ($vtype eq "ve") { 2753 print SCRIPT "sudo umount /proc\n"; 2754 } 2755 close(SCRIPT); 2756 chmod 0755,"$pbscript"; 2757 2758 # Force shutdown of VM except 2759 pb_script2v($pbscript,$vtype,1,$v); 2709 2760 } 2710 2761 return;
Note:
See TracChangeset
for help on using the changeset viewer.