Changeset 891 in ProjectBuilder
- Timestamp:
- Oct 28, 2009, 10:25:19 AM (15 years ago)
- Location:
- devel
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb-modules/etc/pb.conf
r867 r891 191 191 osupd md = sudo urpmi.update -a ; sudo urpmi --auto 192 192 osupd novell = export TERM=linux ; export PATH=\$PATH:/sbin:/usr/sbin ; sudo yast2 -i 193 osupd sol = sudo pkgadd -d 193 194 194 195 # From the most generic to the most specialized, in term of granularity, … … 215 216 osremovedotinver mandrake = true 216 217 osremovedotinver redhat = true 218 219 # pb install dependencies per distro 220 # osperldep gives perl file dependecies to get from CPAN 221 # ospkgdep gives distribution package dependencies 222 # 223 # Asianux 224 osperldep asianux = Module-Build,File-MimeInfo,File-BaseDir,Mail-Sendmail 225 ospkgdep asianux = wget,make,perl-Date-Manip,perl-ExtUtils-MakeMaker,rpm-build,patch,ntp 226 # Fedora 227 osperldep fedora-4 = Module-Build,File-MimeInfo,File-BaseDir,Mail-Sendmail 228 ospkgdep fedora-4 = wget,make,perl-Date-Manip,perl-ExtUtils-MakeMaker,rpm-build,patch,ntp 229 osperldep fedora = 230 ospkgdep fedora = wget,make,perl-Date-Manip,perl-ExtUtils-MakeMaker,rpm-build,patch,ntp,perl-File-MimeInfo,perl-Mail-Sendmail 231 # Slack 232 osperldep tgz = Date-Manip,Module-Build,File-MimeInfo,File-BaseDir,Mail-Sendmail 233 ospkgdep tgz = wget,make,ntp,patch 234 # Old RedHat 235 osperldep redhat = Date-Manip,Module-Build,File-MimeInfo,File-BaseDir,Mail-Sendmail 236 ospkgdep redhat = wget,make,ntp,patch 237 # Old SuSE 238 osperldep opensuse-10.0 = Date-Manip,Module-Build,File-MimeInfo,File-BaseDir,Mail-Sendmail 239 ospkgdep opensuse-10.0 = wget,make,ntp,patch 240 osperldep opensuse-10.1 = Date-Manip,Module-Build,File-MimeInfo,File-BaseDir,Mail-Sendmail 241 ospkgdep opensuse-10.1 = wget,make,ntp,patch 242 osperldep suse = Date-Manip,Module-Build,File-MimeInfo,File-BaseDir,Mail-Sendmail 243 ospkgdep suse = wget,make,ntp,patch 244 # New OpenSuSE 245 ospkgdep opensuse-10.2 = wget,make,ntp,patch 246 ospkgdep opensuse-10.3 = wget,make,ntp,patch 247 osperldep opensuse = Module-Build,File-MimeInfo,File-BaseDir 248 ospkgdep opensuse = wget,make,sntp,patch,perl-Date-Manip,perl-File-HomeDir,perl-Mail-Sendmail 249 # Mdv 250 osperldep mandrake-10.1 = Date-Manip 251 ospkgdep mandrake-10.1 = rpm-build,wget,patch,make,ntp-client,perl-File-MimeInfo,perl-Mail-Sendmail 252 osperldep md = 253 ospkgdep md = rpm-build,wget,patch,make,ntp-client,perl-File-MimeInfo,perl-Mail-Sendmail,perl-Date-Manip 254 # Debian 255 osperldep debian-3.1 = File-MimeInfo,File-BaseDir 256 ospkgdep debian-3.1 = wget,patch,dpkg-dev,make,debian-builder,dh-make,fakeroot,ntpdate,libmodule-build-perl,libdate-manip-perl,libmail-sendmail-perl 257 osperldep deb = 258 ospkgdep deb = wget,patch,dpkg-dev,make,debian-builder,dh-make,fakeroot,ntpdate,libfile-mimeinfo-perl,libmodule-build-perl,libdate-manip-perl,libmail-sendmail-perl 259 # Gentoo 260 osperldep gen = 261 ospkgdep gen = wget,ntp,make,patch,DateManip,File-MimeInfo,Mail-Sendmail 262 # Solaris 263 osperldep pkg = Date-Manip,Module-Build,File-MimeInfo,File-BaseDir,Mail-Sendmail 264 ospkgdep pkg = wget,make 265 266 # Version of the perl module as found on CPAN 267 # http://search.cpan.org/CPAN/modules/by-module 268 osperlver Date-Manip = 5.54 269 osperlver Module-Build = 0.2808 270 osperlver File-MimeInfo = 0.15 271 osperlver File-BaseDir = 0.03 272 osperlver Mail-Sendmail = 0.79 -
devel/pb-modules/lib/ProjectBuilder/Conf.pm
r638 r891 25 25 26 26 # Global list of conf files 27 our@pbconffiles = ();27 my @pbconffiles = (); 28 28 29 29 =pod -
devel/pb-modules/lib/ProjectBuilder/Distribution.pm
r869 r891 23 23 24 24 our @ISA = qw(Exporter); 25 our @EXPORT = qw(pb_distro_ init pb_distro_get pb_distro_installdeps pb_distro_getdeps pb_distro_only_deps_needed pb_distro_setuprepo pb_distro_get_param);25 our @EXPORT = qw(pb_distro_conffile pb_distro_init pb_distro_get pb_distro_installdeps pb_distro_getdeps pb_distro_only_deps_needed pb_distro_setuprepo pb_distro_get_param); 26 26 27 27 =pod … … 60 60 =over 4 61 61 62 =item B<pb_distro_conffile> 63 64 This function returns the mandatory configuration file used for distribution/OS detection 65 66 =cut 67 68 sub pb_distro_conffile { 69 70 return("CCCC/pb.conf"); 71 } 72 73 74 =over 4 75 62 76 =item B<pb_distro_init> 63 77 … … 92 106 # the location of the conf file is finalyzed at install time 93 107 # depending whether we deal with package install or tar file install 94 pb_conf_add( "CCCC/pb.conf");108 pb_conf_add(pb_distro_conffile()); 95 109 96 110 # If we don't know which distribution we're on, then guess it -
devel/pb/bin/pb
r888 r891 2111 2111 my ($ntpline,$dateline) = pb_date2v($vtype,$v); 2112 2112 2113 # Get distro context 2114 my ($name,$ver,$darch) = split(/-/,$v); 2115 chomp($darch); 2116 my ($ddir, $dver, $dfam, $dtype, $pbsuf, $pbupd) = pb_distro_init($name,$ver,$darch); 2117 2113 2118 # Name of the account to deal with for VM/VE 2114 2119 # Do not use the one passed potentially with -a … … 2170 2175 2171 2176 if (defined $vepkglist) { 2172 # Get distro context2173 my ($name,$ver,$darch) = split(/-/,$v);2174 chomp($darch);2175 my ($ddir, $dver, $dfam, $dtype, $pbsuf, $pbupd) = pb_distro_init($name,$ver,$darch);2176 2177 2177 my $postparam = pb_distro_get_param($ddir,$dver,$darch,$vepkglist); 2178 2178 # Change the list of pkg in to a space separated list … … 2221 2221 EOF 2222 2222 if (defined $ntpline) { 2223 print SCRIPT " system(\"$ntpline\");\n";2223 print SCRIPT "pb_system(\"$ntpline\");\n"; 2224 2224 } else { 2225 print SCRIPT " system(\"$dateline\");\n";2225 print SCRIPT "pb_system(\"$dateline\");\n"; 2226 2226 } 2227 2227 } … … 2238 2238 \$found = 1 if (/^$pbac->{$ENV{'PBPROJ'}}:/); 2239 2239 EOF 2240 print SCRIPT << 'EOF'; 2240 2241 my $home = "/home"; 2242 # Solaris doesn't like that we use /home 2243 $home = "/export/home" if ($dtype eq "pkg"); 2244 2245 print SCRIPT << "EOF"; 2241 2246 } 2242 2247 close(PBFILE); 2243 2248 2244 if ( $found == 0 ) {2245 if ( ! -d " /home" ) {2246 pb_mkdir ("/home");2249 if ( \$found == 0 ) { 2250 if ( ! -d "$home" ) { 2251 pb_mkdir_p("$home"); 2247 2252 } 2248 2253 EOF 2249 2254 print SCRIPT << "EOF"; 2250 2255 pb_system("groupadd $pbac->{$ENV{'PBPROJ'}}","Adding group $pbac->{$ENV{'PBPROJ'}}"); 2251 pb_system("useradd $pbac->{$ENV{'PBPROJ'}} -g $pbac->{$ENV{'PBPROJ'}} -m -d /home/$pbac->{$ENV{'PBPROJ'}}","Adding user $pbac->{$ENV{'PBPROJ'}} (group $pbac->{$ENV{'PBPROJ'}} - home /home/$pbac->{$ENV{'PBPROJ'}}"); 2252 } 2256 pb_system("useradd -g $pbac->{$ENV{'PBPROJ'}} -m -d $home/$pbac->{$ENV{'PBPROJ'}} $pbac->{$ENV{'PBPROJ'}}","Adding user $pbac->{$ENV{'PBPROJ'}} (group $pbac->{$ENV{'PBPROJ'}} - home $home/$pbac->{$ENV{'PBPROJ'}}"); 2257 } 2258 EOF 2259 2260 # Copy the content of our local conf file to the VM/VE 2261 my $content = pb_get_content(pb_distro_conffile()); 2262 print SCRIPT << "EOF"; 2263 # 2264 # Create a temporary local conf file for distribution support 2265 # This is created here before its use later. Its place is hardcoded, so no choice for the path 2266 # 2267 my \$tempconf = pb_distro_conffile(); 2268 pb_mkdir_p(dirname(\$tempconf)); 2269 open(CONF,"> \$tempconf") || die "Unable to create \$tempconf"; 2270 print CONF q{$content}; 2271 close(CONF); 2253 2272 EOF 2254 2273 … … 2257 2276 # allow ssh entry to build 2258 2277 # 2259 mkdir " /home/$pbac->{$ENV{'PBPROJ'}}/.ssh",0700;2278 mkdir "$home/$pbac->{$ENV{'PBPROJ'}}/.ssh",0700; 2260 2279 # Allow those accessing root to access the build account 2261 copy("\$ENV{'HOME'}/.ssh/authorized_keys"," /home/$pbac->{$ENV{'PBPROJ'}}/.ssh/authorized_keys");2280 copy("\$ENV{'HOME'}/.ssh/authorized_keys","$home/$pbac->{$ENV{'PBPROJ'}}/.ssh/authorized_keys"); 2262 2281 chmod 0600,".ssh/authorized_keys"; 2263 pb_system("chown -R $pbac->{$ENV{'PBPROJ'}}:$pbac->{$ENV{'PBPROJ'}} /home/$pbac->{$ENV{'PBPROJ'}}","Finish setting up the account env for $pbac->{$ENV{'PBPROJ'}}");2282 pb_system("chown -R $pbac->{$ENV{'PBPROJ'}}:$pbac->{$ENV{'PBPROJ'}} $home/$pbac->{$ENV{'PBPROJ'}}","Finish setting up the account env for $pbac->{$ENV{'PBPROJ'}}"); 2264 2283 2265 2284 EOF … … 2305 2324 # We need to have that pb_distro_init function 2306 2325 # Get it from Project-Builder::Distribution 2307 my ($ddir, $dver, $dfam, $dtype, $pbsuf, $pbupd, $arch) = pb_distro_init(); 2308 print "distro tuple: ".join(',',($ddir, $dver, $dfam, $dtype, $pbsuf, $arch))."\n"; 2326 # And we now need the conf file required for this to work created above 2327 2328 my ($ddir, $dver, $dfam, $dtype, $pbsuf, $pbupd, $darch) = pb_distro_init(); 2329 print "distro tuple: ".join(',',($ddir, $dver, $dfam, $dtype, $pbsuf, $darch))."\n"; 2309 2330 2310 2331 # Adapt sudoers … … 2340 2361 2341 2362 EOF 2342 2343 my $SCRIPT = \*SCRIPT; 2363 2364 # We may need a proxy configuration. Get it from the local env 2365 2366 if (defined $ENV{'http_proxy'}) { 2367 print SCRIPT "\$ENV\{'http_proxy'\}=\"$ENV{'http_proxy'}\";\n"; 2368 } 2369 2370 if (defined $ENV{'ftp_proxy'}) { 2371 print SCRIPT "\$ENV\{'ftp_proxy'\}=\"$ENV{'ftp_proxy'}\";\n"; 2372 } 2373 2374 print SCRIPT << 'EOF'; 2344 2375 2345 pb_install_deps($SCRIPT);2376 my ($ospkgdep,$osperldep,$osperlver) = pb_conf_get_if("ospkgdep","osperldep","osperlver"); 2346 2377 2347 print SCRIPT << 'EOF'; 2378 # First install all required packages 2379 pb_system("yum clean all","Cleaning yum env") if (($ddir eq "fedora") || ($ddir eq "asianux") || ($ddir eq "rhel")); 2380 my $pkgdep = pb_distro_get_param($ddir,$dver,$darch,$ospkgdep,$dfam,$dtype); 2381 pb_distro_installdeps(undef,$dtype,$pbupd,pb_distro_only_deps_needed($dtype,join(' ',split(/,/,$pkgdep)))); 2382 2383 # Then install manually the missing perl modules 2384 my $perldep = pb_distro_get_param($ddir,$dver,$darch,$osperldep,$dfam,$dtype); 2385 foreach my $m (split(/,/,$perldep)) { 2386 my $dir = $m; 2387 $dir =~ s/-.*//; 2388 pb_system("rm -rf $m"."* ; wget http://search.cpan.org/CPAN/modules/by-module/$dir/$m-$osperlver->{$m}.tar.gz ; gzip -cd $m-$osperlver->{$m}.tar.gz | tar xf - ; cd $m"."* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf $m"."*","Installing perl module $m-$osperlver->{$m}"); 2389 } 2390 2348 2391 # Suse wants sudoers as 640 2349 2392 if (($ddir eq "sles") || (($ddir eq "opensuse") && ($dver =~ /10.[012]/))) { … … 2351 2394 } 2352 2395 2353 pb_system("rm -rf ProjectBuilder-* ; wget --passive-ftp ftp://ftp.mondorescue.org/src/ProjectBuilder-latest.tar.gz ; tar xvfz ProjectBuilder-latest.tar.gz ; cd ProjectBuilder-* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf ProjectBuilder-* ; rm -rf project-builder-* ; wget --passive-ftp ftp://ftp.mondorescue.org/src/project-builder-latest.tar.gz ; tar xvfz project-builder-latest.tar.gz; cd project-builder-* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf project-builder-* ;","Building Project-Builder");2354 system "pb 2>&1 | head -5";2396 pb_system("rm -rf ProjectBuilder-* ; wget --passive-ftp ftp://ftp.mondorescue.org/src/ProjectBuilder-latest.tar.gz ; gzip -cd ProjectBuilder-latest.tar.gz | tar xf - ; cd ProjectBuilder-* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf ProjectBuilder-* ; rm -rf project-builder-* ; wget --passive-ftp ftp://ftp.mondorescue.org/src/project-builder-latest.tar.gz ; gzip -cd project-builder-latest.tar.gz | tar xf - ; cd project-builder-* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf project-builder-* ;","Building Project-Builder"); 2397 pb_system("pb 2>&1 | head -5","verbose"); 2355 2398 EOF 2356 2399 if ($vtype eq "ve") { … … 2373 2416 } 2374 2417 2375 # Adds pb_distro_init from ProjectBuilder::Distribution and Base2418 # Adds pb_distro_init and all functions needed from ProjectBuilder::Distribution and Base 2376 2419 foreach my $d (@INC) { 2377 my @f = ("$d/ProjectBuilder/Base.pm","$d/ProjectBuilder/Distribution.pm" );2420 my @f = ("$d/ProjectBuilder/Base.pm","$d/ProjectBuilder/Distribution.pm","$d/ProjectBuilder/Conf.pm"); 2378 2421 foreach my $f (@f) { 2379 2422 if (-f "$f") { 2380 2423 open(PBD,"$f") || die "Unable to open $f"; 2381 2424 while (<PBD>) { 2382 2383 2384 2385 2425 next if (/^package/); 2426 next if (/^use Exporter/); 2427 next if (/^use ProjectBuilder::/); 2428 next if (/^our /); 2386 2429 print SCRIPT $_; 2387 2430 } … … 2439 2482 } 2440 2483 return; 2441 }2442 2443 sub pb_install_deps {2444 2445 my $SCRIPT = shift;2446 2447 print {$SCRIPT} << 'EOF';2448 # We may need a proxy configuration. Get it from the local env2449 EOF2450 2451 if (defined $ENV{'http_proxy'}) {2452 print SCRIPT "\$ENV\{'http_proxy'\}=\"$ENV{'http_proxy'}\";\n";2453 }2454 2455 if (defined $ENV{'ftp_proxy'}) {2456 print SCRIPT "\$ENV\{'ftp_proxy'\}=\"$ENV{'ftp_proxy'}\";\n";2457 }2458 2459 print {$SCRIPT} << 'EOF';2460 # Get and install pb2461 my $insdm = "rm -rf Date-Manip* ; wget http://search.cpan.org/CPAN/authors/id/S/SB/SBECK/Date-Manip-5.54.tar.gz ; tar xvfz Date-Manip-5.54.tar.gz ; cd Date-Manip* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf Date-Manip*";2462 my $insmb = "rm -rf Module-Build* ; wget http://search.cpan.org/CPAN/authors/id/K/KW/KWILLIAMS/Module-Build-0.2808.tar.gz ; tar xvfz Module-Build-0.2808.tar.gz ; cd Module-Build* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf Module-Build*";2463 my $insfm = "rm -rf File-MimeInfo* ; wget http://search.cpan.org/CPAN/authors/id/P/PA/PARDUS/File-MimeInfo/File-MimeInfo-0.15.tar.gz ; tar xvfz File-MimeInfo-0.15.tar.gz ; cd File-MimeInfo* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf File-MimeInfo*";2464 my $insfb = "rm -rf File-Basedir* ; wget http://search.cpan.org/CPAN/authors/id/P/PA/PARDUS/File-BaseDir-0.03.tar.gz ; tar xvfz File-BaseDir-0.03.tar.gz ; cd File-BaseDir* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf File-BaseDir*";2465 my $insms = "rm -rf Mail-Sendmail* ; wget http://search.cpan.org/CPAN/authors/id/M/MI/MIVKOVIC/Mail-Sendmail-0.79.tar.gz ; tar xvfz Mail-Sendmail-0.79.tar.gz ; cd Mail-Sendmail* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf Mail-Sendmail*";2466 my $cmtdm = "Installing Date-Manip perl module";2467 my $cmtmb = "Installing Module-Build perl module";2468 my $cmtfm = "Installing File-MimeInfo perl module";2469 my $cmtfb = "Installing File-Basedir perl module";2470 my $cmtms = "Installing Perl-Sendmail perl module";2471 my $cmtall = "Installing required modules";2472 2473 if ( $ddir eq "fedora" ) {2474 pb_system("yum clean all","Cleaning yum env");2475 if ($dver == 4) {2476 pb_distro_installdeps(undef,$dtype,$pbupd,pb_distro_only_deps_needed($dtype,"rpm-build wget patch ntp sudo perl-DateManip perl-ExtUtils-MakeMaker"));2477 pb_system("$insmb","$cmtmb");2478 pb_system("$insfm","$cmtfm");2479 pb_system("$insfb","$cmtfb");2480 pb_system("$insms","$cmtms");2481 } else {2482 pb_distro_installdeps(undef,$dtype,$pbupd,pb_distro_only_deps_needed($dtype,"rpm-build wget patch ntp sudo perl-DateManip perl-ExtUtils-MakeMaker perl-File-MimeInfo perl-Mail-Sendmail"));2483 }2484 } elsif ($dtype eq "pkg") {2485 pb_distro_installdeps(undef,$dtype,$pbupd,pb_distro_only_deps_needed($dtype,"make wget ntp"));2486 pb_system("$insmb","$cmtmb");2487 pb_system("$insdm","$cmtdm");2488 pb_system("$insfm","$cmtfm");2489 pb_system("$insfb","$cmtfb");2490 pb_system("$insms","$cmtms");2491 } elsif ($ddir eq "asianux") {2492 pb_system("yum clean all","Cleaning yum env");2493 pb_distro_installdeps(undef,$dtype,$pbupd,pb_distro_only_deps_needed($dtype,"rpm-build wget patch ntp sudo perl-DateManip"));2494 pb_system("$insmb","$cmtmb");2495 pb_system("$insfm","$cmtfm");2496 pb_system("$insfb","$cmtfb");2497 pb_system("$insms","$cmtms");2498 } elsif (( $dfam eq "rh" ) || ($ddir eq "suse") || ($ddir eq "sles") || (($ddir eq "opensuse") && (($dver eq "10.1") || ($dver eq "10.0"))) || ($ddir eq "slackware")) {2499 # Suppose pkg are installed already as no online mirror available2500 pb_system("rpm -e lsb 2>&1 > /dev/null","Removing lsb package");2501 pb_system("$insdm","$cmtdm");2502 pb_system("$insmb","$cmtmb");2503 pb_system("$insfm","$cmtfm");2504 pb_system("$insfb","$cmtfb");2505 pb_system("$insms","$cmtms");2506 } elsif ($ddir eq "opensuse") {2507 # New OpenSuSE2508 pb_distro_installdeps(undef,$dtype,$pbupd,pb_distro_only_deps_needed($dtype,"make wget patch sudo ntp"));2509 pb_system("$insmb","$cmtmb");2510 pb_system("$insfm","$cmtfm");2511 pb_system("$insfb","$cmtfb");2512 pb_distro_installdeps(undef,$dtype,$pbupd,pb_distro_only_deps_needed($dtype,"perl-Date-Manip perl-File-HomeDir perl-Mail-Sendmail"));2513 if ($dver < 11) {2514 pb_distro_installdeps(undef,$dtype,$pbupd,pb_distro_only_deps_needed($dtype,"ntp"));2515 } else {2516 pb_distro_installdeps(undef,$dtype,$pbupd,pb_distro_only_deps_needed($dtype,"sntp"));2517 }2518 } elsif ( $dfam eq "md" ) {2519 my $addp = "";2520 if (($ddir eq "mandrake") && ($dver eq "10.1")) {2521 pb_system("$insdm","$cmtdm");2522 } else {2523 $addp ="perl-DateManip";2524 }2525 pb_distro_installdeps(undef,$dtype,$pbupd,pb_distro_only_deps_needed($dtype,"rpm-build wget sudo patch ntp-client perl-File-MimeInfo perl-Mail-Sendmail $addp"));2526 } elsif ( $dfam eq "du" ) {2527 if (( $dver eq "3.1" ) && ($ddir eq "debian")) {2528 pb_system("$insfb","$cmtfb");2529 pb_system("$insfm","$cmtfm");2530 pb_distro_installdeps(undef,$dtype,$pbupd,pb_distro_only_deps_needed($dtype,"wget patch ssh sudo debian-builder dh-make fakeroot ntpdate libmodule-build-perl libdate-manip-perl libmail-sendmail-perl"));2531 } else {2532 pb_distro_installdeps(undef,$dtype,$pbupd,pb_distro_only_deps_needed($dtype,"wget patch openssh-server dpkg-dev sudo debian-builder dh-make fakeroot ntpdate libfile-mimeinfo-perl libmodule-build-perl libdate-manip-perl libmail-sendmail-perl"));2533 }2534 } elsif ( $dfam eq "gen" ) {2535 #system "emerge -u system";2536 pb_distro_installdeps(undef,$dtype,$pbupd,pb_distro_only_deps_needed($dtype,"wget sudo ntp DateManip File-MimeInfo Mail-Sendmail"));2537 } else {2538 pb_log(0,"No pkg to install\n");2539 }2540 EOF2541 2484 } 2542 2485
Note:
See TracChangeset
for help on using the changeset viewer.