From 57dda90d3b5f19858e3cdb16523a46ea24608d8c Mon Sep 17 00:00:00 2001 From: Steven Seungcheol Lee Date: Fri, 28 Jan 2022 16:53:52 +0900 Subject: [PATCH] rpmbuild: Add json required version that detected from meson With higher version of json-c, yum install shows required version of it Error: Package: nvme-2.0-1.el7.x86_64 (/nvme-2.0-1.el7.x86_64) Requires: json-c >= 0.14 Installed: json-c-0.11-4.el7_0.x86_64 (@anaconda) json-c = 0.11-4.el7_0 Signed-off-by: Steven Seungcheol Lee --- meson.build | 9 ++++++++- nvme.spec.in | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 04bb9999..df5dbe1e 100644 --- a/meson.build +++ b/meson.build @@ -29,6 +29,7 @@ systemddir = join_paths(prefixdir, get_option('systemddir')) ############################################################################### conf = configuration_data() +requires = '' libnvme_dep = dependency('libnvme', fallback : ['libnvme', 'libnvme_dep']) @@ -40,7 +41,12 @@ conf.set('CONFIG_LIBUUID', libuuid_dep.found(), description: 'Is libuuid availab json_c_dep = dependency('json-c', version: '>=0.13', fallback : ['json-c', 'json_c_dep']) if json_c_dep.found() conf.set('CONFIG_JSONC', true, description: 'Is json-c available?') - conf.set('CONFIG_JSONC_14', json_c_dep.version().version_compare('>=0.14'), description: 'Is json-c at least 0.14?') + if json_c_dep.version().version_compare('>=0.14') + conf.set('CONFIG_JSONC_14', true, description: 'Is json-c at least 0.14?') + requires = 'Requires: json-c >= 0.14' + else + requires = 'Requires: json-c >= 0.13' + endif endif # Check for libhugetlbfs availability @@ -148,6 +154,7 @@ substs.set('VERSION', meson.project_version()) substs.set('LICENSE', meson.project_license()[0]) substs.set('UDEVRULESDIR', udevrulesdir) substs.set('DRACUTRILESDIR', dracutrulesdir) +substs.set('REQUIRES', requires) configure_file( input: 'nvme.spec.in', diff --git a/nvme.spec.in b/nvme.spec.in index aff1de3e..f4764bdf 100644 --- a/nvme.spec.in +++ b/nvme.spec.in @@ -8,6 +8,7 @@ URL: https://github.com/linux-nvme/nvme-cli/ Provides: nvme Requires(post): util-linux systemd systemd-udev BuildRoot: %{_tmppath}/%{name}-%{version}-root +@REQUIRES@ %description NVMe is a fast, scalable, direct attached storage interface. The nvme -- 2.50.1