gitea/gitea.spec

129 lines
3.0 KiB
RPMSpec

ExclusiveArch: %{go_arches}
%if 0%{?el8}
%global debug_package %{nil}
%endif
%if 0%{?el9}
%global debug_package %{nil}
%endif
%if 0%{?fc40}
%global debug_package %{nil}
%endif
%if 0%{?fc41}
%global debug_package %{nil}
%endif
Name: gitea
Version: 1.22.4
Release: 1%{?dist}
Summary: Gitea: Git with a cup of tea
License: MIT
URL: https://gitea.io/en-us/
Source0: https://github.com/go-gitea/gitea/releases/download/v%{version}/gitea-src-%{version}.tar.gz
BuildRequires: git
BuildRequires: golang >= 1.22
BuildRequires: pam-devel
Requires(pre): /usr/bin/getent
Requires(pre): /usr/sbin/useradd
Requires: git
%description
%prep
%setup -q -n %{name}-src-%{version}
%build
sed -i -e 's/-s -w //g' Makefile
LDFLAGS=""
export LDFLAGS
make \
TAGS="bindata pam sqlite sqlite_unlock_notify" \
GITEA_VERSION="%{version}-%{release}" \
build
sed -i \
-e 's|^User=.*$|User=gitea|g' \
-e 's|^Group=.*$|Group=gitea|g' \
-e 's|^WorkingDirectory=.*$|WorkingDirectory=/var/lib/gitea|g' \
-e 's|^ExecStart=.*$|ExecStart=%{_bindir}/gitea web /etc/gitea/app.ini|g' \
-e 's|^Environment=.*$|Environment=USER=gitea HOME=/var/lib/gitea GITEA_WORK_DIR=/var/lib/gitea|g' \
contrib/systemd/gitea.service
%install
rm -rf %{buildroot}
%{__install} -d %{buildroot}%{_bindir}
%{__install} -d %{buildroot}%{_sysconfdir}/gitea
%{__install} -d %{buildroot}/usr/lib/systemd/system
%{__install} -d %{buildroot}/var/lib/gitea
%{__install} -d %{buildroot}/var/log/gitea
%{__install} -p -m 0755 %{name} %{buildroot}%{_bindir}/%{name}
%{__install} -p -m 0644 contrib/systemd/gitea.service %{buildroot}/usr/lib/systemd/system/gitea.service
%pre
getent passwd gitea > /dev/null 2>&1 || useradd -r -d /var/lib/gitea -s /bin/bash gitea
%post
if [ -x /usr/bin/systemctl ]
then
systemctl condrestart gitea
elif [ -x /usr/sbin/service ]
then
service gitea condrestart
fi
%files
%license LICENSE
%doc CHANGELOG.md
%doc CODE_OF_CONDUCT.md
%doc CONTRIBUTING.md
%doc DCO
%doc MAINTAINERS
%doc README.md
%doc README_ZH.md
%doc SECURITY.md
%attr(0700, gitea, gitea) %dir /var/lib/gitea
%attr(0700, gitea, gitea) %dir /var/log/gitea
%{_bindir}/%{name}
%attr(0644, root, root) /usr/lib/systemd/system/gitea.service
%attr(-, gitea, gitea) %config(noreplace) %{_sysconfdir}/gitea
%changelog
* Thu Dec 05 2024 Jason Rothstein
- version bump to 1.22.4
* Thu Oct 03 2024 Jason Rothstein
- version bump to 1.22.3
* Thu Oct 03 2024 Jason Rothstein
- version bump to 1.22.2
* Sun Jul 07 2024 Jason Rothstein
- version bump to 1.22.1
* Fri Apr 19 2024 Jason Rothstein
- version bump to 1.21.11
* Tue Mar 26 2024 Jason Rothstein
- version bump to 1.21.10
* Tue Mar 26 2024 Jason Rothstein
- version bump to 1.21.9
* Tue Mar 26 2024 Jason Rothstein
- version bump to 1.20.6
* Sun Mar 24 2024 Jason Rothstein
- rebuild for Fedora 39
- version bump to 1.19.4
- add new nodejs, npm, git package dependency
- strip -Wl,-z,relro from LDFLAGS because that isn't compatible with Go