pkgsrc/pkgtools/tinderbox-dragonfly/patches/patch-aw
marino 7c330214d0 pkgtools/tinderbox-dragonfly: Minor fixes
1) Bulk Build: don't add ports where there's no makefile present (x2)
2) Make hook processing more robust (g option on regex, check for
   non-empty string value)
3) Make enterBuild function work with HOST_WKRDIRS option
4) Handle specific DEPENDS+= case for perl where the addition of the
   dependency port is conditional on the version of perl used.
   This addresses the infinite loop case seen on some perl packages
2011-12-04 21:55:01 +00:00

234 lines
7.3 KiB
Text

$NetBSD: patch-aw,v 1.4 2011/12/04 21:55:01 marino Exp $
--- ../FreeBSD/lib/Tinderbox/MakeCache.pm 2011-10-16 00:52:55.000000000 +0000
+++ lib/Tinderbox/MakeCache.pm
@@ -31,14 +31,14 @@ use strict;
# a list of variables that we pull from the port Makefile
our @makeTargets = (
- 'PKGNAME', 'IGNORE',
- 'NO_PACKAGE', 'FORBIDDEN',
+ 'PKGNAME', '_CBBH',
'EXTRACT_DEPENDS', 'PATCH_DEPENDS',
'FETCH_DEPENDS', 'BUILD_DEPENDS',
'LIB_DEPENDS', 'RUN_DEPENDS',
'TEST_DEPENDS', 'MAINTAINER',
- 'COMMENT', 'PORTNAME',
- 'DISTFILES',
+ 'COMMENT', 'PKGBASE',
+ 'DISTFILES', 'BOOTSTRAP_DEPENDS',
+ 'DEPENDS'
);
# Create a new cache object
@@ -48,6 +48,7 @@ sub new {
CACHE => undef,
SEEN => undef,
BASEDIR => shift,
+ OPTFILE => shift,
}, $name;
$self;
@@ -60,20 +61,95 @@ sub _execMake {
my $self = shift;
my $port = shift;
my @ret;
- my $tmp;
+ my $target;
+ my $deptype;
+ my $tmp = '';
return if ($self->{SEEN}->{$port} eq 1);
- $tmp = '-V ' . join(' -V ', @makeTargets);
+ foreach $target (@makeTargets) {
+ $tmp .= "-V '\${" . $target . "}' ";
+ }
my $dir = $self->{BASEDIR} . '/' . $port;
- @ret = split("\n", `cd $dir && make $tmp`);
+ my $customOptions = $self->_package_options ($dir);
+ my $nativeOptions = $self->_native_preferences ();
+ @ret = split("\n", `cd $dir && bmake $customOptions $nativeOptions $tmp`);
foreach $tmp (@makeTargets) {
- $self->{CACHE}->{$port}{$tmp} = shift @ret;
+ $deptype = $tmp;
+ if (${tmp} eq "BOOTSTRAP_DEPENDS") {
+ $deptype = "FETCH_DEPENDS";
+ }
+ $self->{CACHE}->{$port}{$deptype} = shift @ret;
}
$self->{SEEN}->{$port} = 1;
}
+# Get option variable name and requested options
+sub _package_options {
+ my $self = shift;
+ my $dir = shift;
+ unless (-e $self->{OPTFILE}) {
+ return "";
+ }
+ my @data = split("\n",
+ `cd $dir && bmake -V '\${PKGNAME}' -V '\${PKG_OPTIONS_VAR}'`);
+ my $pkname = $data[0];
+ my $optvar = $data[1];
+ $pkname =~ s/nb[0-9]+$//;
+ my $instruction = `grep ^$pkname: $self->{OPTFILE}`;
+ unless ($instruction) {
+ return "";
+ }
+ my @customSet = split(/:/, $instruction);
+ unless (scalar (@customSet) >= 3) {
+ return "";
+ }
+ return $optvar . '="' . $customSet[2] . '"';
+}
+
+# Recreate a trim function
+sub _trim {
+ my $self = shift;
+ my $string = shift;
+ $string =~ s/^\s+//;
+ $string =~ s/\s+$//;
+ return $string;
+}
+
+# Figure out if we want to avoid built-in dependencies or not
+sub _native_preferences {
+ my $self = shift;
+ my $moremk = $self->{OPTFILE};
+ $moremk =~ s!/?[^/]*/*$!!;
+ $moremk .= '/more_mk.conf';
+ unless (-e $moremk) {
+ return "";
+ }
+ my @worker;
+ my $result = "";
+ my $ppkgsrc=`grep PREFER_PKGSRC $moremk`;
+ my $pnative=`grep PREFER_NATIVE $moremk`;
+ my $develop=`grep PKG_DEVELOPER $moremk`;
+ if ($ppkgsrc) {
+ @worker = split(/=/, $ppkgsrc);
+ if (scalar (@worker) >= 2) {
+ $result = 'PREFER_PKGSRC="' . $self->_trim($worker[1]) . '" ';
+ }
+ }
+ if ($pnative) {
+ @worker = split(/=/, $pnative);
+ if (scalar (@worker) >= 2) {
+ $result .= 'PREFER_NATIVE="' . $self->_trim($worker[1]) . '" ';
+ }
+ }
+ if ($develop) {
+ $result .= 'PKG_DEVELOPER=yes ';
+ }
+ $result .= 'SKIP_LICENSE_CHECK=yes ';
+ return $result;
+}
+
# Internal function for returning a port variable
sub _getVariable {
my $self = shift;
@@ -90,16 +166,30 @@ sub _getList {
my $port = shift;
my $item = shift;
my @deps;
+ my $found;
$self->_execMake($port);
foreach my $dep (split(/\s+/, $self->{CACHE}->{$port}{$item})) {
- my ($d, $ddir) = split(/:/, $dep);
- if (!defined($ddir) || $item eq 'DEPENDS') {
+ my ($d, $ddir) = split(/:/, $self->_trim($dep));
+ if (!defined($ddir)) {
$ddir = $d;
}
- $ddir =~ s|^$self->{BASEDIR}/||;
+ if ($d =~ /^{perl>=?5.+,.+}$/) {
+ $ddir = "lang/perl5"
+ } else {
+ $ddir =~ s|^$self->{BASEDIR}/||;
+ $ddir =~ s|^\.\.\/\.\.\/||;
+ }
if ($ddir) {
- push @deps, $ddir;
+ $found = 0;
+ foreach my $storedep (@deps) {
+ if ($storedep eq $ddir) {
+ $found = 1;
+ }
+ }
+ if (!$found) {
+ push @deps, $ddir;
+ }
}
}
return @deps;
@@ -109,7 +199,7 @@ sub _getList {
sub Name {
my $self = shift;
my $port = shift;
- return $self->_getVariable($port, 'PORTNAME');
+ return $self->_getVariable($port, 'PKGBASE');
}
# Package name
@@ -133,6 +223,13 @@ sub Maintainer {
return $self->_getVariable($port, 'MAINTAINER');
}
+# Buildlink3 dependencies
+sub Buildlink3Depends {
+ my $self = shift;
+ my $port = shift;
+ return $self->_getList($port, 'DEPENDS');
+}
+
# Extract dependencies
sub ExtractDepends {
my $self = shift;
@@ -189,8 +286,8 @@ sub IgnoreList {
my $n = 0;
$self->_execMake($port);
- foreach my $var ('NO_PACKAGE', 'IGNORE', 'FORBIDDEN') {
- $n++ if ($self->{CACHE}->{$port}{$var} ne "");
+ foreach my $var ('_CBBH') {
+ $n++ if ($self->{CACHE}->{$port}{$var} ne "yes");
}
return $n eq 0 ? "" : $self->PkgName($port);
}
@@ -206,6 +303,17 @@ sub FetchDependsList {
return grep { !$uniq{$_}++ } @deps;
}
+sub Buildlink3DependsList {
+ my $self = shift;
+ my $port = shift;
+
+ my @deps;
+ push(@deps, $self->Buildlink3Depends($port));
+
+ my %uniq;
+ return grep { !$uniq{$_}++ } @deps;
+}
+
sub ExtractDependsList {
my $self = shift;
my $port = shift;
@@ -250,6 +358,7 @@ sub BuildDependsList {
push(@deps, $self->FetchDepends($port));
push(@deps, $self->BuildDepends($port));
push(@deps, $self->LibDepends($port));
+ push(@deps, $self->Buildlink3Depends($port));
my %uniq;
return grep { !$uniq{$_}++ } @deps;
@@ -263,6 +372,7 @@ sub RunDependsList {
my @deps;
push(@deps, $self->LibDepends($port));
push(@deps, $self->RunDepends($port));
+ push(@deps, $self->Buildlink3Depends($port));
my %uniq;
return grep { !$uniq{$_}++ } @deps;