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.

112 lines
3.3 KiB

Name: abstruse
Version: 2.0.0
Release: 1%{?dist}
Source0: https://github.com/bleenco/abstruse/archive/refs/tags/v%{version}.tar.gz
Source1: abstruse-server.service
Source2: abstruse-server.env
Source3: abstruse-worker.service
Source4: abstruse-worker.env
Source5: abstruse-worker@.service
Patch0: abstruse-protoc-import.patch
Patch1: abstruse-postgres-ssl.patch
Summary: Abstruse is a free and open-source CI/CD platform that tests your models and code.
Group: System/Pipeline
License: MIT
URL: https://www.abstruse.cc
BuildRequires: golang
#Requires:
%description
%package server
Summary: Abstruse Server
%description server
%package worker
Summary: Abstruse Worker
%description worker
%prep
%setup -q -c %{name}-%{version}
mkdir -p src/github.com/bleenco/
tar xvf %{SOURCE0}
mv abstruse-%{version} src/github.com/bleenco/abstruse/
#cd src/github.com/bleenco/abstruse/
%patch0 -p0
%patch1 -p0
%build
export GOPATH=`pwd`
export PATH="$PATH:$GOPATH/bin/"
export GO111MODULE=on
go get github.com/jkuri/statik github.com/golang/protobuf/protoc-gen-go github.com/cespare/reflex github.com/google/wire/...
cd src/github.com/bleenco/abstruse/
export GIT_COMMIT=$(git rev-list -1 HEAD)
export BUILD_DATE=$(date +%FT%T%z)
export ABSTRUSE_VERSION_PATH="github.com/bleenco/abstruse/internal/version"
%ifarch ppc64
export CGO_ENABLED=1
%endif
pushd web/abstruse
yarnpkg add ng
yarnpkg install
yarnpkg build
popd
$GOPATH/bin/statik -dest ./server -p ui -src ./web/abstruse/dist
$GOPATH/bin/wire ./server/cmd/... ./worker/cmd/...
protoc ./pb/api.proto --go_out=plugins=grpc:./pb/
go build -v -gcflags=all="-N -l" -ldflags "-X ${ABSTRUSE_VERSION_PATH}.GitCommit=${GIT_COMMIT} -X ${ABSTRUSE_VERSION_PATH}.UIVersion=%{version} -X ${ABSTRUSE_VERSION_PATH}.BuildDate=${BUILD_DATE} -extldflags -s -w -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')" -o build/abstruse-server ./cmd/abstruse-server
go build -v -gcflags=all="-N -l" -ldflags "-X ${ABSTRUSE_VERSION_PATH}.GitCommit=${GIT_COMMIT} -X ${ABSTRUSE_VERSION_PATH}.UIVersion=%{version} -X ${ABSTRUSE_VERSION_PATH}.BuildDate=${BUILD_DATE} -extldflags -s -w -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')" -o build/abstruse-worker ./cmd/abstruse-worker
%install
mkdir -p %{buildroot}%{_bindir}
cp src/github.com/bleenco/abstruse/build/abstruse-server %{buildroot}%{_bindir}
cp src/github.com/bleenco/abstruse/build/abstruse-worker %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_unitdir}
cp %{SOURCE1} %{buildroot}%{_unitdir}/
cp %{SOURCE3} %{buildroot}%{_unitdir}/
cp %{SOURCE5} %{buildroot}%{_unitdir}/
mkdir -p %{buildroot}%{_sysconfdir}/%{name}
cp %{SOURCE2} %{buildroot}%{_sysconfdir}/%{name}/server
cp %{SOURCE4} %{buildroot}%{_sysconfdir}/%{name}/worker
%post server
%systemd_post abstruse-server.service
%preun server
%systemd_preun abstruse-server.service
%postun server
%systemd_postun abstruse-server.service
%post worker
%systemd_post abstruse-worker.service
%postun worker
%systemd_postun abstruse-worker.service
%preun worker
%systemd_preun abstruse-worker.service
%files
%files server
%config(noreplace) %{_sysconfdir}/%{name}/server
%{_bindir}/abstruse-server
%{_unitdir}/abstruse-server.service
%files worker
%config(noreplace) %{_sysconfdir}/%{name}/worker
%{_bindir}/abstruse-worker
%{_unitdir}/abstruse-worker.service
%{_unitdir}/abstruse-worker@.service
%changelog