2024-02-25 09:22:07 +01:00
|
|
|
|
#
|
|
|
|
|
# spec file for package forgejo
|
|
|
|
|
#
|
|
|
|
|
# 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/
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
2024-04-04 10:14:51 +02:00
|
|
|
|
%if 0%{?suse_version} > 1600
|
|
|
|
|
%bcond_without selinux
|
|
|
|
|
%bcond_without apparmor
|
|
|
|
|
%else
|
|
|
|
|
%if 0%{?suse_version} == 1600
|
|
|
|
|
%bcond_without selinux
|
|
|
|
|
%bcond_with apparmor
|
|
|
|
|
%else
|
|
|
|
|
# Leap & SLE
|
|
|
|
|
%bcond_with selinux
|
|
|
|
|
%bcond_without apparmor
|
|
|
|
|
%endif
|
|
|
|
|
%endif
|
2024-02-25 09:22:07 +01:00
|
|
|
|
Name: forgejo
|
2024-06-16 15:05:45 +02:00
|
|
|
|
Version: 7.0.4
|
2024-02-25 09:22:07 +01:00
|
|
|
|
Release: 0
|
|
|
|
|
Summary: Self-hostable forge
|
|
|
|
|
License: MIT
|
|
|
|
|
Group: Development/Tools/Version Control
|
|
|
|
|
URL: https://forgejo.org
|
2024-04-25 04:47:42 +02:00
|
|
|
|
Source0: https://codeberg.org/%{name}/%{name}/releases/download/v%{version}/%{name}-src-%{version}.tar.gz
|
|
|
|
|
Source1: https://codeberg.org/%{name}/%{name}/releases/download/v%{version}/%{name}-src-%{version}.tar.gz.asc
|
2024-04-04 10:14:51 +02:00
|
|
|
|
Source2: http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xeb114f5e6c0dc2bcdd183550a4b61a2dc5923710#/%{name}.keyring
|
2024-02-25 09:22:07 +01:00
|
|
|
|
Source3: package-lock.json
|
|
|
|
|
Source4: node_modules.spec.inc
|
|
|
|
|
%include %{_sourcedir}/node_modules.spec.inc
|
2024-04-04 10:14:51 +02:00
|
|
|
|
Source5: %{name}.service
|
|
|
|
|
Source6: %{name}.sysusers
|
|
|
|
|
Source7: apparmor-usr.bin.%{name}
|
|
|
|
|
Source8: %{name}.fc
|
|
|
|
|
Source9: %{name}.if
|
|
|
|
|
Source10: %{name}.sh
|
|
|
|
|
Source11: %{name}.te
|
2024-02-25 09:22:07 +01:00
|
|
|
|
Source99: get-sources.sh
|
|
|
|
|
Patch0: custom-app.ini.patch
|
|
|
|
|
BuildRequires: golang-packaging
|
2024-04-04 10:14:51 +02:00
|
|
|
|
BuildRequires: golang(API) = 1.22
|
2024-02-25 09:22:07 +01:00
|
|
|
|
## node >= 20
|
|
|
|
|
%if 0%{?suse_version} == 1500
|
|
|
|
|
BuildRequires: nodejs-devel-default
|
|
|
|
|
BuildRequires: npm-default
|
|
|
|
|
%else
|
|
|
|
|
BuildRequires: nodejs-packaging
|
|
|
|
|
%endif
|
|
|
|
|
BuildRequires: local-npm-registry
|
|
|
|
|
BuildRequires: make
|
|
|
|
|
BuildRequires: systemd-rpm-macros
|
|
|
|
|
BuildRequires: sysuser-tools
|
|
|
|
|
Requires: git-core
|
|
|
|
|
Requires: git-lfs
|
2024-04-04 10:14:51 +02:00
|
|
|
|
Requires: (%{name}-apparmor if apparmor-abstractions)
|
|
|
|
|
Requires: (%{name}-selinux if selinux-policy-targeted)
|
|
|
|
|
%if %{with apparmor}
|
|
|
|
|
BuildRequires: apparmor-abstractions
|
|
|
|
|
BuildRequires: apparmor-rpm-macros
|
|
|
|
|
BuildRequires: libapparmor-devel
|
|
|
|
|
%endif
|
|
|
|
|
%if %{with selinux}
|
|
|
|
|
BuildRequires: checkpolicy
|
|
|
|
|
BuildRequires: selinux-policy-devel
|
|
|
|
|
%endif
|
2024-02-25 09:22:07 +01:00
|
|
|
|
%{systemd_requires}
|
|
|
|
|
%{sysusers_requires}
|
|
|
|
|
|
2024-04-04 10:14:51 +02:00
|
|
|
|
%if %{with apparmor}
|
2024-03-21 13:27:58 +01:00
|
|
|
|
%package apparmor
|
|
|
|
|
Summary: Apparmor profile for %{name}
|
2024-04-04 10:14:51 +02:00
|
|
|
|
BuildArch: noarch
|
|
|
|
|
Requires: %{name} = %{version}-%{release}
|
2024-03-21 13:27:58 +01:00
|
|
|
|
|
|
|
|
|
%description apparmor
|
2024-04-04 10:14:51 +02:00
|
|
|
|
This package adds the Apparmor profile to %{name}
|
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
%if %{with selinux}
|
|
|
|
|
%package selinux
|
|
|
|
|
Summary: Selinux support for %{name}
|
|
|
|
|
BuildArch: noarch
|
|
|
|
|
Requires: %{name} = %{version}-%{release}
|
|
|
|
|
Requires: selinux-policy-targeted
|
|
|
|
|
|
|
|
|
|
%description selinux
|
|
|
|
|
This package adds SELinux enforcement to %{name}.
|
|
|
|
|
%endif
|
2024-03-21 13:27:58 +01:00
|
|
|
|
|
2024-02-25 09:22:07 +01:00
|
|
|
|
%description
|
|
|
|
|
Providing Git hosting for your project, friends, company or community? Forgejo (/for'd͡ʒe.jo/ inspired by forĝejo
|
|
|
|
|
– the Esperanto word for forge) has you covered with its intuitive interface, light and easy hosting and a lot of builtin functionality.
|
|
|
|
|
|
|
|
|
|
%prep
|
2024-04-25 04:47:42 +02:00
|
|
|
|
%autosetup -p1 -n %{name}-src-%{version}
|
2024-02-25 09:22:07 +01:00
|
|
|
|
local-npm-registry %{_sourcedir} install --also=dev
|
|
|
|
|
|
|
|
|
|
%build
|
|
|
|
|
%sysusers_generate_pre %{SOURCE6} %{name} %{name}.conf
|
|
|
|
|
export EXTRA_GOFLAGS="-buildmode=pie -mod=vendor"
|
|
|
|
|
export TAGS="bindata timetzdata sqlite sqlite_unlock_notify"
|
2024-04-25 04:47:42 +02:00
|
|
|
|
%make_build build
|
2024-02-25 09:22:07 +01:00
|
|
|
|
|
|
|
|
|
%install
|
|
|
|
|
install -d %{buildroot}%{_bindir}
|
2024-04-04 10:14:51 +02:00
|
|
|
|
install -d %{buildroot}%{_datadir}/%{name}
|
|
|
|
|
install -d %{buildroot}%{_datadir}/%{name}/{conf,https,mailer}
|
2024-02-25 09:22:07 +01:00
|
|
|
|
ln -s %{name} %{buildroot}%{_bindir}/gitea
|
|
|
|
|
install -d %{buildroot}%{_sharedstatedir}/%{name}/{data,https,indexers,queues,repositories}
|
|
|
|
|
install -d %{buildroot}%{_sysconfdir}/%{name}
|
|
|
|
|
install -d %{buildroot}%{_localstatedir}/log/%{name}
|
2024-04-25 04:47:42 +02:00
|
|
|
|
install -D -m 0644 %{_builddir}/%{name}-src-%{version}/custom/conf/app.example.ini %{buildroot}%{_sysconfdir}/%{name}/conf/app.ini
|
|
|
|
|
install -D -m 0755 %{_builddir}/%{name}-src-%{version}/gitea %{buildroot}%{_bindir}/%{name}
|
2024-04-04 10:14:51 +02:00
|
|
|
|
install -D -m 0644 %{SOURCE5} %{buildroot}%{_unitdir}/%{name}.service
|
2024-02-25 09:22:07 +01:00
|
|
|
|
install -D -m 0644 %{SOURCE6} %{buildroot}%{_sysusersdir}/%{name}.conf
|
2024-04-04 10:14:51 +02:00
|
|
|
|
|
|
|
|
|
%if %{with apparmor}
|
|
|
|
|
install -d %{buildroot}%{_sysconfdir}/apparmor.d
|
|
|
|
|
install -Dm0644 %{SOURCE7} %{buildroot}%{_sysconfdir}/apparmor.d/usr.bin.%{name}
|
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
%if %{with selinux}
|
|
|
|
|
cd %{_sourcedir}
|
|
|
|
|
make -f %{_datadir}/selinux/devel/Makefile %{name}.pp
|
|
|
|
|
install -Dm0644 %{name}.pp %{buildroot}%{_datadir}/selinux/packages/%{name}/%{name}.pp
|
|
|
|
|
install -Dm0644 %{name}.if %{buildroot}%{_datadir}/selinux/devel/include/distributed/%{name}.if
|
|
|
|
|
%endif
|
2024-02-25 09:22:07 +01:00
|
|
|
|
|
|
|
|
|
%pre -f %{name}.pre
|
2024-04-04 10:14:51 +02:00
|
|
|
|
%service_add_pre %{name}.service
|
2024-02-25 09:22:07 +01:00
|
|
|
|
|
|
|
|
|
%post
|
2024-04-04 10:14:51 +02:00
|
|
|
|
%service_add_post %{name}.service
|
|
|
|
|
|
|
|
|
|
%if %{with apparmor}
|
|
|
|
|
%post apparmor
|
|
|
|
|
%apparmor_reload %{_sysconfdir}/apparmor.d/usr.bin.%{name}
|
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
%if %{with selinux}
|
|
|
|
|
%post selinux
|
|
|
|
|
semodule -i %{_datadir}/selinux/packages/%{name}/%{name}.pp 2>/dev/null || :
|
|
|
|
|
|
|
|
|
|
%preun selinux
|
|
|
|
|
semodule -r %{name} 2>/dev/null || :
|
|
|
|
|
%endif
|
2024-02-25 09:22:07 +01:00
|
|
|
|
|
|
|
|
|
%preun
|
2024-04-04 10:14:51 +02:00
|
|
|
|
%service_del_preun %{name}.service
|
2024-02-25 09:22:07 +01:00
|
|
|
|
|
|
|
|
|
%postun
|
2024-04-04 10:14:51 +02:00
|
|
|
|
%service_del_postun %{name}.service
|
2024-02-25 09:22:07 +01:00
|
|
|
|
|
|
|
|
|
%check
|
2024-04-25 04:47:42 +02:00
|
|
|
|
#as of now, broken
|
|
|
|
|
#%%make_build test
|
2024-02-25 09:22:07 +01:00
|
|
|
|
|
|
|
|
|
%files
|
|
|
|
|
%license LICENSE
|
2024-04-25 04:47:42 +02:00
|
|
|
|
%doc README.md RELEASE-NOTES.md CONTRIBUTING.md
|
2024-02-25 09:22:07 +01:00
|
|
|
|
%{_unitdir}/%{name}.service
|
|
|
|
|
%{_bindir}/%{name}
|
|
|
|
|
%{_bindir}/gitea
|
|
|
|
|
%defattr(0660,root,forgejo,770)
|
|
|
|
|
%{_localstatedir}/log/%{name}
|
|
|
|
|
%defattr(0660,forgejo,forgejo,750)
|
2024-04-20 16:15:17 +02:00
|
|
|
|
%config(noreplace) %{_sysconfdir}/%{name}/conf/app.ini
|
|
|
|
|
%{_sysconfdir}/%{name}
|
2024-04-04 10:14:51 +02:00
|
|
|
|
%{_datadir}/%{name}
|
2024-02-25 09:22:07 +01:00
|
|
|
|
%{_sharedstatedir}/%{name}
|
|
|
|
|
%{_sysusersdir}/%{name}.conf
|
|
|
|
|
|
2024-04-04 10:14:51 +02:00
|
|
|
|
%if %{with apparmor}
|
2024-03-21 13:27:58 +01:00
|
|
|
|
%files apparmor
|
2024-04-04 10:14:51 +02:00
|
|
|
|
%dir %{_sysconfdir}/apparmor.d
|
|
|
|
|
%config %{_sysconfdir}/apparmor.d/usr.bin.%{name}
|
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
%if %{with selinux}
|
|
|
|
|
%files selinux
|
|
|
|
|
%dir %{_datadir}/selinux/devel/include/distributed
|
|
|
|
|
%{_datadir}/selinux/packages/%{name}
|
|
|
|
|
%{_datadir}/selinux/devel/include/distributed/%{name}.if
|
|
|
|
|
%endif
|
2024-03-21 13:27:58 +01:00
|
|
|
|
|
2024-02-25 09:22:07 +01:00
|
|
|
|
%changelog
|