<?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>9738</bug_id>
          
          <creation_ts>2016-06-09 14:14:55 +0000</creation_ts>
          <short_desc>[PATCH] fetcher: allow git+&lt;protocol&gt;: syntax</short_desc>
          <delta_ts>2021-11-03 12:26:08 +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>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard> </status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>4.99</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Enrico Scholz">enrico.scholz</reporter>
          <assigned_to name="Richard Purdie">richard.purdie</assigned_to>
          <cc>evadeflow</cc>
    
    <cc>liam.howlett</cc>
    
    <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>randy.macleod</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Yes (doc changes required)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>62812</commentid>
    <comment_count>0</comment_count>
      <attachid>3223</attachid>
    <who name="Enrico Scholz">enrico.scholz</who>
    <bug_when>2016-06-09 14:14:55 +0000</bug_when>
    <thetext>Created attachment 3223
patch

Specifying an alternative git respository with a different access
protocol is very difficulty atm because the protocol is part of the
URI parameters which are at end the end of the URI.

E.g. when having

| MY_GIT_REPO = &quot;git://example.com&quot;
| SRC_URI = &quot;${MY_GIT_REPO}/foo.git;protocol=ssh&quot;

and somebody wants to access this over https (e.g. because of firewall
constraints) or over ssh (e.g. because it contains a private branch),
this requires modification of &apos;SRC_URI&apos;.

With this patch, this can be done by

| MY_GIT_REPO = &quot;git+https://example.com&quot;

or

| MY_GIT_REPO = &quot;git+ssh://private.example.com&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62813</commentid>
    <comment_count>1</comment_count>
      <attachid>3224</attachid>
    <who name="Enrico Scholz">enrico.scholz</who>
    <bug_when>2016-06-09 14:28:52 +0000</bug_when>
    <thetext>Created attachment 3224
patch

correct patch; previous ones missed half of required changes</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66029</commentid>
    <comment_count>2</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2016-09-12 10:52:55 +0000</bug_when>
    <thetext>Your patch means special casing the git fetcher and the protocol parameter into generic code. I&apos;ve also wondered about this problem but I think I&apos;d prefer to fix it by allowing the MIRRORS code to handle remapping the protocol part of the url.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66031</commentid>
    <comment_count>3</comment_count>
    <who name="Enrico Scholz">enrico.scholz</who>
    <bug_when>2016-09-12 11:45:17 +0000</bug_when>
    <thetext>Code can be generalized to accept &lt;scm&gt;[+&lt;protocol&gt;]:// syntax. Other SCMs (bzr, clearcase, hg, osc, repo, svn) have this parameter too.

Modifying MIRROR would be too complicated for generic case IMO.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83204</commentid>
    <comment_count>4</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2019-03-07 15:39:56 +0000</bug_when>
    <thetext>*** Bug 13211 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83206</commentid>
    <comment_count>5</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2019-03-07 15:40:28 +0000</bug_when>
    <thetext>*** Bug 3306 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83209</commentid>
    <comment_count>6</comment_count>
    <who name="Enrico Scholz">enrico.scholz</who>
    <bug_when>2019-03-07 16:00:10 +0000</bug_when>
    <thetext>fwiw, we are solving this with a .bbclass now (no changes to bitbake itself required):

https://github.com/sigma-embedded/meta-de.sigma-chemnitz/blob/thud/classes/elito-uridecode.bbclass

https://github.com/sigma-embedded/meta-de.sigma-chemnitz/blob/thud/lib/elito/__init__.py</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>91875</commentid>
    <comment_count>7</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2021-11-02 21:43:31 +0000</bug_when>
    <thetext>The url remapping code now supports setting parameters in mirror urls so it is possible to change a procotol using the mirror syntax. I&apos;ve just added a test for it to ensure it keeps working, 

Enrico also shared another way to do that here by patching the fetcher. 

I&apos;m marking this bug as obsolete, it is hard to know what to do as there is a solution here and there is a way to use the mirrors too so that could be fixed, won&apos;t fix or obsolete!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>91878</commentid>
    <comment_count>8</comment_count>
    <who name="Enrico Scholz">enrico.scholz</who>
    <bug_when>2021-11-03 10:11:08 +0000</bug_when>
    <thetext>This does not seem to work.  I have

| PREMIRRORS:prepend = &quot;git\+([^/]+)://.* git://\\2;protocol=\\1 \n&quot;
| SRC_URI = &quot;git+http://git.example.org&quot;

which fails with

