# This RPM spec file exists primarily to enable CI/CD pipelines and automatic # testing of built RPMs. This RPM can be used as a suitable baseline for a # proper distribution package, but changes should be made to suit the needs of # the package. %define debug_package %{nil} %global ygg_pkg_mgr_ver 0.1.4.2 Name: rhc Version: 0.2.8 Release: 0.63.git.d26206c%{?dist} Epoch: 1 Summary: Client for registering Red Hat Enterprise Linux systems License: GPLv3 URL: https://github.com/redhatinsights/rhc Source0: %{name}-%{version}.tar.gz # The yggdrasil variants must be referenced unconditionally: packit builds # a single SRPM for all targets in an environment that is evaluated # without the RHEL 8 macros, and only the sources referenced in that SRPM end # up in the lookaside cache. Selecting only one yggdrasil variant would leave # the RHEL 8 chroot without the tarball it needs ("Bad source" error). The # variant to build with is instead selected here and used as the source # number / version in %prep and %build below. The worker package manager is # common for all distributions and its version is shared as %{ygg_pkg_mgr_ver}. Source1: https://github.com/RedHatInsights/yggdrasil/releases/download/0.2.7.3/yggdrasil-0.2.7.3.tar.gz Source2: https://github.com/RedHatInsights/yggdrasil-worker-package-manager/releases/download/%{ygg_pkg_mgr_ver}/yggdrasil-worker-package-manager-%{ygg_pkg_mgr_ver}.tar.xz Source3: https://github.com/RedHatInsights/yggdrasil/releases/download/0.2.6.4/yggdrasil-0.2.6.4.tar.gz %if 0%{?rhel} && 0%{?rhel} == 8 %global yggdrasil_source 3 %global yggdrasil_version 0.2.6.4 %else %global yggdrasil_source 1 %global yggdrasil_version 0.2.7.3 %endif ExclusiveArch: %{go_arches} %if 0%{?rhel} && 0%{?rhel} == 8 Requires: insights-client %else Recommends: insights-client %endif Requires: subscription-manager BuildRequires: git BuildRequires: golang BuildRequires: dbus-devel BuildRequires: systemd-devel BuildRequires: systemd %description rhc is a client that registers a system with RHSM and activates the Red Hat yggd MQTT client. %prep %setup -T -D -c -n %{name} -a 0 %setup -T -D -c -n %{name} -a %{yggdrasil_source} %setup -T -D -c -n %{name} -a 2 %build cd %{_builddir}/%{name}/yggdrasil-%{yggdrasil_version} make PREFIX=%{_prefix} \ SYSCONFDIR=%{_sysconfdir} \ LOCALSTATEDIR=%{_localstatedir} \ SHORTNAME=rhc \ LONGNAME=rhc \ PKGNAME=@PKGNAME@ \ BRANDNAME=rhc \ TOPICPREFIX=redhat/insights \ VERSION=%{version} \ DATAHOST=cert.cloud.redhat.com \ 'PROVIDER=Red Hat' cd %{_builddir}/%{name}/yggdrasil-worker-package-manager-%{ygg_pkg_mgr_ver} go build -o rhc-package-manager-worker -mod=vendor . cd %{_builddir}/%{name}/%{name}-%{version} make PREFIX=%{_prefix} \ SYSCONFDIR=%{_sysconfdir} \ LOCALSTATEDIR=%{_localstatedir} \ SHORTNAME=rhc \ LONGNAME=rhc \ PKGNAME=@PKGNAME@ \ BRANDNAME=rhc \ TOPICPREFIX=redhat/insights \ VERSION=%{version} \ DATAHOST=cert.cloud.redhat.com \ 'PROVIDER=Red Hat' %install cd %{_builddir}/%{name}/yggdrasil-%{yggdrasil_version} make PREFIX=%{_prefix} \ SYSCONFDIR=%{_sysconfdir} \ LOCALSTATEDIR=%{_localstatedir} \ DESTDIR=%{buildroot} \ SHORTNAME=rhc \ LONGNAME=rhc \ PKGNAME=@PKGNAME@ \ BRANDNAME=rhc \ TOPICPREFIX=redhat/insights \ VERSION=%{version} \ DATAHOST=cert.cloud.redhat.com \ 'PROVIDER=Red Hat' \ install cd %{_builddir}/%{name}/yggdrasil-worker-package-manager-%{ygg_pkg_mgr_ver} install -D -m 755 rhc-package-manager-worker %{buildroot}%{_libexecdir}/rhc/ install -D -m 644 config.toml %{buildroot}%{_sysconfdir}/rhc/workers/rhc-package-manager.toml cd %{_builddir}/%{name}/%{name}-%{version} make PREFIX=%{_prefix} \ SYSCONFDIR=%{_sysconfdir} \ LOCALSTATEDIR=%{_localstatedir} \ DESTDIR=%{buildroot} \ SHORTNAME=rhc \ LONGNAME=rhc \ PKGNAME=@PKGNAME@ \ BRANDNAME=rhc \ TOPICPREFIX=redhat/insights \ VERSION=%{version} \ DATAHOST=cert.cloud.redhat.com \ 'PROVIDER=Red Hat' \ install %files %doc %{name}-%{version}/README.md %{_bindir}/rhc %{_sbindir}/rhcd %{_sysconfdir}/rhc/ %config(noreplace) %{_sysconfdir}/rhc/config.toml %{_unitdir}/rhcd.service %{_datadir}/bash-completion/completions/* %{_mandir}/man1/* %{_prefix}/share/pkgconfig/rhc.pc %{_libexecdir}/rhc %changelog