diff --git a/rpm/README.md b/rpm/README.md new file mode 100644 index 00000000..75b4e951 --- /dev/null +++ b/rpm/README.md @@ -0,0 +1,43 @@ +# Building the rpm locally + +The revised spec file uses [`go-vendor-tools`] +(https://fedora.gitlab.io/sigs/go/go-vendor-tools/scenarios/#generate-specfile-with-go2rpm) +which enable vendoring for Go +language packages in Fedora. + +Follow these steps to build an rpm locally using Fedora packager tools. +These steps assume a Fedora machine. + +1. Install packager tools. See [Installing Packager Tools](https://docs.fedoraproject.org/en-US/package-maintainers/Installing_Packager_Tools/). + +1. Install go-vendor-tools: + + ``` bash + sudo dnf install go-vendor-tools* + ``` + +1. Copy `podman-bootc.spec` and `go-vendor-tools.toml` into a directory. + +1. Change into the directory. + +1. Change version in spec file if needed. + +1. Download tar file: + + ``` bash + spectool -g -s 0 podman-bootc.spec + ``` + +1. Generate archive: + + ```bash + go_vendor_archive create --config go-vendor-tools.toml podman-bootc.spec + ``` + +1. Build rpm locally: + + ```bash + fedpkg --release rawhide mockbuild --srpm-mock + ``` + +1. Check output in the `results_podman-bootc` subdirectory diff --git a/rpm/go-vendor-tools.toml b/rpm/go-vendor-tools.toml new file mode 100644 index 00000000..9ea86c09 --- /dev/null +++ b/rpm/go-vendor-tools.toml @@ -0,0 +1,18 @@ +[archive] + +[licensing] +detector = "askalono" +[[licensing.licenses]] +path = "vendor/github.com/fsouza/go-dockerclient/DOCKER-LICENSE" +sha256sum = "04649aa5a97550d0bb083955b37586eb0ed6c6caa6e8a32f9cc840bbb3274254" +expression = "Apache-2.0" + +[[licensing.licenses]] +path = "vendor/github.com/shirou/gopsutil/v3/LICENSE" +sha256sum = "ad1e64b82c04fb2ee6bfe521bff01266971ffaa70500024d4ac767c6033aafb9" +expression = "BSD-3-Clause" + +[[licensing.licenses]] +path = "vendor/gopkg.in/yaml.v3/LICENSE" +sha256sum = "d18f6323b71b0b768bb5e9616e36da390fbd39369a81807cca352de4e4e6aa0b" +expression = "MIT" diff --git a/rpm/podman-bootc.spec b/rpm/podman-bootc.spec index e213229e..643fa187 100644 --- a/rpm/podman-bootc.spec +++ b/rpm/podman-bootc.spec @@ -1,61 +1,92 @@ +# Generated by go2rpm 1.16.0.post0 +%bcond check 1 + # https://github.com/containers/podman-bootc %global goipath github.com/containers/podman-bootc -Version: 0.1.1 +Version: 0.1.2 %gometa -L -f -%global golicenses LICENSE -%global godocs README.md +%global common_description %{expand: +A scriptable CLI that offers an efficient and ergonomic "edit-compile-debug" +cycle for bootable containers.} Name: podman-bootc Release: %autorelease Summary: Streamlining podman + bootc interactions -License: Apache-2.0 +# Generated by go-vendor-tools +License: Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 AND Unlicense URL: %{gourl} Source0: %{gosource} -Source1: vendor.tar.gz # Vendor file place holder - -BuildRequires: gcc -BuildRequires: golang -BuildRequires: make -BuildRequires: libvirt-devel +# Generated by go-vendor-tools +Source1: %{archivename}-vendor.tar.bz2 +Source2: go-vendor-tools.toml -Requires: podman-machine -Requires: xorriso -Requires: podman -Requires: qemu -Requires: libvirt +BuildRequires: go-vendor-tools +# make needed for man generation but not available in release +# BuildRequires: make +BuildRequires: gcc +BuildRequires: libvirt-devel +BuildRequires: go-md2man -%description -%{summary}. +Requires: podman-machine +Requires: xorriso +Requires: podman +Requires: qemu +Requires: libvirt -%gopkg +%description %{common_description} %prep -%goprep -Ak # k: keep vendor directory -%setup -T -D -a 1 +%goprep -A +%setup -q -T -D -a1 %{forgesetupargs} %autopatch -p1 +%generate_buildrequires +%go_vendor_license_buildrequires -c %{S:2} + %build -export BUILDTAGS="exclude_graphdriver_btrfs btrfs_noversion exclude_graphdriver_devicemapper containers_image_openpgp remote" -%gobuild -o %{gobuilddir}/bin/%%{name} %{goipath} -%{__make} docs +# explicitly turn on module support for gotest and gobuild +%global gomodulesmode GO111MODULE=on + +# define global for use in gobuild and gotest +%global buildtags exclude_graphdriver_btrfs btrfs_noversion exclude_graphdriver_devicemapper containers_image_openpgp remote +export GO_BUILDTAGS="%{buildtags}" + +%gobuild -o %{gobuilddir}/bin/podman-bootc %{goipath} + +# docs directory not included in current source tar file +# build man files +# %%make_build docs %install -%gopkginstall +%go_vendor_license_install -c %{S:2} install -m 0755 -vd %{buildroot}%{_bindir} install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/ -install -m 0755 -vd %{buildroot}%{_mandir}/man1 -install -m 0755 -vp docs/*.1 %{buildroot}%{_mandir}/man1/ +# docs directory not included in current source tar file +# install -m 0755 -vd %%{buildroot}%%{_mandir}/man1 +# install -m 0755 -vp docs/*.1 %%{buildroot}%%{_mandir}/man1/ -%files -%license LICENSE -%doc README.md -%{_bindir}/* -%{_mandir}/man1/*.1* +%check +%go_vendor_license_check -c %{S:2} + +%if %{with check} + +# redefine gotestflags to include needed buildtags +%define gotestflags %{gocompilerflags} '-tags=%{buildtags}' -%gopkgfiles +# skip ./pkg/vms - cannot run vm tests in build +# skip ./test - end-to-end integration tests that cannot run in build +%gotest $(go list ./... | awk '!/(vm|test)/ {print $1}') +%endif + +%files -f %{go_vendor_license_filelist} +%license vendor/modules.txt +%doc README.md +%{_bindir}/podman-bootc +# docs directory not included in current source tar file +# %%{_mandir}/man1/*.1* %changelog %autochangelog