You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.6 KiB

%global _hardened_build 1
%define gitea_user git
%define gitea_group git
%define gitea_home /var/lib/gitea/
%define gitea_logdir /var/log/gitea/
Name : lgtm
Version : 1.0.0
Release : 1%{dist}
License : MIT
URL : http://gitea.io
Summary : A simple pull request approval system
Source0 : lgtm.service
Source1 : lgtm.env
BuildRequires: golang
BuildRequires: git
Requires : git
%description
A simple pull request approval system
%prep
%setup -T -q -c %{name}-%{version}
export GOPATH=`pwd`
mkdir -p go/src/github.com/go-gitea/
cd go/src/github.com/go-gitea/
git clone https://github.com/go-gitea/lgtm
%build
export GOPATH=`pwd`
export GO111MODULE=on
cd go/src/github.com/go-gitea/lgtm
go build -v -ldflags "-extldflags -s -w -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n') -buildid "%{version}" -X 'github.com/go-gitea/lgtm/version.VersionDev=""'"
%install
install -p -D -m 0644 %{SOURCE0} %{buildroot}%{_unitdir}/%{name}.service
install -p -D -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/%{name}/env
install -p -D -m 0555 go/src/github.com/go-gitea/lgtm/lgtm %{buildroot}%{_bindir}/%{name}
%pre
getent group %{gitea_group} > /dev/null || groupadd -r %{gitea_group}
getent passwd %{gitea_user} > /dev/null || \
useradd -r -d %{gitea_home} -g %{gitea_group} \
-s /bin/bash -c "git user" %{gitea_user}
exit 0
%post
%systemd_post lgtm.service
%preun
%systemd_preun lgtm.service
%postun
%systemd_postun lgtm.service
%files
%config(noreplace) %{_sysconfdir}/%{name}/env
%{_bindir}/lgtm
%{_unitdir}/lgtm.service
%changelog