Changeset 1109


Ignore:
Timestamp:
Nov 17, 2010, 12:40:28 PM (9 years ago)
Author:
bruno
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.
Location:
devel
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-modules/etc/pb.conf

    r1108 r1109  
    405405#ospkgdep pkg = wget,make,perl
    406406# And also need ftp://ftp.sunfreeware.com/pub/freeware/sparc/10/sudo-1.7.2p1-sol10-sparc-local.gz ftp://ftp.sunfreeware.com/pub/freeware/sparc/10/make-3.81-sol10-sparc-local.gz ftp://ftp.sunfreeware.com/pub/freeware/intel/10/libintl-3.4.0-sol10-x86-local.gz ftp://ftp.sunfreeware.com/pub/freeware/intel/10/libiconv-1.9.2-sol10-x86-local.gz ftp://ftp.sunfreeware.com/pub/freeware/intel/10/libgcc-3.4.6-sol10-x86-local.gz
     407#
    407408
    408409# Version of the perl module as found on CPAN
     
    436437#oscmdopt rpmbootstrap =
    437438#
     439# Commands to check packages
     440#
     441oschkcmd rpm = /usr/bin/rpmlint
     442oschkopt rpm =
     443oschkcmd deb = /usr/bin/lintian
     444oschkopt deb =
  • devel/pb-modules/etc/pb.conf.pod

    r1072 r1109  
    7070 Conffile: pb
    7171 Example: osambiguous debian = debian,ubuntu
     72
     73=item B<oschkcmd>
     74
     75 Nature: Optional
     76 Key: OS (could be from the most generic up to the most specific from ostype, osfamily, os, os-ver, os-ver-arch).
     77 Value: package checker tool.
     78 Conffile: pb
     79 Example: oschkcmd deb = /usr/bin/lintian
     80
     81=item B<oschkopt>
     82
     83 Nature: Optional
     84 Key: OS (could be from the most generic up to the most specific from ostype, osfamily, os, os-ver, os-ver-arch).
     85 Value: package checker tool options.
     86 Conffile: pb
     87 Example: oschkcmd rpm = -i
    7288
    7389=item B<oscodename>
     
    200216 Example: pbdefdir default = $ENV{'HOME'}/local/pb/projects
    201217
     218=item B<pbinstalltype>
     219
     220 Nature: Mandatory
     221 Key: project (as defined in the -p option or PBPROJ environment variable)
     222 Value: file or pkg. Indicates how pb will be installed during the setupve|vm phase in the virtual environment|machine, using CPAN files or upstream packages. Only the dev team needs to use file as packages do not yet exist for it. Or when no repository exists to pull project-builder.org from.
     223 Conffile: pb
     224
    202225=item B<pbml>
    203226
     
    215238 Conffile: project
    216239 Example: pbpackager pb = Bruno Cornec <bruno@project-builder.org>
     240
     241=item B<pbpkg>
     242
     243 Nature: Optional (Mandatory if pbinstalltype is pkg)
     244 Key: OS (could be from the most generic up to the most specific from ostype, osfamily, os, os-ver, os-ver-arch).
     245 Value: coma separated list of packages that have to be installed in order for pb to be operational in the VE|VM
     246 Conffile: pb
     247 Example: pbpkg rhel-5 = project-builder
    217248
    218249=item B<pbprojdir>
  • devel/pb-modules/lib/ProjectBuilder/Log.pm

    r1090 r1109  
    55
    66use strict;
    7 use Mail::Sendmail;
    87use ProjectBuilder::Base;
    98use ProjectBuilder::Log::Item;
     
    227226# mails the summary to $to
    228227sub mailSummary {
     228    require Mail::Sendmail;
    229229    my $self = shift;
    230230    my $to = shift || "";
     
    239239        Message => $self->summary()
    240240    );
    241     sendmail(%mail) or return $Mail::Sendmail::error;
     241    if (! sendmail(%mail)) {
     242        if (defined $Mail::Sendmail::error) {
     243            return $Mail::Sendmail::error;
     244        } else {
     245            return "Unkown error";
     246        }
     247    }
    242248    pb_log(0,"Mail send to ". $to ."\n");
    243249}
  • devel/pb-modules/t/Base.t

    r1106 r1109  
    55use strict;
    66use ProjectBuilder::Base;
    7 use Test;
    87
    98eval
     
    1514# Test::More not found so no test will be performed here
    1615if ($@) {
    17     BEGIN { plan tests => 1 };
     16    require Test;
     17    plan(tests => 1);
    1818    print "# Faking tests as test::More is not available\n";
    1919    ok(1,1);
  • devel/pb-modules/t/Log.t

    r1106 r1109  
    55use strict;
    66use ProjectBuilder::Base;
    7 use Test;
    87
    98eval
     
    1514# Test::More not found so no test will be performed here
    1615if ($@) {
    17     BEGIN { plan tests => 1 };
     16    require Test;
     17    plan(tests => 1);
    1818    print "# Faking tests as test::More is not available\n";
    1919    ok(1,1);
  • 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.