On 12/01/2009 03:39 AM, Marian Csontos wrote:
On 11/30/2009 09:42 PM, Bill Peck wrote:
>
> Hi Marian,
>
> I thought I'd mention that I stumbled across freeze for python. It
> allows you to compile python code into a native binary.
>
> python26 ../freeze/freeze.py -X PyDOC /usr/bin/beah-beaker-backend -m
> encodings -m encodings.hex_codec -m encodings.ascii
>
> I had to add the encodings since freeze didn't figure it out
> automatically.
>
> I also had to edit the config.c file that it generated. It
> improperly puts in a _warnings entry which is incorrect.
>
> After that I was able to compile the code with a simple make.
>
> [root@dell-pe1850-01 beah-beaker-backend]# eu-readelf -d
> beah-beaker-backend |more
>
> Dynamic segment contains 29 entries:
> Addr: 0x08390684 Offset: 0x348684 Link to section: [ 5] '.dynstr'
> Type Value
> NEEDED Shared library: [libpthread.so.0]
> NEEDED Shared library: [libdl.so.2]
> NEEDED Shared library: [libutil.so.1]
> NEEDED Shared library: [libm.so.6]
> NEEDED Shared library: [libc.so.6]
> INIT 0x08057f58
> FINI 0x0813738c
> HASH 0x08048148
> STRTAB 0x080504d0
> SYMTAB 0x0804a880
> STRSZ 24862 (bytes)
> SYMENT 16 (bytes)
> DEBUG
>
> As you can see its only linking against glibc and some other standard
> libraries. Everything else is static.
>
> [root@dell-pe1850-01 beah-beaker-backend]# ls -lh beah-beaker-backend
> -rwxr-xr-x 1 root root 3.5M Nov 30 15:28
> beah-beaker-backend
>
> [root@dell-pe1850-01 beah-beaker-backend]# ./beah-beaker-backend
> /usr/lib/python2.6/site-packages/twisted/spread/pb.py:30:
> DeprecationWarning: the md5 module is deprecated; use hashlib instead
> import md5
> BackendFactory : Started to connect.
> BackendFactory : Connected. Address:
> <twisted.internet.address.IPv4Address object at 0xb6f4804c>
> BackendFactory : Resetting reconnection delay
> start <function callRemote at
> 0xb6f42d84>(*(<beah.backends.beakerlc.LoggingProxy instance at
> 0xb6f480ac>, 'get_recipe',
'dell-pe1850-01.rhts.eng.bos.redhat.com'),
> **{}) {
>
> } <function callRemote at 0xb6f42d84> returned <Deferred at 0xb6f4812cL>
>
> XML-RPC call get_recipe failed: [Failure instance: Traceback: <class
> 'xmlrpclib.Fault'>: <Fault 1:
"beaker.server.bexceptions.BX:'No
> active recipe for dell-pe1850-01.rhts.eng.bos.redhat.com'">
> /usr/lib/python2.6/site-packages/twisted/protocols/basic.py:239:dataReceived
>
> /usr/lib/python2.6/site-packages/twisted/web/http.py:467:rawDataReceived
> /usr/lib/python2.6/site-packages/twisted/web/http.py:430:handleResponseEnd
>
> /usr/lib/python2.6/site-packages/twisted/web/xmlrpc.py:279:handleResponse
>
> --- <exception caught here> ---
> /usr/lib/python2.6/site-packages/twisted/web/xmlrpc.py:307:parseResponse
> /usr/lib/python2.6/xmlrpclib.py:1184:loads
> /usr/lib/python2.6/xmlrpclib.py:838:close
> ]
> original call:
> get_recipe(*('dell-pe1850-01.rhts.eng.bos.redhat.com',), **{})
>
> The traceback is expected since we don't have an active recipe for
> this host.
>
> I think it would make sense to build the harness this way so we don't
> interfere with whats on the host. :-)
>
> What do you think?
I think it is brilliant idea.
Thanks for helping me out of python packaging. ;-)
-- Marian
So it turns out freeze doesn't freeze as much as I thought. When
copying the binary to another machine it didn't work. python is
compiled by default with lots of shared modules, so I tried recompiling
it statically and that got me a little further but then all the
additional libraries are built shared (ssl, xml, etc..)
So I don't think its worth the effort. At least not right now.
I'll stick to just having all the support rpms built for now.