<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>14944</bug_id>
          
          <creation_ts>2022-10-21 13:37:31 +0000</creation_ts>
          <short_desc>go recipes are not devtool upgradeable</short_desc>
          <delta_ts>2026-10-29 15:25:27 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>oe-core other</component>
          <version>0.0.0</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>6.2 M1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Thomas Roos">thomas</reporter>
          <assigned_to name="Unassigned">unassigned</assigned_to>
          <cc>fawzi.khaber</cc>
    
    <cc>paul</cc>
    
    <cc>pokylinux</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>sgw</cc>
    
    <cc>tgamblin</cc>
    
    <cc>tim.orling</cc>
    
    <cc>yoann.congal</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>94229</commentid>
    <comment_count>0</comment_count>
    <who name="Thomas Roos">thomas</who>
    <bug_when>2022-10-21 13:37:31 +0000</bug_when>
    <thetext>When doing a &quot;devtool upgrade&quot; for a recipe which inherits &quot;go&quot; and using an SRC_URI to a git repo, this will fail.

E.g. set the go-helloworld bb srcrev to an older rev:
SRCREV = &quot;ad95e7f791d8e1e7e7ec7f7cedfc2f6b29f6c9e2&quot;

&quot;devtool upgrade go-helloworld&quot;

INFO: Extracting upgraded version source...
Traceback (most recent call last):
  File &quot;/home/ubuntu/yocto/poky/scripts/lib/devtool/upgrade.py&quot;, line 567, in upgrade
    rev2, md5, sha256, srcbranch, srcsubdir2 = _extract_new_source(args.version, srctree, args.no_patch,
  File &quot;/home/ubuntu/yocto/poky/scripts/lib/devtool/upgrade.py&quot;, line 183, in _extract_new_source
    __run(&apos;git checkout %s&apos; % rev)
  File &quot;/home/ubuntu/yocto/poky/scripts/lib/devtool/upgrade.py&quot;, line 170, in __run
    return _run(cmd, srctree)
  File &quot;/home/ubuntu/yocto/poky/scripts/lib/devtool/upgrade.py&quot;, line 31, in _run
    return bb.process.run(&apos;%s&apos; % cmd, cwd=cwd)
  File &quot;/home/ubuntu/yocto/poky/bitbake/lib/bb/process.py&quot;, line 189, in run
    raise ExecutionError(cmd, pipe.returncode, stdout, stderr)
bb.process.ExecutionError: Execution of &apos;git checkout 2e68773dfca072cb81f219fc3b97ad34fe9d9f94&apos; failed with exit code 128:
fatal: reference is not a tree: 2e68773dfca072cb81f219fc3b97ad34fe9d9f94

this is because that go.bbclass is using a subdir called &quot;src&quot; and that will break the devtool check for upgrades mechanism because it&apos;s not looking into a src subdir. So git will fail checkout anything in the parent dir &quot;reference is not a tree&quot;
I think go.bbclass is not setting S correct.

This simple change in the go.bbclass fix it in my case, but this will break others:


# src folder will break devtool upgrade
python go_do_unpack() {
    src_uri = (d.getVar(&apos;SRC_URI&apos;) or &quot;&quot;).split()
    if len(src_uri) == 0:
        return

    fetcher = bb.fetch2.Fetch(src_uri, d)
    for url in fetcher.urls:
        if fetcher.ud[url].type == &apos;git&apos;:
            if fetcher.ud[url].parm.get(&apos;destsuffix&apos;) is None:
                s_dirname = os.path.basename(d.getVar(&apos;S&apos;))
#cause problems                fetcher.ud[url].parm[&apos;destsuffix&apos;] = os.path.join(s_dirname, &apos;src&apos;, d.getVar(&apos;GO_IMPORT&apos;)) + &apos;/&apos;
#FIX
                fetcher.ud[url].parm[&apos;destsuffix&apos;] = os.path.join(s_dirname, &apos;&apos;, d.getVar(&apos;GO_IMPORT&apos;)) + &apos;/&apos;
#FIX
    fetcher.unpack(d.getVar(&apos;WORKDIR&apos;))
}

# src folder will break devtool upgrade
go_do_configure() {
#cause problems      ln -snf ${S}/src ${B}/
#FIX
    ln -snf ${S} ${B}/
#FIX
}

came up with something simpler, but this will break other stuff:
python go_do_unpack() {
    src_uri = (d.getVar(&apos;SRC_URI&apos;) or &quot;&quot;).split()
    if len(src_uri) == 0:
        return

    fetcher = bb.fetch2.Fetch(src_uri, d)
    for url in fetcher.urls:
        if fetcher.ud[url].type == &apos;git&apos;:
            if fetcher.ud[url].parm.get(&apos;destsuffix&apos;) is None:
                s_dirname = os.path.basename(d.getVar(&apos;S&apos;))
#                fetcher.ud[url].parm[&apos;destsuffix&apos;] = os.path.join(s_dirname, &apos;src&apos;, d.getVar(&apos;GO_IMPORT&apos;)) + &apos;/&apos;
                fetcher.ud[url].parm[&apos;destsuffix&apos;] = os.path.join(s_dirname) + &apos;/&apos;
    fetcher.unpack(d.getVar(&apos;WORKDIR&apos;))
}

# src folder will break devtool upgrade
go_do_configure() {
#cause problems      ln -snf ${S}/src ${B}/
#FIX
#    install -d ${B}/src/${GO_IMPORT}
#    cp -r ${S}/. ${B}/src/${GO_IMPORT}
     install -d ${B}/src/${GO_IMPORT}/
     rm -r ${B}/src/${GO_IMPORT}/
     ln -snf ${S} ${B}/src/${GO_IMPORT}
#FIX
}

go_do_install() {
	install -d ${D}${libdir}/go/src/${GO_IMPORT}
	tar -C ${B}/src/${GO_IMPORT} -cf - --exclude-vcs --exclude &apos;*.test&apos; --exclude &apos;testdata&apos; . | \
		tar -C ${D}${libdir}/go/src/${GO_IMPORT} --no-same-owner -xf -
	tar -C ${B} -cf - --exclude-vcs --exclude &apos;*.test&apos; --exclude &apos;testdata&apos; pkg | \
		tar -C ${D}${libdir}/go --no-same-owner -xf -

	if [ -n &quot;`ls ${B}/${GO_BUILD_BINDIR}/`&quot; ]; then
		install -d ${D}${bindir}
		install -m 0755 ${B}/${GO_BUILD_BINDIR}/* ${D}${bindir}/
	fi
}

Might somebody can say anything about that src dir - as said I don&apos;t have any knowledge about GO.

originated here: https://lists.yoctoproject.org/g/yocto/topic/94449982#58372</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94261</commentid>
    <comment_count>1</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2022-10-27 14:37:46 +0000</bug_when>
    <thetext>We want to fix this but the devtool maintainer is busy with other work for a whle.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96103</commentid>
    <comment_count>2</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2023-07-26 21:22:06 +0000</bug_when>
    <thetext>Bulk move of 64 bugs to 4.3 M3 after a quick review.
If a bug is actually fixed, please add a commit link and resolve it.
-- Randy for YP bug team.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96446</commentid>
    <comment_count>3</comment_count>
    <who name="Trevor Gamblin">tgamblin</who>
    <bug_when>2023-09-14 15:47:06 +0000</bug_when>
    <thetext>Moved to 5.0 M1.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97676</commentid>
    <comment_count>4</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2023-12-21 23:28:29 +0000</bug_when>
    <thetext>Bulk move of 52 5.0-M1 bugs to M2.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98001</commentid>
    <comment_count>5</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2024-01-25 14:28:48 +0000</bug_when>
    <thetext>Bulk move of bugs owned by &quot;unassigned&quot; from 5.0-M2 to 5.0-M3.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98204</commentid>
    <comment_count>6</comment_count>
    <who name="Fawzi KHABER">fawzi.khaber</who>
    <bug_when>2024-02-15 10:24:59 +0000</bug_when>
    <thetext>the issue is still here, the bug cannot be solved using Thomas solution, it does not work. I think it requires a devtool patch.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98221</commentid>
    <comment_count>7</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2024-02-16 00:38:30 +0000</bug_when>
    <thetext>Fawzi, Thanks for checking. We&apos;re short of volunteers so it is unlikely to be worked on any time soon. If you or anyone else has a personal/business interest in this feature, please consider implementing the devtool enhancement or asking a Yocto-based OS vendor to do so.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100796</commentid>
    <comment_count>8</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2025-01-30 16:06:37 +0000</bug_when>
    <thetext>Bulk move to 5.2-M3.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100813</commentid>
    <comment_count>9</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2025-01-30 16:17:04 +0000</bug_when>
    <thetext>Bulk move to 5.2-M3 and this time I&apos;ll actually specify M3!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101003</commentid>
    <comment_count>10</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2025-02-14 16:46:33 +0000</bug_when>
    <thetext>bulk change to add Saul&apos;s non-WR address.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101049</commentid>
    <comment_count>11</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2025-02-14 16:48:17 +0000</bug_when>
    <thetext>Bulk change: Remove Saul&apos;s old WR address.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>