File longhorn-engine.spec of Package longhorn-engine

# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
 
# Please submit bugfixes or comments via https://bugs.opensuse.org/
# 

# needs to match path in source5

Name:           longhorn-engine
Version:        1.9.1+git.0.e28f603a
Release:        0
License:        Apache-2.0
Summary:        World's smallest storage controller 
Url:            https://github.com/longhorn/longhorn-engine
Group:          Development/Languages/Other
Source0:        %{name}-%{version}.tar.xz
Source1:        vendor.tar.xz
BuildRequires:  golang-packaging
BuildRequires:  xz
BuildRequires:  zlib-devel
BuildRequires:  libqcow-devel
BuildRequires:  open-iscsi
BuildRequires:  qemu-tools
BuildRequires:  longhorn-instance-manager
Requires:       libqcow1
Requires(post): %fillup_prereq

%{go_nostrip}
%{go_provides}

%description
Longhorn Engine implements a lightweight block device storage controller
capable of storing the data in a number of replicas. It functions like a
network RAID controller.

%prep
%autosetup -a1

%build
REV="%{version}"
#export REV="${REV##*.}"
#go build \
#  -mod=vendor \
#  -buildmode=pie 
#  -ldflags "-X main.VERSION=%{version}"
VERSION="${REV%%+*}"
GITCOMMIT="${REV##*.}"
BUILDDATE=$(date -u --rfc-3339=seconds)
BUILDDATE=${BUILDDATE// /T}
LDFLAGS="-X main.Version=v$VERSION
         -X main.GitCommit=$GITCOMMIT
         -X main.BuildDate=$BUILDDATE
         -linkmode external"
%{goprep} github.com/longhorn/longhorn-engine
#%{gobuild} -ldflags="$LDFLAGS" ""
go build -o longhorn -tags netgo -ldflags="$LDFLAGS"

%check
go test -v ./...

%install
mkdir -p %{buildroot}%{_bindir}
cp longhorn package/launch-simple-longhorn package/engine-manager package/launch-simple-file %{buildroot}%{_bindir}

%files
%doc README.md
%license LICENSE
%{_bindir}/longhorn
%{_bindir}/launch-simple-longhorn
%{_bindir}/engine-manager
%{_bindir}/launch-simple-file

%changelog
openSUSE Build Service is sponsored by