Changeset 28


Ignore:
Timestamp:
Aug 2, 2007, 12:15:11 AM (12 years ago)
Author:
bruno
Message:

build2pkg works for rpm. No we need a correct spec file ;-)

File:
1 edited

Legend:

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

    r27 r28  
    311311        if ($dtype eq "rpm") {
    312312            # rpm has its own standard build directory
    313             $ENV{'PBBUILDDIR'}=`rpmquery --eval '%{_topdir}' 2> /dev/null`;
    314             chdir "$ENV{'PBBUILDDIR'}";
     313            my $tmp=`rpmquery --eval '%{_topdir}' 2> /dev/null`;
     314            chomp($tmp);
     315            $ENV{'PBBUILDDIR'}=$tmp;
     316            print $LOG "Working under $ENV{'PBBUILDDIR'}\n" if ($debug >= 0);
    315317            foreach my $d ('RPMS','SRPMS','SPECS','SOURCES','BUILD') {
    316                 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";
     318                if (! -d "$ENV{'PBBUILDDIR'}/$d") {
     319                pbmkdir_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";
     320                }
    317321            }
    318322
    319323            # We need to first extract the spec file
    320             symlink "$src","SOURCES/".basename($src) || die "Unable to symlink $src in SOURCES";;
    321             extract_build_files($src,"$pbpkg-$pbver/pbconf/$ddir-$dver/","SPECS");
    322 
     324            symlink "$src","$ENV{'PBBUILDDIR'}/SOURCES/".basename($src) || die "Unable to symlink $src in $ENV{'PBBUILDDIR'}/SOURCES";
     325            my @specfile;
     326            @specfile = extract_build_files($src,"$pbpkg-$pbver/pbconf/$ddir-$dver/","$ENV{'PBBUILDDIR'}/SPECS");
     327
     328            print $LOG "specfile: ".Dumper(\@specfile)."\n" if ($debug >= 1);
    323329            # set LANGUAGE to check for correct log messages
    324330            $ENV{'LANGUAGE'}="C";
    325             system("ls -R ");
    326             system("cd SPECS ; rpmbuild -ba *.spec");
    327 
     331            #system("ls -R $ENV{'PBBUILDDIR'}") if ($debug >= 1);
     332            foreach my $f (@specfile) {
     333                if ($f =~ /\.spec$/) {
     334                    print $LOG "rpmbuild -ba $f ...\n";
     335                    system("rpmbuild -ba $f");
     336                    last;
     337                }
     338            }
    328339        } elsif ($dtype eq "tgz") {
    329340            pbmkdir_p("$ENV{'PBBUILDDIR'}/install") if (! -d "$ENV{'PBBUILDDIR'}/install");
     
    405416my $dir=shift;
    406417my $ddir=shift;
     418my @files;
    407419
    408420print $LOG "Extracting build files... " if ($debug >= 0);
     
    419431    next if ($f =~ /^\./);
    420432    move("$dir/$f","$ddir") || die "Unable to move $dir/$f to $ddir";
    421     print $LOG "mv $dir/$f .\n" if ($debug >= 1);
     433    print $LOG "mv $dir/$f $ddir\n" if ($debug >= 1);
     434    push @files,"$ddir/$f";
    422435}
    423436closedir(DIR);
    424437# Not enough but still a first cleanup
    425438pbrm_rf("$dir");
     439return(@files);
    426440}
    427441
Note: See TracChangeset for help on using the changeset viewer.