[libvirt PATCH] meson: Don't require the parted command at build time

Andrea Bolognani abologna at redhat.com
Tue Dec 28 14:56:25 UTC 2021


We need libparted to be available at build time otherwise we
can't link against it; we don't, however, need the parted
command to be present until runtime and, just as is the case
for other commands, we already perform a lookup through the
virCommand API so making sure it's available at build time
is unnecessary.

This doesn't make any difference for platform such as Fedora
and CentOS, where both the library and the command are in the
same package, but others like Debian, Ubuntu and openSUSE
have separate packages for the two components and this change
means that we can install one less package at build time.

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
Test pipeline: https://gitlab.com/abologna/libvirt/-/pipelines/437853370

 meson.build                        | 8 --------
 src/storage/storage_backend_disk.c | 2 ++
 src/storage/storage_util.c         | 2 ++
 3 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/meson.build b/meson.build
index 57561adf51..be51af1934 100644
--- a/meson.build
+++ b/meson.build
@@ -1043,14 +1043,6 @@ endif
 
 libparted_version = '1.8.0'
 libparted_dep = dependency('libparted', version: '>=' + libparted_version, required: false)
-if libparted_dep.found()
-  parted_prog = find_program('parted', required: false, dirs: libvirt_sbin_path)
-  if parted_prog.found()
-    conf.set_quoted('PARTED', parted_prog.path())
-  else
-    libparted_dep = dependency('', required: false)
-  endif
-endif
 
 libpcap_version = '1.5.0'
 if not get_option('libpcap').disabled()
diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c
index 97554e2576..be8a535570 100644
--- a/src/storage/storage_backend_disk.c
+++ b/src/storage/storage_backend_disk.c
@@ -40,6 +40,8 @@ VIR_LOG_INIT("storage.storage_backend_disk");
 
 #define SECTOR_SIZE 512
 
+#define PARTED "parted"
+
 static bool
 virStorageVolPartFindExtended(virStorageVolDef *def,
                               const void *opaque G_GNUC_UNUSED)
diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
index 03874d6ca3..728710153e 100644
--- a/src/storage/storage_util.c
+++ b/src/storage/storage_util.c
@@ -85,6 +85,8 @@ VIR_LOG_INIT("storage.storage_util");
 # define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
 #endif
 
+#define PARTED "parted"
+
 /* virStorageBackendNamespaceInit:
  * @poolType: virStoragePoolType
  * @xmlns: Storage Pool specific namespace callback methods
-- 
2.31.1




More information about the libvir-list mailing list