Skip to content

Commit

Permalink
spec: Autogenerate Requires: bundled()
Browse files Browse the repository at this point in the history
This makes use of https://github.com/cfergeau/gomod2rpmdeps/ in order
to add virtual requires for the go modules which are vendored by
admin-helper.
  • Loading branch information
cfergeau committed Mar 8, 2021
1 parent 1422c43 commit c4a3d99
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ admin-helper.exe
dist
out
release
crc-admin-helper.spec
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
VERSION ?= $(shell git describe --tags --dirty)
BUILD_DIR ?= out

GOPATH ?= $(shell go env GOPATH)

BINARY_NAME := admin-helper
RELEASE_DIR ?= release

Expand All @@ -23,6 +25,7 @@ $(BUILD_DIR):
clean:
rm -rf $(BUILD_DIR)
rm -fr release
rm -fr crc-admin-helper.spec

$(BUILD_DIR)/macos-amd64/$(BINARY_NAME):
CGO_ENABLED=0 GOARCH=amd64 GOOS=darwin go build -ldflags="$(LDFLAGS)" -o $(BUILD_DIR)/macos-amd64/$(BINARY_NAME) $(GO_BUILDFLAGS) ./main.go
Expand Down Expand Up @@ -55,3 +58,14 @@ lint:
.PHONY: test
test:
go test ./...

.PHONY: spec
spec: crc-admin-helper.spec

$(GOPATH)/bin/gomod2rpmdeps:
pushd /tmp && GO111MODULE=on go get github.com/cfergeau/gomod2rpmdeps/cmd/gomod2rpmdeps && popd

%.spec: %.spec.in $(GOPATH)/bin/gomod2rpmdeps
@$(GOPATH)/bin/gomod2rpmdeps | sed -e '/__BUNDLED_REQUIRES__/r /dev/stdin' \
-e '/__BUNDLED_REQUIRES__/d' \
$< >$@
9 changes: 1 addition & 8 deletions crc-admin-helper.spec → crc-admin-helper.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,7 @@ BuildRequires: git-core
BuildRequires: go-srpm-macros
BuildRequires: make

Provides: bundled(golang(github.com/davecgh/go-spew)) = 1.1.1
Provides: bundled(golang(github.com/dimchansky/utfbom)) = 1.1.1
Provides: bundled(golang(github.com/goodhosts/hostsfile)) = 0.0.7
Provides: bundled(golang(github.com/inconshreveable/mousetrap)) = 1.0.0
Provides: bundled(golang(github.com/pmezard/go-difflib)) = 1.0.0
Provides: bundled(golang(github.com/spf13/cobra)) = 1.1.1
Provides: bundled(golang(github.com/spf13/pflag)) = 1.0.5
Provides: bundled(golang(github.com/stretchr/testify)) = 1.3.0
__BUNDLED_REQUIRES__

%description
%{common_description}
Expand Down

0 comments on commit c4a3d99

Please sign in to comment.