fix automatic feature disabling failed when more than one dependency is missing

Wed, 20 Sep 2023 18:41:58 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Wed, 20 Sep 2023 18:41:58 +0200
changeset 68
c997c0978665
parent 67
e43d30273f74
child 69
96d8badffe58

fix automatic feature disabling failed when more than one dependency is missing

src/test/resources/golden-sample/configure file | annotate | diff | comparison | revisions
src/test/resources/golden-sample/configure2 file | annotate | diff | comparison | revisions
test/configure file | annotate | diff | comparison | revisions
test/make/configure.vm file | annotate | diff | comparison | revisions
test/make/project.xml file | annotate | diff | comparison | revisions
--- a/src/test/resources/golden-sample/configure	Tue Sep 19 19:29:19 2023 +0200
+++ b/src/test/resources/golden-sample/configure	Wed Sep 20 18:41:58 2023 +0200
@@ -322,9 +322,6 @@
     # dependency libxml2
     while true
     do
-        if [ -z "$lang_c" ] ; then
-            break
-        fi
         if [ -z "$PKG_CONFIG" ]; then
             break
         fi
@@ -403,10 +400,6 @@
     DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED openssl "
     ERROR=1
 fi
-if dependency_error_libpq; then
-    DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libpq "
-    ERROR=1
-fi
 
 # Features
 if [ -n "$FEATURE_PG" ]; then
@@ -414,8 +407,8 @@
     if dependency_error_libpq ; then
         # "auto" features can fail and are just disabled in this case
         if [ "$FEATURE_PG" = "auto" ]; then
-            unset FEATURE_PG
-		else
+            DISABLE_FEATURE_PG=1
+        else
             DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libpq "
             ERROR=1
         fi
@@ -424,12 +417,15 @@
     if dependency_error_cpp ; then
         # "auto" features can fail and are just disabled in this case
         if [ "$FEATURE_PG" = "auto" ]; then
-            unset FEATURE_PG
-		else
+            DISABLE_FEATURE_PG=1
+        else
             DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED cpp "
             ERROR=1
         fi
     fi
+    if [ -n "$DISABLE_FEATURE_PG" ]; then
+        unset FEATURE_PG
+    fi
 fi
 
 
--- a/src/test/resources/golden-sample/configure2	Tue Sep 19 19:29:19 2023 +0200
+++ b/src/test/resources/golden-sample/configure2	Wed Sep 20 18:41:58 2023 +0200
@@ -560,24 +560,30 @@
     if dependency_error_sqlite ; then
         # "auto" features can fail and are just disabled in this case
         if [ "$FEATURE_DB" = "auto" ]; then
-            unset FEATURE_DB
-		else
+            DISABLE_FEATURE_DB=1
+        else
             DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED sqlite "
             ERROR=1
         fi
     fi
+    if [ -n "$DISABLE_FEATURE_DB" ]; then
+        unset FEATURE_DB
+    fi
 fi
 if [ -n "$FEATURE_GUI" ]; then
     # check dependency
     if dependency_error_gtk3 ; then
         # "auto" features can fail and are just disabled in this case
         if [ "$FEATURE_GUI" = "auto" ]; then
-            unset FEATURE_GUI
-		else
+            DISABLE_FEATURE_GUI=1
+        else
             DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED gtk3 "
             ERROR=1
         fi
     fi
+    if [ -n "$DISABLE_FEATURE_GUI" ]; then
+        unset FEATURE_GUI
+    fi
 fi
 
 # Option: --toolkit
--- a/test/configure	Tue Sep 19 19:29:19 2023 +0200
+++ b/test/configure	Wed Sep 20 18:41:58 2023 +0200
@@ -322,9 +322,6 @@
     # dependency libxml2
     while true
     do
-        if [ -z "$lang_c" ] ; then
-            break
-        fi
         if [ -z "$PKG_CONFIG" ]; then
             break
         fi
@@ -403,10 +400,6 @@
     DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED openssl "
     ERROR=1
 fi
-if dependency_error_libpq; then
-    DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libpq "
-    ERROR=1
-fi
 
 # Features
 if [ -n "$FEATURE_PG" ]; then
@@ -414,8 +407,8 @@
     if dependency_error_libpq ; then
         # "auto" features can fail and are just disabled in this case
         if [ "$FEATURE_PG" = "auto" ]; then
-            unset FEATURE_PG
-		else
+            DISABLE_FEATURE_PG=1
+        else
             DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libpq "
             ERROR=1
         fi
@@ -424,12 +417,15 @@
     if dependency_error_cpp ; then
         # "auto" features can fail and are just disabled in this case
         if [ "$FEATURE_PG" = "auto" ]; then
-            unset FEATURE_PG
-		else
+            DISABLE_FEATURE_PG=1
+        else
             DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED cpp "
             ERROR=1
         fi
     fi
+    if [ -n "$DISABLE_FEATURE_PG" ]; then
+        unset FEATURE_PG
+    fi
 fi
 
 
--- a/test/make/configure.vm	Tue Sep 19 19:29:19 2023 +0200
+++ b/test/make/configure.vm	Wed Sep 20 18:41:58 2023 +0200
@@ -476,13 +476,16 @@
     if dependency_error_$dependency ; then
         # "auto" features can fail and are just disabled in this case
         if [ "$${feature.getVarName()}" = "auto" ]; then
-            unset ${feature.getVarName()}
-		else
+            DISABLE_${feature.getVarName()}=1
+        else
             DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} "
             ERROR=1
         fi
     fi
 #end
+    if [ -n "$DISABLE_${feature.getVarName()}" ]; then
+        unset ${feature.getVarName()}
+    fi
 fi
 #end
 
--- a/test/make/project.xml	Tue Sep 19 19:29:19 2023 +0200
+++ b/test/make/project.xml	Wed Sep 20 18:41:58 2023 +0200
@@ -23,7 +23,6 @@
 
 	<dependency name="libxml2">
 		<pkgconfig>libxml-2.0</pkgconfig>
-		<lang>c</lang>
 	</dependency>
 	
 	<dependency name="openssl">
@@ -44,7 +43,7 @@
 		<feature name="pg" default="true">
 			<dependencies>libpq,cpp</dependencies>
 		</feature>
-		<dependencies>libxml2,openssl,libpq</dependencies>
+		<dependencies>libxml2,openssl</dependencies>
 	</target>
 </project>
 

mercurial