File notary.spec of Package notary

# spec file for package notary
# Copyright (c) 2021 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
# nodebuginfo

%define goipath

Name:           notary
Version:        0.7.0
Release:        0
Summary:        Trusted collections handling: server and signer
License:        Apache-2.0
Group:          System/Management
Source0:        %{name}-%{version}.tar.gz
Source1:        vendor.tar.gz
Source2:        server-config.postgres.json
Source3:        signer-config.postgres.json
Patch0:         0001-Hide-DB-credentials.patch
BuildRequires:  golang-packaging
BuildRequires:  golang(API) >= 1.15

The Notary project comprises a server and a client for running and
interacting with trusted collections.

%setup -q -n %{name}-%{version} -a 1
%patch0 -p1

%goprep %{goipath}
export CGO_ENABLED=0
%define ldflags "-w -X %{goipath}/version.NotaryVersion=v%{version} -X  %{goipath}/version.GitCommit=%{release}"
%define buildtags "pkcs11"

%gobuild -mod vendor -ldflags %{ldflags} -tags %{buildtags} cmd/notary-server
%gobuild -mod vendor -ldflags %{ldflags} -tags %{buildtags} cmd/notary-signer


install -Dm 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/notary/server-config.postgres.json
install -Dm 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/notary/signer-config.postgres.json

mkdir -p %{buildroot}%{_localstatedir}/lib/notary/migrations
mkdir -p %{buildroot}%{_localstatedir}/lib/notary/migrations/server/postgresql
mkdir -p %{buildroot}%{_localstatedir}/lib/notary/migrations/signer/postgresql
install -Dpm 0755 migrations/ %{buildroot}%{_localstatedir}/lib/notary/migrations/
install -Dpm 0644 migrations/server/postgresql/* %{buildroot}%{_localstatedir}/lib/notary/migrations/server/postgresql/
install -Dpm 0644 migrations/signer/postgresql/* %{buildroot}%{_localstatedir}/lib/notary/migrations/signer/postgresql/

%license LICENSE
%config %{_sysconfdir}/notary

%config(noreplace) %{_sysconfdir}/notary/server-config.postgres.json
%config(noreplace) %{_sysconfdir}/notary/signer-config.postgres.json

openSUSE Build Service is sponsored by