yggdrasil/yggdrasil.spec

158 lines
5.6 KiB
RPMSpec

# Generated by go2rpm 1.3
%bcond_without check
# https://github.com/redhatinsights/yggdrasil
%global goipath github.com/redhatinsights/yggdrasil
%global commit ffb580f55ae91beff78156fdb6a41be8bc049117
%global shortcommit %(c=%commit}; echo ${c:0:7})
Version: 0.2.98^1.%{shortcommit}
%gometa
%global common_description %{expand:
yggdrasil is a client daemon that establishes a receiving queue for instructions
to be sent to the system via a broker.}
%global golicenses LICENSE
%global godocs INSTALL.md HACKING.md README.md
Name: yggdrasil
Release: 0.2%{?dist}
Summary: Remote execution client and dispatch service
License: GPLv3
URL: %{gourl}
Source0: %{gosource}
BuildRequires: golang(git.sr.ht/~spc/go-log)
BuildRequires: golang(github.com/briandowns/spinner)
BuildRequires: golang(github.com/coreos/go-systemd/v22/dbus)
BuildRequires: golang(github.com/eclipse/paho.mqtt.golang)
BuildRequires: golang(github.com/godbus/dbus/v5)
BuildRequires: golang(github.com/google/uuid)
BuildRequires: golang(github.com/pelletier/go-toml)
BuildRequires: golang(github.com/rjeczalik/notify)
BuildRequires: golang(github.com/urfave/cli/v2)
BuildRequires: golang(github.com/urfave/cli/v2/altsrc)
BuildRequires: golang(golang.org/x/crypto/ssh/terminal)
BuildRequires: golang(google.golang.org/grpc)
BuildRequires: golang(google.golang.org/grpc/codes)
BuildRequires: golang(google.golang.org/grpc/status)
BuildRequires: golang(google.golang.org/protobuf/reflect/protoreflect)
BuildRequires: golang(google.golang.org/protobuf/runtime/protoimpl)
BuildRequires: systemd-rpm-macros
%if %{with check}
# Tests
BuildRequires: golang(github.com/google/go-cmp/cmp)
BuildRequires: golang(github.com/google/go-cmp/cmp/cmpopts)
%endif
%description
%{common_description}
%package devel
Summary: Development files for %{name}
Requires: %{name} = %{version}-%{release}
%description devel
%{common_description}
This package includes files necessary for building yggdrasil workers.
%prep
%goprep
%global brandname yggdrasil
%global shortname ygg
%global longname yggdrasil
%global topicprefix ""
%global datahost ""
%global provider ""
%global sed_flags %{expand:-e 's,[@]SHORTNAME[@],%{shortname},g' \\
-e 's,[@]LONGNAME[@],%{longname},g' \\
-e 's,[@]BRANDNAME[@],%{brandname},g' \\
-e 's,[@]PKGNAME[@],%{name},g' \\
-e 's,[@]VERSION[@],%{version},g' \\
-e 's,[@]TOPICPREFIX[@],%{topicprefix},g' \\
-e 's,[@]DATAHOST[@],%{datahost},g' \\
-e 's,[@]PROVIDER[@],%{provider},g' \\
-e 's,[@]PREFIX[@],%{_prefix},g' \\
-e 's,[@]BINDIR[@],%{_bindir},g' \\
-e 's,[@]SBINDIR[@],%{_sbindir},g' \\
-e 's,[@]LIBEXECDIR[@],%{_libexecdir},g' \\
-e 's,[@]SYSCONFDIR[@],%{_sysconfdir},g' \\
-e 's,[@]DATADIR[@],%{_datadir},g' \\
-e 's,[@]DATAROOTDIR[@],%{_datarootdir},g' \\
-e 's,[@]MANDIR[@],%{_mandir},g' \\
-e 's,[@]DOCDIR[@],%{_docdir},g' \\
-e 's,[@]LOCALSTATEDIR[@],%{_localstatedir},g'}
%global ldflags %{expand:-X 'github.com/redhatinsights/yggdrasil.ShortName=%{shortname}' \\
-X 'github.com/redhatinsights/yggdrasil.LongName=%{longname}' \\
-X 'github.com/redhatinsights/yggdrasil.BrandName=%{brandname}' \\
-X 'github.com/redhatinsights/yggdrasil.Version=%{version}' \\
-X 'github.com/redhatinsights/yggdrasil.TopicPrefix=%{topicprefix}' \\
-X 'github.com/redhatinsights/yggdrasil.DataHost=%{datahost}' \\
-X 'github.com/redhatinsights/yggdrasil.Provider=%{provider}' \\
-X 'github.com/redhatinsights/yggdrasil.PrefixDir=%{_prefix}' \\
-X 'github.com/redhatinsights/yggdrasil.BinDir=%{_bindir}' \\
-X 'github.com/redhatinsights/yggdrasil.SbinDir=%{_sbindir}' \\
-X 'github.com/redhatinsights/yggdrasil.LibexecDir=%{_libexecdir}' \\
-X 'github.com/redhatinsights/yggdrasil.SysconfDir=%{_sysconfdir}' \\
-X 'github.com/redhatinsights/yggdrasil.DataDir=%{_datadir}' \\
-X 'github.com/redhatinsights/yggdrasil.DatarootDir=%{_datarootdir}' \\
-X 'github.com/redhatinsights/yggdrasil.ManDir=%{_mandir}' \\
-X 'github.com/redhatinsights/yggdrasil.DocDir=%{_docdir}' \\
-X 'github.com/redhatinsights/yggdrasil.LocalstateDir=%{_localstatedir}'}
%build
export LDFLAGS="%{ldflags}"
%gobuild -o %{gobuilddir}/bin/yggd %{goipath}/cmd/yggd
%__sed %{sed_flags} data/systemd/yggd.service.in > data/systemd/yggd.service
%__sed %{sed_flags} data/pkgconfig/yggdrasil.pc.in > data/pkgconfig/yggdrasil.pc
%{gobuilddir}/bin/yggd --generate-bash-completion > yggd.bash
%{gobuilddir}/bin/yggd --generate-man-page | gzip > yggd.1.gz
%install
install -D -m 0755 -vp %{gobuilddir}/bin/yggd %{buildroot}%{_sbindir}/yggd
install -D -m 0644 -vp data/systemd/yggd.service %{buildroot}%{_unitdir}/yggd.service
install -D -m 0644 -vp data/pkgconfig/yggdrasil.pc %{buildroot}%{_datadir}/pkgconfig/yggdrasil.pc
install -D -m 0644 -vp yggd.bash %{buildroot}%{_datadir}/bash-completion/completions/yggd.bash
install -D -m 0644 -vp yggd.1.gz %{buildroot}%{_mandir}/man1/yggd.1.gz
install -D -m 0644 -vp data/yggdrasil/config.toml %{buildroot}%{_sysconfdir}/%{longname}/config.toml
%if %{with check}
%check
%gocheck
%endif
%files
%license LICENSE
%doc INSTALL.md HACKING.md README.md
%{_sbindir}/*
%config(noreplace) %{_sysconfdir}/%{longname}
%{_unitdir}/*
%{_datadir}/bash-completion/completions/*
%{_mandir}/man1/*
%files devel
%{_datadir}/pkgconfig/*
%changelog
* Sat Jun 18 2022 Robert-André Mauchin <zebob.m@gmail.com> - 0.2.98^1.ffb580f-0.2
- Rebuilt for CVE-2022-1996, CVE-2022-24675, CVE-2022-28327, CVE-2022-27191,
CVE-2022-29526, CVE-2022-30629
* Tue Aug 10 2021 Link Dupont <linkdupont@fedoraproject.org> - 0.2.98^1.ffb580f-0.1.20210728gitffb580f
- Initial package