forked from osbuild/image-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
image-builder.spec
119 lines (91 loc) · 3.48 KB
/
image-builder.spec
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# Do not build with tests by default
# Pass --with tests to rpmbuild to override
%bcond_with tests
%global goipath github.com/osbuild/image-builder
Version: 1
%gometa
%global common_description %{expand:
A web service which relays requests to osbuild-composer.
}
Name: image-builder
Release: 1%{?dist}
Summary: A web service which relays requests to osbuild-composer
# Upstream license specification: Apache-2.0
License: ASL 2.0
URL: %{gourl}
Source0: %{gosource}
BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
BuildRequires: systemd
Requires: systemd
%description
%{common_description}
%prep
%forgeautosetup -p1
%build
GO_BUILD_PATH=$PWD/_build
install -m 0755 -vd $(dirname $GO_BUILD_PATH/src/%{goipath})
ln -fs $PWD $GO_BUILD_PATH/src/%{goipath}
cd $GO_BUILD_PATH/src/%{goipath}
install -m 0755 -vd _bin
export PATH=$PWD/_bin${PATH:+:$PATH}
export GOPATH=$GO_BUILD_PATH:%{gopath}
export GOFLAGS=-mod=vendor
%gobuild -o _bin/image-builder %{goipath}/cmd/image-builder
%gobuild -o _bin/image-builder-migrate-db %{goipath}/cmd/image-builder-migrate-db
%install
install -m 0755 -vd %{buildroot}%{_libexecdir}/image-builder
install -m 0755 -vp _bin/image-builder %{buildroot}%{_libexecdir}/image-builder/
install -m 0755 -vp _bin/image-builder-migrate-db %{buildroot}%{_libexecdir}/image-builder/
install -m 0755 -vp tools/gen-ssh.sh %{buildroot}%{_libexecdir}/image-builder/
install -m 0755 -vd %{buildroot}%{_unitdir}
install -m 0644 -vp distribution/*.{service,socket} %{buildroot}%{_unitdir}/
install -m 0755 -vd %{buildroot}%{_datadir}/image-builder/distributions
install -m 0644 -vp distributions/* %{buildroot}%{_datadir}/image-builder/distributions/
install -m 0755 -vd %{buildroot}%{_datadir}/image-builder/migrations
install -m 0644 -vp internal/db/migrations/* %{buildroot}%{_datadir}/image-builder/migrations/
%if %{with tests} || 0%{?rhel}
install -m 0755 -vd %{buildroot}%{_libexecdir}/tests/image-builder
install -m 0755 -vp test/cases/* %{buildroot}%{_libexecdir}/tests/image-builder/
install -m 0755 -vd %{buildroot}%{_datadir}/tests/image-builder/edge
install -m 0644 -vp test/data/edge/* %{buildroot}%{_datadir}/tests/image-builder/edge/
%endif
%post
%systemd_post image-builder.service
%preun
%systemd_preun image-builder.service
%postun
%systemd_postun_with_restart image-builder.service
%files
%{_libexecdir}/image-builder/image-builder
%{_libexecdir}/image-builder/image-builder-migrate-db
%{_libexecdir}/image-builder/gen-ssh.sh
%{_unitdir}/image-builder.service
%{_unitdir}/image-builder.socket
%{_datadir}/image-builder/distributions/
%{_datadir}/image-builder/migrations/
%if %{with tests} || 0%{?rhel}
%package tests
Summary: Integration tests
Requires: %{name} = %{version}-%{release}
Requires: openssl
Requires: jq
Requires: curl
Requires: httpd
Requires: expect
Requires: qemu-img
Requires: qemu-kvm
Requires: libvirt-client
Requires: libvirt-daemon-kvm
Requires: virt-install
Requires: wget
%description tests
Integration tests to be run on a system with image-builder installed.
%files tests
%{_libexecdir}/tests/image-builder
%{_datadir}/tests/image-builder
%endif
%changelog
# the changelog is distribution-specific, therefore there's just one entry
# to make rpmlint happy.
* Fri Mar 27 2020 Image Builder team <[email protected]> - 0-1
- On this day, this project was born.