-
Notifications
You must be signed in to change notification settings - Fork 16
Add vendoring to spec file #98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+124
−32
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry I forgot to ask why this file is required? (I'm not familiar with the go-vendor tool)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the go-vendor-tools macros process the license files during the rpm build process. The
tomlfile provides configuration to that process. E.G. specify alternate license detector, set licenses for modules where the detector cannot find a license, exclude directories or files from license detection.The
tomlfile can also replace a module with a different version if needed. For example to resolve an urgent CVE.See https://fedora.gitlab.io/sigs/go/go-vendor-tools/config/ for options.