[libvirt PATCH 0/4] Misc version updates

In both yajl and wireshark we can bump our min version per our platform support matrix and thus eliminate some historical cruft. Daniel P. Berrangé (4): meson: assume pkg-config support for yajl meson: bump min wireshark to 2.6.0 rpm: remove version checks for wireshark rpm: enable wireshark build for RHEL-8 and later libvirt.spec.in | 8 +++---- meson.build | 63 ++++++++++++++----------------------------------- 2 files changed, 22 insertions(+), 49 deletions(-) -- 2.28.0

Per the platform support rules, we no longer need to consider SLES 12 as a target, and so can now assume pkg-config support in yajl. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- meson.build | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/meson.build b/meson.build index cecaad199d..816cf97a19 100644 --- a/meson.build +++ b/meson.build @@ -1460,25 +1460,7 @@ else endif yajl_version = '2.0.3' -if not get_option('yajl').disabled() - yajl_dep = dependency('yajl', version: '>=' + yajl_version, required: false) - # 2.0.3 was the version where the pkg-config file was first added - # SLES 12 and openSUSE Leap 42.3 still use 2.0.1 - # TODO: delete this in July 2020 - if not yajl_dep.found() - yajl_dep = cc.find_library('yajl', required: get_option('yajl')) - if yajl_dep.found() - has_func = cc.has_function('yajl_tree_parse', dependencies: yajl_dep, prefix: '#include <yajl/yajl_tree.h>') - if not has_func and get_option('yajl').enabled() - error('yajl >= @0@ was not found'.format(yajl_version)) - elif not has_func - yajl_dep = dependency('', required: false) - endif - endif - endif -else - yajl_dep = dependency('', required: false) -endif +yajl_dep = dependency('yajl', version: '>=' + yajl_version, required: get_option('yajl')) if yajl_dep.found() conf.set('WITH_YAJL', 1) endif -- 2.28.0

If using the declared min version of wireshark, 2.4.0, libvirt plugin fails to build. This min version isn't present in any supported distros and thus not tested by CI. We don't support wireshark on RHEL-7 since it has 1.x.x series. The next oldest version present in supported distros is 2.6.2 on RHEL-8. Thus we should bump the min version to 2.6.0. This also lets us assume that the "plugindir" variable exists in pkg-config. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- meson.build | 43 +++++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/meson.build b/meson.build index 816cf97a19..565a5f12e2 100644 --- a/meson.build +++ b/meson.build @@ -1403,7 +1403,7 @@ else win32_link_flags = [] endif -wireshark_version = '2.4.0' +wireshark_version = '2.6.0' wireshark_dep = dependency('wireshark', version: '>=' + wireshark_version, required: get_option('wireshark_dissector')) if wireshark_dep.found() wireshark_plugindir = get_option('wireshark_plugindir') @@ -1411,31 +1411,22 @@ if wireshark_dep.found() wireshark_plugindir = wireshark_dep.get_pkgconfig_variable('plugindir') endif - # On some systems the plugindir variable may not be stored within pkg config. - # Fall back to older style of constructing the plugin dir path. - if wireshark_plugindir == '' - wireshark_modversion = wireshark_dep.version() - wireshark_plugindir = '@0@/wireshark/plugins/@1@'.format( - libdir, wireshark_modversion - ) - else - wireshark_prefix = wireshark_dep.get_pkgconfig_variable('prefix') - if wireshark_prefix == '' - # If wireshark's prefix cannot be retrieved from pkg-config, - # this is our best bet. - wireshark_prefix = '/usr' - endif - # Replace wireshark's prefix with our own. - # There is no replace method in meson so we have to workaround it. - rc = run_command( - 'python3', '-c', - 'print("@0@".replace("@1@", "@2@"))'.format( - wireshark_plugindir, wireshark_prefix, prefix, - ), - check: true, - ) - wireshark_plugindir = rc.stdout().strip() - endif + wireshark_prefix = wireshark_dep.get_pkgconfig_variable('prefix') + if wireshark_prefix == '' + # If wireshark's prefix cannot be retrieved from pkg-config, + # this is our best bet. + wireshark_prefix = '/usr' + endif + # Replace wireshark's prefix with our own. + # There is no replace method in meson so we have to workaround it. + rc = run_command( + 'python3', '-c', + 'print("@0@".replace("@1@", "@2@"))'.format( + wireshark_plugindir, wireshark_prefix, prefix, + ), + check: true, + ) + wireshark_plugindir = rc.stdout().strip() # Since wireshark 2.5.0 plugins can't live in top level plugindir but have # to be under one of ["epan", "wiretap", "codecs"] subdir. The first one looks okay. -- 2.28.0

We only turn on with_wireshark if we already know the distro is guaranteed to have new enough packages. The versioned dep is thus not required. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- libvirt.spec.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 034982809d..43955b0e09 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -386,7 +386,7 @@ BuildRequires: numad %endif %if %{with_wireshark} -BuildRequires: wireshark-devel >= 2.4.0 +BuildRequires: wireshark-devel %endif %if %{with_libssh} @@ -928,7 +928,7 @@ Bash completion script stub. %if %{with_wireshark} %package wireshark Summary: Wireshark dissector plugin for libvirt RPC transactions -Requires: wireshark >= 2.4.0 +Requires: wireshark Requires: %{name}-libs = %{version}-%{release} %description wireshark -- 2.28.0

wireshark plugin was disabled in RHEL because RHEL-7 was too old, but we forgot to enable it in RHEL-8 where it builds fine. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- libvirt.spec.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 43955b0e09..de76878bc6 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -167,8 +167,8 @@ %define with_libssh2 0%{!?_without_libssh2:1} %endif -# Enable wireshark plugins for all distros shipping libvirt 1.2.2 or newer -%if 0%{?fedora} +# Enable wireshark plugins for all distros except RHEL-7 +%if 0%{?fedora} || 0%{?rhel} > 7 %define with_wireshark 0%{!?_without_wireshark:1} %define wireshark_plugindir %(pkg-config --variable plugindir wireshark)/epan %endif -- 2.28.0

On 11/13/20 6:03 PM, Daniel P. Berrangé wrote:
In both yajl and wireshark we can bump our min version per our platform support matrix and thus eliminate some historical cruft.
Daniel P. Berrangé (4): meson: assume pkg-config support for yajl meson: bump min wireshark to 2.6.0 rpm: remove version checks for wireshark rpm: enable wireshark build for RHEL-8 and later
libvirt.spec.in | 8 +++---- meson.build | 63 ++++++++++++++----------------------------------- 2 files changed, 22 insertions(+), 49 deletions(-)
Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Michal
participants (2)
-
Daniel P. Berrangé
-
Michal Privoznik