Changeset 87 for devel/pb/bin/pb


Ignore:
Timestamp:
Sep 3, 2007, 2:46:15 PM (12 years ago)
Author:
bruno
Message:

confparam is gone. params are stored in .pbrc instead

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.