From 92425abcab4f5b2f6f52998f6e8079ed3b58d562 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= Date: Tue, 15 Aug 2023 11:30:16 +0200 Subject: [PATCH] version_calculate: chdir to the osclib dir version_calculate() calls describe in the current working dir, but that fails in git repositories without any commits in them. Actually we should be calling this in the osc-release-tools repository instead, hence fixing this issue. --- osclib/common.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osclib/common.py b/osclib/common.py index ebd45da3..b0bfb4f0 100644 --- a/osclib/common.py +++ b/osclib/common.py @@ -3,10 +3,13 @@ NAME = 'openSUSE-release-tools' def version_calculate(): from os import path - if path.exists('.git'): + # osclib is most likely "installed" via a symlink in ~/.osc-plugins + # => need to resolve the relative path + osc_release_tools_dir = path.abspath(path.join(path.realpath(path.dirname(__file__)), "..")) + if path.exists(path.join(osc_release_tools_dir, ".git")): from osclib.git import describe try: - return describe() + return describe(directory=osc_release_tools_dir) except FileNotFoundError: pass # Fall through to final return.