summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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