Changeset 149 for devel/pb/bin/pb


Ignore:
Timestamp:
Sep 25, 2007, 1:39:22 AM (12 years ago)
Author:
bruno
Message:

Adds support for non-rpm distro

File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r145 r149  
    318318        print $LOG "Source file: $src\n" if ($debug >= 0);
    319319
     320        print $LOG "Working directory: $ENV{'PBBUILDDIR'}\n" if ($debug >= 0);
    320321        if ($dtype eq "rpm") {
    321             print $LOG "Working under $ENV{'PBBUILDDIR'}\n" if ($debug >= 0);
    322322            foreach my $d ('RPMS','SRPMS','SPECS','SOURCES','BUILD') {
    323323                if (! -d "$ENV{'PBBUILDDIR'}/$d") {
     
    342342            }
    343343            $made="$made RPMS/*/$pbpkg-$pbver-$pbtag$pbsuf.*.rpm SRPMS/$pbpkg-$pbver-$pbtag$pbsuf.src.rpm";
     344            if (-f "/usr/bin/rpmlint") {
     345                pb_system("rpmlint $made","Checking validity of rpms with rpmlint");
    344346        } elsif ($dtype eq "deb") {
     347            chdir "$ENV{'PBBUILDDIR'}" || die "Unable to chdir to $ENV{'PBBUILDDIR'}";
     348            pb_system("tar xfz $src","Extracting sources");
     349
     350            chdir "$pbpkg-$pbver" || die "Unable to chdir to $pbpkg-$pbver";
     351            symlink "pbconf/$ddir-$dver","debian" || die "Unable to symlink to pbconf/$ddir-$dver";
     352            pb_system("dpkg-buildpackage -us -uc -rfakeroot","Building package");
    345353            $made="$made $pbpkg"."_*.deb $pbpkg"."_*.dsc $pbpkg"."_*.tar.gz";
    346354        } elsif ($dtype eq "ebuild") {
    347             $made="$made portage/*/$pbpkg/$pbpkg-$pbver.ebuild";
    348             pb_mkdir_p("$ENV{'PBBUILDDIR'}/portage") if (! -d "$ENV{'PBBUILDDIR'}/portage");
     355            my @ebuildfile;
     356            # For gentoo we need to take pb as subsystem name
     357            pb_mkdir_p("$ENV{'PBBUILDDIR'}/portage/pb/$pbpkg") if (! -d "$ENV{'PBBUILDDIR'}/portage/pb/$pbpkg");
     358
     359            # We need to first extract the ebuild file
     360            @ebuildfile = pb_extract_build_files($src,"$pbpkg-$pbver/pbconf/$ddir-$dver/","$ENV{'PBBUILDDIR'}/portage/pb/$pbpkg");
     361
     362            # Prepare the build env for gentoo
     363            my $found = 0;
     364            my $pbbd = $ENV{'PBBUILDDIR'};
     365            $pbbd =~ /|/|\\/|g;
     366            open(MAKE,"/etc/make.conf") || die "Unable to open /etc/make.conf";
     367            while (<MAKE>) {
     368                $found = 1 if (/$pbbd\/portage/);
     369            }
     370            close(MAKE);
     371            if ($found == 0) {
     372                pb_system("sudo \'echo \"$ENV{'PBBUILDDIR'}/portage\" >> /etc/make.conf\'");
     373            }
     374            $found = 0;
     375            open(KEYW,"/etc/portage/package.keywords") || die "Unable to open /etc/portage/package.keywords";
     376            while (<KEYW>) {
     377                $found = 1 if (/portage\/pb/);
     378            }
     379            close(KEYW);
     380            if ($found == 0) {
     381                pb_system("sudo \'echo \"portage/pb\" >> /etc/portage/package.keywords\'");
     382            }
     383
     384            # Build
     385            foreach my $f (@ebuildfile) {
     386                if ($f =~ /\.ebuild$/) {
     387                    pb_system("ebuild $f digest ; ebuild $f package");
     388                }
     389            }
     390            print $LOG "ebuild file: ".Dumper(\@ebuildfile)."\n" if ($debug >= 1);
     391
     392            $made="$made portage/pb/$pbpkg/$pbpkg-$pbver.ebuild";
    349393        } elsif ($dtype eq "slackware") {
    350394            $made="$made build-$pbpkg/$pbpkg-$pbver-*-$pbtag.tgz";
Note: See TracChangeset for help on using the changeset viewer.