Changeset 1109 in ProjectBuilder for devel/pb/bin/pb


Ignore:
Timestamp:
Nov 17, 2010, 12:40:28 PM (13 years ago)
Author:
Bruno Cornec
Message:

r4041@localhost: bruno | 2010-11-17 11:40:41 +0100

  • Adds new configuration parameters (oschkcmd, oschkopt) to externalize package checking command
  • Adds new configuration parameters (pbinstalltype, pbpkg) to start allowing installation of pb in VM/VE with packages or files (this last is only needed by upstream)
  • Remove dependency on Mail::Sendmail to where it's really needed (part of Log, not used yet, and annouce). In particular this removes one non std dep for VE/VM build.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r1107 r1109  
    11481148        }
    11491149    }
     1150    # Find the appropriate check cmd/opts
     1151    my ($oschkcmd,$oschkopt) = pb_conf_get_if("oschkcmd","oschkopt");
     1152    my $chkcmd .= pb_distro_get_param($ddir,$dver,$arch,$oschkcmd,$dtype,$dfam,$dos);
     1153    my $chkopt .= pb_distro_get_param($ddir,$dver,$arch,$oschkopt,$dtype,$dfam,$dos);
     1154
    11501155    # Packages check if needed
    11511156    if ($dtype eq "rpm") {
    1152         if (-f "/usr/bin/rpmlint") {
    1153             pb_system("rpmlint $made","Checking validity of rpms with rpmlint","verbose");
     1157        if (-x $chkcmd) {
     1158            pb_system("$chkcmd $chkopt $made","Checking validity of rpms with $chkcmd","verbose");
    11541159        }
    11551160        my $rpms ="";
     
    11661171            $made2 .= "../$f " if ($f =~ /\.changes$/);
    11671172        }
    1168         if (-f "/usr/bin/lintian") {
    1169             pb_system("lintian $made2","Checking validity of debs with lintian","verbose");
     1173        if (-x $chkcmd) {
     1174            pb_system("$chkcmd $chkopt $made2","Checking validity of debs with $chkcmd","verbose");
    11701175        } else {
    11711176            pb_log(0,"deb packages generated: $made2\n");
     
    25602565    print SCRIPT << 'EOF';
    25612566   
    2562     my ($ospkgdep,$osperldep,$osperlver) = pb_conf_get_if("ospkgdep","osperldep","osperlver");
    2563    
    2564     # First install all required packages
    2565     pb_system("yum clean all","Cleaning yum env") if (($ddir eq "fedora") || ($ddir eq "asianux") || ($ddir eq "rhel"));
    2566     my $pkgdep = pb_distro_get_param($ddir,$dver,$darch,$ospkgdep,$dfam,$dtype,$dos);
    2567     pb_distro_installdeps(undef,$dtype,$pbupd,pb_distro_only_deps_needed($dtype,join(' ',split(/,/,$pkgdep))));
    2568 
    2569     # Then install manually the missing perl modules
    2570     my $perldep = pb_distro_get_param($ddir,$dver,$darch,$osperldep,$dfam,$dtype,$dos);
    2571     foreach my $m (split(/,/,$perldep)) {
    2572         # Skip empty deps
    2573         next if ($m =~ /^\s*$/);
    2574         my $dir = $m;
    2575         $dir =~ s/-.*//;
    2576         pb_system("echo \"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* ; if [ -f Build.PL ]; then perl Build.PL; ./Build ; ./Build install ; else perl Makefile.PL; make ; make install ; fi; cd .. ; rm -rf $m*\" | bash" ,"Installing perl module $m-$osperlver->{$m}");
    2577     }
    2578 
    25792567# Suse wants sudoers as 640
    25802568if ((($ddir eq "sles") && (($dver =~ /10/) || ($dver =~ /9/))) || (($ddir eq "opensuse") && ($dver =~ /10.[012]/))) {
     
    25822570}
    25832571
     2572# First install all required packages
     2573pb_system("yum clean all","Cleaning yum env") if (($ddir eq "fedora") || ($ddir eq "asianux") || ($ddir eq "rhel"));
     2574my ($ospkgdep) = pb_conf_get_if("ospkgdep");
     2575   
     2576my $pkgdep = pb_distro_get_param($ddir,$dver,$darch,$ospkgdep,$dfam,$dtype,$dos);
     2577pb_distro_installdeps(undef,$dtype,$pbupd,pb_distro_only_deps_needed($dtype,join(' ',split(/,/,$pkgdep))));
     2578
     2579EOF
     2580    my $itype = pb_conf_get("pbinstalltype");
     2581    if ($itype->{$ENV{'PBPROJ'}} =~ /^file/) {
     2582        print SCRIPT << 'EOF';
     2583# Then install manually the missing perl modules
     2584my ($osperldep,$osperlver) = pb_conf_get_if("osperldep","osperlver");
     2585   
     2586my $perldep = pb_distro_get_param($ddir,$dver,$darch,$osperldep,$dfam,$dtype,$dos);
     2587foreach my $m (split(/,/,$perldep)) {
     2588    # Skip empty deps
     2589    next if ($m =~ /^\s*$/);
     2590    my $dir = $m;
     2591    $dir =~ s/-.*//;
     2592    pb_system("echo \"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* ; if [ -f Build.PL ]; then perl Build.PL; ./Build ; ./Build install ; else perl Makefile.PL; make ; make install ; fi; cd .. ; rm -rf $m*\" | bash" ,"Installing perl module $m-$osperlver->{$m}");
     2593}
     2594
    25842595pb_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");
     2596EOF
     2597    } elsif ($itype->{$ENV{'PBPROJ'}} =~ /^pkg/) {
     2598        # pkg based install. We need to point to the project-builder.org repository
     2599        print SCRIPT << 'EOF';
     2600my ($pbpkg) = pb_conf_get_if("pbpkg");
     2601
     2602my $pkgforpb = pb_distro_get_param($ddir,$dver,$darch,$pbpkg,$dfam,$dtype,$depdos);
     2603pb_distro_setuprepo($ddir,$dver,$darch,$dtype);
     2604pb_distro_installdeps(undef,$dtype,$pbupd,pb_distro_only_deps_needed($dtype,join(' ',split(/,/,$pkgforpb))));
     2605EOF
     2606    } else {
     2607        # Unknown install type
     2608        die("Unknown install type $itype->{$ENV{'PBPROJ'}} for param pbinstalltype");
     2609    }
     2610    print SCRIPT << 'EOF';
    25852611pb_system("pb 2>&1 | head -5",undef,"verbose");
    25862612EOF
     
    28772903   
    28782904    # Preparation of headers
     2905    require Mail::Sendmail;
    28792906
    28802907    my %mail = (   
     
    28872914           
    28882915    # Send mail
    2889     sendmail(%mail) or die "Unable to send mail ($Mail::Sendmail::error): $Mail::Sendmail::log";
     2916    if (! sendmail(%mail)) {
     2917        if ((defined $Mail::Sendmail::error) and (defined $Mail::Sendmail::log)) {
     2918            die "Unable to send mail ($Mail::Sendmail::error): $Mail::Sendmail::log";
     2919        }
     2920    }
    28902921}
    28912922
Note: See TracChangeset for help on using the changeset viewer.