Explorar el Código

check option conflicts, propagate committed options to dependency check

Michael van Elst hace 22 años
padre
commit
df1c341800
Se han modificado 2 ficheros con 40 adiciones y 15 borrados
  1. 38 13
      openpkg-tool/openpkg-build.pl
  2. 2 2
      openpkg-tool/openpkg-tool.spec

+ 38 - 13
openpkg-tool/openpkg-build.pl

@@ -1360,7 +1360,11 @@ sub target_suitable ($$) {
     my($iwith);
     my($k,$v);
 
-    $with = name_with($target->{name}, $with);
+    if ($target->{GOAL}) {
+        $with = name_with($target->{name}, $with);
+    } else {
+        $with = name_only_with($target->{name}, $with);
+    }
 
     $iwith = $target->{OPTIONS};
     while (($k,$v) = each %$with) {
@@ -1405,16 +1409,38 @@ sub warn_about_options ($$$) {
 # add dependency as build option
 #
 sub depend_option ($$$) {
-    my($target,$dep,$with) = @_;
+    my($target,$dep,$env) = @_;
+    my($with,$opt,$relmap,@t,$t);
     my($pro) = depends2provides($dep);
+    my($conflict) = 0;
 
     return 1 unless defined $pro->{with};
 
-    my($opt) = $pro->{prefix}.'::'.$pro->{with};
     my($val) = defined $pro->{version} ? $pro->{version} : 'yes';
+
+    $with = $env->{with};
+    $opt  = $pro->{prefix}.'::'.$pro->{with};
     if (defined $with->{$opt} && $with->{$opt} ne $val) {
-        return 0;
+        print "# ",vsn($target),
+            " has conflicting requirement $opt = $with->{$opt} != $val\n";
+        $conflict = 1;
+    }
+
+    $relmap = $env->{built}->{$pro->{prefix}} ||
+              $env->{installed}->{$pro->{prefix}};
+    @t = get_targets($relmap, sub { 1; });
+    foreach $t (@t) {
+        $with = $t->{OPTIONS};
+        $opt  = $pro->{with};
+        if (defined $with->{$opt} && $with->{$opt} ne $val) {
+            print "# ",vsn($t),
+                " has conflicting requirement $opt = $with->{$opt} != $val\n";
+            $conflict = 1;
+        }
     }
+
+    return 0 if $conflict;
+                  
     print "# ",vsn($target)," adds option $opt = $val\n";
     $with->{$opt} = $val;
     return 1;
@@ -1559,7 +1585,7 @@ sub make_dep ($$$$$$$) {
         } elsif ($why = target_better($env, $target, $env->{installed})) {
             target_setstatus($target,'UPDATE',3);
             print "# rebuilding $target->{name} ($why)\n";
-        } elsif ($target->{GOAL} && !target_suitable($t, $env->{with})) {
+        } elsif (!target_suitable($t, $env->{with})) {
             target_setstatus($target,'MISMATCH',2);
             print "# rebuilding $target->{name} (parameter mismatch)\n";
         } else {
@@ -1621,7 +1647,7 @@ sub make_dep ($$$$$$$) {
                     print "# $target->{name} requires ".vsn($t)." for $_\n";
                 }
 
-                unless (depend_option($t, $d{$_}, $env->{with})) {
+                unless (depend_option($t, $d{$_}, $env)) {
                     print "# $target->{name} has conflicting requirement\n";
                     push(@{$env->{fatal}},vsn($target));
                     target_setstatus($target,'UNDEF',4);
@@ -1652,6 +1678,11 @@ sub make_dep ($$$$$$$) {
     $target->{WHY} = $target->{STATUS};
     push(@$list, $target);
     $target->{LIMBO} = 0;
+     
+    # remember new options
+    override_options($target->{OPTIONS},
+                     name_with($target->{name}, $env->{with}),
+                     '');
 
     foreach (@{target_nosource($target,$env)}) {
         my($p) = target_source($target,$env)->[$_];
@@ -1965,12 +1996,6 @@ sub print_list1 ($$$@$) {
         $spkg = $_->{href};
         $bpkg = target2rpm($_, $c);
 
-    if ($_->{GOAL}) {
-        $mywith = name_with($_->{name},$with);
-    } else {
-        $mywith = name_only_with($_->{name},$with);
-    }
-
         #
         # rebuild binary package IF
         #
@@ -1982,7 +2007,7 @@ sub print_list1 ($$$@$) {
         #
         $cmd1 = undef;
         if ($uncond || $_->{REBUILD} || !-f $bpkg ||
-            !target_suitable(binary_target($_, $bpkg),$mywith)) {
+            !target_suitable(binary_target($_, $bpkg), $mywith)) {
 
             $opt = make_defines($_->{OPTIONS}, $mywith,
                                 $_->{DEFOPTS}, $c);

+ 2 - 2
openpkg-tool/openpkg-tool.spec

@@ -32,8 +32,8 @@ Packager:     The OpenPKG Project
 Distribution: OpenPKG [PLUS]
 Group:        Bootstrapping
 License:      GPL
-Version:      20030514
-Release:      20030514
+Version:      20030528
+Release:      20030528
 
 #   list of sources
 Source0:      openpkg.sh