%global debug_package %{nil} # # spec file for package hub-xmlrpc-api # # Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via https://bugs.opensuse.org/ # %if 0%{?rhel} == 8 %global debug_package %{nil} %endif %if 0%{?rhel} # Fix ERROR: No build ID note found in %undefine _missing_build_ids_terminate_build %endif %global provider github %global provider_tld com %global org uyuni-project %global project hub-xmlrpc-api %global provider_prefix %{provider}.%{provider_tld}/%{org}/%{project} %global import_path %{provider_prefix} Name: %{project} Version: 0.7 Release: 230900.6.11.uyuni3 Summary: XMLRPC API for Hub environments License: Apache-2.0 Group: Applications/Internet URL: https://%{provider_prefix} Source0: %{name}-%{version}.tar.gz BuildRequires: go >= 1.9 BuildRequires: golang-packaging BuildRequires: rsyslog BuildRoot: %{_tmppath}/%{name}-%{version}-build Requires: logrotate Requires: rsyslog Requires: systemd %description The Hub XMLRPC API provides an API which allows access to Uyuni functionality in a Server of Serves architecture (Hub) %prep %setup -q -n %{project}-%{version} %build export GOFLAGS=-mod=vendor %goprep %{import_path} %gobuild ... %install %goinstall %gofilelist %define _release_dir %{_builddir}/%{project}-%{version}/release # Service file for hub xmlrpc api install -D -m 0644 %{_release_dir}/hub-xmlrpc-api.service %{buildroot}/usr/lib/systemd/system/hub-xmlrpc-api.service # Add config files for hub install -d -m 0750 %{buildroot}%{_sysconfdir}/hub install -D -m 0644 %{_release_dir}/hub.conf %{buildroot}%{_sysconfdir}/hub install -d -m 0750 %{buildroot}%{_var}/log/hub # Add syslog config to redirect logs to /var/log/hub/hub-xmlrpc-api.log install -D -m 0644 %{_release_dir}/hub-logs.conf %{buildroot}%{_sysconfdir}/rsyslog.d/hub-logs.conf #logrotate config install -D -m 0644 %{_release_dir}/logrotate.conf %{buildroot}%{_sysconfdir}/logrotate.d/hub-xmlrpc-api %check # Fix OBS debug_package execution. rm -f %{buildroot}/usr/lib/debug/%{_bindir}/%{name}-%{version}-*.debug %pre %if 0%{?suse_version} %service_add_pre %{name}.service %endif %post %if 0%{?rhel} %systemd_post %{name}.service %else %service_add_post %{name}.service %endif if [ $1 == 1 ];then echo "-----------------------" echo "### The Hub XMLRPC API does NOT start on installation. You can set it up to start automatically with systemd, by executing the following commands" echo " sudo systemctl enable hub-xmlrpc-api.service" echo "" echo "### You can start Hub XMLRPC API by executing the following command" echo " sudo systemctl start hub-xmlrpc-api.service" echo "" echo " Make sure that '/etc/hub/hub.conf' is pointing to the correct Hub host" echo " Logs can be viewed at /var/log/hub/hub-xmlrpc-api.log" %if 0%{?rhel} %systemd_postun rsyslog.service %else %service_del_postun rsyslog.service %endif fi %preun %if 0%{?rhel} %systemd_preun %{name}.service %else %service_del_preun %{name}.service %endif %postun %if 0%{?rhel} %systemd_postun %{name}.service %else %service_del_postun %{name}.service %endif %files %defattr(-,root,root) %doc README.md %{_bindir}/hub-xmlrpc-api /usr/lib/systemd/system/hub-xmlrpc-api.service %dir %{_sysconfdir}/hub %dir %{_var}/log/hub %config(noreplace) %{_sysconfdir}/rsyslog.d/hub-logs.conf %config(noreplace) %{_sysconfdir}/hub/hub.conf %config(noreplace) %{_sysconfdir}/logrotate.d/hub-xmlrpc-api %changelog * Mon Apr 24 2023 Marina Latini - Do not strictly require Go 1.18 on SUSE Linux Enterprise 15 SP3 (bsc#1203599) * Thu Sep 29 2022 Marina Latini - Use golang(API) = 1.18 for building on SUSE (bsc#1203599) This source fails to build with the current go1.19 on SUSE and we need to use go1.18 instead. * Fri Jan 21 2022 Stefan Bluhm - Updated to build on Enterprise Linux 8. * Wed Sep 8 2021 Ricardo Mateus - use rpm systemd macro to restart service in replace of systemctl * Wed Aug 19 2020 Silvio Moioli - version 0.7 - one configuration flag was renamed for clarity * Wed Jul 15 2020 Abid Mehmood - version 0.6 - Added USE_SSL flag to https insted of plain http - Updated docs - Bugfixes * Thu Jun 18 2020 Silvio Moioli - version 0.5 - Changed configuration to plain variables - Bugfixes * Mon Mar 30 2020 Abid Mehmood - version 0.1.4 - Added systemd unit file for the api - Refactoring to make code more rebust - Better error handling in case of problems - Unit and Integration tests have been added * Fri Feb 7 2020 Abid Mehmood - Initial commit 0.1.3