| WARNING: Invalid protocol (git\+([^/]+)) in PREMIRRORS: (&apos;git\\+([^/]+)://.*&apos;, &apos;git://\\\\2;protocol=\\\\1&apos;)
| ... NoMethodError: Could not find a fetcher which supports the URL: &apos;git+http://git.example.org&apos;

I am in doubt that mirrors are good way to set the protocol: they add new uri entries but do not replace them.  The original uri might be still tried under some conditions.

Native &apos;git+&lt;protocol&gt;://&apos; support would be much better.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>91881</commentid>
    <comment_count>9</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2021-11-03 12:17:18 +0000</bug_when>
    <thetext>(In reply to comment #8)
&gt; This does not seem to work.  I have
&gt; 
&gt; | PREMIRRORS:prepend = &quot;git\+([^/]+)://.* git://\\2;protocol=\\1 \n&quot;
&gt; | SRC_URI = &quot;git+http://git.example.org&quot;
&gt; 
&gt; which fails with
&gt; 
&gt; | WARNING: Invalid protocol (git\+([^/]+)) in PREMIRRORS:
&gt; (&apos;git\\+([^/]+)://.*&apos;, &apos;git://\\\\2;protocol=\\\\1&apos;)
&gt; | ... NoMethodError: Could not find a fetcher which supports the URL:
&gt; &apos;git+http://git.example.org&apos;
&gt; 
&gt; I am in doubt that mirrors are good way to set the protocol: they add new
&gt; uri entries but do not replace them.

They can offer replacement, see:

http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=b3dcb6b1790d14845cc5ad70b0749dd6aed32e7a

&gt; The original uri might be still tried under some conditions.
&gt; 
&gt; Native &apos;git+&lt;protocol&gt;://&apos; support would be much better.

We have never supported that syntax and I&apos;m not planning to add it as we do not want to support too many different ways of doing things, it just complicates the codebase.

FWIW the regex in the above likely wouldn&apos;t work anyway since the pattern substitutions work within the url component they&apos;re part of, so the \1 in the parameter wouldn&apos;t see the match from the protocol section. Changing that would again significantly complicate the code which I don&apos;t believe is necessary.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>91882</commentid>
    <comment_count>10</comment_count>
    <who name="Enrico Scholz">enrico.scholz</who>
    <bug_when>2021-11-03 12:26:08 +0000</bug_when>
    <thetext>This syntax is already supported by the npmsw fetcher and a common way to express the git protocol.

Writing a non-generic PREMIRROR (e.g. to add alternatives for certain hosts) for git:// uris is not ergonomic because mirror setup is global configuration and expensive to change.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="0"
              isprivate="0"
          >
            <attachid>3223</attachid>
            <date>2016-06-09 14:14:55 +0000</date>
            <delta_ts>2016-06-09 14:28:52 +0000</delta_ts>
            <desc>patch</desc>
            <filename>0009-fetcher-allow-git-protocol-syntax.patch</filename>
            <type>application/x-download</type>
            <size>1783</size>
            <attacher name="Enrico Scholz">enrico.scholz</attacher>
            
              <data encoding="base64">RnJvbSBhNjEzNmM2NGQ2YjQ1NDhiZGViOWM0MjgzOTRiMzgxMTY3YWM3YjUxIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBFbnJpY28gU2Nob2x6IDxlbnJpY28uc2Nob2x6QHNpZ21hLWNo
ZW1uaXR6LmRlPgpEYXRlOiBNb24sIDI2IE9jdCAyMDE1IDE5OjMzOjE1ICswMTAwClN1YmplY3Q6
IFtQQVRDSCAwOS8xMF0gZmV0Y2hlcjogYWxsb3cgZ2l0Kzxwcm90b2NvbD46IHN5bnRheAoKU3Bl
Y2lmeWluZyBhbiBhbHRlcm5hdGl2ZSBnaXQgcmVzcG9zaXRvcnkgd2l0aCBhIGRpZmZlcmVudCBh
Y2Nlc3MKcHJvdG9jb2wgaXMgdmVyeSBkaWZmaWN1bHR5IGF0bSBiZWNhdXNlIHRoZSBwcm90b2Nv
bCBpcyBwYXJ0IG9mIHRoZQpVUkkgcGFyYW1ldGVycyB3aGljaCBhcmUgYXQgZW5kIHRoZSBlbmQg
b2YgdGhlIFVSSS4KCkUuZy4gd2hlbiBoYXZpbmcKCnwgTVlfR0lUX1JFUE8gPSAiZ2l0Oi8vZXhh
bXBsZS5jb20iCnwgU1JDX1VSSSA9ICIke01ZX0dJVF9SRVBPfS9mb28uZ2l0O3Byb3RvY29sPXNz
aCIKCmFuZCBzb21lYm9keSB3YW50cyB0byBhY2Nlc3MgdGhpcyBvdmVyIGh0dHBzIChlLmcuIGJl
Y2F1c2Ugb2YgZmlyZXdhbGwKY29uc3RyYWludHMpIG9yIG92ZXIgc3NoIChlLmcuIGJlY2F1c2Ug
aXQgY29udGFpbnMgYSBwcml2YXRlIGJyYW5jaCksCnR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B0byBtYWtlIFVSSSBzY2hlbWUgdXNl
IG5ldGxvYwpAQCAtMjY3LDYgKzI3Miw5IEBAIGNsYXNzIFVSSShvYmplY3QpOgogICAgICAgICBp
ZiB1cmxwLnF1ZXJ5OgogICAgICAgICAgICAgc2VsZi5xdWVyeSA9IHNlbGYuX3BhcmFtX3N0cl9z
cGxpdCh1cmxwLnF1ZXJ5LCAiJiIpCiAKKyAgICAgICAgaWYgcHJvdG9jb2w6CisgICAgICAgICAg
ICBzZWxmLnBhcmFtc1sncHJvdG9jb2wnXSA9IHByb3RvY29sCisKICAgICBkZWYgX19zdHJfXyhz
ZWxmKToKICAgICAgICAgdXNlcmluZm8gPSBzZWxmLnVzZXJpbmZvCiAgICAgICAgIGlmIHVzZXJp
bmZvOgotLSAKMi41LjUKCg==
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>3224</attachid>
            <date>2016-06-09 14:28:52 +0000</date>
            <delta_ts>2016-06-09 14:28:52 +0000</delta_ts>
            <desc>patch</desc>
            <filename>0009-fetcher-allow-git-protocol-syntax.patch</filename>
            <type>text/plain</type>
            <size>2374</size>
            <attacher name="Enrico Scholz">enrico.scholz</attacher>
            
              <data encoding="base64">RnJvbSAxNjM4NjU4OTJlNWE4MTk2OTk3OTE0NDJhNTBkM2FjMmNlZTAwMjU2IE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBFbnJpY28gU2Nob2x6IDxlbnJpY28uc2Nob2x6QHNpZ21hLWNo
ZW1uaXR6LmRlPgpEYXRlOiBNb24sIDI2IE9jdCAyMDE1IDE5OjMzOjE1ICswMTAwClN1YmplY3Q6
IFtQQVRDSCAwOS8xMV0gZmV0Y2hlcjogYWxsb3cgZ2l0Kzxwcm90b2NvbD46IHN5bnRheAoKU3Bl
Y2lmeWluZyBhbiBhbHRlcm5hdGl2ZSBnaXQgcmVzcG9zaXRvcnkgd2l0aCBhIGRpZmZlcmVudCBh
Y2N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vbmUKKyAgICBpZiB0eXBlLnN0YXJ0c3dpdGgoJ2dpdCsnKToKKyAg
ICAgICAgcHJvdG9jb2wgPSB0eXBlWzQ6XQorICAgICAgICB0eXBlID0gdHlwZVs6M10KKwogICAg
IGxvY2lkeCA9IGxvY2F0aW9uLmZpbmQoJy8nKQogICAgIGlmIGxvY2lkeCAhPSAtMSBhbmQgdHlw
ZS5sb3dlcigpICE9ICdmaWxlJzoKICAgICAgICAgaG9zdCA9IGxvY2F0aW9uWzpsb2NpZHhdCkBA
IC0zOTQsNiArNDA3LDkgQEAgZGVmIGRlY29kZXVybCh1cmwpOgogICAgICAgICAgICAgICAgIHMx
LCBzMiA9IHMuc3BsaXQoJz0nKQogICAgICAgICAgICAgICAgIHBbczFdID0gczIKIAorICAgIGlm
IHByb3RvY29sOgorICAgICAgICBwWydwcm90b2NvbCddID0gcHJvdG9jb2wKKwogICAgIHJldHVy
biB0eXBlLCBob3N0LCB1cmxsaWIucGFyc2UudW5xdW90ZShwYXRoKSwgdXNlciwgcHN3ZCwgcAog
CiBkZWYgZW5jb2RldXJsKGRlY29kZWQpOgotLSAKMi41LjUKCg==
</data>

          </attachment>
      

    </bug>

</bugzilla>