summaryrefslogtreecommitdiffstats
path: root/scripts/oe-go-mod-autogen.py
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@gmail.com>2025-03-24 03:16:19 +0000
committerBruce Ashfield <bruce.ashfield@gmail.com>2025-03-24 18:42:34 +0000
commit82d55f60c94d5998699e46b8e18636029ec6b104 (patch)
tree07a9ac46269786e7093e277818f27e5b2e2af98f /scripts/oe-go-mod-autogen.py
parenta42666e77c52d5f1be124dc0e65f8453ffeac27c (diff)
downloadmeta-virtualization-82d55f60c94d5998699e46b8e18636029ec6b104.tar.gz
scripts/oe-go-mod-autogen: verbosely log exceptions and continue processing
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Diffstat (limited to 'scripts/oe-go-mod-autogen.py')
-rwxr-xr-xscripts/oe-go-mod-autogen.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/scripts/oe-go-mod-autogen.py b/scripts/oe-go-mod-autogen.py
index 0fe829d0..588a77ae 100755
--- a/scripts/oe-go-mod-autogen.py
+++ b/scripts/oe-go-mod-autogen.py
@@ -30,7 +30,7 @@ import textwrap
30import re 30import re
31 31
32# This switch is used to make this script error out ASAP, mainly for debugging purpose 32# This switch is used to make this script error out ASAP, mainly for debugging purpose
33ERROR_OUT_ON_FETCH_AND_CHECKOUT_FAILURE = True 33ERROR_OUT_ON_FETCH_AND_CHECKOUT_FAILURE = False
34 34
35logger = logging.getLogger('oe-go-mod-autogen') 35logger = logging.getLogger('oe-go-mod-autogen')
36loggerhandler = logging.StreamHandler() 36loggerhandler = logging.StreamHandler()
@@ -257,6 +257,7 @@ class GoModTool(object):
257 self.modules_repoinfo[module_name] = (repo_url, repo_dest_dir, requiredrev) 257 self.modules_repoinfo[module_name] = (repo_url, repo_dest_dir, requiredrev)
258 else: 258 else:
259 logger.warning("Failed to get requiredrev, repo_url = %s, rev = %s, module_name = %s" % (repo_url, rev, module_name)) 259 logger.warning("Failed to get requiredrev, repo_url = %s, rev = %s, module_name = %s" % (repo_url, rev, module_name))
260 return None
260 261
261 def parse_go_mod(self, go_mod_path): 262 def parse_go_mod(self, go_mod_path):
262 """ 263 """
@@ -303,12 +304,19 @@ class GoModTool(object):
303 # with the version 'v0.5.5-0.20211029085301-ec551be6f75c'. 304 # with the version 'v0.5.5-0.20211029085301-ec551be6f75c'.
304 # So the destdir is vendor/github.com/hashicorp/golang-lru while the contents are from github.com/ktock/golang-lru 305 # So the destdir is vendor/github.com/hashicorp/golang-lru while the contents are from github.com/ktock/golang-lru
305 for line in self.replace_lines: 306 for line in self.replace_lines:
306 orig_module, actual = line.split('=>') 307 try:
307 actual_module, actual_version = actual.split() 308 orig_module, actual = line.split('=>')
308 orig_module = orig_module.strip() 309 print( f"replace line: orig: {orig_module} actual_version: {actual}")
309 actual_module = actual_module.strip() 310 actual_module, actual_version = actual.split()
310 actual_version = actual_version.strip() 311 print( f"replace line: actual: {actual_module} actual_version: {actual_version}")
311 self.modules_replace[orig_module] = (actual_module, actual_version) 312 orig_module = orig_module.strip()
313 actual_module = actual_module.strip()
314 actual_version = actual_version.strip()
315 self.modules_replace[orig_module] = (actual_module, actual_version)
316 except Exception as e:
317 print( f"exception {e} caught while parsing, ignoring line: {line}")
318 # sys.exit(1)
319 continue
312 # 320 #
313 # Typical require lines are as below: 321 # Typical require lines are as below:
314 # github.com/Masterminds/semver/v3 v3.1.1 322 # github.com/Masterminds/semver/v3 v3.1.1