bitbake: prserv/serv: Use with while reading pidfile
PATCH 2/2 bitbake-layers: Keep loglevel in colored logger
In reply to Ola x Nilsson--- bin/bitbake-layers | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
bin/bitbake-layers +3 -1
@@ -52,7 +52,9 @@ def main(): # Need to re-run logger_create with color argument # (will be the same logger since it has the same name) - bb.msg.logger_create('bitbake-layers', output=sys.stdout, color=global_args.color) + bb.msg.logger_create('bitbake-layers', output=sys.stdout, + color=global_args.color, + level=logger.getEffectiveLevel()) plugins = [] tinfoil = bb.tinfoil.Tinfoil(tracking=True)
Signature · 1 line
2.11.0
PATCH 1/2 bitbake: prserv/serv: Use with while reading pidfile
--- lib/prserv/serv.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
lib/prserv/serv.py +2 -3
@@ -353,9 +353,8 @@ def start_daemon(dbfile, host, port, logfile): ip = socket.gethostbyname(host) pidfile = PIDPREFIX % (ip, port) try: - pf = open(pidfile,'r') - pid = int(pf.readline().strip()) - pf.close() + with open(pidfile) as pf: + pid = int(pf.readline().strip()) except IOError: pid = None
Signature · 1 line
2.11.0
Quoted 30 lines
-----Original Message-----
From: [email protected] <bitbake-devel- [email protected]> On Behalf Of Ola x Nilsson
Sent: den 20 december 2019 15:23
To: [email protected]
Subject: [bitbake-devel] [PATCH 1/2] bitbake: prserv/serv: Use with while reading pidfileSigned-off-by Ola x Nilsson <[email protected]>--- lib/prserv/serv.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)lib/prserv/serv.py +2
-4@@ -353,9 +353,8 @@ def start_daemon(dbfile, host, port, logfile): ip = socket.gethostbyname(host) pidfile = PIDPREFIX % (ip, port) try: - pf = open(pidfile,'r') - pid = int(pf.readline().strip()) - pf.close() + with open(pidfile) as pf: + pid = int(pf.readline().strip()) except IOError: pid = None --
Quoted 1 line
2.11.0
This only half the patch. Please add the following:
@@ -292,10 +292,9 @@ class PRServer(SimpleXMLRPCServer):
logger.addHandler(streamhandler)
# write pidfile
- pid = str(os.getpid())
- pf = open(self.pidfile, 'w')
- pf.write("%s\n" % pid)
- pf.close()
+ pid = str(os.getpid())
+ with open(self.pidfile, 'w') as pf:+ pf.write("%s\n" % pid)
self.work_forever()
self.delpid()
//Peter
Quoted 40 lines · Peter Kjellerstedt
Quoted 31 lines
-----Original Message-----
From: [email protected] <bitbake-devel- [email protected]> On Behalf Of Ola x Nilsson
Sent: den 20 december 2019 15:23
To: [email protected]
Subject: [bitbake-devel] [PATCH 1/2] bitbake: prserv/serv: Use with while
reading pidfileSigned-off-by Ola x Nilsson <[email protected]>--- lib/prserv/serv.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)lib/prserv/serv.py +2
-4@@ -353,9 +353,8 @@ def start_daemon(dbfile, host, port, logfile): ip = socket.gethostbyname(host) pidfile = PIDPREFIX % (ip, port) try: - pf = open(pidfile,'r') - pid = int(pf.readline().strip()) - pf.close() + with open(pidfile) as pf: + pid = int(pf.readline().strip()) except IOError: pid = None --Quoted 1 line
2.11.0
This only half the patch. Please add the following:
(quoted diff) +0
-0@@ -292,10 +292,9 @@ class PRServer(SimpleXMLRPCServer): logger.addHandler(streamhandler) # write pidfile
Review class PRServer(SimpleXMLRPCServer): · line 300
Quoted 10 lines
(quoted diff) +3
-4- pid = str(os.getpid()) - pf = open(self.pidfile, 'w') - pf.write("%s\n" % pid) - pf.close() + pid = str(os.getpid()) + with open(self.pidfile, 'w') as pf: + pf.write("%s\n" % pid) self.work_forever() self.delpid()
I've handled this but asking me to manually merge hunks of patches together before applying them seems a little potentially error prone?
Cheers,
Richard
Quoted 63 lines
-----Original Message-----
From: Richard Purdie <[email protected]>
Sent: den 30 december 2019 12:00
To: Peter Kjellerstedt <[email protected]>; Ola x Nilsson <[email protected]>; [email protected]
Subject: Re: [bitbake-devel] [PATCH 1/2] bitbake: prserv/serv: Use with while reading pidfileQuoted 40 lines · Peter Kjellerstedt
Quoted 31 lines
-----Original Message-----
From: [email protected] <bitbake-devel- [email protected]> On Behalf Of Ola x Nilsson
Sent: den 20 december 2019 15:23
To: [email protected]
Subject: [bitbake-devel] [PATCH 1/2] bitbake: prserv/serv: Use with while
reading pidfileSigned-off-by Ola x Nilsson <[email protected]>--- lib/prserv/serv.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)lib/prserv/serv.py +2
-4@@ -353,9 +353,8 @@ def start_daemon(dbfile, host, port, logfile): ip = socket.gethostbyname(host) pidfile = PIDPREFIX % (ip, port) try: - pf = open(pidfile,'r') - pid = int(pf.readline().strip()) - pf.close() + with open(pidfile) as pf: + pid = int(pf.readline().strip()) except IOError: pid = None --Quoted 1 line
2.11.0
This only half the patch. Please add the following:
(quoted diff) +0
-0@@ -292,10 +292,9 @@ class PRServer(SimpleXMLRPCServer): logger.addHandler(streamhandler) # write pidfileReview class PRServer(SimpleXMLRPCServer): · line 300
Quoted 10 lines
(quoted diff) +3
-4- pid = str(os.getpid()) - pf = open(self.pidfile, 'w') - pf.write("%s\n" % pid) - pf.close() + pid = str(os.getpid()) + with open(self.pidfile, 'w') as pf: + pf.write("%s\n" % pid) self.work_forever() self.delpid()I've handled this but asking me to manually merge hunks of patches together before applying them seems a little potentially error prone?
Quoted 3 lines
Cheers,
Richard
Well, I mainly meant for Ola to send an updated patch with both hunks, but I guess I should have stated that in my response. Anyway, thanks for taking care of it.
//Peter