From a5739cb7160349f96c428995049ff61411689ea0 Mon Sep 17 00:00:00 2001 From: Vladimir Lavor Date: Tue, 7 Sep 2021 15:21:19 +0200 Subject: 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 --- binapigen/vppapi/util.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 } } -- cgit 1.2.3-korg