100 lines
2.6 KiB
RPMSpec
100 lines
2.6 KiB
RPMSpec
# Generated by go2rpm 1.17.1
|
|
%bcond check 1
|
|
|
|
# https://github.com/TecharoHQ/anubis
|
|
%global goipath github.com/TecharoHQ/anubis
|
|
Version: 1.24.0
|
|
|
|
%gometa -L -f
|
|
|
|
|
|
Name: anubis
|
|
Release: %autorelease
|
|
Summary: Weighs the soul of incoming HTTP requests to stop AI crawlers
|
|
|
|
# Generated by go-vendor-tools
|
|
License: Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0
|
|
URL: %{gourl}
|
|
Source0: %{gosource}
|
|
# Generated by go-vendor-tools
|
|
Source1: %{archivename}-vendor.tar.bz2
|
|
Source2: go-vendor-tools.toml
|
|
Source20: https://github.com/TecharoHQ/anubis/releases/download/v%{version}/anubis-src-vendor-npm-%{version}.tar.gz
|
|
|
|
BuildRequires: go-vendor-tools
|
|
BuildRequires: sed
|
|
BuildRequires: systemd-rpm-macros
|
|
|
|
# To build the assets
|
|
BuildRequires: bash
|
|
BuildRequires: brotli
|
|
BuildRequires: golang-github-evanw-esbuild
|
|
BuildRequires: gzip
|
|
BuildRequires: make
|
|
BuildRequires: nodejs-cssnano
|
|
BuildRequires: nodejs-cssnano-preset-advanced
|
|
BuildRequires: nodejs-npm
|
|
BuildRequires: nodejs-postcss-url
|
|
BuildRequires: postcss-cli
|
|
BuildRequires: zstd
|
|
|
|
|
|
%description
|
|
Weighs the soul of incoming HTTP requests to stop AI crawlers.
|
|
|
|
%prep
|
|
%goprep -A
|
|
%setup -q -T -D -a1 -a20 %{forgesetupargs}
|
|
rm -rf anubis-src-vendor-npm-%{version}/vendor
|
|
cp -r anubis-src-vendor-npm-%{version}/* ./
|
|
#autopatch -p1
|
|
|
|
# Neuter vendoring logic in the Makefile
|
|
sed -i 's/assets: deps/assets:/' Makefile
|
|
|
|
%generate_buildrequires
|
|
%go_vendor_license_buildrequires -c %{S:2}
|
|
|
|
%build
|
|
%global gomodulesmode GO111MODULE=on
|
|
export GO_LDFLAGS="-X 'github.com/TecharoHQ/anubis.Version=%{version}-%{release}'"
|
|
%gobuild -o %{gobuilddir}/bin/%{name} %{goipath}/cmd/%{name}
|
|
|
|
%install
|
|
%go_vendor_license_install -c %{S:2}
|
|
install -m 0755 -vd %{buildroot}%{_bindir}
|
|
install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/
|
|
|
|
install -Dpm0644 -t %{buildroot}%{_unitdir}/ run/anubis@.service
|
|
install -Dpm0644 -t %{buildroot}%{_sysconfdir}/%{name}/ run/default.env
|
|
|
|
|
|
%post
|
|
%systemd_post anubis@default.service
|
|
|
|
%preun
|
|
%systemd_preun anubis@default.service
|
|
|
|
%postun
|
|
%systemd_postun_with_restart anubis@default.service
|
|
|
|
%check
|
|
%go_vendor_license_check -c %{S:2}
|
|
%if %{with check}
|
|
export DONT_USE_NETWORK=1
|
|
# Skip tests that don't work in mock because they spawn an HTTP server
|
|
# TODO: make this less coarse
|
|
rm lib/{anubis,http}_test.go
|
|
%gotest ./...
|
|
%endif
|
|
|
|
%files -f %{go_vendor_license_filelist}
|
|
%license vendor/modules.txt
|
|
%doc data docs README.md
|
|
%{_bindir}/%{name}
|
|
%{_unitdir}/anubis@.service
|
|
%dir %{_sysconfdir}/%{name}
|
|
%config(noreplace) %{_sysconfdir}/%{name}/default.env
|
|
|
|
%changelog
|
|
%autochangelog
|