Skip to content

Commit 829cfb4

Browse files
authored
Merge pull request #98 from buckaroogeek/newspec
Add vendoring to spec file
2 parents 3332ec0 + 57fa255 commit 829cfb4

File tree

3 files changed

+124
-32
lines changed

3 files changed

+124
-32
lines changed

rpm/README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Building the rpm locally
2+
3+
The revised spec file uses [`go-vendor-tools`]
4+
(https://fedora.gitlab.io/sigs/go/go-vendor-tools/scenarios/#generate-specfile-with-go2rpm)
5+
which enable vendoring for Go
6+
language packages in Fedora.
7+
8+
Follow these steps to build an rpm locally using Fedora packager tools.
9+
These steps assume a Fedora machine.
10+
11+
1. Install packager tools. See [Installing Packager Tools](https://docs.fedoraproject.org/en-US/package-maintainers/Installing_Packager_Tools/).
12+
13+
1. Install go-vendor-tools:
14+
15+
``` bash
16+
sudo dnf install go-vendor-tools*
17+
```
18+
19+
1. Copy `podman-bootc.spec` and `go-vendor-tools.toml` into a directory.
20+
21+
1. Change into the directory.
22+
23+
1. Change version in spec file if needed.
24+
25+
1. Download tar file:
26+
27+
``` bash
28+
spectool -g -s 0 podman-bootc.spec
29+
```
30+
31+
1. Generate archive:
32+
33+
```bash
34+
go_vendor_archive create --config go-vendor-tools.toml podman-bootc.spec
35+
```
36+
37+
1. Build rpm locally:
38+
39+
```bash
40+
fedpkg --release rawhide mockbuild --srpm-mock
41+
```
42+
43+
1. Check output in the `results_podman-bootc` subdirectory

rpm/go-vendor-tools.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[archive]
2+
3+
[licensing]
4+
detector = "askalono"
5+
[[licensing.licenses]]
6+
path = "vendor/github.com/fsouza/go-dockerclient/DOCKER-LICENSE"
7+
sha256sum = "04649aa5a97550d0bb083955b37586eb0ed6c6caa6e8a32f9cc840bbb3274254"
8+
expression = "Apache-2.0"
9+
10+
[[licensing.licenses]]
11+
path = "vendor/github.com/shirou/gopsutil/v3/LICENSE"
12+
sha256sum = "ad1e64b82c04fb2ee6bfe521bff01266971ffaa70500024d4ac767c6033aafb9"
13+
expression = "BSD-3-Clause"
14+
15+
[[licensing.licenses]]
16+
path = "vendor/gopkg.in/yaml.v3/LICENSE"
17+
sha256sum = "d18f6323b71b0b768bb5e9616e36da390fbd39369a81807cca352de4e4e6aa0b"
18+
expression = "MIT"

rpm/podman-bootc.spec

Lines changed: 63 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,92 @@
1+
# Generated by go2rpm 1.16.0.post0
2+
%bcond check 1
3+
14
# https://github.com/containers/podman-bootc
25
%global goipath github.com/containers/podman-bootc
3-
Version: 0.1.1
6+
Version: 0.1.2
47

58
%gometa -L -f
69

7-
%global golicenses LICENSE
8-
%global godocs README.md
10+
%global common_description %{expand:
11+
A scriptable CLI that offers an efficient and ergonomic "edit-compile-debug"
12+
cycle for bootable containers.}
913

1014
Name: podman-bootc
1115
Release: %autorelease
1216
Summary: Streamlining podman + bootc interactions
1317

14-
License: Apache-2.0
18+
# Generated by go-vendor-tools
19+
License: Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 AND Unlicense
1520
URL: %{gourl}
1621
Source0: %{gosource}
17-
Source1: vendor.tar.gz # Vendor file place holder
18-
19-
BuildRequires: gcc
20-
BuildRequires: golang
21-
BuildRequires: make
22-
BuildRequires: libvirt-devel
22+
# Generated by go-vendor-tools
23+
Source1: %{archivename}-vendor.tar.bz2
24+
Source2: go-vendor-tools.toml
2325

24-
Requires: podman-machine
25-
Requires: xorriso
26-
Requires: podman
27-
Requires: qemu
28-
Requires: libvirt
26+
BuildRequires: go-vendor-tools
27+
# make needed for man generation but not available in release
28+
# BuildRequires: make
29+
BuildRequires: gcc
30+
BuildRequires: libvirt-devel
31+
BuildRequires: go-md2man
2932

30-
%description
31-
%{summary}.
33+
Requires: podman-machine
34+
Requires: xorriso
35+
Requires: podman
36+
Requires: qemu
37+
Requires: libvirt
3238

33-
%gopkg
39+
%description %{common_description}
3440

3541
%prep
36-
%goprep -Ak # k: keep vendor directory
37-
%setup -T -D -a 1
42+
%goprep -A
43+
%setup -q -T -D -a1 %{forgesetupargs}
3844
%autopatch -p1
3945

46+
%generate_buildrequires
47+
%go_vendor_license_buildrequires -c %{S:2}
48+
4049
%build
41-
export BUILDTAGS="exclude_graphdriver_btrfs btrfs_noversion exclude_graphdriver_devicemapper containers_image_openpgp remote"
42-
%gobuild -o %{gobuilddir}/bin/%%{name} %{goipath}
43-
%{__make} docs
50+
# explicitly turn on module support for gotest and gobuild
51+
%global gomodulesmode GO111MODULE=on
52+
53+
# define global for use in gobuild and gotest
54+
%global buildtags exclude_graphdriver_btrfs btrfs_noversion exclude_graphdriver_devicemapper containers_image_openpgp remote
55+
export GO_BUILDTAGS="%{buildtags}"
56+
57+
%gobuild -o %{gobuilddir}/bin/podman-bootc %{goipath}
58+
59+
# docs directory not included in current source tar file
60+
# build man files
61+
# %%make_build docs
4462

4563
%install
46-
%gopkginstall
64+
%go_vendor_license_install -c %{S:2}
4765
install -m 0755 -vd %{buildroot}%{_bindir}
4866
install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/
49-
install -m 0755 -vd %{buildroot}%{_mandir}/man1
50-
install -m 0755 -vp docs/*.1 %{buildroot}%{_mandir}/man1/
67+
# docs directory not included in current source tar file
68+
# install -m 0755 -vd %%{buildroot}%%{_mandir}/man1
69+
# install -m 0755 -vp docs/*.1 %%{buildroot}%%{_mandir}/man1/
5170

52-
%files
53-
%license LICENSE
54-
%doc README.md
55-
%{_bindir}/*
56-
%{_mandir}/man1/*.1*
71+
%check
72+
%go_vendor_license_check -c %{S:2}
73+
74+
%if %{with check}
75+
76+
# redefine gotestflags to include needed buildtags
77+
%define gotestflags %{gocompilerflags} '-tags=%{buildtags}'
5778

58-
%gopkgfiles
79+
# skip ./pkg/vms - cannot run vm tests in build
80+
# skip ./test - end-to-end integration tests that cannot run in build
81+
%gotest $(go list ./... | awk '!/(vm|test)/ {print $1}')
82+
%endif
83+
84+
%files -f %{go_vendor_license_filelist}
85+
%license vendor/modules.txt
86+
%doc README.md
87+
%{_bindir}/podman-bootc
88+
# docs directory not included in current source tar file
89+
# %%{_mandir}/man1/*.1*
5990

6091
%changelog
6192
%autochangelog

0 commit comments

Comments
 (0)