# 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}


Name:    yggdrasil
Version: 0.2.6
Release: 1.20250305181328315951.yggdrasil.0.2.2.g43f1c30.g43f1c30a.g43f1c30a%{?dist}
Summary: Message dispatch agent for cloud-connected systems
License: GPLv3
URL: https://github.com/redhatinsights/yggdrasil

Source: yggdrasil-0.2.6.tar.gz

ExclusiveArch: %{go_arches}

BuildRequires: git-core
BuildRequires: golang
BuildRequires: pkgconfig(systemd)


%description
yggdrasil is pair of utilities that register systems with RHSM and establishes
a receiving queue for instructions to be sent to the system via a broker.

%prep
%autosetup -n yggdrasil-0.2.6


%build
make PREFIX=%{_prefix} \
     SYSCONFDIR=%{_sysconfdir} \
     LOCALSTATEDIR=%{_localstatedir} \
     SHORTNAME=ygg \
     LONGNAME=yggdrasil \
     PKGNAME=@PKGNAME@ \
     BRANDNAME=yggdrasil \
     TOPICPREFIX=yggdrasil \
     VERSION=%{version} \
     DATAHOST= \
     'PROVIDER='


%install
make PREFIX=%{_prefix} \
     SYSCONFDIR=%{_sysconfdir} \
     LOCALSTATEDIR=%{_localstatedir} \
     DESTDIR=%{buildroot} \
     SHORTNAME=ygg \
     LONGNAME=yggdrasil \
     PKGNAME=@PKGNAME@ \
     BRANDNAME=yggdrasil \
     TOPICPREFIX=yggdrasil \
     VERSION=%{version} \
     DATAHOST= \
     'PROVIDER=' \
     install


%files
%doc README.md doc/tags.toml
%{_bindir}/ygg
%{_sbindir}/yggd
%config(noreplace) %{_sysconfdir}/yggdrasil/config.toml
%{_unitdir}/yggd.service
%{_datadir}/bash-completion/completions/*
%{_mandir}/man1/*
%{_prefix}/share/pkgconfig/yggdrasil.pc
%{_libexecdir}/yggdrasil


%changelog
* Wed Mar 05 2025 Pino Toscano <ptoscano@redhat.com> - 0.2.6-1.20250305181328315951.yggdrasil.0.2.2.g43f1c30.g43f1c30a.g43f1c30a
- Downstream changes (43f1c30a)

* Wed Mar 05 2025 Pino Toscano <ptoscano@redhat.com> - 0.2.6-1.20250305181328315951.yggdrasil.0.2.2.g43f1c30.g43f1c30a
- Downstream changes (43f1c30a)

* Wed Mar 05 2025 Pino Toscano <ptoscano@redhat.com> - 0.2.6-1.20250305181328315951.yggdrasil.0.2.2.g43f1c30
- ci: fix packit config for post-merge builds (Pino Toscano)
- ci: fix packit configuration for versions & coprs (Pino Toscano)
- build: Update Makefile to version 0.2.6 (Joe VLcek)
- fix: Update bundled version of go-yaml to v2.2.4 (Joe VLcek)
- refactor: drop call to rand.Seed (Link Dupont)
- revert: revert the "v1" module (Link Dupont)
- refactor!: add "v1" to module (Link Dupont)
- feat(worker): Add debug logging to startWorker (Link Dupont)
- feat(echo): set log level according to env (Link Dupont)
- build: update build requirements (Link Dupont)
- ci: Add Packit (Link Dupont)
- fix: Update instruction for hacking yggdrasil-0.2 (Jiri Hnidek)
- style: Correct typos in README (Link Dupont)
- docs: Clarify the worker config file path (Link Dupont)
- chore: set version to 0.2.5 (Link Dupont)
- refactor: refactor watchWorkerDir (Link Dupont)
- feat(yggd): Set env variables from config file (Link Dupont)
- refactor(yggd): move worker functions to worker.go (Link Dupont)
- build: remove 'go mod tidy' (Link Dupont)
- chore: set version to 0.2.4 (Alba Hita Catala)
- feat(mqtt): Use Token.WaitTimeout (Link Dupont)
- fix: add http env to workers execution (Alba Hita Catala)
- chore: set version to 0.2.3 (Link Dupont)
- refactor: Replace golang.org/x/crypto/ssh/terminal (Link Dupont)
- refactor: Replace grpc.WithInsecure() (Link Dupont)
- refactor: Remove deprecated ioutil package (Link Dupont)
- style: Format code with golines (Link Dupont)
- ci: Update Go versions in tests (Link Dupont)
- fix: Update go to 1.19 (Link Dupont)
- fix: Update grpc to 1.58.3 (Link Dupont)
- fix: default mqtt-auto-reconnect to true (Link Dupont)
- feat: add --mqtt-reconnect-delay flag (Link Dupont)
- feat: add MQTT connection options (Link Dupont)
- chore: set version to 0.2.2 (Link Dupont)
- fix: Remove debug and trace logs that print msg (Rodolfo Olivieri)
- fix: read worker output using io.Read (Link Dupont)
- feat: MQTT debug logging (Link Dupont)
- revert: require cert-file and key-file (Link Dupont)
- fix: require cert-file and key-file (Link Dupont)
- chore: set version to 0.2.1 (Link Dupont)
- ci: Add Github Workflow Actions (Gael Chamoulaud (Strider))
- feat: add --exclude-worker config option (Link Dupont)
- fix: make malformed tags content not fatal (Link Dupont)
- fix: log inotify failure at "info" level (Link Dupont)
- fix: report active dispatchers when connecting to broker (Link Dupont)
- feat: Include Description in help output (Link Dupont)
- fix: Improve output during 'disconnect' (Link Dupont)
- build: Exclude .copr when making dist tarball (Link Dupont)

* Wed Mar 05 2025 Pino Toscano <ptoscano@redhat.com> - 0.2.6-1.g43f1c30a.g43f1c30a
- Downstream changes (43f1c30a)

* Wed Mar 05 2025 Pino Toscano <ptoscano@redhat.com> - 0.2.6-1.g43f1c30a
- Downstream changes (43f1c30a)