]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: skip missing optional libraries in image install
authorLuca Boccassi <luca.boccassi@microsoft.com>
Thu, 14 Jan 2021 16:48:13 +0000 (16:48 +0000)
committerLuca Boccassi <luca.boccassi@microsoft.com>
Mon, 18 Jan 2021 17:24:05 +0000 (17:24 +0000)
Not all optional libraries might be available on developers machines,
so log and skip.
Also some pkg-config files are broken (eg: tss2 on Debian Stable) so
skip if the required variables are missing, and improve logs.

test/test-functions

index 06dea3c7beca68cccfa64208b9f322c1faa046b2..efa2989bff9e22a5ed4e0453f9f0ec3498ac65d7 100644 (file)
@@ -698,14 +698,25 @@ install_missing_libraries() {
     # A number of dependencies is now optional via dlopen, so the install
     # script will not pick them up, since it looks at linkage.
     for lib in libcryptsetup libidn libidn2 pwquality libqrencode tss2-esys tss2-rc tss2-mu libfido2; do
-            if pkg-config --exists ${lib}; then
-                    path=$(pkg-config --variable=libdir ${lib})
-                    if ! [[ ${lib} =~ ^lib ]]; then
-                            lib="lib${lib}"
-                    fi
-                    inst_libs "${path}/${lib}.so"
-                    inst_library "${path}/${lib}.so"
-            fi
+        ddebug "Searching for $lib via pkg-config"
+        if pkg-config --exists ${lib}; then
+                path=$(pkg-config --variable=libdir ${lib})
+                if [ -z "${path}" ]; then
+                    ddebug "$lib.pc does not contain a libdir variable, skipping"
+                    continue
+                fi
+
+                if ! [[ ${lib} =~ ^lib ]]; then
+                        lib="lib${lib}"
+                fi
+                # Some pkg-config files are broken and give out the wrong paths
+                # (eg: libcryptsetup), so just ignore them
+                inst_libs "${path}/${lib}.so" || true
+                inst_library "${path}/${lib}.so" || true
+        else
+            ddebug "$lib.pc not found, skipping"
+            continue
+        fi
     done
 }