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.

73 lines
1.5 KiB

%global _hardened_build 1
%define _user git
%define _group git
%define _home /var/lib/lgtm/
%define _logdir /var/log/lgtm/
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}%{_home}/env
install -p -D -m 0555 go/src/github.com/go-gitea/lgtm/lgtm %{buildroot}%{_home}/%{name}
%pre
getent group %{_group} > /dev/null || groupadd -r %{_group}
getent passwd %{_user} > /dev/null || \
useradd -r -d %{_home} -g %{_group} \
-s /bin/bash -c "git user" %{_user}
exit 0
%post
%systemd_post lgtm.service
%preun
%systemd_preun lgtm.service
%postun
%systemd_postun lgtm.service
%files
%config(noreplace) %{_home}/env
%{_home}/lgtm
%{_unitdir}/lgtm.service
%attr(700,%{_user},%{_group}) %dir %{_home}
%changelog