Changeset 87


Ignore:
Timestamp:
Sep 3, 2007, 2:46:15 PM (13 years ago)
Author:
Bruno Cornec
Message:

confparam is gone. params are stored in .pbrc instead

Location:
devel
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r83 r87  
    9999    pb_cms2build();
    100100    pb_build2pkg();
     101} elsif ($action =~ /^build2ftp$/) {
     102    pb_build2ftp();
     103} elsif ($action =~ /^pkg2ftp$/) {
     104    pb_pkg2ftp();
    101105} else {
    102106    print $LOG "'$action' is not available\n";
     
    333337}
    334338
     339sub pb_build2ftp {
     340
     341    # Get list of packages to build
     342    my $ptr = pb_get_pkg();
     343    @pkgs = @$ptr;
     344
     345    # Get the running distro to build on
     346    my ($ddir, $dver, $dfam, $dtype, $dsuf) = pb_distro_init();
     347    print $LOG "DEBUG: distro tuple: ".join(',',($ddir, $dver, $dfam, $dtype, $dsuf))."\n" if ($debug >= 1);
     348
     349    # Get content saved in cms2build
     350    my $pkg = pb_conf_read("$ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb","pbpkg");
     351    $pkg = { } if (not defined $pkg);
     352    my %pkg = %$pkg;
     353
     354    chdir "$ENV{'PBBUILDDIR'}";
     355    foreach my $pbpkg (@pkgs) {
     356        my $vertag = $pkg{$pbpkg};
     357        # get the version of the current package - maybe different
     358        ($pbver,$pbtag) = split(/-/,$vertag);
     359
     360        my $src="$ENV{'PBDESTDIR'}/$pbpkg-$pbver.tar.gz";
     361        print $LOG "Source file: $src\n" if ($debug >= 0);
     362
     363    }
     364}
     365sub pb_pkg2ftp {
     366
     367    # Get list of packages to build
     368    my $ptr = pb_get_pkg();
     369    @pkgs = @$ptr;
     370
     371    # Get the running distro to build on
     372    my ($ddir, $dver, $dfam, $dtype, $dsuf) = pb_distro_init();
     373    print $LOG "DEBUG: distro tuple: ".join(',',($ddir, $dver, $dfam, $dtype, $dsuf))."\n" if ($debug >= 1);
     374
     375    # Get content saved in cms2build
     376    my $pkg = pb_conf_read("$ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb","pbpkg");
     377    $pkg = { } if (not defined $pkg);
     378    my %pkg = %$pkg;
     379
     380    chdir "$ENV{'PBBUILDDIR'}";
     381    foreach my $pbpkg (@pkgs) {
     382        my $vertag = $pkg{$pbpkg};
     383        # get the version of the current package - maybe different
     384        ($pbver,$pbtag) = split(/-/,$vertag);
     385
     386        my $src="$ENV{'PBDESTDIR'}/$pbpkg-$pbver.tar.gz";
     387        print $LOG "Source file: $src\n" if ($debug >= 0);
     388
     389        if ($dtype eq "rpm") {
     390            # rpm has its own standard build directory
     391            my $tmp=`rpmquery --eval '%{_topdir}' 2> /dev/null`;
     392            chomp($tmp);
     393            $ENV{'PBBUILDDIR'}=$tmp;
     394            print $LOG "Working under $ENV{'PBBUILDDIR'}\n" if ($debug >= 0);
     395            foreach my $d ('RPMS','SRPMS','SPECS','SOURCES','BUILD') {
     396                if (! -d "$ENV{'PBBUILDDIR'}/$d") {
     397                pb_mkdir_p("$ENV{'PBBUILDDIR'}/$d") || die "Please ensure that you can write into $ENV{'PBBUILDDIR'} to create $d\nSolution: setup _topdir in your ~/.rpmmacros or\nchown the $ENV{'PBBUILDDIR'} directory to your uid";
     398                }
     399            }
     400
     401            # We need to first extract the spec file
     402            symlink "$src","$ENV{'PBBUILDDIR'}/SOURCES/".basename($src) || die "Unable to symlink $src in $ENV{'PBBUILDDIR'}/SOURCES";
     403            my @specfile;
     404            @specfile = pb_extract_build_files($src,"$pbpkg-$pbver/pbconf/$ddir-$dver/","$ENV{'PBBUILDDIR'}/SPECS");
     405
     406            print $LOG "specfile: ".Dumper(\@specfile)."\n" if ($debug >= 1);
     407            # set LANGUAGE to check for correct log messages
     408            $ENV{'LANGUAGE'}="C";
     409            #system("ls -R $ENV{'PBBUILDDIR'}") if ($debug >= 1);
     410            foreach my $f (@specfile) {
     411                if ($f =~ /\.spec$/) {
     412                    pb_system("rpmbuild -ba $f","Building package with $f");
     413                    last;
     414                }
     415            }
     416        } elsif ($dtype eq "tgz") {
     417            pb_mkdir_p("$ENV{'PBBUILDDIR'}/install") if (! -d "$ENV{'PBBUILDDIR'}/install");
     418        } elsif ($dtype eq "ebuild") {
     419            pb_mkdir_p("$ENV{'PBBUILDDIR'}/portage") if (! -d "$ENV{'PBBUILDDIR'}/portage");
     420        } else {
     421        }
     422    }
     423}
     424
    335425sub pb_get_pkg {
    336426
  • devel/pb/lib/ProjectBuilder/Base.pm

    r82 r87  
    7676
    7777my %version = ();
    78 my %confparam = ();
    7978
    8079if (-f "$ENV{'PBCONF'}/$proj.pb") {
    81     # main parameter confparam (mandatory)
    8280    # List of pkg to build by default (mandatory)
    8381    # List of additional pkg to build when all is called (optional)
    8482    # Valid version names (optional)
    8583    # List of files to filter (optional)
    86     my $ptr = pb_conf_read("$ENV{'PBCONF'}/$proj.pb","confparam","defpkgdir","extpkgdir","version","filteredfiles");
    87     my ($confparam, $defpkgdir, $extpkgdir, $version, $filteredfiles) = @$ptr;
    88     print "DEBUG: confparam: ".Dumper($confparam)."\n" if ($debug >= 1);
     84    my $ptr = pb_conf_read("$ENV{'PBCONF'}/$proj.pb","defpkgdir","extpkgdir","version","filteredfiles");
     85    my ($defpkgdir, $extpkgdir, $version, $filteredfiles) = @$ptr;
    8986    print "DEBUG: defpkgdir: ".Dumper($defpkgdir)."\n" if ($debug >= 1);
    9087    print "DEBUG: extpkgdir: ".Dumper($extpkgdir)."\n" if ($debug >= 1);
    9188    print "DEBUG: version: ".Dumper($version)."\n" if ($debug >= 1);
    9289    print "DEBUG: filteredfiles: ".Dumper($filteredfiles)."\n" if ($debug >= 1);
    93     die "Unable to find confparam in $ENV{'PBCONF'}/$proj.pb" if (not defined $confparam);
    9490    die "Unable to find defpkgdir in $ENV{'PBCONF'}/$proj.pb" if (not defined $defpkgdir);
    95     %confparam = %$confparam;
    9691    # Global
    9792    %defpkgdir = %$defpkgdir;
     
    106101} else {
    107102    die "Unable to open $ENV{'PBCONF'}/$proj.pb";
    108 }
    109 
    110 #
    111 # Export content if needed
    112 #
    113 if (defined $confparam{"cvsroot"}) {
    114     $ENV{'CVSROOT'} = $confparam{"cvsroot"};
    115103}
    116104
     
    278266my $ret;
    279267
    280 my $cms = pb_conf_read("$ENV{'PBETC'}","cms");
     268my ($cms,$cvsroot) = pb_conf_read("$ENV{'PBETC'}","cms","cvsroot");
    281269die "No CMS defined for $proj" if (not defined $cms);
    282270my %cms = %$cms;
     
    295283    $ENV{'PBCMSLOGFILE'}="cvs.log";
    296284    $ENV{'PBCMSEXP'}="cvs export"
     285    #
     286    # Export content if needed
     287    #
     288    $ENV{'CVSROOT'} = $cvsroot{$proj} if (defined $cvsroot{$proj});
    297289} else {
    298290    die "CMS $cms{$proj} unknown";
  • devel/pb/lib/ProjectBuilder/Changelog.pm

    r74 r87  
    6666    my $n2date = &UnixDate($date,"%a, %d %b %Y %H:%M:%S %z");
    6767    #print "**$ndate**\n";
    68     my $confparam = pb_conf_read("$ENV{'PBCONF'}/$ENV{'PBPROJ'}.pb", "confparam");
    69     my %confparam = %$confparam;
     68    my $packager = pb_conf_read("$ENV{'PBETC'}", "packager");
     69    my %packager = %$packager;
    7070    if (($dtype eq "rpm") || ($dtype eq "fc")) {
    7171        if ($ver !~ /-/) {
     
    7979            $ver2 = "$ver$dsuf";
    8080        }
    81         print $OUTPUT "* $ndate $confparam{'packager'} $ver2\n";
     81        print $OUTPUT "* $ndate $packager{$ENV{'PBPROJ'}} $ver2\n";
    8282        print $OUTPUT "- Updated to $ver\n";
    8383        }
     
    102102
    103103    if ($dtype eq "deb") {
    104         print $OUTPUT " -- $confparam{'packager'} $n2date\n\n";
     104        print $OUTPUT " -- $packager{$ENV{'PBPROJ'}} $n2date\n\n";
    105105        print $OUTPUT "\n";
    106106        }
  • devel/pbconf/pb.pb

    r58 r87  
    55# $Id$
    66#
    7 
    8 # confparam is a hash to ease interface
    9 
    10 # Packager for ChangeLogs
    11 confparam packager = "Bruno Cornec <bruno@mondorescue.org>"
    12 
    13 # If CVS give login method with CVSROOT
    14 #cvsroot = ":pserver:anonymous@linuxcoe.cvs.sourceforge.net:/cvsroot/linuxcoe"
    15 confparam cvsroot = " "
    167
    178# Hash of default package/package directory
Note: See TracChangeset for help on using the changeset viewer.