From: Vladimir Lavor Date: Tue, 7 Sep 2021 13:21:19 +0000 (+0200) Subject: binapigen: enhanced vpp version resolution X-Git-Tag: v0.4.0~7 X-Git-Url: https://gerrit.fd.io/r/gitweb?p=govpp.git;a=commitdiff_plain;h=a5739cb7160349f96c428995049ff61411689ea0 binapigen: enhanced vpp version resolution While assuming whether the VPP is installed (in order to retrieve a version), the generator looks directly for the VPP executable instead of the API path. This allows to get version if generated from any directory. Signed-off-by: Vladimir Lavor Change-Id: I147e4fba49c102bf5f1cbcf2784c212479dc15b6 --- diff --git a/binapigen/vppapi/util.go b/binapigen/vppapi/util.go index 3db8ef5..1374bb9 100644 --- a/binapigen/vppapi/util.go +++ b/binapigen/vppapi/util.go @@ -42,12 +42,12 @@ func ResolveVPPVersion(apidir string) string { } // assuming VPP package is installed - if path.Clean(apidir) == DefaultDir { + if _, err := exec.LookPath("vpp"); err == nil { version, err := GetVPPVersionInstalled() if err != nil { logrus.Warnf("resolving VPP version from installed package failed: %v", err) } else { - logrus.Debugf("resolved VPP version from installed package: %v", version) + logrus.Infof("resolved VPP version from installed package: %v", version) return version } }