Skip to content

rpcserver: Add dcrd version info to getversion RPC.#1097

Merged
davecgh merged 2 commits intodecred:masterfrom
davecgh:rpcserver_dcrd_version
Mar 2, 2018
Merged

rpcserver: Add dcrd version info to getversion RPC.#1097
davecgh merged 2 commits intodecred:masterfrom
davecgh:rpcserver_dcrd_version

Conversation

@davecgh
Copy link
Copy Markdown
Member

@davecgh davecgh commented Feb 28, 2018

This adds the dcrd version info as an additional key to the JSON-RPC getversion response to accompany the existing RPC API version information and bumps the JSON-RPC minor version to account for the backwards-compatible change.

Also, it corrects the semver build handling. The semver spec allow the build portion to contain multiple identifiers separated by periods, however, the current code is stripping periods.

@davecgh davecgh force-pushed the rpcserver_dcrd_version branch from 7d21ece to aeccc12 Compare February 28, 2018 23:47
rpcserver.go Outdated
@@ -5659,13 +5660,25 @@ func handleVerifyMessage(s *rpcServer, cmd interface{}, closeChan <-chan struct{

// handleVersion implements the version command.
func handleVersion(s *rpcServer, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
buildMeta := normalizeBuildString(runtime.Version())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would this cause a runtime version e.g. go1.10 to enter the build metadata, when build metadata should be separated by periods? This would result in two additional metadata identifiers, go1 and 10, which is not what we intend here.

Copy link
Copy Markdown
Member Author

@davecgh davecgh Mar 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's what I was going for. I suppose I could replace the period with a -.

Copy link
Copy Markdown
Member Author

@davecgh davecgh Mar 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm open to other suggestions here too. Basically, I want to be able to see the runtime information as part of the build metadata. Showing it as go110 doesn't work. Given the alphabet only allows [0-9a-zA-Z-] the only other option is go1-10. Currently it shows up as:

{
  "dcrd": {
    "versionstring": "1.1.2+blockchainremovemainchainindex",
    "major": 1,
    "minor": 1,
    "patch": 2,
    "prerelease": "",
    "buildmetadata": "blockchainremovemainchainindex.go1.10"
  },
  "dcrdjsonrpcapi": {
    "versionstring": "3.2.0",
    "major": 3,
    "minor": 2,
    "patch": 0,
    "prerelease": "",
    "buildmetadata": ""
  }
}

Copy link
Copy Markdown
Member Author

@davecgh davecgh Mar 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update to replace . with - then pass it through the semver build normalizer.

The result is now:

$ dcrctl --testnet version
{
  "dcrd": {
    "versionstring": "1.1.2+tempintegration",
    "major": 1,
    "minor": 1,
    "patch": 2,
    "prerelease": "",
    "buildmetadata": "tempintegration.go1-10"
  },
  "dcrdjsonrpcapi": {
    "versionstring": "3.3.0",
    "major": 3,
    "minor": 3,
    "patch": 0,
    "prerelease": "",
    "buildmetadata": ""
  }
}

@davecgh davecgh force-pushed the rpcserver_dcrd_version branch from aeccc12 to abb9e6b Compare March 2, 2018 01:17
davecgh added 2 commits March 1, 2018 19:41
The semver spec allow the build portion to contain multiple identifiers
separated by periods, however, the current code is stripping periods.
This adds the dcrd version info as an additional key to the JSON-RPC
getversion response to accompany the existing RPC API version
information and bumps the JSON-RPC minor version to account for the
backwards-compatible change.
@davecgh davecgh force-pushed the rpcserver_dcrd_version branch from abb9e6b to f92d363 Compare March 2, 2018 01:41
@davecgh davecgh merged commit f92d363 into decred:master Mar 2, 2018
@davecgh davecgh deleted the rpcserver_dcrd_version branch March 2, 2018 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants