GithubHelp home page GithubHelp logo

-version doesn't expose version about stayrtr HOT 10 CLOSED

bgp avatar bgp commented on September 28, 2024
-version doesn't expose version

from stayrtr.

Comments (10)

ties avatar ties commented on September 28, 2024

This is odd. On my local machine I get

$ make
...
$ ./dist/stayrtr-v0.5.1-49-g3b91cfa-linux-x86_64 -version
StayRTR v0.5.1-49-g3b91cfa (2024-05-04T09:39:53+0200)

What source are you using for stayrtr?

from stayrtr.

randomthingsandstuff avatar randomthingsandstuff commented on September 28, 2024

its a link-time variable. if you don't use the makefile, you're not going to get it.

i can maybe make some autogen'ed shit or another to fix that for the go install or whatever, but i don't personally care. and i'm willing to spend a maximum of 30 min to sort it out.

edited:
and time spent. vcsbuild info in go doesnt include the tag. would need to run go generate beforehand to bump the rev. not really useful.

makefile is the way from my pov.

from stayrtr.

funzoneq avatar funzoneq commented on September 28, 2024
avermeer@rpki02-lab01:~$ dpkg -l stayrtr
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-=================================
ii  stayrtr        0.5.1-2+b1   amd64        RPKI to Router server

avermeer@rpki02-lab01:~$ /usr/bin/stayrtr --version
StayRTR

This is the pre-release package from github. I'm fine with whatever solution you use to generate the version number. But let's make sure that official releases include them as part of their normal release procedure.

from stayrtr.

moshivji avatar moshivji commented on September 28, 2024

I also get the same ,

$ stayrtr -version
StayRTR  
$ 

from stayrtr.

job avatar job commented on September 28, 2024

@randomthingsandstuff how about just solving this as follows: #125

from stayrtr.

mrngm avatar mrngm commented on September 28, 2024

If you have the Go toolchain (>= 1.18, which happens to be the minimum declared in go.mod) installed, you could also use

go version -m stayrtr

A fresh clone (and Go 1.22) of this repository gives:

$ git log | head -n1 && go build ./cmd/stayrtr/ && go version -m ./stayrtr
commit bf5793cf0fe897888f0dd78f5bb236db46a8fd18
./stayrtr: go1.22.3
	path	github.com/bgp/stayrtr/cmd/stayrtr
	mod	github.com/bgp/stayrtr	(devel)	
	dep	github.com/beorn7/perks	v1.0.1	h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
	dep	github.com/cespare/xxhash/v2	v2.1.1	h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
	dep	github.com/golang/protobuf	v1.4.3	h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
	dep	github.com/matttproud/golang_protobuf_extensions	v1.0.1	h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
	dep	github.com/prometheus/client_golang	v1.11.1	h1:+4eQaD7vAZ6DsfsxB15hbE0odUjGI5ARs9yskGu1v4s=
	dep	github.com/prometheus/client_model	v0.2.0	h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M=
	dep	github.com/prometheus/common	v0.26.0	h1:iMAkS2TDoNWnKM+Kopnx/8tnEStIfpYA0ur0xQzzhMQ=
	dep	github.com/prometheus/procfs	v0.6.0	h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4=
	dep	github.com/sirupsen/logrus	v1.8.1	h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
	dep	golang.org/x/crypto	v0.6.0	h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc=
	dep	golang.org/x/sys	v0.15.0	h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
	dep	google.golang.org/protobuf	v1.26.0-rc.1	h1:7QnIQpGRHE5RnLKnESfDoxm2dTapTZua5a0kS0A+VXQ=
	build	-buildmode=exe
	build	-compiler=gc
	build	DefaultGODEBUG=httplaxcontentlength=1,httpmuxgo121=1,panicnil=1,tls10server=1,tlsrsakex=1,tlsunsafeekm=1
	build	CGO_ENABLED=1
	build	CGO_CFLAGS=
	build	CGO_CPPFLAGS=
	build	CGO_CXXFLAGS=
	build	CGO_LDFLAGS=
	build	GOARCH=amd64
	build	GOOS=linux
	build	GOAMD64=v1
	build	vcs=git
	build	vcs.revision=bf5793cf0fe897888f0dd78f5bb236db46a8fd18
	build	vcs.time=2024-06-26T14:52:40Z
	build	vcs.modified=false

After abcaca9 makes it into a (pre-)release, you should be able to use the above method to view the revision stayrtr was based on.

from stayrtr.

mrngm avatar mrngm commented on September 28, 2024

After extracting /usr/bin/stayrtr from https://github.com/bgp/stayrtr/releases/download/v0.5.1/stayrtr_0.5.1_amd64.deb:

