Skip to content

Commit d03317d

Browse files
author
Paul Whalen
committed
refactor: switch to standard Go vendoring for cross-distro packaging
Replace go-vendor-tools with standard Go module vendoring to support building on both Fedora and CentOS/RHEL with a single spec file. Changes: - Commit vendor/ directory to git (998 vendored dependency files) - Include vendor/ directory in Source0 tarball - Set GO111MODULE=on and GOFLAGS=-mod=vendor for build and test phases - Remove go-vendor-tools dependency from spec and Packit config - Add vendor/modules.txt to %license for bundled dependency tracking This approach follows the standard pattern used by major Go packages in Fedora and ensures compatibility across distributions. Signed-off-by: Paul Whalen <[email protected]>
1 parent 3481ae3 commit d03317d

File tree

1,001 files changed

+727058
-45
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,001 files changed

+727058
-45
lines changed

.packit.yaml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ files_to_sync:
66
- src:
77
- ".packit.yaml"
88
- "build/package/rpm/go-fdo-server.spec"
9-
- "build/package/rpm/go-vendor-tools.toml"
10-
- "build/package/rpm/go-fdo-server-*-vendor.tar.bz2"
119
dest: .
1210

1311
upstream_package_name: go-fdo-server
@@ -24,8 +22,6 @@ srpm_build_deps:
2422
- gcc
2523
- glibc-devel
2624
- golang
27-
- go-vendor-tools
28-
- python3-tomlkit
2925

3026
packages:
3127
go-fdo-server-fedora:
@@ -126,14 +122,7 @@ jobs:
126122
packages: [go-fdo-server-centos]
127123
trigger: pull_request
128124
targets:
129-
epel-9:
130-
additional_repos:
131-
- https://download.copr.fedorainfracloud.org/results/@go-sig/golang-rawhide/epel-9-$basearch/
132-
additional_packages:
133-
- golang
134-
epel-10:
135-
additional_repos:
136-
- https://download.copr.fedorainfracloud.org/results/@go-sig/golang-rawhide/epel-10-$basearch/
125+
centos-stream-10:
137126
additional_packages:
138127
- golang
139128

@@ -151,5 +140,4 @@ jobs:
151140
tmt_plan: test/fmf/plans/e2e
152141
packages: [go-fdo-server-centos]
153142
targets:
154-
- epel-9
155-
- epel-10
143+
- centos-stream-10

Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ SOURCE_DIR := $(CURDIR)/build/package/rpm
3535
SOURCE_TARBALL_FILENAME := go-fdo-server-$(VERSION).tar.gz
3636
SOURCE_TARBALL := $(SOURCE_DIR)/${SOURCE_TARBALL_FILENAME}
3737
$(SOURCE_TARBALL):
38-
git archive --prefix=go-fdo-server-$(VERSION)/ --format=tar.gz HEAD > $(SOURCE_TARBALL)
38+
@echo "Creating source tarball with vendor/ directory..."
39+
rm -rf vendor; \
40+
go mod vendor; \
41+
git ls-files | tar --transform='s,^,go-fdo-server-$(VERSION)/,' -czf - -T - vendor/ > $(SOURCE_TARBALL); \
42+
rm -rf vendor
3943

