Skip to content

Commit 1911209

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 - Add testdata files (dc.bin, mfg_key.pem, ov.pem) to vendored go-fdo package required by //go:embed directives for build-time compilation CI workflow updates: - Exclude vendor/ from codespell spell-check to avoid false positives in third-party dependencies - Exclude vendor/ from DevSkim security scanner to prevent flagging vendored code issues - Disable Go dependency caching in setup-go action since vendored dependencies don't require go.sum 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 1911209

File tree

1,006 files changed

+727124
-46
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,006 files changed

+727124
-46
lines changed

.github/workflows/analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
check_filenames: true
2020
check_hidden: true
2121
ignore_words_file: .github/spellcheck-ignore
22-
skip: "./docs/Gemfile.lock,./docs/_config.yml,./.github,./.git"
22+
skip: "./docs/Gemfile.lock,./docs/_config.yml,./.github,./.git,./vendor"
2323

2424
commitlint:
2525
name: check commitlint
@@ -56,7 +56,7 @@ jobs:
5656
- name: Run DevSkim scanner
5757
uses: microsoft/DevSkim-Action@v1
5858
with:
59-
ignore-globs: '**/test/**,*_test.go,**/deployments/compose/**'
59+
ignore-globs: '**/test/**,*_test.go,**/deployments/compose/**,**/vendor/**'
6060

6161
- name: Upload DevSkim scan results to GitHub Security tab
6262
uses: github/codeql-action/upload-sarif@v3

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
uses: actions/setup-go@v5
2020
with:
2121
go-version: "1.25"
22+
cache: false
2223

2324
- name: Check out repository code
2425
uses: actions/checkout@v4
@@ -44,6 +45,7 @@ jobs:
4445
uses: actions/setup-go@v5
4546
with:
4647
go-version: "1.25"
48+
cache: false
4749

4850
- name: Check out repository code
4951
uses: actions/checkout@v4
@@ -73,6 +75,7 @@ jobs:
7375
uses: actions/setup-go@v5
7476
with:
7577
go-version: "1.25"
78+
cache: false
7679

7780
- name: Check out repository code
7881
uses: actions/checkout@v4
@@ -102,6 +105,7 @@ jobs:
102105
uses: actions/setup-go@v5
103106
with:
104107
go-version: "1.25"
108+
cache: false
105109

106110
- name: Check out repository code
107111
uses: actions/checkout@v4
@@ -131,6 +135,7 @@ jobs:
131135
uses: actions/setup-go@v5
132136
with:
133137
go-version: "1.25"
138+
cache: false
134139

135140
- name: Check out repository code
136141
uses: actions/checkout@v4
@@ -160,6 +165,7 @@ jobs:
160165
uses: actions/setup-go@v5
161166
with:
162167
go-version: "1.25"
168+
cache: false
163169

164170
- name: Check out repository code
165171
uses: actions/checkout@v4
@@ -189,6 +195,7 @@ jobs:
189195
uses: actions/setup-go@v5
190196
with:
191197
go-version: "1.25"
198+
cache: false
192199

193200
- name: Check out repository code
194201
uses: actions/checkout@v4

.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: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,24 @@
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)