Support for generating rpms via meson
Add a meson script that can be used to create rpms from the source tree. It can also be used to install the plugins.
This commit is contained in:
parent
8fb1342631
commit
df628f26aa
3 changed files with 167 additions and 0 deletions
68
koji-osbuild.spec.in
Normal file
68
koji-osbuild.spec.in
Normal file
|
|
@ -0,0 +1,68 @@
|
||||||
|
%global commit @commit@
|
||||||
|
%global forgeurl https://github.com/gicmo/koji-osbuild
|
||||||
|
|
||||||
|
Name: koji-osbuild
|
||||||
|
Version: @version@
|
||||||
|
Release: 0%{?dist}
|
||||||
|
Summary: Koji integration for osbuild composer
|
||||||
|
|
||||||
|
%forgemeta
|
||||||
|
|
||||||
|
License: ASL 2.0
|
||||||
|
URL: %{forgeurl}
|
||||||
|
Source0: %{forgesource}
|
||||||
|
|
||||||
|
BuildArch: noarch
|
||||||
|
BuildRequires: python%{python3_pkgversion}-devel
|
||||||
|
BuildRequires: python%{python3_pkgversion}dist(setuptools)
|
||||||
|
|
||||||
|
%description
|
||||||
|
Koji integration for osbuild composer.
|
||||||
|
|
||||||
|
%package hub
|
||||||
|
Summary: Koji hub plugin for osbuild composer integration
|
||||||
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
Requires: koji-hub
|
||||||
|
|
||||||
|
%description hub
|
||||||
|
Koji hub plugin for osbuild composer integration.
|
||||||
|
|
||||||
|
%package builder
|
||||||
|
Summary: Koji hub plugin for osbuild composer integration
|
||||||
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
Requires: koji-builder
|
||||||
|
|
||||||
|
%description builder
|
||||||
|
Koji builder plugin for osbuild composer integration.
|
||||||
|
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%forgesetup
|
||||||
|
|
||||||
|
%build
|
||||||
|
# no op
|
||||||
|
|
||||||
|
%install
|
||||||
|
install -d %{buildroot}/%{_prefix}/lib/koji-hub-plugins
|
||||||
|
install -p -m 0755 plugins/hub/osbuild.py %{buildroot}/%{_prefix}/lib/koji-hub-plugins/
|
||||||
|
%py_byte_compile %{__python3} %{buildroot}/%{_prefix}/lib/koji-hub-plugins/osbuild.py
|
||||||
|
|
||||||
|
install -d %{buildroot}/%{_prefix}/lib/koji-builder-plugins
|
||||||
|
install -p -m 0755 plugins/builder/osbuild.py %{buildroot}/%{_prefix}/lib/koji-builder-plugins/
|
||||||
|
%py_byte_compile %{__python3} %{buildroot}/%{_prefix}/lib/koji-builder-plugins/osbuild.py
|
||||||
|
|
||||||
|
%files
|
||||||
|
%license LICENSE
|
||||||
|
%doc README.md
|
||||||
|
|
||||||
|
%files hub
|
||||||
|
%pycached %{_prefix}/lib/koji-hub-plugins/osbuild.py
|
||||||
|
|
||||||
|
|
||||||
|
%files builder
|
||||||
|
%pycached %{_prefix}/lib/koji-builder-plugins/osbuild.py
|
||||||
|
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* @longdate@ osbuild <osbuilders@osbuild.org> - @version@-@reltag@
|
||||||
|
- build from git sources.
|
||||||
95
meson.build
Normal file
95
meson.build
Normal file
|
|
@ -0,0 +1,95 @@
|
||||||
|
project('koji-osbuild', license: 'ASL 2.0', version: '1')
|
||||||
|
|
||||||
|
srcdir = meson.source_root()
|
||||||
|
|
||||||
|
hub_plugins_path = get_option('hub-plugins-path')
|
||||||
|
builder_plugins_path = get_option('builder-plugins-path')
|
||||||
|
|
||||||
|
install_data(
|
||||||
|
'plugins/hub/osbuild.py',
|
||||||
|
install_dir: hub_plugins_path,
|
||||||
|
)
|
||||||
|
|
||||||
|
install_data(
|
||||||
|
'plugins/builder/osbuild.py',
|
||||||
|
install_dir: builder_plugins_path
|
||||||
|
)
|
||||||
|
|
||||||
|
git = find_program('git')
|
||||||
|
|
||||||
|
subs = configuration_data()
|
||||||
|
subs.set('version', meson.project_version())
|
||||||
|
|
||||||
|
longdate = run_command('date', '+%a %b %d %Y').stdout().strip()
|
||||||
|
subs.set('longdate', longdate)
|
||||||
|
|
||||||
|
gitres = run_command(git, ['--git-dir=@0@/.git'.format(srcdir),
|
||||||
|
'rev-parse',
|
||||||
|
'--short=7',
|
||||||
|
'HEAD'])
|
||||||
|
|
||||||
|
if gitres.returncode() == 0
|
||||||
|
commit = gitres.stdout().strip()
|
||||||
|
subs.set('commit', commit)
|
||||||
|
|
||||||
|
gitrev = gitres.stdout().strip()
|
||||||
|
gitdate = run_command('date', '+%Y%m%d').stdout().strip()
|
||||||
|
# YYYYMMDD<scm><revision>
|
||||||
|
subs.set('reltag', '@0@git@1@'.format(gitdate, gitrev))
|
||||||
|
endif
|
||||||
|
|
||||||
|
spec_file = configure_file(
|
||||||
|
input: 'koji-osbuild.spec.in',
|
||||||
|
output: 'koji-osbuild.spec',
|
||||||
|
configuration: subs
|
||||||
|
)
|
||||||
|
|
||||||
|
archive_name = meson.project_name() + '-' + gitrev
|
||||||
|
full_archive_name = archive_name + '.tar.gz'
|
||||||
|
archive = custom_target(
|
||||||
|
'tarball',
|
||||||
|
command: [
|
||||||
|
git,
|
||||||
|
'-C', meson.source_root(),
|
||||||
|
'archive',
|
||||||
|
'-o', join_paths(meson.build_root(), full_archive_name),
|
||||||
|
'--prefix', archive_name + '/',
|
||||||
|
commit
|
||||||
|
],
|
||||||
|
output: full_archive_name,
|
||||||
|
)
|
||||||
|
|
||||||
|
mkdir = find_program('mkdir')
|
||||||
|
rpmdirs_target = custom_target(
|
||||||
|
'rpmdirs',
|
||||||
|
command: [
|
||||||
|
mkdir, '-p',
|
||||||
|
'rpmbuild/BUILD',
|
||||||
|
'rpmbuild/RPMS',
|
||||||
|
'rpmbuild/SPECS',
|
||||||
|
'rpmbuild/SRPMS'],
|
||||||
|
output: 'rpmbuild',
|
||||||
|
)
|
||||||
|
|
||||||
|
rpmbuild = find_program('rpmbuild', required: false)
|
||||||
|
|
||||||
|
rpm_target = custom_target(
|
||||||
|
'rpm',
|
||||||
|
command: [
|
||||||
|
rpmbuild, '-ba',
|
||||||
|
spec_file,
|
||||||
|
'--define', '_sourcedir ' + meson.build_root(),
|
||||||
|
'--define', '_topdir ' + rpmdirs_target.full_path()
|
||||||
|
],
|
||||||
|
output: 'rpms',
|
||||||
|
depends: [archive]
|
||||||
|
)
|
||||||
|
|
||||||
|
msg = ['',
|
||||||
|
'version: @0@'.format(meson.project_version()),
|
||||||
|
'',
|
||||||
|
'hub plugins path: @0@'.format(hub_plugins_path),
|
||||||
|
'builder plugins path: @0@'.format(builder_plugins_path),
|
||||||
|
'',
|
||||||
|
]
|
||||||
|
message('\n '.join(msg))
|
||||||
4
meson_options.txt
Normal file
4
meson_options.txt
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
option('hub-plugins-path', type: 'string', value: '/usr/lib/koji-hub-plugins',
|
||||||
|
description: 'Path for koji hub plugins')
|
||||||
|
option('builder-plugins-path', type: 'string', value: '/usr/lib/koji-builder-plugins',
|
||||||
|
description: 'Path for koji builder plugins')
|
||||||
Loading…
Add table
Add a link
Reference in a new issue