meson: rename and modify spec file

We will create the final spec file by meson to have virt-manager version
in single place.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Pavel Hrdina 2024-10-25 14:48:27 +02:00 committed by Pavel Hrdina
parent d803491c47
commit 1f80a62239
5 changed files with 50 additions and 14 deletions

1
.gitignore vendored
View File

@ -15,5 +15,4 @@
/man/virt-clone.1
/man/virt-xml.1
/virt-manager.spec
/virtinst/build.cfg

View File

@ -5,3 +5,22 @@ project('virt-manager',
python = import('python')
python3 = python.find_installation('python3')
# figure out if we are building from git
git = run_command('test', '-e', '.git', check: false).returncode() == 0
subdir('scripts')
if git
spec_conf = configuration_data({
'VERSION': meson.project_version(),
})
spec_file = configure_file(
input: 'virt-manager.spec.in',
output: '@BASENAME@',
configuration: spec_conf,
)
meson.add_dist_script(meson_dist_prog.full_path(), spec_file)
endif

8
scripts/meson.build Normal file
View File

@ -0,0 +1,8 @@
scripts = [
'meson_dist.py',
]
foreach name : scripts
sname = name.split('.')[0].underscorify()
set_variable('@0@_prog'.format(sname), find_program(name))
endforeach

13
scripts/meson_dist.py Normal file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env python3
import os
import shutil
import sys
file_name = sys.argv[1]
meson_build_root = os.environ['MESON_BUILD_ROOT']
meson_dist_root = os.environ['MESON_DIST_ROOT']
shutil.copy(os.path.join(meson_build_root, file_name),
os.path.join(meson_dist_root, file_name))

View File

@ -7,7 +7,7 @@
# End local config
Name: virt-manager
Version: 4.1.0
Version: @VERSION@
Release: 1%{?dist}
%global verrel %{version}-%{release}
@ -15,7 +15,7 @@ Summary: Desktop tool for managing virtual machines via libvirt
License: GPL-2.0-or-later
BuildArch: noarch
URL: https://virt-manager.org/
Source0: https://virt-manager.org/download/sources/%{name}/%{name}-%{version}.tar.gz
Source0: https://virt-manager.org/download/sources/%{name}/%{name}-%{version}.tar.xz
Requires: virt-manager-common = %{verrel}
@ -53,7 +53,7 @@ Suggests: python3-libguestfs
BuildRequires: gettext
BuildRequires: python3-devel
BuildRequires: python3-docutils
BuildRequires: python3-setuptools
BuildRequires: meson
%description
@ -104,18 +104,15 @@ machine).
%build
%if %{default_hvs}
%global _default_hvs --default-hvs %{default_hvs}
%endif
./setup.py configure \
%{?_default_hvs}
%meson \
-Ddefault-hvs=%{default_hvs} \
-Dupdate-icon-cache=false \
-Dcompile-schemas=false
%meson_build
%install
./setup.py \
--no-update-icon-cache --no-compile-schemas \
install -O1 --root=%{buildroot}
%meson_install
%find_lang %{name}
%if 0%{?py_byte_compile:1}