Changeset 1111 in ProjectBuilder
- Timestamp:
- Nov 18, 2010, 2:06:01 AM (14 years ago)
- Location:
- devel
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb-modules/bin/pbdistrocheck
r1071 r1111 121 121 @param = split(/-/,$dist) if (defined $dist); 122 122 123 my ($ddir, $dver, $dfam, $dtype, $dos, $pbsuf, $pbupd, $ arch) = pb_distro_init(@param);123 my ($ddir, $dver, $dfam, $dtype, $dos, $pbsuf, $pbupd, $pbins, $arch) = pb_distro_init(@param); 124 124 my $sep = "\n"; 125 125 if (defined $opts{'l'}) { … … 144 144 $pbsuf = "Suffix:\t$pbsuf"; 145 145 $pbupd = "Update:\t$pbupd"; 146 $pbins = "Install:\t$pbupd"; 146 147 $arch = "Arch:\t$arch"; 147 148 print "Project-Builder tuple:\n"; 148 149 } 149 print join($sep,($dos, $ddir, $dver, $arch, $dtype, $dfam, $pbsuf, $pbupd ))."\n";150 print join($sep,($dos, $ddir, $dver, $arch, $dtype, $dfam, $pbsuf, $pbupd, $pbins))."\n"; 150 151 } -
devel/pb-modules/etc/pb.conf
r1109 r1111 194 194 # key depends on granularity, value is install command 195 195 196 # Command to update the distribution to latest state 197 osupd du = sudo apt-get update 198 osupd gen = sudo emerge 199 osupd rpm = sudo yum clean all; sudo yum -y update 200 osupd md = sudo urpmi.update -a ; sudo urpmi --autoa--auto-select 201 osupd opensuse = sudo zypper -n update 202 osupd sol = /bin/true 203 osupd lsb = /bin/true 204 196 205 # Chaining the commands allow to only test for what is able to be installed, 197 206 # not the update of the repo which may well be unaccessible if too old 198 os upddu = sudo apt-get update ; sudo apt-get -y install199 os updgen = sudo emerge200 os updrpm = sudo yum clean all; sudo yum -y update ; sudo yum -y install201 os updrhel-2.1 = sudo up2date -y202 os updrhel-3 = sudo up2date -y203 os updrhel-4 = sudo up2date -y204 os updmd = sudo urpmi.update -a ; sudo urpmi --auto205 os updnovell = export TERM=linux ; export PATH=\$PATH:/sbin:/usr/sbin ; sudo yast2 -i206 os updopensuse-10.2 = sudo yes | zypper install207 os updopensuse = sudo zypper -n install208 os updsol = sudo pkgadd -d209 os updlsb = /bin/true207 osins du = sudo apt-get update ; sudo apt-get -y install 208 osins gen = sudo emerge 209 osins rpm = sudo yum clean all; sudo yum -y update ; sudo yum -y install 210 osins rhel-2.1 = sudo up2date -y 211 osins rhel-3 = sudo up2date -y 212 osins rhel-4 = sudo up2date -y 213 osins md = sudo urpmi.update -a ; sudo urpmi --auto 214 osins novell = export TERM=linux ; export PATH=\$PATH:/sbin:/usr/sbin ; sudo yast2 -i 215 osins opensuse-10.2 = sudo yes | zypper install 216 osins opensuse = sudo zypper -n install 217 osins sol = sudo pkgadd -d 218 osins lsb = /bin/true 210 219 211 220 # From the most generic to the most specialized, in term of granularity, -
devel/pb-modules/etc/pb.conf.pod
r1109 r1111 102 102 Conffile: pb 103 103 Example: osfamily debian = du 104 105 =item B<osins> 106 107 Nature: Optional 108 Key: OS (could be from the most generic up to the most specific from ostype, osfamily, os, os-ver, os-ver-arch). The family name is generaly used here. 109 Value: OS command to lauch in order to automatically install packages on it. 110 Conffile: pb 111 Example: osins fedora = sudo yum -y install 104 112 105 113 =item B<osmindep> … … 196 204 Nature: Optional 197 205 Key: OS (could be from the most generic up to the most specific from ostype, osfamily, os, os-ver, os-ver-arch). The family name is generaly used here. 198 Value: OS command to lauch in order to automatically install packages on it.199 Conffile: pb 200 Example: os type rh = rpm, ostype md = rpm, ostype novell = rpm206 Value: OS command to lauch in order to automatically update th VM|VE 207 Conffile: pb 208 Example: osupd fedora = sudo yum -y update 201 209 202 210 =item B<pbconfurl> -
devel/pb-modules/lib/ProjectBuilder/Distribution.pm
r1102 r1111 42 42 # Return information on the running distro 43 43 # 44 my ($ddir, $dver, $dfam, $dtype, $pbsuf, $dos, $pbupd, $ arch) = pb_distro_init();45 print "distro tuple: ".Dumper($ddir, $dver, $dfam, $dtype, $pbsuf, $pbupd, $ arch)."\n";44 my ($ddir, $dver, $dfam, $dtype, $pbsuf, $dos, $pbupd, $pbins, $arch) = pb_distro_init(); 45 print "distro tuple: ".Dumper($ddir, $dver, $dfam, $dtype, $pbsuf, $pbupd, $pbins, $arch)."\n"; 46 46 # 47 47 # Return information on the requested distro 48 48 # 49 my ($ddir, $dver, $dfam, $dtype, $dos, $pbsuf, $pbupd, $ arch) = pb_distro_init("ubuntu","7.10","x86_64");50 print "distro tuple: ".Dumper($ddir, $dver, $dfam, $dtype, $pbsuf, $pbupd, $ arch)."\n";49 my ($ddir, $dver, $dfam, $dtype, $dos, $pbsuf, $pbupd, $pbins, $arch) = pb_distro_init("ubuntu","7.10","x86_64"); 50 print "distro tuple: ".Dumper($ddir, $dver, $dfam, $dtype, $pbsuf, $pbupd, $pbins, $arch)."\n"; 51 51 # 52 52 # Return information on the running distro 53 53 # 54 54 my ($ddir,$dver) = pb_distro_get(); 55 my ($ddir, $dver, $dfam, $dtype, $dos, $pbsuf, $pbupd, $ arch) = pb_distro_init($ddir,$dver);56 print "distro tuple: ".Dumper($ddir, $dver, $dfam, $dtype, $pbsuf, $pbupd, $ arch)."\n";55 my ($ddir, $dver, $dfam, $dtype, $dos, $pbsuf, $pbupd, $pbins, $arch) = pb_distro_init($ddir,$dver); 56 print "distro tuple: ".Dumper($ddir, $dver, $dfam, $dtype, $pbsuf, $pbupd, $pbins, $arch)."\n"; 57 57 58 58 =head1 USAGE … … 74 74 =item B<pb_distro_init> 75 75 76 This function returns a list of 7 parameters indicating the distribution name, version, family, type of build system, suffix of packages, update command line and architecture of the underlying Linux distribution. The value of the 7fields may be "unknown" in case the function was unable to recognize on which distribution it is running.76 This function returns a list of 8 parameters indicating the distribution name, version, family, type of build system, suffix of packages, update command line, installation command line and architecture of the underlying Linux distribution. The value of the 8 fields may be "unknown" in case the function was unable to recognize on which distribution it is running. 77 77 78 78 As an example, Ubuntu and Debian are in the same "du" family. As well as RedHat, RHEL, CentOS, fedora are on the same "rh" family. … … 98 98 my $dsuf = "unknown"; 99 99 my $dupd = "unknown"; 100 my $dins = "unknown"; 100 101 my $darch = shift || undef; 101 102 my $dnover = "false"; … … 113 114 $darch=pb_get_arch() if (not defined $darch); 114 115 115 my ($osfamily,$ostype,$osupd,$os suffix,$osnover,$osremovedotinver,$os) = pb_conf_get("osfamily","ostype","osupd","ossuffix","osnover","osremovedotinver","os");116 my ($osfamily,$ostype,$osupd,$osins,$ossuffix,$osnover,$osremovedotinver,$os) = pb_conf_get("osfamily","ostype","osupd","osins","ossuffix","osnover","osremovedotinver","os"); 116 117 117 118 # Dig into the tuple to find the best answer … … 120 121 $dos = pb_distro_get_param($ddir,$dver,$darch,$os,$dfam,$dtype); 121 122 $dupd = pb_distro_get_param($ddir,$dver,$darch,$osupd,$dfam,$dtype,$dos); 123 $dins = pb_distro_get_param($ddir,$dver,$darch,$osins,$dfam,$dtype,$dos); 122 124 $dsuf = pb_distro_get_param($ddir,$dver,$darch,$ossuffix,$dfam,$dtype,$dos); 123 125 $dnover = pb_distro_get_param($ddir,$dver,$darch,$osnover,$dfam,$dtype,$dos); … … 141 143 # $opt="--exclude=*.i?86"; 142 144 # } 143 pb_log(2,"DEBUG: pb_distro_init: $ddir, $dver, $dfam, $dtype, $dsuf, $dupd, $d arch\n");144 145 return($ddir, $dver, $dfam, $dtype, $dos, $dsuf, $dupd, $d arch);145 pb_log(2,"DEBUG: pb_distro_init: $ddir, $dver, $dfam, $dtype, $dsuf, $dupd, $dins, $darch\n"); 146 147 return($ddir, $dver, $dfam, $dtype, $dos, $dsuf, $dupd, $dins, $darch); 146 148 } 147 149 -
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; -
devel/rpmbootstrap/bin/rpmbootstrap
r1082 r1111 216 216 my ($name,$ver,$darch) = split(/-/,$ENV{'PBV'}); 217 217 chomp($darch); 218 my ($ddir, $dver, $dfam, $dtype, $dos, $pbsuf, $pbupd ) = pb_distro_init($name,$ver,$darch);218 my ($ddir, $dver, $dfam, $dtype, $dos, $pbsuf, $pbupd, $pbins) = pb_distro_init($name,$ver,$darch); 219 219 220 220 # … … 282 282 my $repo = $mirror; 283 283 my $found = 0; 284 if ($pb upd=~ /yum/) {284 if ($pbins =~ /yum/) { 285 285 my $response1; 286 286 while ($found == 0) { … … 334 334 my $osupdname = ""; 335 335 336 if ($pb upd=~ /yum/) {336 if ($pbins =~ /yum/) { 337 337 $oscachedir = "$vepath/var/cache/yum/core/packages/"; 338 338 $osupdcachedir = "$vepath/var/cache/yum/updates-released/packages/"; … … 344 344 $osupdcachedir = "$vepath/var/cache/yum/updates-released/packages/"; 345 345 } 346 } elsif ($pb upd=~ /zypper/) {346 } elsif ($pbins =~ /zypper/) { 347 347 $oscachedir = "$vepath/var/cache/zypp/packages/opensuse/suse/$darch"; 348 348 $osupdname = "Zypper"; 349 } elsif ($pb upd=~ /urpmi/) {349 } elsif ($pbins =~ /urpmi/) { 350 350 $oscachedir = "$vepath/var/cache/urpmi/rpms"; 351 351 $osupdname = "URPMI"; … … 418 418 419 419 # yum needs that distro-release package be installed, so force it 420 if ($pb upd=~ /yum/) {420 if ($pbins =~ /yum/) { 421 421 foreach my $p1 (<$cachedir/($ddir|redhat)-release-*.rpm>) { 422 422 copy("$cachedir/$p1","$vepath/tmp"); … … 461 461 462 462 pb_log(1,"Adapting $osupdname repository entries\n"); 463 if ($pb upd=~ /yum/) {463 if ($pbins =~ /yum/) { 464 464 # 465 465 # Force the architecture for yum … … 478 478 } 479 479 $minipkglist = "ldconfig yum passwd vim-minimal dhclient authconfig"; 480 } elsif ($pb upd=~ /zypper/) {480 } elsif ($pbins =~ /zypper/) { 481 481 pb_mkdir_p("$vepath/etc/zypp/repos.d"); 482 482 open(REPO,"> $vepath/etc/zypp/repos.d/$ddir-$dver") || die "Unable to create repo file"; … … 497 497 pb_system("chroot $vepath /bin/bash -c \"yes | /usr/bin/zypper sa $baseurl $ddir-$dver\"","Bootstrapping Zypper"); 498 498 } 499 } elsif ($pb upd=~ /urpmi/) {499 } elsif ($pbins =~ /urpmi/) { 500 500 # Setup the repo 501 501 my $baseurl = dirname(dirname(dirname($mirror))); … … 508 508 # No need for sudo here 509 509 # 510 $pb upd=~ s/sudo//g;511 pb_system("chroot $vepath /bin/bash -c \"$pb upd $minipkglist \"","Bootstrapping OS by running $pbupd$minipkglist");510 $pbins =~ s/sudo//g; 511 pb_system("chroot $vepath /bin/bash -c \"$pbins $minipkglist \"","Bootstrapping OS by running $pbins $minipkglist"); 512 512 513 513 # … … 520 520 if (defined $opts{'a'}) { 521 521 $opts{'a'} =~ s/,/ /g; 522 pb_system("chroot $vepath /bin/bash -c \"$pb upd $opts{'a'} \"","Adding packages to OS by running $pbupd$opts{'a'}");522 pb_system("chroot $vepath /bin/bash -c \"$pbins $opts{'a'} \"","Adding packages to OS by running $pbins $opts{'a'}"); 523 523 } 524 524 … … 527 527 # 528 528 pb_log(1,"Cleaning up\n"); 529 if ($pb upd=~ /yum/) {529 if ($pbins =~ /yum/) { 530 530 pb_system("chroot $vepath /usr/bin/yum clean all","Cleaning yum"); 531 531 }
Note:
See TracChangeset
for help on using the changeset viewer.