Changeset 25 in ProjectBuilder


Ignore:
Timestamp:
Aug 1, 2007, 3:30:16 AM (17 years ago)
Author:
Bruno Cornec
Message:

code of build2pkg done. tests begin

Location:
devel
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb.pl

    r23 r25  
    160160            $build{"$ddir-$dver"} = "yes";
    161161            if (-d "$ENV{'PBCONF'}/$pkg/$dtype") {
    162                 opendir(BDIR,"$ENV{'PBCONF'}/$pkg/$dtype" || die "Unable to open dir $ENV{'PBCONF'}/$pkg/$dtype: $!");
     162                opendir(BDIR,"$ENV{'PBCONF'}/$pkg/$dtype") || die "Unable to open dir $ENV{'PBCONF'}/$pkg/$dtype: $!";
    163163                foreach my $f (readdir(BDIR)) {
    164164                    next if ($f =~ /^\./);
     
    168168                closedir(BDIR);
    169169            } elsif (-d "$ENV{'PBCONF'}/$pkg/$dfam") {
    170                 opendir(BDIR,"$ENV{'PBCONF'}/$pkg/$dfam" || die "Unable to open dir $ENV{'PBCONF'}/$pkg/$dfam: $!");
     170                opendir(BDIR,"$ENV{'PBCONF'}/$pkg/$dfam") || die "Unable to open dir $ENV{'PBCONF'}/$pkg/$dfam: $!";
    171171                foreach my $f (readdir(BDIR)) {
    172172                    next if ($f =~ /^\./);
     
    176176                closedir(BDIR);
    177177            } elsif (-d "$ENV{'PBCONF'}/$pkg/$ddir") {
    178                 opendir(BDIR,"$ENV{'PBCONF'}/$pkg/$ddir" || die "Unable to open dir $ENV{'PBCONF'}/$pkg/$ddir: $!");
     178                opendir(BDIR,"$ENV{'PBCONF'}/$pkg/$ddir") || die "Unable to open dir $ENV{'PBCONF'}/$pkg/$ddir: $!";
    179179                foreach my $f (readdir(BDIR)) {
    180180                    next if ($f =~ /^\./);
     
    184184                closedir(BDIR);
    185185            } elsif (-d "$ENV{'PBCONF'}/$pkg/$ddir-$dver") {
    186                 opendir(BDIR,"$ENV{'PBCONF'}/$pkg/$ddir-$dver" || die "Unable to open dir $ENV{'PBCONF'}/$pkg/$ddir-$dver: $!");
     186                opendir(BDIR,"$ENV{'PBCONF'}/$pkg/$ddir-$dver") || die "Unable to open dir $ENV{'PBCONF'}/$pkg/$ddir-$dver: $!";
    187187                foreach my $f (readdir(BDIR)) {
    188188                    next if ($f =~ /^\./);
     
    269269        chdir "$ENV{'PBDESTDIR'}";
    270270        print $LOG "Creating $pkg tar files (gzip... " if ($debug >= 0);
     271        # Possibility to look at PBSRC to guess more the filename
    271272        system("tar cfphz $pkg-$pbver.tar.gz $pkg-$pbver");
    272273        if ($? == -1) {
     
    300301    # Get the running distro to build on
    301302    my ($ddir, $dver, $dfam, $dtype, $dsuf) = distro_init();
    302     print $LOG "DEBUG: distro tuple: ".Dumper($ddir, $dver, $dfam, $dtype, $dsuf)."\n" if ($debug >= 1);
    303 
     303    print $LOG "DEBUG: distro tuple: ".join(',',($ddir, $dver, $dfam, $dtype, $dsuf))."\n" if ($debug >= 1);
     304
     305    chdir "$ENV{'PBBUILDDIR'}";
    304306    foreach my $pkg (@pkgs) {
     307        my $src="$ENV{'PBDESTDIR'}/$pkg-$pbver.tar.gz";
     308        print $LOG "Handling source file $src\n" if ($debug >= 0);
     309
     310        if ($dtype eq "rpm") {
     311            # rpm has its own standard build directory
     312            $ENV{'PBBUILDDIR'}=`rpmquery --eval '%{_topdir}' 2> /dev/null`;
     313            chdir "$ENV{'PBBUILDDIR'}";
     314            foreach my $d ('RPMS','SRPMS','SPECS','SOURCES','BUILD') {
     315                pbmkdir_p($d) if (! -d $d) || die "Please ensure that you can write into $ENV{'PBBUILDDIR'}\nSolution: setup _topdir in your ~/.rpmmacros or\nchown the $ENV{'PBBUILDDIR'} directory to your uid";
     316            }
     317
     318            # We need to first extract the spec file
     319            print $LOG "Extracting spec file\n" if ($debug >= 0);
     320            symlink $src,"SOURCES/" || die "Unable to symlink $src in SOURCES";;
     321            chdir "SPECS";
     322            extract_build_files($src,"$pkg-$pbver/pbconf/$ddir-$dver/");
     323
     324            # set LANGUAGE to check for correct log messages
     325            $ENV{'LANGUAGE'}="C";
     326            system("rpmbuild -ba *.spec 2>&1 | tee ");
     327
     328        } elsif ($dtype eq "tgz") {
     329            pbmkdir_p("$ENV{'PBBUILDDIR'}/install") if (! -d "$ENV{'PBBUILDDIR'}/install");
     330        } elsif ($dtype eq "ebuild") {
     331            pbmkdir_p("$ENV{'PBBUILDDIR'}/portage") if (! -d "$ENV{'PBBUILDDIR'}/portage");
     332        } else {
     333        }
    305334    }
    306335} else {
     
    371400}
    372401
     402sub extract_build_files {
     403
     404my $src=shift;
     405my $dir=shift;
     406
     407system("tar xfz $src $dir >/dev/null");
     408if ($? == -1) {
     409    print $LOG "failed to execute: $!\n" if ($debug >= 0);
     410} elsif ($? & 127) {
     411    printf $LOG "child died with signal %d, %s coredump\n", ($? & 127),  ($? & 128) ? 'with' : 'without' if ($debug >= 0);
     412} else {
     413    print $LOG " OK\n" if ($debug >= 0);
     414}
     415opendir(DIR,"$dir") || die "Unable to open directory $dir";
     416foreach my $f (readdir(DIR)) {
     417    next if ($f =~ /^\./);
     418    rename("$dir/$f",".");
     419}
     420closedir(DIR);
     421pbrm_rf("$dir");
     422}
     423
    373424sub syntax {
    374425
  • devel/pb/lib/common.pm

    r18 r25  
    8989# Set delivery directory
    9090#
    91 $ENV{'PBTOPDIR'}="$ENV{'PBROOT'}/../delivery";
     91chdir "$ENV{'PBROOT'}/..";
     92my $path = `pwd`;
     93chomp($path);
     94$ENV{'PBTOPDIR'}=$path."/delivery";
    9295$ENV{'PBDESTDIR'}="$ENV{'PBTOPDIR'}/$ENV{'PBVER'}-$ENV{'PBTAG'}";
    93 pbrm_rf($ENV{'PBDESTDIR'}) if (-d "$ENV{'PBDESTDIR'}");
    94 pbmkdir_p($ENV{'PBDESTDIR'}) || die "Unable to recursively create $ENV{'PBDESTDIR'}";
     96if (-d $ENV{'PBDESTDIR'}) {
     97    opendir(DIR,$ENV{'PBDESTDIR'}) || die "Unable to open directory $ENV{'PBDESTDIR'}: $!";
     98    foreach my $d (readdir(DIR)) {
     99        next if ($d =~ /^\./);
     100        pbrm_rf("$ENV{'PBDESTDIR'}/$d") if (-d "$ENV{'PBDESTDIR'}/$d");
     101    }
     102    closedir(DIR);
     103}
     104if (! -d "$ENV{'PBDESTDIR'}") {
     105    pbmkdir_p($ENV{'PBDESTDIR'}) || die "Unable to recursively create $ENV{'PBDESTDIR'}";
     106}
     107
     108#
     109# Set build directory
     110#
     111$ENV{'PBBUILDDIR'}=$path."/build";
     112pbrm_rf($ENV{'PBBUILDDIR'}) if (-d "$ENV{'PBBUILDDIR'}");
     113pbmkdir_p($ENV{'PBBUILDDIR'}) || die "Unable to recursively create $ENV{'PBBUILDDIR'}";
    95114
    96115umask 0022;
  • devel/pbconf/projectbuilder/rpm/pb.spec

    r17 r25  
    1515BuildRoot:  %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n)
    1616BuildRequires: 
     17BuildArch:  noarch
    1718Requires:   perl >= 5.8.8, PBDEP
    1819
Note: See TracChangeset for help on using the changeset viewer.