$ sha256sum stayrtr && ./stayrtr -version
fced62afc99edf79314ea2ec0a0a027ba4b43c95fe346a601ccf77251c70fa05  stayrtr
StayRTR v0.5.1 (2023-03-01T14:37:13+0000)

That opens the question: what binary are you actually running?

from stayrtr.

job avatar job commented on September 28, 2024

After extracting /usr/bin/stayrtr from https://github.com/bgp/stayrtr/releases/download/v0.5.1/stayrtr_0.5.1_amd64.deb:

$ sha256sum stayrtr && ./stayrtr -version
fced62afc99edf79314ea2ec0a0a027ba4b43c95fe346a601ccf77251c70fa05  stayrtr
StayRTR v0.5.1 (2023-03-01T14:37:13+0000)

That opens the question: what binary are you actually running?

Maybe something from Debian .deb repositories?

from stayrtr.

mrngm avatar mrngm commented on September 28, 2024

It appears so:

$ curl -O http://ftp.de.debian.org/debian/pool/main/s/stayrtr/stayrtr_0.5.1-2+b1_amd64.deb
$ dpkg-deb -x stayrtr_0.5.1-2+b1_amd64.deb stayrtr-debstable
$ cd stayrtr-debstable/usr/bin/
$ sha256sum stayrtr && ./stayrtr -version
361e4b46b2d00a608154f033b94222966996f97615a992edab94eab6151cd47e  stayrtr
StayRTR  

Addendum:

### /usr/bin/stayrtr from packages.debian.org (bookworm)
$ sha256sum stayrtr && go version -m stayrtr
361e4b46b2d00a608154f033b94222966996f97615a992edab94eab6151cd47e  stayrtr
stayrtr: go1.19.8
	path	github.com/bgp/stayrtr/cmd/stayrtr
	build	-compiler=gc
	build	-trimpath=true
	build	CGO_ENABLED=1
	build	GOARCH=amd64
	build	GOOS=linux
	build	GOAMD64=v1

### /usr/bin/stayrtr from Github:
$ sha256sum stayrtr-orig && go version -m stayrtr-orig
fced62afc99edf79314ea2ec0a0a027ba4b43c95fe346a601ccf77251c70fa05  stayrtr-orig
stayrtr-orig: go1.17.6
	path	command-line-arguments
	mod	github.com/bgp/stayrtr	(devel)	
	dep	github.com/beorn7/perks	v1.0.1	h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
	dep	github.com/cespare/xxhash/v2	v2.1.1	h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
	dep	github.com/golang/protobuf	v1.4.3	h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
	dep	github.com/matttproud/golang_protobuf_extensions	v1.0.1	h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
	dep	github.com/prometheus/client_golang	v1.11.1	h1:+4eQaD7vAZ6DsfsxB15hbE0odUjGI5ARs9yskGu1v4s=
	dep	github.com/prometheus/client_model	v0.2.0	h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M=
	dep	github.com/prometheus/common	v0.26.0	h1:iMAkS2TDoNWnKM+Kopnx/8tnEStIfpYA0ur0xQzzhMQ=
	dep	github.com/prometheus/procfs	v0.6.0	h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4=
	dep	github.com/sirupsen/logrus	v1.8.1	h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
	dep	golang.org/x/crypto	v0.6.0	h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc=
	dep	golang.org/x/sys	v0.5.0	h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
	dep	google.golang.org/protobuf	v1.26.0-rc.1	h1:7QnIQpGRHE5RnLKnESfDoxm2dTapTZua5a0kS0A+VXQ=

Addendum2:

The Debian version was built using go 1.19.8 as opposed to go 1.17.6 from this repository's artifacts. The current way of injecting the VCS details depends on git and the presence of .git/ in the build environment.

The Debian build environment doesn't seem to have the .git/ directory present, yielding an empty STAYRTR_VERSION during build time.

from stayrtr.

randomthingsandstuff avatar randomthingsandstuff commented on September 28, 2024

job @'ed me so i guess i'm back..

if i understand right, we have like 3 ways this thing is built:

  1. the usual golang build system
  2. the happy makefile with the git
  3. the happy makefile without the git

in case 1, which i am strongly going to support as the ultimate, premier, long-term way of doing things (until it makes sense ot me that it isn't and i'm philosophizing too much again), we can't derive the version info from git anyway.

in case 2, we can drag the version info automagically

in case 3, we don't have a git so lol whats the version again?

what i really really want is something like ~ where version comes from the tag. in the absence of really being able to do that for mostly the same issues as case 1 and 3, we should just shove it in as a constant per job's patch and call it a day. if we are really lazy, maybe we can one day have the tag get autoadded when someone bumps the version variable or something.

so i merged job's patch. its an easy decision. its done and solves the problem for now. we will live to fight --version another day.

from stayrtr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.