File autogits.spec of Package autogits

#
# spec file for package autogits
#
# Copyright (c) 2024 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/
#


Name:           autogits
Version:        1
Release:        0
Summary:        GitWorkflow utilities
License:        GPL-2.0-or-later
URL:            https://src.opensuse.org/adamm/autogits
BuildRequires:  git
BuildRequires:  systemd-rpm-macros
BuildRequires:  go
%{?systemd_ordering}

%description
Git Workflow tooling and utilities enabling automated handing of OBS projects
as git repositories


%package devel-importer
Summary:        Imports devel projects from obs to git

%description -n autogits-devel-importer
Command-line tool to import devel projects from obs to git


%package doc
Summary:        Common documentation files
BuildArch:      noarch

%description -n autogits-doc
Common documentation files


%package gitea-events-rabbitmq-publisher
Summary:        Publishes Gitea webhook data via RabbitMQ

%description gitea-events-rabbitmq-publisher
Listens on an HTTP socket and publishes Gitea events on a RabbitMQ instance
with a topic
  <scope>.src.$organization.$webhook_type.[$webhook_action_type]


%package gitea-status-proxy
Summary:        Proxy for setting commit status in Gitea

%description gitea-status-proxy
Setting commit status requires code write access token. This proxy
is middleware that delegates status setting without access to other APIs

%package group-review
Summary:        Reviews of groups defined in ProjectGit

%description group-review
Is used to handle reviews associated with groups defined in the
ProjectGit.


%package obs-forward-bot
Summary:        obs-forward-bot

%description obs-forward-bot


%package obs-groups-bot
Summary:        Tool to fetch groups from OBS and save them as JSON files
Requires:       openssh-clients
Requires:       git-core

%description obs-groups-bot
Tool to fetch groups from OBS and save them as JSON files.


%package obs-staging-bot
Summary:        Build a PR against a ProjectGit, if review is requested

%description obs-staging-bot
Build a PR against a ProjectGit, if review is requested.


%package obs-status-service
Summary:        Reports build status of OBS service as an easily to produce SVG

%description obs-status-service
Reports build status of OBS service as an easily to produce SVG


%package utils
Summary:        HuJSON to JSON parser
Provides:       hujson
Provides:       /usr/bin/hujson

%description utils
HuJSON to JSON parser, using stdin -> stdout pipe


%package workflow-direct
Summary:        Keep ProjectGit in sync for a devel project
Requires:       openssh-clients
Requires:       git-core

%description workflow-direct
Keep ProjectGit in sync with packages in the organization of a devel project


%package workflow-pr
Summary:        Keeps ProjectGit PR in-sync with a PackageGit PR
Requires:       openssh-clients
Requires:       git-core

%description workflow-pr
Keeps ProjectGit PR in-sync with a PackageGit PR



