forked from osbuild/weldr-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweldr-client.spec.in
More file actions
105 lines (82 loc) · 3.05 KB
/
weldr-client.spec.in
File metadata and controls
105 lines (82 loc) · 3.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Pass --without tests to skip building composer-cli-tests
%bcond_without tests
# Pass --without signed to skip gpg signed tar.gz (DO NOT DO THAT IN PRODUCTION)
%bcond_without signed
# https://github.com/osbuild/weldr-client
%global goipath github.com/osbuild/weldr-client/v2
Version: %%VERSION%%
%gometa -L -f
Name: weldr-client
Release: %autorelease
Summary: Go client library and cmdline tool for WELDR API servers like lorax-composer and osbuild-composer
# Generated by go-vendor-tools
License: Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND ISC AND MIT
URL: %{gourl}
Source0: %{gosource}
# Generated by go-vendor-tools
Source1: %{archivename}-vendor.tar.bz2
Source2: go-vendor-tools.toml
%if %{with signed}
Source3: %{gosource}.asc
Source4: https://keys.openpgp.org/vks/v1/by-fingerprint/%%GPGKEY%%#/gpg-%%GPGKEY%%.key
%endif
Requires: diffutils
BuildRequires: go-vendor-tools
BuildRequires: git-core
BuildRequires: make
BuildRequires: gnupg2
%description
Go client library and cmdline tool for WELDR API servers like lorax-composer
and osbuild-composer.
%prep
%if %{with signed}
%{gpgverify} --keyring='%{SOURCE4}' --signature='%{SOURCE3}' --data='%{SOURCE0}'
%endif
%goprep -p1
tar -xf %{S:1}
%generate_buildrequires
%go_vendor_license_buildrequires -c %{S:2}
%build
%global gomodulesmode GO111MODULE=on
export GO_LDFLAGS="-X %{goipath}/cmd/composer-cli/root.Version=%{version} "
%gobuild -o composer-cli ./cmd/composer-cli
%if %{with tests} || 0%{?rhel}
# Build test binaries with `go test -c`, so that they can take advantage of
# golang's testing package. The RHEL golang rpm macros don't support building them
# directly. Thus, do it manually, taking care to also include a build id.
#
# On Fedora go modules have already been turned off, and the path set to the one into which
# the golang-* packages install source code.
export LDFLAGS="-linkmode=external -compressdwarf=false -B 0x$(od -N 20 -An -tx1 -w100 /dev/urandom | tr -d ' ') ${LDFLAGS:-}"
go test -c -tags=integration -buildmode pie -compiler gc -ldflags "${LDFLAGS}" -o composer-cli-tests ./weldr
%endif
%install
%go_vendor_license_install -c %{S:2}
make DESTDIR=%{buildroot} install
%if %{with tests} || 0%{?rhel}
make DESTDIR=%{buildroot} install-tests
%endif
%check
%go_vendor_license_check -c %{S:2}
%if %{with tests}
export GO_LDFLAGS="-X %{goipath}/cmd/composer-cli/root.Version=%{version} "
%gocheck2
%endif
%files -f %{go_vendor_license_filelist}
%doc examples HACKING.md README.md RELEASE.md
%{_bindir}/composer-cli
%dir %{_sysconfdir}/bash_completion.d
%{_sysconfdir}/bash_completion.d/composer-cli
%{_mandir}/man1/composer-cli*
%if %{with tests} || 0%{?rhel}
%package tests
Summary: Integration tests for composer-cli
Requires: createrepo_c
%description tests
Integration tests to be run on a pristine-dedicated system to test the
composer-cli package against a running osbuild-composer service.
%files -f %{go_vendor_license_filelist} tests
%{_libexecdir}/tests/composer-cli/
%endif
%changelog
%autochangelog