Patchwork Patches for bakery fixing potential use of non-existing indices in two if-conditions

login
register
mail settings
Submitter Christian Rasmussen
Date Jan. 21, 2013, 11:54 a.m.
Message ID <1AF0AD83BEC32F489C74B5B223C246C22578B36B@VMPREVAS1.prevas.se>
Download mbox | patch
Permalink /patch/214109/
State Rejected
Delegated to: Esben Haabendal
Headers show

Comments

Christian Rasmussen - Jan. 21, 2013, 11:54 a.m.
Hello dev-oelite

Patches for bakery, fixing potential use of non-existing indices in two if-conditions

Best regards
Christian Rasmussen
Esben Haabendal - Jan. 31, 2013, 5:11 p.m.
Christian Rasmussen <Christian.Rasmussen@prevas.dk> writes:

> Hello dev-oelite
>
> Patches for bakery, fixing potential use of non-existing indices in two if-conditions
>
> Best regards
> Christian Rasmussen
>
> diff --git a/oebakery/cmd_update.py b/oebakery/cmd_update.py
> index 735034c..aba36d2 100644
> --- a/oebakery/cmd_update.py
> +++ b/oebakery/cmd_update.py
> @@ -94,8 +94,13 @@ def update_submodule(path, fetch_url, params):
>          err("Failed to synchronize git submodule")
>  
>      status = git_submodule_status(path)
> +    if status[0] == "-":
> +        cmd = "git submodule update --init --recursive"
> +        if not oebakery.call("%s %s"%(cmd, path)):
> +            err("Failed to add submodule: %s"%(path))
> +            return False
>  
> -    if status is None:
> +    elif status is None:
>          cmd = "git submodule add -f"
>          if "branch" in params:
>              branch = params["branch"]
> @@ -109,12 +114,6 @@ def update_submodule(path, fetch_url, params):
>              err("Failed to initialize submodule: %s"%(path))
>              return False
>  
> -    elif status[0] == "-":
> -        cmd = "git submodule update --init --recursive"
> -        if not oebakery.call("%s %s"%(cmd, path)):
> -            err("Failed to add submodule: %s"%(path))
> -            return False
> -
>      # set push_default to 'tracking' if unset
>      push_default = oebakery.call('git config --get push.default',
>                                   dir=path, quiet=True)

What commit is this change based on?

Current master branch has this already:
http://git.oe-lite.org/gitweb?p=oe-lite/bakery.git;a=blob;f=oebakery/cmd_update.py;h=7ee81db88cefe195e1640416f5f0aa3113a4a2a6;hb=HEAD#l96

And AFAICS, has been like this since 2012-02-01
(df99a0013fb0ac4144c805fffed29ef90fe53496).

Am I missing something?

> diff --git a/oebakery/oe.py b/oebakery/oe.py
> index cea5171..eff854d 100755
> --- a/oebakery/oe.py
> +++ b/oebakery/oe.py
> @@ -198,7 +198,7 @@ def config_defaults(config, debug=False):
>              if not "protocol" in params:
>                  params["protocol"] = "git"
>          config["__oestack"].append((path, params))
> -        if params["srcuri"].startswith("git://"):
> +        if "srcuri" in params and params["srcuri"].startswith("git://"):
>              url = "%s%s"%(params["protocol"], params["srcuri"][3:])
>              config["__submodules"].append((path, url, params))
>          if "oepath" in params:

AFAICS, this is also already in current master branch.

Could you try again with OE-lite Bakery v3.1.0?

/Esben

Patch

diff --git a/oebakery/cmd_update.py b/oebakery/cmd_update.py
index 735034c..aba36d2 100644
--- a/oebakery/cmd_update.py
+++ b/oebakery/cmd_update.py
@@ -94,8 +94,13 @@  def update_submodule(path, fetch_url, params):
         err("Failed to synchronize git submodule")
 
     status = git_submodule_status(path)
+    if status[0] == "-":
+        cmd = "git submodule update --init --recursive"
+        if not oebakery.call("%s %s"%(cmd, path)):
+            err("Failed to add submodule: %s"%(path))
+            return False
 
-    if status is None:
+    elif status is None:
         cmd = "git submodule add -f"
         if "branch" in params:
             branch = params["branch"]
@@ -109,12 +114,6 @@  def update_submodule(path, fetch_url, params):
             err("Failed to initialize submodule: %s"%(path))
             return False
 
-    elif status[0] == "-":
-        cmd = "git submodule update --init --recursive"
-        if not oebakery.call("%s %s"%(cmd, path)):
-            err("Failed to add submodule: %s"%(path))
-            return False
-
     # set push_default to 'tracking' if unset
     push_default = oebakery.call('git config --get push.default',
                                  dir=path, quiet=True)
diff --git a/oebakery/oe.py b/oebakery/oe.py
index cea5171..eff854d 100755
--- a/oebakery/oe.py
+++ b/oebakery/oe.py
@@ -198,7 +198,7 @@  def config_defaults(config, debug=False):
             if not "protocol" in params:
                 params["protocol"] = "git"
         config["__oestack"].append((path, params))
-        if params["srcuri"].startswith("git://"):
+        if "srcuri" in params and params["srcuri"].startswith("git://"):
             url = "%s%s"%(params["protocol"], params["srcuri"][3:])
             config["__submodules"].append((path, url, params))
         if "oepath" in params: