All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] yocto-bsp: Fix git url parsing, allowing for local mirrors
@ 2012-10-18 14:23 Darren Hart
  2012-10-18 14:42 ` Darren Hart
  0 siblings, 1 reply; 2+ messages in thread
From: Darren Hart @ 2012-10-18 14:23 UTC (permalink / raw)
  To: Poky; +Cc: Darren Hart, evadeflow

The git URLs used in bitbake recipes are not compatible directly with git.  In
bitbake-speak, all git URLs start with git:// and the protocol is optionally
specified in the SRC_URI. Local git mirrors are specified like so:

    git:///path/to/local/mirror.git;protocol=file

The URL that git requires would be:

    file:///path/to/local/mirror.git

Update the yocto-bsp kernel.py to make the necessary adjustment when parsing
the SRC_URI to extract the git URL.

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
CC: Tom Zanussi <tom.zanussi@intel.com>
CC: evadeflow@gmail.com
---
 scripts/lib/bsp/kernel.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/scripts/lib/bsp/kernel.py b/scripts/lib/bsp/kernel.py
index d4bdc4c..128fad0 100644
--- a/scripts/lib/bsp/kernel.py
+++ b/scripts/lib/bsp/kernel.py
@@ -631,6 +631,7 @@ def extract_giturl(file):
     Extract the git url of the kernel repo from the kernel recipe's
     SRC_URI.
     """
+    url = None
     f = open(file, "r")
     lines = f.readlines()
     for line in lines:
@@ -641,10 +642,15 @@ def extract_giturl(file):
                 line = line[1:].strip()
                 if line.startswith("\""):
                     line = line[1:].strip()
-                    fields = line.split(";")
-                    if fields:
-                        return fields[0]
-    return None
+                    prot = "git"
+                    for s in line.split(";"):
+                        if s.startswith("git://"):
+                            url = s
+                        if s.startswith("protocol="):
+                            prot = s.split("=")[1]
+                    if url:
+                        url = prot + url[3:]
+    return url
 
 
 def find_giturl(context):
-- 
1.7.11.7



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

* Re: [PATCH] yocto-bsp: Fix git url parsing, allowing for local mirrors
  2012-10-18 14:23 [PATCH] yocto-bsp: Fix git url parsing, allowing for local mirrors Darren Hart
@ 2012-10-18 14:42 ` Darren Hart
  0 siblings, 0 replies; 2+ messages in thread
From: Darren Hart @ 2012-10-18 14:42 UTC (permalink / raw)
  To: Darren Hart; +Cc: Poky, evadeflow

Forgot to include:

Fixes [YOCTO #3305]

Saul/RP: Can you include the tag or would you prefer I resend?
(sorry, a bit rushed between conference discussions)

--
Darren

On 10/18/2012 10:23 AM, Darren Hart wrote:
> The git URLs used in bitbake recipes are not compatible directly with git.  In
> bitbake-speak, all git URLs start with git:// and the protocol is optionally
> specified in the SRC_URI. Local git mirrors are specified like so:
> 
>     git:///path/to/local/mirror.git;protocol=file
> 
> The URL that git requires would be:
> 
>     file:///path/to/local/mirror.git
> 
> Update the yocto-bsp kernel.py to make the necessary adjustment when parsing
> the SRC_URI to extract the git URL.
> 
> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
> CC: Tom Zanussi <tom.zanussi@intel.com>
> CC: evadeflow@gmail.com
> ---
>  scripts/lib/bsp/kernel.py | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/scripts/lib/bsp/kernel.py b/scripts/lib/bsp/kernel.py
> index d4bdc4c..128fad0 100644
> --- a/scripts/lib/bsp/kernel.py
> +++ b/scripts/lib/bsp/kernel.py
> @@ -631,6 +631,7 @@ def extract_giturl(file):
>      Extract the git url of the kernel repo from the kernel recipe's
>      SRC_URI.
>      """
> +    url = None
>      f = open(file, "r")
>      lines = f.readlines()
>      for line in lines:
> @@ -641,10 +642,15 @@ def extract_giturl(file):
>                  line = line[1:].strip()
>                  if line.startswith("\""):
>                      line = line[1:].strip()
> -                    fields = line.split(";")
> -                    if fields:
> -                        return fields[0]
> -    return None
> +                    prot = "git"
> +                    for s in line.split(";"):
> +                        if s.startswith("git://"):
> +                            url = s
> +                        if s.startswith("protocol="):
> +                            prot = s.split("=")[1]
> +                    if url:
> +                        url = prot + url[3:]
> +    return url
>  
>  
>  def find_giturl(context):
> 

-- 
Darren Hart
Intel Open Source Technology Center
Yocto Project - Technical Lead - Linux Kernel


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

end of thread, other threads:[~2012-10-18 14:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-18 14:23 [PATCH] yocto-bsp: Fix git url parsing, allowing for local mirrors Darren Hart
2012-10-18 14:42 ` Darren Hart

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.