4044
.PHONY: source-tarball
4145
source-tarball: $(SOURCE_TARBALL)
@@ -155,13 +159,14 @@ rpm: $(RPMBUILD_SPECFILE) $(RPMBUILD_TARBALL) $(RPMBUILD_GOLANG_VENDOR_TOOLS_FIL
155159
#
156160

157161
.PHONY: packit-create-archive
158-
packit-create-archive: $(SOURCE_TARBALL) $(VENDOR_TARBALL)
162+
packit-create-archive: $(SOURCE_TARBALL)
159163
ls -1 $(SOURCE_TARBALL)
160164

161165
.PHONY: clean
162166
clean:
163167
rm -rf $(RPMBUILD_TOP_DIR)
164168
rm -rf $(SOURCE_DIR)/go-fdo-server-*.tar.{gz,bz2}
169+
rm -rf vendor
165170

166171
# Default target
167172
all: build test

build/package/rpm/go-fdo-server.spec

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,30 @@
33

44
# https://github.com/fido-device-onboard/go-fdo-server
55
%global goipath github.com/fido-device-onboard/go-fdo-server
6-
%global commit e48986e6b56ae67f738a2543b5bd2a01e016668c
6+
%global commit 601ab728f9c7ab9d8d8d5db8a82296f5c96c22b8
77

88
%global debug_package %{nil}
99

1010
%gometa -L -f
1111

12+
# Vendoring: vendor/ directory is included in Source0
13+
1214
Name: go-fdo-server
1315
Version: 0
1416
Release: %autorelease -p
1517
Summary: A Go implementation of the FIDO Device Onboard Specification
1618

17-
# Generated by go-vendor-tools
19+
# Upstream license: Apache-2.0
20+
# Bundled dependencies licenses determined from vendor/modules.txt
1821
License: Apache-2.0 AND BSD-3-Clause AND MIT
1922
URL: %{gourl}
2023
Source0: %{gosource}
21-
# Generated by go-vendor-tools
22-
Source1: %{archivename}-vendor.tar.bz2
23-
Source2: go-vendor-tools.toml
24-
Source3: go-fdo-server-group.conf
25-
Source4: go-fdo-server-manufacturer-user.conf
26-
Source5: go-fdo-server-rendezvous-user.conf
27-
Source6: go-fdo-server-owner-user.conf
28-
29-
BuildRequires: go-vendor-tools
24+
Source1: go-fdo-server-group.conf
25+
Source2: go-fdo-server-manufacturer-user.conf
26+
Source3: go-fdo-server-rendezvous-user.conf
27+
Source4: go-fdo-server-owner-user.conf
28+
29+
BuildRequires: golang >= 1.25
3030
# Systemd units
3131
BuildRequires: systemd-rpm-macros
3232
# Sysusers
@@ -39,28 +39,24 @@ binding of device credentials, allowing for automated and secure on-boarding of
3939
devices when they are first powered on in their final location.
4040

4141
%prep
42-
%goprep -A
43-
%setup -q -T -D -a1 %{forgesetupargs}
42+
%goprep -k -A
4443
#%%autopatch -p1
4544

46-
%generate_buildrequires
47-
%go_vendor_license_buildrequires -c %{S:2}
48-
4945
%build
50-
%global gomodulesmode GO111MODULE=on
46+
export GO111MODULE=on
47+
export GOFLAGS=-mod=vendor
5148
%gobuild -o %{gobuilddir}/bin/go-fdo-server %{goipath}
5249

5350
%install
54-
%go_vendor_license_install -c %{S:2}
5551
install -m 0755 -vd %{buildroot}%{_bindir}
5652
install -m 0755 -vp -s %{gobuilddir}/bin/* %{buildroot}%{_bindir}
5753
# Configuration dir
5854
install -m 0755 -vd %{buildroot}%{_sysconfdir}/%{name}
5955
# Sysusers
60-
install -m 0644 -vp -D %{SOURCE3} %{buildroot}/%{_sysusersdir}/go-fdo-server.conf
61-
install -m 0644 -vp -D %{SOURCE4} %{buildroot}/%{_sysusersdir}/go-fdo-server-manufacturer.conf
62-
install -m 0644 -vp -D %{SOURCE5} %{buildroot}/%{_sysusersdir}/go-fdo-server-rendezvous.conf
63-
install -m 0644 -vp -D %{SOURCE6} %{buildroot}/%{_sysusersdir}/go-fdo-server-owner.conf
56+
install -m 0644 -vp -D %{SOURCE1} %{buildroot}/%{_sysusersdir}/go-fdo-server.conf
57+
install -m 0644 -vp -D %{SOURCE2} %{buildroot}/%{_sysusersdir}/go-fdo-server-manufacturer.conf
58+
install -m 0644 -vp -D %{SOURCE3} %{buildroot}/%{_sysusersdir}/go-fdo-server-rendezvous.conf
59+
install -m 0644 -vp -D %{SOURCE4} %{buildroot}/%{_sysusersdir}/go-fdo-server-owner.conf
6460
# Sysconfig files
6561
install -m 0755 -vd %{buildroot}%{_sysconfdir}/sysconfig
6662
install -m 0644 -vp -D configs/sysconfig/* %{buildroot}%{_sysconfdir}/sysconfig/
@@ -72,12 +68,15 @@ install -m 0755 -vd %{buildroot}%{_datadir}/%{name}
7268
install -m 0755 -vp -D scripts/* %{buildroot}%{_datadir}/%{name}
7369

7470
%check
75-
%go_vendor_license_check -c %{S:2}
7671
%if %{with check}
72+
# Run tests with vendored dependencies
73+
export GO111MODULE=on
74+
export GOFLAGS=-mod=vendor
7775
%gotest ./...
7876
%endif
79-
%files -f %{go_vendor_license_filelist}
80-
%license vendor/modules.txt
77+
78+
%files
79+
%license LICENSE vendor/modules.txt
8180
%doc DOCKERFILE_USAGE.md FSIM_USAGE.md README.md SECURITY.md
8281
%{_bindir}/go-fdo-server
8382
%config(noreplace) %attr(770, root, go-fdo-server) %{_sysconfdir}/%{name}
@@ -90,7 +89,7 @@ install -m 0755 -vp -D scripts/* %{buildroot}%{_datadir}/%{name}
9089
%{_datadir}/%{name}/generate-owner-certs.sh
9190

9291
%pre
93-
%sysusers_create_compat %{SOURCE3}
92+
%sysusers_create_compat %{SOURCE1}
9493

9594
%package manufacturer
9695
Requires: go-fdo-server
@@ -110,7 +109,7 @@ preparing devices for the on-boarding process during the manufacturing phase.
110109
# Sysuser
111110
%{_sysusersdir}/go-fdo-server-manufacturer.conf
112111
%pre manufacturer
113-
%sysusers_create_compat %{SOURCE4}
112+
%sysusers_create_compat %{SOURCE2}
114113

115114
%post manufacturer
116115
%systemd_post go-fdo-server-manufacturer.service
@@ -139,7 +138,7 @@ voucher.
139138
# Sysuser
140139
%{_sysusersdir}/go-fdo-server-rendezvous.conf
141140
%pre rendezvous
142-
%sysusers_create_compat %{SOURCE5}
141+
%sysusers_create_compat %{SOURCE3}
143142

144143
%post rendezvous
145144
%systemd_post go-fdo-server-rendezvous.service
@@ -168,7 +167,7 @@ necessary credentials and configuration for operation.
168167
# Sysuser
169168
%{_sysusersdir}/go-fdo-server-owner.conf
170169
%pre owner
171-
%sysusers_create_compat %{SOURCE6}
170+
%sysusers_create_compat %{SOURCE4}
172171

173172
%post owner
174173
%systemd_post go-fdo-server-owner.service

vendor/github.com/fido-device-onboard/go-fdo/.adr-dir

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/fido-device-onboard/go-fdo/.gitignore

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/fido-device-onboard/go-fdo/.golangci.yml

Lines changed: 46 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/fido-device-onboard/go-fdo/.markdownlint.yml

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/fido-device-onboard/go-fdo/.pre-commit-config.yaml

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)