Openembedded Core Discussions
 help / color / mirror / Atom feed
* [oe][yocto][bitbake] Fetching source using different protocols
@ 2020-05-11  9:03 Dawod
  2020-05-11  9:17 ` Quentin Schulz
  2020-05-11  9:20 ` [OE-core] " Andre McCurdy
  0 siblings, 2 replies; 5+ messages in thread
From: Dawod @ 2020-05-11  9:03 UTC (permalink / raw)
  To: openembedded-core, yocto

[-- Attachment #1: Type: text/plain, Size: 359 bytes --]

Hello,

I need to fetch a git repo using 2 different protocols ( ssh & https )
So that when I run bitbake, It will fetch using ssh protocol first and if
it fails to fetch, It will try to fetch using https protocol.

can I do some thing like that or I will have to change it manually every
time ?

Thank you,
-- 

Mohamed Dawod
Computer Engineer

[-- Attachment #2: Type: text/html, Size: 692 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [oe][yocto][bitbake] Fetching source using different protocols
  2020-05-11  9:03 [oe][yocto][bitbake] Fetching source using different protocols Dawod
@ 2020-05-11  9:17 ` Quentin Schulz
  2020-05-11 18:37   ` Mark Hatle
  2020-05-11  9:20 ` [OE-core] " Andre McCurdy
  1 sibling, 1 reply; 5+ messages in thread
From: Quentin Schulz @ 2020-05-11  9:17 UTC (permalink / raw)
  To: Dawod; +Cc: openembedded-core, yocto

Hi Mohamed,

On Mon, May 11, 2020 at 11:03:26AM +0200, Dawod wrote:
> Hello,
> 
> I need to fetch a git repo using 2 different protocols ( ssh & https )
> So that when I run bitbake, It will fetch using ssh protocol first and if
> it fails to fetch, It will try to fetch using https protocol.
> 

Why? What's the exact use case?

> can I do some thing like that or I will have to change it manually every
> time ?
> 

Maybe you could play with PREMIRROS? (I've never explicitly used that
variable though):
https://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#var-PREMIRRORS

I guess the asterisk parts could be removed and the path to more or less your
source could be used (ssh first, to http path in your SRC_URI)?

That's a shot in the dark for me but something to test I'd say :)

Quentin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [OE-core] [oe][yocto][bitbake] Fetching source using different protocols
  2020-05-11  9:03 [oe][yocto][bitbake] Fetching source using different protocols Dawod
  2020-05-11  9:17 ` Quentin Schulz
@ 2020-05-11  9:20 ` Andre McCurdy
  1 sibling, 0 replies; 5+ messages in thread
From: Andre McCurdy @ 2020-05-11  9:20 UTC (permalink / raw)
  To: Dawod; +Cc: OE Core mailing list, Yocto discussion list

On Mon, May 11, 2020 at 2:03 AM Dawod <mhm.dawod@gmail.com> wrote:
>
> Hello,
>
> I need to fetch a git repo using 2 different protocols ( ssh & https )
> So that when I run bitbake, It will fetch using ssh protocol first and if it fails to fetch, It will try to fetch using https protocol.
>
> can I do some thing like that or I will have to change it manually every time ?

You can add fallback rules to MIRRORS (either globally or per-recipe).
See the last few lines of meta/classes/mirrors.bbclass as an example.

> Thank you,
> --
>
> Mohamed Dawod
> Computer Engineer
>
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [oe][yocto][bitbake] Fetching source using different protocols
  2020-05-11  9:17 ` Quentin Schulz
@ 2020-05-11 18:37   ` Mark Hatle
  2020-05-12 10:25     ` Dawod
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Hatle @ 2020-05-11 18:37 UTC (permalink / raw)
  To: Quentin Schulz, Dawod; +Cc: openembedded-core, yocto



On 5/11/20 4:17 AM, Quentin Schulz wrote:
> Hi Mohamed,
> 
> On Mon, May 11, 2020 at 11:03:26AM +0200, Dawod wrote:
>> Hello,
>>
>> I need to fetch a git repo using 2 different protocols ( ssh & https )
>> So that when I run bitbake, It will fetch using ssh protocol first and if
>> it fails to fetch, It will try to fetch using https protocol.
>>
> 
> Why? What's the exact use case?
> 
>> can I do some thing like that or I will have to change it manually every
>> time ?
>>
> 
> Maybe you could play with PREMIRROS? (I've never explicitly used that
> variable though):
> https://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#var-PREMIRRORS

This is what I would suggest.  Have the recipe itself set the fallback URI as
the main URL.


SRC_URI = "git://example.com/my/repository/uri;proto=https"

PREMIRRORS_prepend = "git://example.com/my/repository/uri;proto=https
git://example.com/my/otherrepo/uri;proto=ssh \n"

(the \n is literally '\' and 'n')

The above should, when it sees the SRC_URI, try the ssh protocol first.. if that
doesn't work it will fall back to SRC_URI.

--Mark

> I guess the asterisk parts could be removed and the path to more or less your
> source could be used (ssh first, to http path in your SRC_URI)?
> 
> That's a shot in the dark for me but something to test I'd say :)
> 
> Quentin
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [oe][yocto][bitbake] Fetching source using different protocols
  2020-05-11 18:37   ` Mark Hatle
@ 2020-05-12 10:25     ` Dawod
  0 siblings, 0 replies; 5+ messages in thread
From: Dawod @ 2020-05-12 10:25 UTC (permalink / raw)
  To: Mark Hatle; +Cc: Quentin Schulz, openembedded-core, yocto

[-- Attachment #1: Type: text/plain, Size: 1935 bytes --]

Thank you all, your answers were so helpful,
My problem had been solved.
The reason behind my question was a temporary connections error for some
machines in the lab so I needed some way to cover this problem  as fast as
possible to keep my Yocto recipes away from this problem.

Thank you very much.

On Mon, May 11, 2020 at 8:37 PM Mark Hatle <mark.hatle@kernel.crashing.org>
wrote:

>
>
> On 5/11/20 4:17 AM, Quentin Schulz wrote:
> > Hi Mohamed,
> >
> > On Mon, May 11, 2020 at 11:03:26AM +0200, Dawod wrote:
> >> Hello,
> >>
> >> I need to fetch a git repo using 2 different protocols ( ssh & https )
> >> So that when I run bitbake, It will fetch using ssh protocol first and
> if
> >> it fails to fetch, It will try to fetch using https protocol.
> >>
> >
> > Why? What's the exact use case?
> >
> >> can I do some thing like that or I will have to change it manually every
> >> time ?
> >>
> >
> > Maybe you could play with PREMIRROS? (I've never explicitly used that
> > variable though):
> >
> https://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#var-PREMIRRORS
>
> This is what I would suggest.  Have the recipe itself set the fallback URI
> as
> the main URL.
>
>
> SRC_URI = "git://example.com/my/repository/uri;proto=https"
>
> PREMIRRORS_prepend = "git://example.com/my/repository/uri;proto=https
> git://example.com/my/otherrepo/uri;proto=ssh \n"
>
> (the \n is literally '\' and 'n')
>
> The above should, when it sees the SRC_URI, try the ssh protocol first..
> if that
> doesn't work it will fall back to SRC_URI.
>
> --Mark
>
> > I guess the asterisk parts could be removed and the path to more or less
> your
> > source could be used (ssh first, to http path in your SRC_URI)?
> >
> > That's a shot in the dark for me but something to test I'd say :)
> >
> > Quentin
> >
> >
> > 
> >
>


-- 

Mohamed Dawod
Computer Engineer

[-- Attachment #2: Type: text/html, Size: 3159 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-05-12 10:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-11  9:03 [oe][yocto][bitbake] Fetching source using different protocols Dawod
2020-05-11  9:17 ` Quentin Schulz
2020-05-11 18:37   ` Mark Hatle
2020-05-12 10:25     ` Dawod
2020-05-11  9:20 ` [OE-core] " Andre McCurdy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox