Skip to content

Commit 99644b8

Browse files
Removes nfpm env workaround (#512)
Signed-off-by: Adrian Cole <adrian@tetrate.io>
1 parent 1791ba3 commit 99644b8

4 files changed

Lines changed: 18 additions & 19 deletions

File tree

Makefile

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -116,31 +116,29 @@ dist/func-e_$(VERSION)_%.zip: build/func-e_%/func-e.exe.signed
116116
@printf "$(ansi_format_bright)" zip "ok"
117117

118118
# Default to a dummy version, which is always lower than a real release
119-
nfpm_version=v$(VERSION:dev=0.0.1)
119+
pkg_version := v$(VERSION:dev=0.0.1)
120120

121-
# It is not precise to put the func-e binary here, but it is easier because the arch pattern matches
122-
# whereas in RPM it won't.
123-
# Note: we are only generating this because the file isn't parameterized.
124-
# See https://github.com/goreleaser/nfpm/issues/362
125-
build/func-e_linux_%/nfpm.yaml: packaging/nfpm/nfpm.yaml build/func-e_linux_%/func-e
126-
@mkdir -p $(@D)
127-
@sed -e 's/amd64/$(*)/g' -e 's/v0.0.1/$(nfpm_version)/g' $< > $@
121+
pkg_config := packaging/nfpm/nfpm.yaml
128122

129123
# We can't use a pattern (%) rule because in RPM amd64 -> x86_64, arm64 -> aarch64
130124
rpm_x86_64 := dist/func-e_$(VERSION)_linux_x86_64.rpm
131125
rpm_aarch64 := dist/func-e_$(VERSION)_linux_aarch64.rpm
132126
rpms := $(rpm_x86_64) $(rpm_aarch64)
133127

134128
man_page := packaging/nfpm/func-e.8
129+
pkg_inputs := $(pkg_config) $(man_page)
130+
131+
pkg_binary = build/func-e_linux_$1/func-e
132+
pkg_arch = $(patsubst build/func-e_linux_%/func-e,%,$1)
135133

136-
$(rpm_x86_64): build/func-e_linux_amd64/nfpm.yaml $(man_page)
134+
$(rpm_x86_64): $(call pkg_binary,amd64) $(pkg_inputs)
137135
$(call nfpm-pkg,$<,"rpm",$@)
138136

139-
$(rpm_aarch64): build/func-e_linux_arm64/nfpm.yaml $(man_page)
137+
$(rpm_aarch64): $(call pkg_binary,arm64) $(pkg_inputs)
140138
$(call nfpm-pkg,$<,"rpm",$@)
141139

142140
# Debian architectures map goarch for amd64 and arm64
143-
dist/func-e_$(VERSION)_linux_%.deb: build/func-e_linux_%/nfpm.yaml $(man_page)
141+
dist/func-e_$(VERSION)_linux_%.deb: $(call pkg_binary,%) $(pkg_inputs)
144142
$(call nfpm-pkg,$<,"deb",$@)
145143

146144
# msi-arch is a macro so we can detect it based on the file naming convention
@@ -226,6 +224,6 @@ endef
226224
define nfpm-pkg
227225
@printf "$(ansi_format_dark)" nfpm "packaging $3"
228226
@mkdir -p $(dir $3)
229-
@$(gotool) nfpm pkg -f $1 --packager $2 --target $3
227+
@PKG_ARCH=$(call pkg_arch,$1) PKG_VERSION=$(pkg_version) $(gotool) nfpm pkg -f $(pkg_config) --packager $2 --target $3
230228
@printf "$(ansi_format_bright)" nfpm "ok"
231229
endef

packaging/nfpm/nfpm.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# check https://nfpm.goreleaser.com/configuration/ for detailed usage
22
name: func-e
3-
arch: amd64
3+
arch: ${PKG_ARCH}
44
platform: linux
5-
version: v0.0.1
5+
version: ${PKG_VERSION}
66
section: default
77
maintainer: Tetrate Labs <tetratelabs@tetrate.io>
88
vendor: Tetrate
@@ -12,7 +12,8 @@ license: Apache-2.0
1212
provides:
1313
- func-e
1414
contents:
15-
- src: build/func-e_linux_amd64/func-e
15+
- src: build/func-e_linux_${PKG_ARCH}/func-e
1616
dst: /usr/bin/func-e
17+
expand: true
1718
- src: packaging/nfpm/func-e.8
1819
dst: /usr/local/share/man/man8/func-e.8

tools/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/tetratelabs/func-e/tools
22

3-
go 1.25.6
3+
go 1.26.2
44

55
tool (
66
github.com/B1NARY-GR0UP/nwa
@@ -404,7 +404,7 @@ require (
404404
golang.org/x/net v0.53.0 // indirect
405405
golang.org/x/oauth2 v0.36.0 // indirect
406406
golang.org/x/sync v0.20.0 // indirect
407-
golang.org/x/sys v0.43.0 // indirect
407+
golang.org/x/sys v0.44.0 // indirect
408408
golang.org/x/text v0.36.0 // indirect
409409
golang.org/x/time v0.15.0 // indirect
410410
golang.org/x/tools v0.44.0 // indirect

tools/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,8 +1227,8 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc
12271227
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
12281228
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
12291229
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1230-
golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI=
1231-
golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
1230+
golang.org/x/sys v0.44.0 h1:ildZl3J4uzeKP07r2F++Op7E9B29JRUy+a27EibtBTQ=
1231+
golang.org/x/sys v0.44.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
12321232
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
12331233
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
12341234
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=

0 commit comments

Comments
 (0)