1- PROJECT := go-fdo-client
2- RPM_BASE_DIR := $(CURDIR ) /build/package/rpm
3- SPEC_FILE_NAME := $(PROJECT ) .spec
4- SPEC_FILE := $(RPM_BASE_DIR ) /$(SPEC_FILE_NAME )
5- COMMIT_SHORT := $(shell git rev-parse --short HEAD)
6- VERSION := $(shell bash -c "set -o pipefail; git describe --tags | sed -e 's/^v//' -e 's/-.* //'")
7- ifeq ($(VERSION ) ,)
8- VERSION := $(shell grep 'Version:' $(SPEC_FILE ) | awk '{printf "% s", $$2}')
9- endif
1+ # ! /usr/bin/make -f
102
3+ PROJECT := go-fdo-client
114ARCH := $(shell uname -m)
12-
135SOURCEDIR := $(CURDIR ) /build/package/rpm
146SPEC_FILE_NAME := $(PROJECT ) .spec
157SPEC_FILE := $(SOURCEDIR ) /$(SPEC_FILE_NAME )
8+ COMMIT_SHORT := $(shell git rev-parse --short HEAD)
9+ VERSION := $(shell grep 'Version:' $(SPEC_FILE ) | awk '{printf "% s", $$2}') .git$(COMMIT_SHORT )
10+
1611GO_VENDOR_TOOLS_FILE_NAME := go-vendor-tools.toml
1712GO_VENDOR_TOOLS_FILE := $(SOURCEDIR ) /$(GO_VENDOR_TOOLS_FILE_NAME )
1813
@@ -120,6 +115,11 @@ $(RPMBUILD_SRPM_FILE): $(RPMBUILD_SPECFILE) $(RPMBUILD_TARBALL) $(RPMBUILD_GOLAN
120115 --define " _buildrootdir $( RPMBUILD_BUILDROOT_DIR) " \
121116 $(RPMBUILD_SPECFILE )
122117
118+ # Build SRPM locally (outputs under ./rpmbuild)
119+ .PHONY : srpm
120+ srpm : $(RPMBUILD_SRPM_FILE )
121+
122+
123123$(RPMBUILD_RPM_FILE ) : $(RPMBUILD_SPECFILE ) $(RPMBUILD_TARBALL ) $(RPMBUILD_GOLANG_VENDOR_TOOLS_FILE )
124124 command -v rpmbuild > /dev/null || { echo " rpmbuild missing" ; exit 1; }
125125 # Uncomment to auto-install build deps on your host:
@@ -134,10 +134,18 @@ $(RPMBUILD_RPM_FILE): $(RPMBUILD_SPECFILE) $(RPMBUILD_TARBALL) $(RPMBUILD_GOLANG
134134 --define " _buildrootdir $( RPMBUILD_BUILDROOT_DIR) " \
135135 $(RPMBUILD_SPECFILE )
136136
137- # Build SRPM locally (outputs under ./rpmbuild)
138- .PHONY : srpm
139- srpm : $(RPMBUILD_SRPM_FILE )
140-
141137# Build binary RPM locally (optional)
142138.PHONY : rpm
143139rpm : $(RPMBUILD_RPM_FILE )
140+
141+ .PHONY : packit-vendor-tarball
142+ packit-vendor-tarball :
143+ export GOTOOLCHAIN=auto; \
144+ # Download the source tarball (Source0) needed by go_vendor_archive
145+ spectool -g -C $(SOURCEDIR ) $(SPEC_FILE ) ; \
146+ go_vendor_archive create --config ${GO_VENDOR_TOOLS_FILE} ${SPEC_FILE} ; \
147+ go_vendor_license \
148+ --config $(GO_VENDOR_TOOLS_FILE ) \
149+ --path $(SPEC_FILE ) \
150+ report \
151+ --verify-spec;
0 commit comments