pld-builder.new: PLD_Builder/buildlogs.py Log compression failure.

Tomasz Wittner twittner w o2.pl
Sob, 25 Lis 2006, 02:15:36 CET


On Fri 24. November 2006 13:10, arekm wrote:
> Author: arekm                        Date: Fri Nov 24 12:10:32 2006 GMT
> Module: pld-builder.new               Tag: HEAD
> ---- Log message:
> Log compression failure.
> 
> ---- Files affected:
> pld-builder.new/PLD_Builder:
>    buildlogs.py (1.14 -> 1.15) 
> 
> ---- Diffs:
> 
> ================================================================
> Index: pld-builder.new/PLD_Builder/buildlogs.py
> diff -u pld-builder.new/PLD_Builder/buildlogs.py:1.14 
pld-builder.new/PLD_Builder/buildlogs.py:1.15
> --- pld-builder.new/PLD_Builder/buildlogs.py:1.14	Thu Dec  9 19:09:03 2004
> +++ pld-builder.new/PLD_Builder/buildlogs.py	Fri Nov 24 13:10:27 2006
> @@ -4,6 +4,7 @@
>  import time
>  import os
>  import re
> +import log
>  
>  from config import config
>  import util
> @@ -22,8 +23,10 @@
>              return
>          name = re.sub(r"\.spec\.log", "", os.path.basename(logfile)) 
+ ".bz2"
>          id = util.uuid()
> -        os.system("bzip2 --best --force < %s > %s" \
> +        ret = os.system("bzip2 --best --force < %s > %s" \
>                      % (logfile, path.buildlogs_queue_dir + id))
> +        if ret:
> +            log.error("bzip2 compression of %s failed; does bzip2 binary 
exist?" % (logfile))
>  
[...]
1. Gdzie pojawi się informacja:
"bzip2 compression of %s failed; does bzip2 binary exist?" ?
Sprawdzałem u siebie i wychodzi, że tylko w logu: spool/log:
#
Sat Nov 25 00:59:50 2006 [ac-athlon]: error: bzip23 compression 
of /home/users/bin_builder/pld-builder.new/spool/builds/1977a33e-e660-4d07-b52c-acaef56c71d
d/trf.spec.log failed; does bzip23 binary exist?
#
a nie w mailach do requestera albo na buildlogs.pld-linux.org (czego bym 
oczekiwał):
#
Sat Nov 25 00:59:52 2006 [all]: notice: sending 
scp://ftpac@ftp.domek.dom/mnt/hda5/srv/ftp/ftp/ac/buildlogs/athlon//trf.bz2
#
trf.bz2 jest zerowej długości.

2. log.error("bzip2 compression of %s failed; does bzip2 binary exist?" % 
(logfile))
Uważam, że /dev/stderr ma pewną przewagę nad /dev/fortune-teller:
#
import popen2
        ret = popen2.Popen3('bzip2 --best --force < ' + logfile + ' > ' + 
path.buildlogs_queue_dir + uuid, True)
        ret.err = ret.childerr.read()
        ret.childerr.close()
        if ret.wait() != 0:
            log.error('bzip2 compression of' + logfile + 'failed with error 
msg.: ' + ret.err)
#
3. id = util.uuid()
$ python
Python 2.4.4 (#1, Oct 25 2006, 19:28:02)
[GCC 3.3.6 (PLD Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print id.__doc__
id(object) -> integer

Return the identity of an object.  This is guaranteed to be unique among
simultaneously existing objects.  (Hint: it's the object's memory address.)
>>> id
<built-in function id>
>>>

`id' jest built-in i przesłanianie go i używanie jako zmiennej jest złe, 
choćby z tego powodu ;), że jest podświetlane tak samo, jak print, if, 
def ... (w emacs/python-mode).

-- 
Tomasz Wittner


Więcej informacji o liście dyskusyjnej pld-devel-pl