Skip to main content

Tools for handling Go library vendoring in Fedora

Project description

go-vendor-tools

CI Badge

Tools for handling Go library vendoring in Fedora

Architecture

The Go Vendor Tools project has four main pieces:

  • go_vendor_archive --- this command creates an archive containing a Go vendor/ directory for use in the specfile. The archive metadata is normalized so archives are reproducible.
  • go_vendor_license --- this command detects licenses within the project tree. It can create a license summary, a normalized SPDX expression, and install detected license files into a single directory for the main project and all vendored modules.
  • RPM macros --- the package ships with RPM macros that use the go_vendor_license command to verify the License: tag in the specfile and install license files into the package's directory in /usr/share/licenses.
  • go-vendor-license.toml --- settings for the two commands and the macros are specified in this shared configuration file.

Example specfile

# Generated by go2rpm 1.11.0 (and then modified)
%bcond_without check

# https://github.com/cupcakearmy/autorestic
%global goipath         github.com/cupcakearmy/autorestic
Version:                1.7.11

%gometa -L -f

%global common_description %{expand:
Config driven, easy backup cli for restic.}

Name:           autorestic
Release:        %autorelease
Summary:        Config driven, easy backup cli for restic

# NOTE: Generated with:
#   $ go_vendor_license -C <UNPACKED ARCHIVE> report expression
License:        Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND MIT AND MPL-2.0
URL:            %{gourl}
Source0:        %{gosource}
# NOTE: Archive created with:
#   $ go_vendor_archive -O autorestic-%%{version}-vendor.tar.xz \
#       autorestic-%%{version}.tar.gz
# NOTE: %%{archivename} is set by %%gometa and evaluates to
# NOTE: autorestic-%%{version} here
Source1:        %{archivename}-vendor.tar.xz

# NOTE: Be sure to depend on the go-vendor-tools package for macros
BuildRequires:  go-vendor-tools

%description %{common_description}

# NOTE: %%gopkg and %%gopkgfiles are not used here!

%prep
# NOTE: %%{forgesetupargs} is set by %%gometa. It contains the correct -n flag
# NOTE: to unpack the primary archive.
# NOTE: -a1 extracts Source1 (the vendor archive) into the build directory.
%autosetup -p1 %{forgesetupargs} -a1
# NOTE: -k prevents %%goprep from deleting the vendor/ directory
# NOTE: -e disables automatic extraction. %%autosetup already does this.
%goprep -k -e

%build
%gobuild -o %{gobuilddir}/bin/autorestic %{goipath}

%install
# NOTE: %%go_vendor_license_install copies all license files into the package's
# NOTE: license directory.
# NOTE: This includes the main specfile's license AND all vendored modules.
%go_vendor_license_install
install -m 0755 -vd                     %{buildroot}%{_bindir}
install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/

%check
# NOTE: %%go_vendor_license_check verifies that the SPDX expression in License:
# NOTE: matches the package contents.
%go_vendor_license_check
%if %{with check}
%gocheck
%endif

# NOTE: %%{go_vendor_license_filelist} includes the license files installed by
# NOTE: %%go_vendor_license_install
%files -f %{go_vendor_license_filelist}
%{_bindir}/autorestic


%changelog
%autochangelog

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

go_vendor_tools-0.0.1.tar.gz (23.0 kB view details)

Uploaded Source

Built Distribution

go_vendor_tools-0.0.1-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

Details for the file go_vendor_tools-0.0.1.tar.gz.

File metadata

  • Download URL: go_vendor_tools-0.0.1.tar.gz
  • Upload date:
  • Size: 23.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for go_vendor_tools-0.0.1.tar.gz
Algorithm Hash digest
SHA256 72cf0faaa038f8ee3312bd78a1415fe93f179d348e5016ea34f5b25862087109
MD5 1dfb54a3d185c18b8c4882e6af014edf
BLAKE2b-256 3597398ce1f485d89b2fe677fb60401b1a039d55d0b8222166c5dde605127cbb

See more details on using hashes here.

File details

Details for the file go_vendor_tools-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for go_vendor_tools-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 42a0205b87f650a4b94ff18d77ee10860d09e58b161e31be2c085b228a8bd3b9
MD5 0b2ace4f0f47f12ea4937fe2b8a99911
BLAKE2b-256 6d58046a6c0e64de95bd72ced9d2950611e071ee7dc7aee8b89a7173ec27b147

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page