Skip to contentSkip to conversation

hob: changed the split of SSTATE_MIRRORS variable

PATCH New Cristiana Voicu 1 participant 2 messages Jul 22, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 hob: changed the split of SSTATE_MIRRORS variable

Until now the split made searching the string "file://", but this is not ok when SSTATE_VARIABLE has the following form:

SSTATE_MIRRORS ?= "\
     file://.* http://someserver.tld/share/sstate/PATH \n \
     file://.* file:///some/local/dir/sstate/PATH"

In the documentation I've found that \n is the list separator.

[YOCTO #4857]
---
 .../lib/bb/ui/crumbs/hig/simplesettingsdialog.py   |   13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
bitbake/lib/bb/ui/crumbs/hig/simplesettingsdialog.py +3 -10
index c1bd45f..e43080a 100644
@@ -310,7 +310,6 @@ class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper):
 
         sub_vbox = gtk.VBox(False)
         advanced_vbox.pack_start(sub_vbox, gtk.TRUE, gtk.TRUE, 0)
-        searched_string = "file://"
 
         if self.sstatemirrors_changed == 0:
             self.sstatemirrors_changed = 1
@@ -319,16 +318,10 @@ class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper):
                 sm_list = ["Standard", "", "file://(.*)"]
                 self.sstatemirrors_list.append(sm_list)
             else:
-                while sstatemirrors.find(searched_string) != -1:
-                    if sstatemirrors.find(searched_string,1) != -1:
-                        sstatemirror = sstatemirrors[:sstatemirrors.find(searched_string,1)]
-                        sstatemirrors = sstatemirrors[sstatemirrors.find(searched_string,1):]
-                    else:
-                        sstatemirror = sstatemirrors
-                        sstatemirrors = sstatemirrors[1:]
-
+                sstatemirrors = [x for x in sstatemirrors.split('\\n')]
+                for sstatemirror in sstatemirrors:
                     sstatemirror_fields = [x for x in sstatemirror.split(' ') if x.strip()]
-                    if len(sstatemirror_fields):
+                    if len(sstatemirror_fields) == 2:
                         if sstatemirror_fields[0] == "file://(.*)":
                             sm_list = ["Standard", sstatemirror_fields[1], "file://(.*)"]
                         else:
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 2/2 hob: sstatemirror is standard also for file://.* regex

---
 .../lib/bb/ui/crumbs/hig/simplesettingsdialog.py   |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
bitbake/lib/bb/ui/crumbs/hig/simplesettingsdialog.py +2 -2
index e43080a..de924b1 100644
@@ -322,8 +322,8 @@ class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper):
                 for sstatemirror in sstatemirrors:
                     sstatemirror_fields = [x for x in sstatemirror.split(' ') if x.strip()]
                     if len(sstatemirror_fields) == 2:
-                        if sstatemirror_fields[0] == "file://(.*)":
-                            sm_list = ["Standard", sstatemirror_fields[1], "file://(.*)"]
+                        if sstatemirror_fields[0] == "file://(.*)" or sstatemirror_fields[0] == "file://.*":
+                            sm_list = ["Standard", sstatemirror_fields[1], sstatemirror_fields[0]]
                         else:
                             sm_list = ["Custom", sstatemirror_fields[1], sstatemirror_fields[0]]
                         self.sstatemirrors_list.append(sm_list)
Signature · 1 line
1.7.9.5