134 lines
3.4 KiB
RPMSpec
134 lines
3.4 KiB
RPMSpec
ExclusiveArch: %{go_arches}
|
|
|
|
Name: gitea
|
|
Version: 1.8.3
|
|
Release: 5%{?dist}
|
|
Summary: Gitea: Git with a cup of tea
|
|
|
|
License: MIT
|
|
URL: https://gitea.io/en-us/
|
|
Source0: https://github.com/go-gitea/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz
|
|
|
|
BuildRequires: golang >= 1.11
|
|
BuildRequires: pam-devel
|
|
Requires(pre): /usr/bin/getent
|
|
Requires(pre): /usr/sbin/useradd
|
|
Requires: git
|
|
|
|
%description
|
|
|
|
|
|
%prep
|
|
%setup -q -c
|
|
%{__mkdir_p} src/code.gitea.io/
|
|
mv %{name}-%{version} src/code.gitea.io/gitea
|
|
|
|
%build
|
|
export GOPATH=%{gopath}:$(pwd)
|
|
|
|
cd src/code.gitea.io/gitea
|
|
|
|
case ${RPM_ARCH} in
|
|
i386)
|
|
GOARCH=386
|
|
;;
|
|
x86_64)
|
|
GOARCH=amd64
|
|
;;
|
|
*)
|
|
echo UNKNOWN ${RPM_ARCH}
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
case ${RPM_OS} in
|
|
linux)
|
|
GOOS=linux
|
|
;;
|
|
*)
|
|
echo UNKNOWN ${RPM_OS}
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
export GOARCH
|
|
export GOOS
|
|
|
|
|
|
#
|
|
# It is best practice to always use external packages, rather than bundled
|
|
# content. As not all of these packages are yet available in Fedora, we will
|
|
# save this for a future date.
|
|
#
|
|
# rm -fr vendor
|
|
#
|
|
|
|
#
|
|
# Using -a to force everything to compile
|
|
#
|
|
# Using -v to display what is happening
|
|
#
|
|
go build -a -v -tags 'bindata pam sqlite sqlite_unlock_notify' -ldflags '-X "main.Version=%{version}-%{release}" -X "main.Tags="bindata pam sqlite sqlite_unlock_notify"'
|
|
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}
|
|
cd src/code.gitea.io/gitea
|
|
%{__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
|
|
# %{__cp} -rp options %{buildroot}/var/lib/gitea/
|
|
# %{__cp} -rp public %{buildroot}/var/lib/gitea/
|
|
# %{__cp} -rp templates %{buildroot}/var/lib/gitea/
|
|
|
|
|
|
%pre
|
|
getent passwd gitea > /dev/null 2>&1 || useradd -r -d /var/lib/gitea -s /bin/bash gitea
|
|
|
|
|
|
%files
|
|
%license src/code.gitea.io/gitea/LICENSE
|
|
%doc src/code.gitea.io/gitea/CHANGELOG.md
|
|
%doc src/code.gitea.io/gitea/CONTRIBUTING.md
|
|
%doc src/code.gitea.io/gitea/DCO
|
|
%doc src/code.gitea.io/gitea/MAINTAINERS
|
|
%doc src/code.gitea.io/gitea/README.md
|
|
%doc src/code.gitea.io/gitea/README_ZH.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
|
|
# %attr(-, gitea, gitea) %config(noreplace) /var/lib/gitea/options
|
|
# %attr(-, gitea, gitea) %config(noreplace) /var/lib/gitea/public
|
|
# %attr(-, gitea, gitea) %config(noreplace) /var/lib/gitea/templates
|
|
|
|
|
|
%changelog
|
|
* Sun Jul 28 2019 Jason Rothstein
|
|
* Use the bindata tag to bundle everything internally
|
|
|
|
* Sun Jul 28 2019 Jason Rothstein
|
|
- Put options into /var/lib/gitea so the locale data is available
|
|
|
|
* Sun Jul 28 2019 Jason Rothstein
|
|
- version bump 1.8.2
|
|
|
|
* Sun Jul 28 2019 Jason Rothstein
|
|
- version bump 1.8.1
|
|
|
|
* Sun Jul 28 2019 Jason Rothstein
|
|
- initial version
|
|
|