Changeset 310 in ProjectBuilder for devel/pb/bin
- Timestamp:
- Feb 7, 2008, 7:59:40 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb/bin/pb
r309 r310 146 146 } elsif ($action =~ /^newver$/) { 147 147 pb_newver(); 148 } elsif ($action =~ /^newchroot$/) { 149 pb_launchchroot($ENV{'PBCHROOT'},1); 148 150 } elsif ($action =~ /^newvm$/) { 149 151 pb_launchvm($ENV{'PBVM'},1); … … 428 430 429 431 chdir "$pbpkg-$pbver" || die "Unable to chdir to $pbpkg-$pbver"; 432 pb_rm_rf("debian"); 430 433 symlink "pbconf/$ddir-$dver","debian" || die "Unable to symlink to pbconf/$ddir-$dver"; 431 434 chmod 0755,"debian/rules"; … … 662 665 } 663 666 667 sub pb_launchchroot { 668 # Virtual env. 669 my $ve = shift; 670 my $create = shift || 0; # By default do not create a chroot 671 672 #die "-i iso parameter needed" if (((not defined $iso) || ($iso eq "")) && ($create != 0)); 673 #die "No VM defined, unable to launch" if (not defined $ve); 674 675 # Keep only the first chroot in case many were given 676 $ve =~ s/,.*//; 677 678 # Launch the chroot 679 my ($ptr,$veopt,$veport,$vepath,$vetmout,$vesize) = pb_conf_get("vetype","veopt","veport","vepath","vetmout","vesize"); 680 my $vetype = $ptr->{$ENV{'PBPROJ'}}; 681 if (not defined $ENV{'PBCHROOTOPT'}) { 682 $ENV{'PBCHROOTOPT'} = ""; 683 } 684 if (defined $veopt->{$ENV{'PBPROJ'}}) { 685 $ENV{'PBVMOPT'} .= " $veopt->{$ENV{'PBPROJ'}}" if ($ENV{'PBVMOPT'} !~ / $veopt->{$ENV{'PBPROJ'}}/); 686 } 687 my $nport = $veport->{$ENV{'PBPROJ'}}; 688 $nport = "$pbport" if (defined $pbport); 689 690 my $cmd; 691 my $vecmd; # has to be used for pb_check_ps 692 my $vem; # has to be used for pb_check_ps 693 if ($vetype eq "qemu") { 694 my $arch = `uname -m`; 695 chomp($arch); 696 my $qemucmd32; 697 my $qemucmd64; 698 if ($arch eq "x86_64") { 699 $qemucmd32 = "/usr/bin/qemu-system-i386"; 700 $qemucmd64 = "/usr/bin/qemu"; 701 } else { 702 $qemucmd32 = "/usr/bin/qemu"; 703 $qemucmd64 = "/usr/bin/qemu-system-x86_64"; 704 } 705 if ($ve =~ /_64/) { 706 $vecmd = "$qemucmd64 -no-kqemu"; 707 } else { 708 $vecmd = "$qemucmd32"; 709 } 710 $vem = "$vepath->{$ENV{'PBPROJ'}}/$ve.qemu"; 711 if ($create != 0) { 712 $ENV{'PBVMOPT'} .= " -cdrom $iso -boot d"; 713 } 714 $cmd = "$vecmd $ENV{'PBVMOPT'} -redir tcp:$nport:10.0.2.15:22 $vem" 715 } elsif ($vetype eq "xen") { 716 } elsif ($vetype eq "vmware") { 717 } else { 718 die "VM of type $vetype not supported. Report to the dev team"; 719 } 720 my ($tmpcmd,$void) = split(/ +/,$cmd); 721 my $veexist = pb_check_ps($tmpcmd,$vem); 722 my $vepid = 0; 723 if (! $veexist) { 724 if ($create != 0) { 725 pb_system("/usr/bin/qemu-img create -f qcow2 $vem $vesize->{$ENV{'PBPROJ'}}","Creating the QEMU VM"); 726 } 727 if (! -f "$vem") { 728 print "Unable to find VM $vem\n"; 729 } else { 730 pb_system("$cmd &","Launching the VM $vem"); 731 pb_system("sleep $vetmout->{$ENV{'PBPROJ'}}","Waiting for VM $ve to come up"); 732 $vepid = pb_check_ps($tmpcmd,$vem); 733 } 734 } else { 735 print "Found an existing VM $vem (pid $veexist)\n"; 736 } 737 return($veexist,$vepid); 738 } 739 664 740 sub pb_launchvm { 665 741 my $vm = shift; … … 718 794 if (! $vmexist) { 719 795 if ($create != 0) { 720 pb_system("/usr/bin/qemu-img create -f qcow2 $vmm $vmsize->{$ENV{'PBPROJ'}}","Creating the QEMU VM"); 796 if (($vmtype eq "qemu") || ($vmtype eq "xen")) { 797 pb_system("/usr/bin/qemu-img create -f qcow2 $vmm $vmsize->{$ENV{'PBPROJ'}}","Creating the QEMU VM"); 798 } elsif ($vmtype eq "vmware") { 799 } else { 800 } 721 801 } 722 802 if (! -f "$vmm") { … … 907 987 print "Syntax: pb [-vhqt][-r pbroot][-p project][[-s script -a account -P port] -m \"mach-1[,...]\"][-i iso] <action> [<pkg1>...]\n"; 908 988 print "\n"; 909 print "-h 910 print "-q 911 print "-t 912 print "-v 913 print "\n"; 914 print "-m machine 915 print " 916 print " 917 print "\n"; 918 print "-s script :Name of the script you want\n";919 print " 920 print "\n"; 921 print "-i iso :Name of the ISO image of the distribution you want\n";922 print " 923 print "\n"; 924 print "-a account 925 print " 926 print "\n"; 927 print "-P port :Number of the port to use\n";928 print " 929 print "\n"; 930 print "-p project 931 print " 932 print "\n"; 933 print "-r pbroot :Path Name of project under the CMS \n";934 print " 935 print "\n"; 936 print "-V newver :New version of the project to create\n";937 print " 989 print "-h: This help file\n"; 990 print "-q: Quiet mode\n"; 991 print "-t: Test mode (not done yet)\n"; 992 print "-v: Verbose mode\n"; 993 print "\n"; 994 print "-m machine: Name of the Virtual Machines (VM) you want\n"; 995 print " to build on (coma separated). All if none precised\n"; 996 print " (or use the env variable PBVM) \n"; 997 print "\n"; 998 print "-s script: Name of the script you want\n"; 999 print " to execute on the related VMs.\n"; 1000 print "\n"; 1001 print "-i iso: Name of the ISO image of the distribution you want\n"; 1002 print " to install on the related VMs.\n"; 1003 print "\n"; 1004 print "-a account: Name of the account to use\n"; 1005 print " to connect on the related VMs.\n"; 1006 print "\n"; 1007 print "-P port: Number of the port to use\n"; 1008 print " to connect on the related VMs.\n"; 1009 print "\n"; 1010 print "-p project: Name of the project you're working on\n"; 1011 print " (or use the env variable PBPROJ) \n"; 1012 print "\n"; 1013 print "-r pbroot: Path Name of project under the CMS \n"; 1014 print " (or use the env variable PBROOT) \n"; 1015 print "\n"; 1016 print "-V newver: New version of the project to create\n"; 1017 print " from the current one. \n"; 938 1018 print "\n"; 939 1019 print "<action> can be:\n"; 940 1020 print "\n"; 941 print "\tcms2build: Create tar files for the project under your CMS\n"; 942 print "\t CMS supported are SVN and CVS\n"; 943 print "\t parameters are packages to build\n"; 944 print "\t if not using default list\n"; 945 print "\n"; 946 print "\tbuild2pkg: Create packages for your running distribution \n"; 947 print "\n"; 948 print "\tcms2pkg: cms2build + build2pkg\n"; 949 print "\n"; 950 print "\tbuild2ssh: Send the tar files to a SSH host \n"; 951 print "\n"; 952 print "\tcms2ssh: cms2build + build2ssh\n"; 953 print "\n"; 954 print "\tpkg2ssh: Send the packages built to a SSH host \n"; 955 print "\n"; 956 print "\tbuild2vm: Create packages in VMs, launching them if needed\n"; 957 print "\t and send those packages to a SSH host once built\n"; 958 print "\t VM type supported are QEMU \n"; 959 print "\n"; 960 print "\tcms2vm: cms2build + build2vm\n"; 961 print "\n"; 962 print "\tlaunchvm: Launch one virtual machine\n"; 963 print "\n"; 964 print "\tscript2vm: Launch one virtual machine if needed \n"; 965 print "\t and executes a script on it \n"; 966 print "\n"; 967 print "\tnewvm: Create a new virtual machine\n"; 968 print "\n"; 969 print "\tnewver: Create a new version of the project derived \n"; 970 print "\t from the current one \n"; 971 print "\n"; 972 print "\tnewproj: Create a new project and a template set of \n"; 973 print "\t configuration files under pbconf \n"; 974 print "\n"; 975 } 1021 print "\tcms2build: Create tar files for the project under your CMS\n"; 1022 print "\t CMS supported are SVN and CVS\n"; 1023 print "\t parameters are packages to build\n"; 1024 print "\t if not using default list\n"; 1025 print "\n"; 1026 print "\tbuild2pkg: Create packages for your running distribution \n"; 1027 print "\n"; 1028 print "\tcms2pkg: cms2build + build2pkg\n"; 1029 print "\n"; 1030 print "\tbuild2ssh: Send the tar files to a SSH host \n"; 1031 print "\n"; 1032 print "\tcms2ssh: cms2build + build2ssh\n"; 1033 print "\n"; 1034 print "\tpkg2ssh: Send the packages built to a SSH host \n"; 1035 print "\n"; 1036 print "\tbuild2vm: Create packages in VMs, launching them if needed\n"; 1037 print "\t and send those packages to a SSH host once built\n"; 1038 print "\t VM type supported are QEMU \n"; 1039 print "\n"; 1040 print "\tbuild2chroot: Create packages in a chroot, creating it if needed\n"; 1041 print "\t and send those packages to a SSH host once built\n"; 1042 print "\n"; 1043 print "\tcms2vm: cms2build + build2vm\n"; 1044 print "\n"; 1045 print "\tlaunchvm: Launch one virtual machine\n"; 1046 print "\n"; 1047 print "\tscript2vm: Launch one virtual machine if needed \n"; 1048 print "\t and executes a script on it \n"; 1049 print "\n"; 1050 print "\tnewvm: Create a new virtual machine\n"; 1051 print "\n"; 1052 print "\tnewchroot: Create a new chroot environment\n"; 1053 print "\n"; 1054 print "\tnewver: Create a new version of the project derived \n"; 1055 print "\t from the current one \n"; 1056 print "\n"; 1057 print "\tnewproj: Create a new project and a template set of \n"; 1058 print "\t configuration files under pbconf \n"; 1059 print "\n"; 1060 }
Note:
See TracChangeset
for help on using the changeset viewer.