FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora Build System

 
 
LinkBack Thread Tools
 
Old 05-11-2008, 04:51 PM
Enrico Scholz
 
Default Make logging line-buffered

Current output processing reads data and puts them to logging without
taking care about eol. This produces ugly and unreadable output like

| checking whether to enable maintainer-specific portions of Makefiles...
| no
| checking build system type...
| i386-redhat-linux-gnu

Patch reads output into a buffer which is given to logging after a
newline.

Signed-off-by: Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
---
py/mock/util.py | 46 +++++++++++++++++++++++++++++++++++-----------
1 files changed, 35 insertions(+), 11 deletions(-)

diff --git a/py/mock/util.py b/py/mock/util.py
index 9f0eb3a..6e3d88e 100644
--- a/py/mock/util.py
+++ b/py/mock/util.py
@@ -225,33 +225,57 @@ def condPersonality(per=None):
def logOutput(fds, logger, returnOutput=1, start=0, timeout=0):
output=""
done = 0
+ input = {}

# set all fds to nonblocking
for fd in fds:
+ input[fd] = '
flags = fcntl.fcntl(fd, fcntl.F_GETFL)
if not fd.closed:
fcntl.fcntl(fd, fcntl.F_SETFL, flags| os.O_NONBLOCK)

while not done:
- if (time.time() - start)>timeout and timeout!=0:
+ if timeout!=0 and (time.time() - start)>timeout:
done = 1
break

- i_rdy,o_rdy,e_rdy = select.select(fds,[],[],1)
+ i_rdy,o_rdy,e_rdy = select.select(fds,[],[],1)
for s in i_rdy:
# slurp as much input as is ready
- input = s.read()
- if input == "":
+ inp = s.read()
+ if inp == "":
done = 1
break
- if logger is not None:
- for line in input.split("
"):
- if line == ': continue
- logger.debug(chomp(line))
- for h in logger.handlers:
- h.flush()
+
if returnOutput:
- output += input
+ output += inp
+
+ if logger is None:
+ continue
+
+ assert('
' not in input[s])
+ input[s] += inp
+ if '
' not in inp:
+ continue
+
+ lines = input[s].split("
")
+ input[s] = lines[len(lines)-1]
+ del lines[len(lines)-1]
+
+ for line in lines:
+ if line == ': continue
+ logger.debug(chomp(line))
+ for h in logger.handlers:
+ h.flush()
+
+ if logger is not None:
+ for fd in fds:
+ if input[s]==': continue
+ logger.debug(chomp(input[s]))
+
+ for h in logger.handlers:
+ h.flush()
+
return output

# logger =
--
1.5.4.1

--
Fedora-buildsys-list mailing list
Fedora-buildsys-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-buildsys-list
 

Thread Tools




All times are GMT. The time now is 08:07 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org