%prep
cp -r /home/abuild/rpmbuild/SOURCES/* ./

%build
go build \
   -C devel-importer \
   -buildmode=pie
go build \
   -C utils/hujson \
   -buildmode=pie
go build \
   -C utils/maintainer-update \
   -buildmode=pie
go build \
   -C gitea-events-rabbitmq-publisher \
   -buildmode=pie
go build \
   -C gitea_status_proxy \
   -buildmode=pie
go build \
   -C group-review \
   -buildmode=pie
go build \
   -C obs-forward-bot \
   -buildmode=pie
go build \
   -C obs-groups-bot \
   -buildmode=pie
go build \
   -C obs-staging-bot \
   -buildmode=pie
go build \
   -C obs-status-service \
   -buildmode=pie
go build \
   -C workflow-direct \
   -buildmode=pie
go build \
   -C workflow-pr \
   -buildmode=pie

%check
go test -C common -v
go test -C group-review -v
go test -C obs-groups-bot -v
go test -C obs-staging-bot -v
go test -C obs-status-service -v
go test -C workflow-direct -v
go test -C utils/maintainer-update
go test -C workflow-pr -v

%install
install -D -m0755 devel-importer/devel-importer                                    %{buildroot}%{_bindir}/devel-importer
install -D -m0755 gitea-events-rabbitmq-publisher/gitea-events-rabbitmq-publisher  %{buildroot}%{_bindir}/gitea-events-rabbitmq-publisher
install -D -m0644 systemd/gitea-events-rabbitmq-publisher.service                  %{buildroot}%{_unitdir}/gitea-events-rabbitmq-publisher.service
install -D -m0755 gitea_status_proxy/gitea_status_proxy                            %{buildroot}%{_bindir}/gitea_status_proxy
install -D -m0755 group-review/group-review                                        %{buildroot}%{_bindir}/group-review
install -D -m0644 systemd/group-review@.service                                    %{buildroot}%{_unitdir}/group-review@.service
install -D -m0755 obs-forward-bot/obs-forward-bot                                  %{buildroot}%{_bindir}/obs-forward-bot
install -D -m0755 obs-groups-bot/obs-groups-bot                                    %{buildroot}%{_bindir}/obs-groups-bot
install -D -m0644 systemd/obs-groups-bot.service                                   %{buildroot}%{_unitdir}/obs-groups-bot.service
install -D -m0644 systemd/obs-groups-bot.timer                                     %{buildroot}%{_unitdir}/obs-groups-bot.timer
install -D -m0755 obs-staging-bot/obs-staging-bot                                  %{buildroot}%{_bindir}/obs-staging-bot
install -D -m0644 systemd/obs-staging-bot.service                                  %{buildroot}%{_unitdir}/obs-staging-bot.service
install -D -m0755 obs-status-service/obs-status-service                            %{buildroot}%{_bindir}/obs-status-service
install -D -m0644 systemd/obs-status-service.service                               %{buildroot}%{_unitdir}/obs-status-service.service
install -D -m0755 workflow-direct/workflow-direct                                  %{buildroot}%{_bindir}/workflow-direct
install -D -m0644 systemd/workflow-direct@.service                                 %{buildroot}%{_unitdir}/workflow-direct@.service
install -D -m0644 systemd/workflow-direct.target                                   %{buildroot}%{_unitdir}/workflow-direct.target
install -D -m0755 workflow-pr/workflow-pr                                          %{buildroot}%{_bindir}/workflow-pr
install -D -m0644 systemd/workflow-pr@.service                                     %{buildroot}%{_unitdir}/workflow-pr@.service
install -D -m0644 systemd/workflow-pr.target                                       %{buildroot}%{_unitdir}/workflow-pr.target
install -D -m0755 utils/hujson/hujson                                              %{buildroot}%{_bindir}/hujson
install -D -m0755 utils/maintainer-update/maintainer-update                        %{buildroot}%{_bindir}/maintainer-update

%pre gitea-events-rabbitmq-publisher
%service_add_pre gitea-events-rabbitmq-publisher.service

%post gitea-events-rabbitmq-publisher
%service_add_post gitea-events-rabbitmq-publisher.service

%preun gitea-events-rabbitmq-publisher
%service_del_preun gitea-events-rabbitmq-publisher.service

%postun gitea-events-rabbitmq-publisher
%service_del_postun gitea-events-rabbitmq-publisher.service

%pre group-review
%service_add_pre group-review@.service

%post group-review
%service_add_post group-review@.service

%preun group-review
%service_del_preun group-review@.service

%postun group-review
%service_del_postun group-review@.service

%pre obs-groups-bot
%service_add_pre obs-groups-bot.service obs-groups-bot.timer

%post obs-groups-bot
%service_add_post obs-groups-bot.service obs-groups-bot.timer

%preun obs-groups-bot
%service_del_preun obs-groups-bot.service obs-groups-bot.timer

%postun obs-groups-bot
%service_del_postun obs-groups-bot.service obs-groups-bot.timer

%pre obs-staging-bot
%service_add_pre obs-staging-bot.service

%post obs-staging-bot
%service_add_post obs-staging-bot.service

%preun obs-staging-bot
%service_del_preun obs-staging-bot.service

%postun obs-staging-bot
%service_del_postun obs-staging-bot.service

%pre obs-status-service
%service_add_pre obs-status-service.service

%post obs-status-service
%service_add_post obs-status-service.service

%preun obs-status-service
%service_del_preun obs-status-service.service

%postun obs-status-service
%service_del_postun obs-status-service.service

%pre workflow-direct
%service_add_pre workflow-direct.target

%post workflow-direct
%service_add_post workflow-direct.target

%preun workflow-direct
%service_del_preun workflow-direct.target

%postun workflow-direct
%service_del_postun workflow-direct.target

%pre workflow-pr
%service_add_pre workflow-pr.target

%post workflow-pr
%service_add_post workflow-pr.target

%preun workflow-pr
%service_del_preun workflow-pr.target

%postun workflow-pr
%service_del_postun workflow-pr.target

%files devel-importer
%license COPYING
%doc devel-importer/README.md
%{_bindir}/devel-importer

%files doc
%license COPYING
%doc doc/README.md
%doc doc/workflows.md

%files gitea-events-rabbitmq-publisher
%license COPYING
%doc gitea-events-rabbitmq-publisher/README.md
%{_bindir}/gitea-events-rabbitmq-publisher
%{_unitdir}/gitea-events-rabbitmq-publisher.service

%files gitea-status-proxy
%license COPYING
%{_bindir}/gitea_status_proxy

%files group-review
%license COPYING
%doc group-review/README.md
%{_bindir}/group-review
%{_unitdir}/group-review@.service

%files obs-forward-bot
%license COPYING
%{_bindir}/obs-forward-bot

%files obs-groups-bot
%license COPYING
%doc obs-groups-bot/README.md
%{_bindir}/obs-groups-bot
%{_unitdir}/obs-groups-bot.service
%{_unitdir}/obs-groups-bot.timer

%files obs-staging-bot
%license COPYING
%doc obs-staging-bot/README.md
%{_bindir}/obs-staging-bot
%{_unitdir}/obs-staging-bot.service

%files obs-status-service
%license COPYING
%doc obs-status-service/README.md
%{_bindir}/obs-status-service
%{_unitdir}/obs-status-service.service

%files utils
%license COPYING
%{_bindir}/hujson
%{_bindir}/maintainer-update

%files workflow-direct
%license COPYING
%doc workflow-direct/README.md
%{_bindir}/workflow-direct
%{_unitdir}/workflow-direct@.service
%{_unitdir}/workflow-direct.target

%files workflow-pr
%license COPYING
%doc workflow-pr/README.md
%{_bindir}/workflow-pr
%{_unitdir}/workflow-pr@.service
%{_unitdir}/workflow-pr.target

openSUSE Build Service is sponsored by