Skip to contentSkip to conversation

prserv: use only PRSERV_HOST

PATCH In review Constantin Musca 2 participants 3 messages Jan 23, 2013 – Jan 25, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 prserv: use only PRSERV_HOST

- remove PRSERV_PORT variable
- use 'hostname:port' as PRSERV_HOST format
- use 'localhost:0' for enabling the local PRServer

[YOCTO #3744]

---
 bitbake/lib/prserv/serv.py | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
bitbake/lib/prserv/serv.py +11 -4
index 5567c6f..d8bdf31 100644
@@ -268,10 +268,17 @@ def is_local_special(host, port):
 
 def auto_start(d):
     global singleton
-    if (not d.getVar('PRSERV_HOST', True)) or (not d.getVar('PRSERV_PORT', True)):
+
+    host_params = filter(None, (d.getVar('PRSERV_HOST', True) or '').split(':'))
+    if not host_params:
+        return True
+
+    if len(host_params) != 2:
+        logger.critical('\n'.join(['PRSERV_HOST: incorrect format',
+                'Usage: PRSERV_HOST = "<hostname>:<port>"']))
         return True
 
-    if is_local_special(d.getVar('PRSERV_HOST', True), int(d.getVar('PRSERV_PORT', True))) and not singleton:
+    if is_local_special(host_params[0], int(host_params[1])) and not singleton:
         import bb.utils
         cachedir = (d.getVar("PERSISTENT_DIR", True) or d.getVar("CACHE", True))
         if not cachedir:
@@ -285,8 +292,8 @@ def auto_start(d):
     if singleton:
         host, port = singleton.getinfo()
     else:
-        host = d.getVar('PRSERV_HOST', True)
-        port = int(d.getVar('PRSERV_PORT', True))
+        host = host_params[0]
+        port = int(host_params[1])
 
     try:
         return PRServerConnection(host,port).ping()
Signature · 1 line
1.7.11.7
#1 lore raw
Quoted 3 lines · Constantin Musca

- remove PRSERV_PORT variable
- use 'hostname:port' as PRSERV_HOST format
- use 'localhost:0' for enabling the local PRServer

Please update
https://wiki.yoctoproject.org/wiki/index.php?title=PR_Service

This seems to break 'bitbake-prserv-tool migrate_localcount'

ERROR: Execution of event handler 'primport_handler' failed################################################################################## | ETA: 00:00:00
Traceback (most recent call last):
File "primport_handler(e)", line 9, in primport_handler(e=<bb.event.ParseCompleted object at 0xce963d0>)
File "/OE/shr-core/openembedded-core/meta/lib/oe/prservice.py", line 43, in prserv_import_db(d=<bb.data_smart.DataSmart object at 0x1aff710>, filter_version=None, filter_pkgarch=None, filter_checksum=None):
if conn is None:
> conn = prserv_make_conn(d)
if conn is None:
File "/OE/shr-core/openembedded-core/meta/lib/oe/prservice.py", line 13, in prserv_make_conn(d=<bb.data_smart.DataSmart object at 0x1aff710>, check=False):
except Exception, exc:
> bb.fatal("Connecting to PR service %s:%s failed: %s" % (host, port, str(exc)))

NameError: global name 'host' is not defined

Cheers,

Quoted 51 lines

[YOCTO #3744]

---
 bitbake/lib/prserv/serv.py | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
bitbake/lib/prserv/serv.py +11 -4
index 5567c6f..d8bdf31 100644
@@ -268,10 +268,17 @@ def is_local_special(host, port):
 
 def auto_start(d):
     global singleton
-    if (not d.getVar('PRSERV_HOST', True)) or (not d.getVar('PRSERV_PORT', True)):
+
+    host_params = filter(None, (d.getVar('PRSERV_HOST', True) or '').split(':'))
+    if not host_params:
+        return True
+
+    if len(host_params) != 2:
+        logger.critical('\n'.join(['PRSERV_HOST: incorrect format',
+                'Usage: PRSERV_HOST = "<hostname>:<port>"']))
         return True
 
-    if is_local_special(d.getVar('PRSERV_HOST', True), int(d.getVar('PRSERV_PORT', True))) and not singleton:
+    if is_local_special(host_params[0], int(host_params[1])) and not singleton:
         import bb.utils
         cachedir = (d.getVar("PERSISTENT_DIR", True) or d.getVar("CACHE", True))
         if not cachedir:
@@ -285,8 +292,8 @@ def auto_start(d):
     if singleton:
         host, port = singleton.getinfo()
     else:
-        host = d.getVar('PRSERV_HOST', True)
-        port = int(d.getVar('PRSERV_PORT', True))
+        host = host_params[0]
+        port = int(host_params[1])
 
     try:
         return PRServerConnection(host,port).ping()
Signature · 7 lines
1.7.11.7


_______________________________________________
bitbake-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/bitbake-devel
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#2 lore raw

PATCH 1/1 prservice.py: fix NameError: global name 'host' is not defined

* http://git.openembedded.org/openembedded-core/commit/?id=e00f49de8b1f79c3e07b887d257bd75a46052fa0
removed host and port variables

---
 meta/lib/oe/prservice.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oe/prservice.py +1 -1
index 57fb39a..27883a7 100644
@@ -10,7 +10,7 @@ def prserv_make_conn(d, check = False):
                 raise Exception('service not available')
         d.setVar("__PRSERV_CONN",conn)
     except Exception, exc:
-        bb.fatal("Connecting to PR service %s:%s failed: %s" % (host, port, str(exc)))
+        bb.fatal("Connecting to PR service %s:%s failed: %s" % (host_params[0], host_params[1], str(exc)))
 
     return conn
 
Signature · 1 line
1.8.1.1