Commit 2985df4b authored by Markus Frosch's avatar Markus Frosch 📣
Browse files

Build with golang 1.10 and update packaging

parent ba31fe7c
Pipeline #2468 failed with stages
in 1 minute and 43 seconds
%define revision 1
%define debug_package %{nil}
%global provider git.icinga
%global provider_tld com
%global project icingadb
%global repo icingadb
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
%global import_path %{provider_prefix}
%global commit f10596b960b05a492f4524c123a2522d4626a6e0
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global golang_scl go-toolset-7
%if 0%{?golang_scl:1}
%global golang_scl_prefix %{golang_scl}-
%global golang_scl_enable scl enable %{golang_scl} --
%if ! 0%{?gobuild:1}
%define gobuild(o:) %{?golang_scl_enable} go build -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**};
%if ! 0%{?gopath:1}
%define gopath %(%{?golang_scl_enable} go env GOPATH)
Name: icingadb
Version: 0.0.0.%{shortcommit}
Release: %{revision}%{?dist}
Summary: Icinga DB
Group: System Environment/Daemons
License: GPLv2+
URL: https://%{provider_prefix}
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
BuildRequires: golang git
BuildRequires: %{?golang_scl_prefix}golang >= 1.10
BuildRequires: git
BuildRequires: systemd
......@@ -26,8 +50,6 @@ Provides: group(icingadb)
%define configdir %{_sysconfdir}/%{name}
%define service %{name}.service
%define gopath %{_tmppath}/%{name}-%{version}-%{release}-gopath
Icinga DB
......@@ -36,18 +58,32 @@ Icinga DB
%setup -q -n %{name}-%{commit}
mkdir -p %{gopath}/src/
ln -s $(pwd) %{gopath}/src/
GOPATH=%{gopath} go get
GOPATH=%{gopath} go install
mkdir -p src/%{provider}.%{provider_tld}/%{project}
ln -s ../../../ src/%{import_path}
export GOPATH=$(pwd):%{gopath}
pushd src/%{import_path}
%gobuild .
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
%if ! 0%{?gotest:1}
%global gotest %{?golang_scl_enable} go test
%gotest %{import_path}/...
mkdir -p %{buildroot}%{_sbindir}
mkdir -p %{buildroot}%{configdir}
mkdir -p %{buildroot}%{_unitdir}
cp %{gopath}/bin/icingadb %{buildroot}%{_sbindir}
cp etc/config_production.ini %{buildroot}%{configdir}/config.ini
cp etc/%{service} %{buildroot}%{_unitdir}
install -d -m 0755 %{buildroot}%{_sbindir}
install -d -m 0755 %{buildroot}%{configdir}
install -d -m 0755 %{buildroot}%{_unitdir}
install -m 0755 icingadb %{buildroot}%{_sbindir}/
install -m 0644 etc/config_production.ini %{buildroot}%{configdir}/config.ini
install -m 0644 etc/%{service} %{buildroot}%{_unitdir}/
getent group icingadb >/dev/null || groupadd -r icingadb
......@@ -68,7 +104,10 @@ rm -rf %{buildroot}
%attr(0755,icingadb,icingadb) %{_sbindir}/icingadb
%attr(0750,icingadb,icingadb) %config(noreplace) %dir %{configdir}
%attr(0640,icingadb,icingadb) %config(noreplace) %{configdir}/config.ini
%attr(0644,root,root) %{_unitdir}/%{service}
%dir %{configdir}
%config(noreplace) %{configdir}/config.ini
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment