Skip to content

Commit

Permalink
Consistently generate build tags metadata (#4582)
Browse files Browse the repository at this point in the history
Dockerfile receives a minor tweak for proper output.

BuildTags value is expected as a plain `netgo,ledger,muslc` string,
however the current approach wraps quotes inside of quotes, and the
resulting string is `'netgo,ledger,muslc'` which gets escaped a
few more times (unnecessarily).

Additionally, Makefile receives a minor tweak for everyone who
builds directly.

With Make 4.3+, the empty whitespace does not seem to work as
originally intended. This causes build tags to be `netgo ledger,`
on Ubuntu 22.04 and other systems that include the newer Make
version. The build tags were intended as `netgo,ledger` which
can be observed on Make 4.2 (shipped with Ubuntu 20.04).

This change swaps out the `+=` use in favor of an explicit `:=`.
Ref: https://www.gnu.org/software/make/manual/html_node/Appending.html

Upstream: cosmos/gaia@297cdb9
  • Loading branch information
sigv authored and pysel committed Mar 14, 2023
1 parent c3700e1 commit 4efea3e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Misc Improvements

* [#4582](https://github.com/osmosis-labs/osmosis/pull/4582) Consistently generate build tags metadata, to return a comma-separated list without stray quotes. This affects the output from `version` CLI subcommand and server info API calls.

## v15.0.0

This release containts the following new modules:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
-X github.com/cosmos/cosmos-sdk/version.AppName="osmosisd" \
-X github.com/cosmos/cosmos-sdk/version.Version=${GIT_VERSION} \
-X github.com/cosmos/cosmos-sdk/version.Commit=${GIT_COMMIT} \
-X github.com/cosmos/cosmos-sdk/version.BuildTags='netgo,ledger,muslc' \
-X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger,muslc \
-w -s -linkmode=external -extldflags '-Wl,-z,muldefs -static'" \
-trimpath \
-o /osmosis/build/osmosisd \
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ build_tags += $(BUILD_TAGS)
build_tags := $(strip $(build_tags))

whitespace :=
whitespace += $(whitespace)
whitespace := $(whitespace) $(whitespace)
comma := ,
build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags))

Expand Down

0 comments on commit 4efea3e

Please sign in to comment.