Changeset 1545 in ProjectBuilder for devel/pb/bin
- Timestamp:
- May 14, 2012, 4:13:43 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb/bin/pb
r1542 r1545 533 533 =head2 setupve 534 534 535 The setupve command prepares a virtual environment for use by project builder. In particular it installs project-builder from the packages into the virtual environment. For example: 535 The setupve command prepares a virtual environment for use by project builder. In particular it installs project-builder from the packages into the virtual environment. Two sub-steps are necessary: 536 537 =over 4 538 539 =item Update $project.pb 540 541 You need to have a sshhost entry for setupve to work, so add one, even an invalid one, e.g.: 542 543 sshhost $project = foo.example.org 544 545 =item Setup the virtual environment 536 546 537 547 % pb -v -p $project -m debian-6.0-i386 setupve 538 548 539 549 If you prefer to install the current SVN version of project builder, you can substitute the setupve option by the sbx2setupv one. 550 551 =back 552 553 =head2 build2ve 554 555 The build2ve command is similar to the build2pkg command in that it will take the sources created by cms2build and turn them into binary packages. The command has two differences. First, it creates the packages in a virtual environment, i.e. the one made by an earlier setupve setup. Second it copies the resulting packages to a repository and builds the repository meta-data needed. 556 557 Two sub-steps are needed: 558 559 =over 4 560 561 =item Update $project.pb 562 563 You need to have a valid sshdir and sshhost entry for build2ve to work, so add them. Note that you need to be able to ssh from the host you run the command on to the repository host, preferably without needing to type in a password, so using ssh-agent or having a special passwordless project-builder ssh key will make this step easier. 564 565 sshhost $project = localhost 566 sshdir $project = $home/cache-project-builder/repos 567 568 =item Build the packages and copy them to the repository 569 570 % pb -v -p $project -m debian-6.0-i386 build2ve 571 572 =back 573 574 *Debugging:* If the build fails (and you did not specify the --no-stop-on-error) option, then the virtual environment and scripts should still be present and configured to build the package. You can run a command like 'sudo setarch i386 chroot $path bash' in order to get into the environment. In your log you should see a command like that. From there you can go into the /home/pb directory as the pb user and run the same style of pb commands as you did when doing build2pkg. This will help you figure out what has gone wrong in the build in the virtual environment. 540 575 541 576 =head1 AUTHORS … … 1329 1364 my $made = ""; # pkgs made during build 1330 1365 my $pm; 1331 $pm = new Parallel::ForkManager($pbparallel) if (defined $pbparallel); 1366 my $all_ok = 1; 1367 1368 if (defined $pbparallel) { 1369 $pm = new Parallel::ForkManager($pbparallel); 1370 $pm->run_on_finish(sub { my ($pid, $code, $id, $signal, $dump) = @_; 1371 $all_ok = 0 unless (($code == 0) && ($signal == 0) && ($dump == 0)); }); 1372 } 1332 1373 1333 1374 # We need to communicate info back from the children if parallel so prepare a dir for that … … 1453 1494 # Get the name of the generated packages 1454 1495 open(LOG,"$ENV{'PBTMP'}/system.$$.log") || die "Unable to open $ENV{'PBTMP'}/system.$$.log"; 1496 my $tmp = ""; 1455 1497 while (<LOG>) { 1456 1498 chomp(); 1457 my $tmp = $_;1458 next if ($tmp !~ /^dpkg-deb.*:/);1459 $tmp =~ s|.*\.\./(.*)_(.*).deb.*|$1|;1460 $made ="$made $tmp.dsc $tmp.tar.gz $tmp"."_*.deb $tmp"."_*.changes";1499 next unless (/^dpkg-deb.*:\s+building\s+package\s+.*\s+in\s+\`\.\.\/(\S+)\'\./o); 1500 $tmp = $1; 1501 die "Missing file $tmp" if (not -f $tmp); 1502 $made = "$made $tmp"; 1461 1503 } 1462 1504 close(LOG); 1505 open(CTRL,"debian/control") or die "Unable to open debian/control: $!"; 1506 #$made="$made $tmp.dsc $tmp.tar.gz $tmp"."_*.deb $tmp"."_*.changes"; 1507 while (<CTRL>) { 1508 next unless (/^Source: (\S+)/o); 1509 foreach my $glob (("$1\_*.changes", "$1\_*.dsc", "$1\_*.tar.gz")) { 1510 my @file = glob($glob); 1511 die "Missing file for $glob" unless @file > 0; 1512 die "Too many files for $glob" if @file > 1; 1513 die "Missing file $file[0]" if (not -f $file[0]); 1514 $made .= " $file[0]"; 1515 } 1516 } 1517 close(CTRL); 1518 pb_display_file("$ENV{'PBTMP'}/system.$$.log"); 1519 1463 1520 chdir ".." || die "Unable to chdir to parent dir"; 1464 1521 pb_rm_rf("$pbpkg-$pbver"); … … 1619 1676 $made .= " ".pb_get_content($f); 1620 1677 } 1678 die "Aborting, one or more of the children failed.\n" if ((not $all_ok) && ($Global::pb_stop_on_error)); 1621 1679 pb_rm_rf($tmpd); 1622 1680 } … … 1661 1719 1662 1720 # Keep track of what is generated so that we can get them back from VMs/RMs 1663 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'}"; 1721 my $pbkeep = "$ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}-$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}"; 1722 open(KEEP,"> $pbkeep") || die "Unable to create $pbkeep: $!"; 1664 1723 print KEEP "$made\n"; 1665 1724 close(KEEP); … … 2110 2169 my ($ptr) = pb_conf_get("vetype"); 2111 2170 my $vetype = $ptr->{$ENV{'PBPROJ'}}; 2171 my $arch = pb_get_arch(); 2112 2172 if ($vetype eq "chroot") { 2113 2173 $shcmd = "sudo /usr/sbin/chroot $tpdir /bin/su - $mac -c "; … … 2115 2175 $shcmd = "schroot $tp -u $mac -- "; 2116 2176 } 2177 $sshcmd = "setarch i386 $sshcmd" if (($pbos->{'arch'} =~ /i?86/) && ($arch eq 'x86_64')); 2117 2178 $cpcmd = "sudo /bin/cp -r "; 2118 2179 # We need to get the home dir of the target account to deliver in the right place … … 2148 2209 } else { 2149 2210 my $keyfile = pb_ssh_get(0); 2211 my $keyopt = defined $keyfile ? "-i $keyfile" : ""; 2150 2212 my $sshcmd = pb_check_req("ssh",1); 2151 2213 my $scpcmd = pb_check_req("scp",1); 2152 $shcmd = "$sshcmd -i $keyfile -q -o UserKnownHostsFile=/dev/null-p $nport $mac";2153 $cpcmd = "$scpcmd -i $keyfile -p -o UserKnownHostsFile=/dev/null-P $nport";2214 $shcmd = "$sshcmd $keyopt -q -o NoHostAuthenticationForLocalhost=yes -p $nport $mac"; 2215 $cpcmd = "$scpcmd $keyopt -p -o NoHostAuthenticationForLocalhost=yes -P $nport"; 2154 2216 $cptarget = "$mac:$tdir"; 2155 2217 if ($cmt =~ /^(V|R)Mbuild/) { … … 2505 2567 my $pbos = shift; 2506 2568 2569 # VE gets time from parent OS. 2570 return "/bin/true" if ($vtype) =~ /^ve/o; 2571 2507 2572 my ($ntp) = pb_conf_get_if($vtype."ntp"); 2508 2573 my $vntp = $ntp->{$ENV{'PBPROJ'}} if (defined $ntp); … … 2567 2632 $i++; 2568 2633 } 2634 print SCRIPT "set -e\n" if $Global::pb_stop_on_error; 2569 2635 # Activate script verbosity if at least 2 for pbdebug 2570 2636 print SCRIPT "set -x\n" if ($i gt 1); … … 2583 2649 } 2584 2650 2585 # VE needs a good /proc 2651 # VE needs a good /proc, tolerate one being potentially left around after a failure 2586 2652 if ($vtype eq "ve") { 2587 print SCRIPT " sudo /bin/mount -t proc /proc /proc\n";2653 print SCRIPT "[ -d /proc/1 ] || sudo /bin/mount -t proc /proc /proc\n"; 2588 2654 } 2589 2655 … … 2593 2659 my $ntpline = pb_date2v($vtype,$pbos); 2594 2660 print SCRIPT "# Time sync\n"; 2595 print SCRIPT "echo 'setting up date with '"; 2596 print SCRIPT "echo $ntpline\n"; 2661 print SCRIPT "echo setting up date with $ntpline\n"; 2597 2662 print SCRIPT "$ntpline\n"; 2598 2663 # Use potential local proxy declaration in case we need it to download repo, pkgs, ... … … 3255 3320 3256 3321 # Adds pb_distro_get_context and all functions needed from ProjectBuilder::Distribution, Conf and Base 3257 foreach my $ d (@INC) {3258 my @f = ("$d/ProjectBuilder/Base.pm","$d/ProjectBuilder/Distribution.pm","$d/ProjectBuilder/Conf.pm");3259 foreach my $f (@f) {3322 foreach my $m ("ProjectBuilder/Base.pm","ProjectBuilder/Distribution.pm","ProjectBuilder/Conf.pm") { 3323 foreach my $d (@INC) { 3324 my $f = "$d/$m"; 3260 3325 if (-f "$f") { 3261 open(PBD,"$f") || die "Unable to open $f ";3326 open(PBD,"$f") || die "Unable to open $f: $!"; 3262 3327 while (<PBD>) { 3263 3328 next if (/^package/); … … 3268 3333 } 3269 3334 close(PBD); 3335 # We just need the first one of each file wrt @INC - hopefully that's the right one. 3336 last; 3270 3337 } 3271 3338 } … … 3841 3908 my $create = shift || 0; # Do not create keys by default 3842 3909 3910 my ($pbagent) = pb_conf_get_if("pbusesshagent"); 3911 # use ssh-agent if asked so. 3912 return(undef) if (($create == 0) && (defined $pbagent->{$ENV{'PBPROJ'}}) && ($pbagent->{$ENV{'PBPROJ'}} =~ /true/io)); 3913 3843 3914 # Check the SSH environment 3844 3915 my $keyfile = undef; … … 3853 3924 $keyfile = "$ENV{'HOME'}/.ssh/id_dsa" if (-s "$ENV{'HOME'}/.ssh/id_dsa"); 3854 3925 $keyfile = "$ENV{'HOME'}/.ssh/pb_dsa" if (-s "$ENV{'HOME'}/.ssh/pb_dsa"); 3855 die "Unable to find your public ssh key under $ keyfile" if (not defined $keyfile);3926 die "Unable to find your public ssh key under $ENV{'HOME'}/.ssh" if (not defined $keyfile); 3856 3927 return($keyfile); 3857 3928 } … … 4149 4220 } 4150 4221 my $debsigncmd = pb_check_req("debsign",1); 4151 pb_system("$debsigncmd -m\'$ENV{'PBPACKAGER'}\' $changes","Signing DEB packages" ) if ($changes ne "");4222 pb_system("$debsigncmd -m\'$ENV{'PBPACKAGER'}\' $changes","Signing DEB packages",undef,1) if ($changes ne ""); 4152 4223 } else { 4153 4224 pb_log(0,"I don't know yet how to sign packages for type $pbos->{'type'}.\nPlease give feedback to dev team\n");
Note:
See TracChangeset
for help on using the changeset viewer.