File tree Expand file tree Collapse file tree 4 files changed +11
-5
lines changed Expand file tree Collapse file tree 4 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ actions:
3737 - make vendor-tarball VERSION=${PACKIT_PROJECT_VERSION}
3838 create-archive :
3939 - make packit-create-archive VERSION=${PACKIT_PROJECT_VERSION}
40+ fix-spec-file :
41+ - bash -c "sed -i -r \"s/Version:(\s*)\S+/Version:\1${PACKIT_PROJECT_VERSION}%{?dist}/\" build/package/rpm/go-fdo-client.spec"
4042
4143jobs :
4244 - &copr_fedora
Original file line number Diff line number Diff line change 11COMMIT := $(shell git rev-parse --short HEAD)
22DATE := $(shell date "+% Y% m% d")
3- VERSION := git$(DATE ) .$(COMMIT )
43PROJECT := go-fdo-client
54
65SOURCEDIR := $(CURDIR ) /build/package/rpm
76SPEC_FILE_NAME := $(PROJECT ) .spec
87SPEC_FILE := $(SOURCEDIR ) /$(SPEC_FILE_NAME )
98GO_VENDOR_TOOLS_FILE := $(SOURCEDIR ) /go-vendor-tools.toml
109GO_VENDOR_TOOLS_FILE_NAME := go-vendor-tools.toml
10+ VERSION ?= $(shell git describe --always --dirty --tags 2>/dev/null || echo "undefined")
1111
1212SOURCE_TARBALL := $(SOURCEDIR ) /$(PROJECT ) -$(VERSION ) .tar.gz
1313VENDOR_TARBALL := $(SOURCEDIR ) /$(PROJECT ) -$(VERSION ) -vendor.tar.gz
@@ -17,7 +17,7 @@ VENDOR_TARBALL := $(SOURCEDIR)/$(PROJECT)-$(VERSION)-vendor.tar.gz
1717all : build test
1818
1919build : tidy fmt vet
20- go build
20+ go build -ldflags= " -X github.com/fido-device-onboard/go-fdo-client/internal/version/version.VERSION= ${VERSION} "
2121
2222tidy :
2323 go mod tidy
3232 go test -v ./...
3333
3434# Packit helpers
35- .PHONY : vendor-tarball packit-create-archive vendor-licenses
35+ .PHONY : vendor-tarball packit-create-archive vendor-licenses render-specfile
3636
3737vendor-tarball : $(VENDOR_TARBALL )
3838
@@ -81,6 +81,7 @@ RPMBUILD_SPECFILE := $(RPMBUILD_SPECS_DIR)/$(PROJECT)-$(VERSION)
8181RPMBUILD_TARBALL := $(RPMBUILD_SOURCES_DIR ) /$(PROJECT ) -$(VERSION ) .tar.gz
8282RPMBUILD_VENDOR_TARBALL := $(RPMBUILD_SOURCES_DIR ) /$(PROJECT ) -$(VERSION ) -vendor.tar.gz
8383
84+ render-specfile : $(RPMBUILD_SPECFILE )
8485# Render a versioned spec into ./rpmbuild/specs (keeps source spec pristine)
8586$(RPMBUILD_SPECFILE ) :
8687 mkdir -p $(RPMBUILD_SPECS_DIR )
Original file line number Diff line number Diff line change 88%global common_description %{expand:
99go-fdo-client is the device-side implementation of FIDO Device Onboard
1010specification in Go. It provides an FDO client that interacts with
11- FDO manufacturer, rendezvous, and owner servers to perform device
12- on-boarding.}
11+ FDO manufacturer and owner servers to perform device on-boarding.}
1312
1413Name: go-fdo-client
1514Version: 0
@@ -40,6 +39,7 @@ BuildRequires: golang
4039
4140%build
4241%global gomodulesmode GO111MODULE=on
42+ export LDFLAGS=" -X %{goipath}/internal/version/version.VERSION=%{version}"
4343%gobuild -o %{gobuilddir }/bin/go-fdo-client %{goipath }
4444
4545%install
Original file line number Diff line number Diff line change 1+ package version
2+
3+ var VERSION = "unknown"
You can’t perform that action at this time.
0 commit comments