<?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>13665</bug_id>
          
          <creation_ts>2019-12-02 16:58:15 +0000</creation_ts>
          <short_desc>gitsm fetcher and PREMIRROR does not use git to clone repositories</short_desc>
          <delta_ts>2022-06-09 07:27:17 +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>BitBake</product>
          <component>bitbake</component>
          <version>3.1</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>NOTABUG</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>4.1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Konrad Scherer">konrad.scherer</reporter>
          <assigned_to name="Pavel Zhukov">pavel</assigned_to>
          <cc>liezhi.yang</cc>
    
    <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>richard.purdie</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>85669</commentid>
    <comment_count>0</comment_count>
    <who name="Konrad Scherer">konrad.scherer</who>
    <bug_when>2019-12-02 16:58:15 +0000</bug_when>
    <thetext>I recently found a strange problem involving the gitsm fetcher and our PREMIRRORS and I was able to reproduce it using poky.

&gt; git clone git://git.yoctoproject.org/poky poky1
&gt; cd poky1
&gt; . oe-init-build-env
&gt; bitbake ovmf

The ovmf recipe has git submodules inside git submodules. This step works fine.

I then exposed the downloads directory over http (http://&lt;host&gt;/downloads) and the downloads/git2 directory over http with git-http-backend enabled (http://&lt;host&gt;/git).

I noticed that there are shallow clone tarballs in downloads that match the git repos in downloads/git2. For example:

downloads/git2/boringssl.googlesource.com.boringssl/
downloads/git2_boringssl.googlesource.com.boringssl.tar.gz

Since these are duplicates of the git repos, I deleted the tar.gz files

&gt; rm -f downloads/git2_*

&lt;new shell&gt;

&gt; git clone git://git.yoctoproject.org/poky poky2
&gt; cd poky2
&gt; . oe-init-build-env
&gt; cat &gt;&gt; conf/local.conf &lt;&lt;EOF
WRS_MIRROR_HOST = &quot;&lt;host&gt;&quot;
BB_ALLOWED_NETWORKS = &quot;${WRS_MIRROR_HOST}&quot;

BB_NO_NETWORK = &apos;0&apos;
BB_FETCH_PREMIRRORONLY = &apos;1&apos;

PREMIRRORS_append = &quot; \
     .*://.*/.* http://${WRS_MIRROR_HOST}/downloads/ \n \
     git://.*/.* git://${WRS_MIRROR_HOST}/git/MIRRORNAME;protocol=http \n \
     gitsm://.*/.* git://${WRS_MIRROR_HOST}/git/MIRRORNAME;protocol=http \n \
&quot;
CONNECTIVITY_CHECK_URIS = &quot;&quot;
EOF
&gt; bitbake ovmf

This fails with:

ERROR: ovmf-edk2-stable201905-r0 do_unpack: gitsm: submodule unpack failed: UnpackError Unpack failure for URL: &apos;gitsm://github.com/openssl/openssl;protocol=https;name=CryptoPkg/Library/OpensslLib/openssl;subpath=CryptoPkg/Library/OpensslLib/openssl;bareclone=1;nobranch=1&apos;. No up to date source found: clone directory not available or not up to date: /ala-lpggp22/kscherer/gitsm/poky2/build/downloads/git2/github.com.openssl.openssl; shallow clone not enabled

If I leave the tarballs in the PREMIRROR the build succeeds. The other recipes that use git are fetched properly. The logs don&apos;t have any warnings before the error and I verified that the objects are indeed present in the repo.

Are my PREMIRROR settings correct? Is this a bug in the gitsm fetcher?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86019</commentid>
    <comment_count>1</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2020-01-10 15:00:52 +0000</bug_when>
    <thetext>Mark, Do you think you&apos;ll work on this in the next few weeks?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93351</commentid>
    <comment_count>2</comment_count>
    <who name="Pavel Zhukov">pavel</who>
    <bug_when>2022-05-28 13:43:22 +0000</bug_when>
    <thetext>It looks like a feature rather than a bug.

BB_FETCH_PREMIRRORONLY functionality is kind of broken in the current bitbake (see https://bugzilla.yoctoproject.org/show_bug.cgi?id=13353 https://bugzilla.yoctoproject.org/show_bug.cgi?id=9061 https://bugzilla.yoctoproject.org/show_bug.cgi?id=13233). Trying to run git clone (and ls-remote) from upstream if premirror has been specified is a actual bug while erroring out if BB_FETCH_PREMIRRORONLY has been specified but mirror doesn&apos;t contain revision is a proper behaviour to not break reproducible builds.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93425</commentid>
    <comment_count>3</comment_count>
    <who name="Pavel Zhukov">pavel</who>
    <bug_when>2022-06-09 07:27:17 +0000</bug_when>
    <thetext>Fixes for mentioned bugs are merged and behaviour should be consistent now.
If BB_FETCH_PREMIRRORONLY = &apos;1&apos; has been specified and revision not in the PREMIRROR the build will fail (with NetworkAccess error). 
Fetchers will not try upstream for git fetcher anymore. 

https://git.openembedded.org/bitbake/commit/?id=b47ecab3e3aad5c5c376ec023aa82a51aa0f3b86</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>