- Timestamp:
- Feb 15, 2011, 3:48:55 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb/bin/pb
r1186 r1189 847 847 # Get list of distributions for which we need to generate build files if no target 848 848 if (not defined ($pbtarget)) { 849 my @pt = pb_conf_get_if("vmlist","velist" );849 my @pt = pb_conf_get_if("vmlist","velist","rmlist"); 850 850 if (defined $pt[0]->{$ENV{'PBPROJ'}}) { 851 851 $tmpl .= $pt[0]->{$ENV{'PBPROJ'}}; … … 857 857 } 858 858 $tmpl .= $pt[1]->{$ENV{'PBPROJ'}} 859 } 860 if (defined $pt[2]->{$ENV{'PBPROJ'}}) { 861 # The lists needs to be grouped with a ',' separating them 862 if ($tmpl ne "") { 863 $tmpl .= ","; 864 } 865 $tmpl .= $pt[2]->{$ENV{'PBPROJ'}} 859 866 } 860 867 } … … 905 912 $pm = new Parallel::ForkManager($pbparallel) if (defined $pbparallel); 906 913 914 pb_log(0,"Preparing delivery ...\n"); 907 915 foreach my $v (keys %virt) { 908 916 $pm->start and next if (defined $pbparallel); … … 911 919 my $pbos = pb_distro_get_context($v); 912 920 $pb->{'pbos'} = $pbos; 921 $pb->{'suf'} = $pbos->{'suffix'}; 913 922 pb_log(3,"DEBUG: pb: ".Dumper($pb)."\n"); 914 923 … … 1452 1461 1453 1462 # Keep track of what is generated so that we can get them back from VMs/RMs 1454 open(KEEP,"> $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'} ") || die "Unable to create $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}";1463 open(KEEP,"> $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}-$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}") || die "Unable to create $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}-$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}"; 1455 1464 print KEEP "$made\n"; 1456 1465 close(KEEP); … … 1580 1589 } elsif ($cmt eq "Packages") { 1581 1590 # Get package list from file made during build2pkg 1582 open(KEEP,"$ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'} ") || die "Unable to read $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}";1591 open(KEEP,"$ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}-$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}") || die "Unable to read $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}-$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}"; 1583 1592 $src = <KEEP>; 1584 1593 chomp($src); 1585 1594 close(KEEP); 1586 $src="$src $ENV{'PBBUILDDIR'}/pbscript ";1595 $src="$src $ENV{'PBBUILDDIR'}/pbscript.$$"; 1587 1596 } 1588 1597 # Remove potential leading spaces (cause problem with basename) … … 1649 1658 1650 1659 # Repository management 1651 open(PBS,"> $ENV{'PBBUILDDIR'}/pbscript ") || die "Unable to create $ENV{'PBBUILDDIR'}/pbscript";1660 open(PBS,"> $ENV{'PBBUILDDIR'}/pbscript.$$") || die "Unable to create $ENV{'PBBUILDDIR'}/pbscript.$$"; 1652 1661 if ($pbos->{'type'} eq "rpm") { 1653 1662 # Also make a pbscript to generate yum/urpmi bases … … 1813 1822 } 1814 1823 close(PBS); 1815 chmod 0755,"$ENV{'PBBUILDDIR'}/pbscript ";1824 chmod 0755,"$ENV{'PBBUILDDIR'}/pbscript.$$"; 1816 1825 } else { 1817 1826 return; … … 1883 1892 # Use the right script name depending on context 1884 1893 my $pbscript; 1885 if ( $cmt =~ /^(V[EM]|RM)/){1894 if (($cmt =~ /^(V[EM]|RM)/) || ($cmt =~ /Packages/)){ 1886 1895 $pbscript = "pbscript.$$"; 1887 1896 } else { … … 1892 1901 if ($cmt =~ /^(V[EM]|RM)build/) { 1893 1902 # Get back info on pkg produced, compute their name and get them from the VM/RM 1894 pb_system("$cpcmd $cp2target/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'} $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.$$ 2> /dev/null","Get package names in $cp2target");1903 pb_system("$cpcmd $cp2target/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}-$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'} $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.$$ 2> /dev/null","Get package names in $cp2target"); 1895 1904 # For VE we need to change the owner manually 1896 1905 if ($cmt eq "VEbuild") { … … 1918 1927 } 1919 1928 1920 open(KEEP,"> $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'} ") || die "Unable to write $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}";1929 open(KEEP,"> $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}-$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}") || die "Unable to write $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}-$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}"; 1921 1930 foreach my $p (split(/ +/,$src)) { 1922 1931 my $j = basename($p); … … 1944 1953 } 1945 1954 } 1946 unlink("$ENV{'PBDESTDIR'}/pbscript.$$") if ( $cmt =~ /^(V[ME]|RM)/);1955 unlink("$ENV{'PBDESTDIR'}/pbscript.$$") if (($cmt =~ /^(V[ME]|RM)/) || ($cmt =~ /Packages/)); 1947 1956 1948 1957 pb_log(2,"Before halt, vmexist: $vmexist, vmpid: $vmpid\n"); … … 2952 2961 # Try to restrict security to what is really needed 2953 2962 if ($vtype =~ /^vm/) { 2954 my $sudocmds = pb_get_sudocmds($pbos);2963 my @sudocmds = pb_get_sudocmds($pbos); 2955 2964 my $hpath = "/sbin"; 2956 2965 # Solaris has halt elsewhere … … 2964 2973 print PBOUT "$pbac->{$ENV{'PBPROJ'}} localhost=NOPASSWD:$hpath/halt\n"; 2965 2974 EOF 2966 foreach my $c ( $sudocmds) {2967 print SCRIPT "print PBOUT \"$pbac->{$ENV{'PBPROJ'}} localhost=NOPASSWD:$c\n\" ";2975 foreach my $c (@sudocmds) { 2976 print SCRIPT "print PBOUT \"$pbac->{$ENV{'PBPROJ'}} localhost=NOPASSWD:$c\n\";"; 2968 2977 } 2969 2978 } elsif ($vtype =~ /^rm/) { 2970 my $sudocmds = pb_get_sudocmds($pbos);2979 my @sudocmds = pb_get_sudocmds($pbos); 2971 2980 print SCRIPT << "EOF"; 2972 2981 # Build account $pbac->{$ENV{'PBPROJ'}} in RM only needs to setup date and install deps if needed each time 2973 2982 EOF 2974 foreach my $c ( $sudocmds) {2975 print SCRIPT "print PBOUT \"$pbac->{$ENV{'PBPROJ'}} localhost=NOPASSWD:$c\n\" ";2983 foreach my $c (@sudocmds) { 2984 print SCRIPT "print PBOUT \"$pbac->{$ENV{'PBPROJ'}} localhost=NOPASSWD:$c\n\";"; 2976 2985 } 2977 2986 } else { … … 3072 3081 print SCRIPT << 'EOF'; 3073 3082 pb_system("pb 2>&1 | head -5",undef,"verbose"); 3083 pb_system("pbdistrocheck",undef,"verbose"); 3074 3084 EOF 3075 3085 if ($vtype eq "ve") {
Note:
See TracChangeset
for help on using the changeset viewer.