summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/oe-go-mod-autogen.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/scripts/oe-go-mod-autogen.py b/scripts/oe-go-mod-autogen.py
index d3b02012..77a06fc5 100755
--- a/scripts/oe-go-mod-autogen.py
+++ b/scripts/oe-go-mod-autogen.py
@@ -104,11 +104,11 @@ class GoModTool(object):
104 # check if this repo needs autogen 104 # check if this repo needs autogen
105 repo_url, repo_dest_dir, repo_fullrev = self.modules_repoinfo[self.repo.split('://')[1]] 105 repo_url, repo_dest_dir, repo_fullrev = self.modules_repoinfo[self.repo.split('://')[1]]
106 if os.path.isdir(os.path.join(repo_dest_dir, 'vendor')): 106 if os.path.isdir(os.path.join(repo_dest_dir, 'vendor')):
107 logger.info("vendor direcotry has already existed for %s, no need to add other repos" % self.repo) 107 logger.info("vendor directory already exists for %s, no need to add other repos" % self.repo)
108 return 108 return
109 go_mod_file = os.path.join(repo_dest_dir, 'go.mod') 109 go_mod_file = os.path.join(repo_dest_dir, 'go.mod')
110 if not os.path.exists(go_mod_file): 110 if not os.path.exists(go_mod_file):
111 logger.info("go.mod file does not exist for %s, no need to add otehr repos" % self.repo) 111 logger.info("go.mod file does not exist for %s, no need to add other repos" % self.repo)
112 return 112 return
113 self.parse_go_mod(go_mod_file) 113 self.parse_go_mod(go_mod_file)
114 self.show_go_mod_info() 114 self.show_go_mod_info()
@@ -499,11 +499,11 @@ class GoModTool(object):
499 src_uri_inc_file = os.path.join(self.workdir, 'src_uri.inc') 499 src_uri_inc_file = os.path.join(self.workdir, 'src_uri.inc')
500 # record the <name> after writting SRCREV_<name>, this is to avoid modules having the same basename resulting in same SRCREV_xxx 500 # record the <name> after writting SRCREV_<name>, this is to avoid modules having the same basename resulting in same SRCREV_xxx
501 srcrev_name_recorded = [] 501 srcrev_name_recorded = []
502 # pre styhead releases
503 # SRC_URI += "git://%s;name=%s;protocol=https;nobranch=1;destsuffix=${WORKDIR}/${BP}/src/import/vendor.fetch/%s"
502 template = """# %s %s 504 template = """# %s %s
503# [1] git ls-remote %s %s 505# [1] git ls-remote %s %s
504SRCREV_%s="%s" 506SRCREV_%s="%s"
505# pre styhead releases
506# SRC_URI += "git://%s;name=%s;protocol=https;nobranch=1;destsuffix=${WORKDIR}/${BP}/src/import/vendor.fetch/%s"
507# styhead and newer 507# styhead and newer
508SRC_URI += "git://%s;name=%s;protocol=https;nobranch=1;destsuffix=${GO_SRCURI_DESTSUFFIX}/vendor.fetch/%s" 508SRC_URI += "git://%s;name=%s;protocol=https;nobranch=1;destsuffix=${GO_SRCURI_DESTSUFFIX}/vendor.fetch/%s"
509 509
@@ -536,7 +536,10 @@ SRC_URI += "git://%s;name=%s;protocol=https;nobranch=1;destsuffix=${GO_SRCURI_DE
536 # sort the src_uri_contents and then write it 536 # sort the src_uri_contents and then write it
537 src_uri_contents.sort(key=take_first_len) 537 src_uri_contents.sort(key=take_first_len)
538 for content in src_uri_contents: 538 for content in src_uri_contents:
539 f.write(template % content) 539 try:
540 f.write(template % content)
541 except Exception as e:
542 logger.warning( "exception while writing src_uri.inc: %s" % e )
540 logger.info("%s generated" % src_uri_inc_file) 543 logger.info("%s generated" % src_uri_inc_file)
541 544
542 def gen_relocation_inc(self): 545 def gen_relocation_inc(self):
@@ -675,6 +678,13 @@ def main():
675 directory). If go.mod is edited, modules.txt also has to be 678 directory). If go.mod is edited, modules.txt also has to be
676 updated to match the revision information. 679 updated to match the revision information.
677 680
681 Note 4: if an entry in go.mod is resolving to a destination that doesn't
682 have a SRCREV (i.e. golang.org vs github), the destination can
683 be temporarily overriden by editing: wget-contents/<repo>.repo_url.cache
684 The next run will use the cached value versus looking it up.
685
686 % vi wget-contents/golang.org_x_sys.repo_url.cache
687
678 How to use in a recipe: 688 How to use in a recipe:
679 ======================= 689 =======================
680 690