diff options
author | Vladimir Lavor <vlavor@cisco.com> | 2021-09-07 15:21:19 +0200 |
---|---|---|
committer | Ondrej Fabry <ofabry@cisco.com> | 2021-09-08 12:27:53 +0000 |
commit | a5739cb7160349f96c428995049ff61411689ea0 (patch) | |
tree | 0d526dd451f783d353589bc7e5471538086c5abb | |
parent | c09ee3241377aae2530a73d48c4e20641d76d0ee (diff) |
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 <vlavor@cisco.com>
Change-Id: I147e4fba49c102bf5f1cbcf2784c212479dc15b6
-rw-r--r-- | binapigen/vppapi/util.go | 4 |
1 files 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 } } |