OpenPKG CVS Repository
http://cvs.openpkg.org/
____________________________________________________________________________
Server: cvs.openpkg.org Name: Michael van Elst
Root: /e/openpkg/cvs Email: [EMAIL PROTECTED]
Module: openpkg-src Date: 29-Nov-2002 11:10:22
Branch: HEAD Handle: 2002112910102100
Modified files:
openpkg-src/openpkg-tool openpkg-build.pl openpkg-tool.spec
Log:
allow for global options used by l_tool_locate macro
parse empty Options: list from description
Summary:
Revision Changes Path
1.9 +23 -17 openpkg-src/openpkg-tool/openpkg-build.pl
1.6 +2 -2 openpkg-src/openpkg-tool/openpkg-tool.spec
____________________________________________________________________________
Index: openpkg-src/openpkg-tool/openpkg-build.pl
============================================================
$ cvs diff -u -r1.8 -r1.9 openpkg-build.pl
--- openpkg-src/openpkg-tool/openpkg-build.pl 27 Nov 2002 16:40:12 -0000 1.8
+++ openpkg-src/openpkg-tool/openpkg-build.pl 29 Nov 2002 10:10:21 -0000 1.9
@@ -226,7 +226,7 @@
sub get_config ()
{
- my($c,@q);
+ my($c,@q,@g);
$c = `$RPM_NPRIV --eval '%{_rpmdir} %{_rpmfilename} %{_target_os}
%{_target_cpu} %{_target_platform} %{_prefix}'`;
chomp($c);
@@ -235,11 +235,16 @@
$q[1] =~ s/%{OS}/$q[2]/;
$q[1] =~ s/%{ARCH}/$q[3]/;
+
+ $c = `$RPM_NPRIV --showrc`;
+ @g = $c =~ /\%\{l_tool_locate\s+([^\s\}]+)/g;
+
return {
rpmdir => $q[0],
template => $q[1],
platform => $q[4],
- prefix => $q[5]
+ prefix => $q[5],
+ optreg => '(?:'.join('|', map { "\Qwith_$_\E" } @g).')'
};
}
@@ -335,16 +340,16 @@
sub parse_options ($) {
my($l) = @_;
- $l = [ split(/\n+/, $l) ] unless ref $l;
- my(%with) = map { /--define\s*'(\S+)\s+(\S+?)'/ } @$l;
- return unless %with;
+ $l = join("\n",@$l) if ref $l;
+ return unless $l =~ s/.*Options://;
+ my(%with) = $l =~ /--define\s*'(\S+)\s+(\S+?)'/g;
return \%with;
}
-sub override_options ($$) {
- my($old, $new) = @_;
+sub override_options ($$$) {
+ my($old, $new, $reg) = @_;
while (my ($k,$v) = each %$new) {
- $old->{$k} = $v if exists $old->{$k};
+ $old->{$k} = $v if exists $old->{$k} || $k =~ /^$reg$/;
}
}
@@ -834,14 +839,14 @@
#
# report options that are not used for
#
-sub warn_about_options ($$) {
- my($target, $with) = @_;
+sub warn_about_options ($$$) {
+ my($target, $with, $c) = @_;
my($iwith) = $target->{OPTIONS};
my($k,$v);
return unless defined $iwith;
while (($k,$v) = each %$with) {
- if (!exists $iwith->{$k}) {
+ if (!exists $iwith->{$k} && $k !~ $c->{optreg}) {
print "# ATTENTION: $target->{name} ignores option '$k'\n";
}
}
@@ -936,7 +941,8 @@
return;
}
# use options from installed base
- override_options($target->{OPTIONS}, $t->{OPTIONS});
+ override_options($target->{OPTIONS}, $t->{OPTIONS},
+ $env->{config}->{optreg});
# remember this is a rebuild for a proxy package
$target->{PROXY} = $t->{PROXY};
$target->{REBUILD} = 1;
@@ -1080,7 +1086,7 @@
die "FATAL: no known source found for '$name'\n" unless $t;
- warn_about_options($t, $env->{with});
+ warn_about_options($t, $env->{with}, $env->{config});
push(@goals, $t);
}
return unless @goals;
@@ -1134,8 +1140,8 @@
return (glob("$prefix/RPM/PKG/$bpkg"))[0];
}
-sub make_defines ($$) {
- my($old, $new) = @_;
+sub make_defines ($$$) {
+ my($old, $new, $c) = @_;
my($with);
#
@@ -1148,7 +1154,7 @@
#
if ($old) {
$old = { %$old };
- override_options($old, $new);
+ override_options($old, $new, $c->{optreg});
} else {
$old = $new;
}
@@ -1189,7 +1195,7 @@
if ($uncond || !-f $bpkg || $_->{REBUILD} ||
!target_suitable(binary_target($_, $bpkg),$with)) {
- $opt = make_defines($_->{OPTIONS}, $with);
+ $opt = make_defines($_->{OPTIONS}, $with, $c);
#
# proxy packages are rebuilt from their maste
Index: openpkg-src/openpkg-tool/openpkg-tool.spec
============================================================
$ cvs diff -u -r1.5 -r1.6 openpkg-tool.spec
--- openpkg-src/openpkg-tool/openpkg-tool.spec 28 Nov 2002 08:32:24 -0000
1.5
+++ openpkg-src/openpkg-tool/openpkg-tool.spec 29 Nov 2002 10:10:21 -0000
1.6
@@ -32,8 +32,8 @@
Distribution: OpenPKG [EVAL]
Group: Bootstrapping
License: GPL
-Version: 20021128
-Release: 20021128
+Version: 20021129
+Release: 20021129
# list of sources
Source0: openpkg.sh
______________________________________________________________________
The OpenPKG Project www.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]