2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2025-01-05 07:56:59 +01:00

Netcache example update

This commit is contained in:
Thomas Nagy 2016-08-21 17:10:17 +02:00
parent e169da4227
commit a4f6c7468d
No known key found for this signature in database
GPG Key ID: 49B4C67C05277AAA
5 changed files with 38 additions and 9 deletions

View File

@ -1,5 +1,6 @@
// Thomas Nagy, 2011
// TODO security
// TODO handle all exceptions properly
import java.util.HashMap;

View File

@ -0,0 +1,4 @@
int main() {
return 0;
}

View File

@ -0,0 +1,3 @@
int foo() {
return 45;
}

View File

@ -1,24 +1,40 @@
#! /usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2012 (ita)
# Thomas Nagy, 2006-2016 (ita)
#
# The Waf network cache consists of a client
# (waflib/extras/netcache_client.py) and a simple
# tcp server that provides a way to share build
# files over a a network.
#
# There are no restrictions to the use of the cache
# at this point, so use with a firewall!
#
#
# The Java server can be run in the current folder using:
# rm -rf /tmp/wafcache/; javac Netcache.java && java Netcache
#
# Then run the example and compare the outputs:
# waf configure clean build --zones=netcache
# waf configure clean build --zones=netcache
#
# A test script for the network cache
APPNAME='cc_test'
APPNAME='netcache_test'
top = '.'
out = 'build'
def options(opt):
#opt.tool_options('compiler_c')
#opt.load('compiler_c')
pass
def configure(conf):
#conf.check_tool('compiler_c')
conf.check_tool('gcc')
conf.check_tool('netcache_client')
#conf.load('compiler_c')
conf.load('gcc')
#conf.load('netcache_client')
def build(bld):
bld.load('netcache_client')
bld(
features = 'c cprogram',
source = 'main.c',

View File

@ -214,12 +214,16 @@ def can_retrieve_cache(self):
p = node.abspath()
recv_file(conn, ssig, cnt, p)
cnt += 1
else:
Logs.debug('netcache: obtained %r from cache', self.outputs)
except MissingFile as e:
Logs.debug('netcache: file is not in the cache %r', e)
err = True
except Exception as e:
Logs.debug('netcache: could not get the files %r', e)
Logs.debug('netcache: could not get the files %r', self.outputs)
if Logs.verbose > 1:
Logs.debug('netcache: exception %r', e)
err = True
# broken connection? remove this one
@ -258,6 +262,7 @@ def put_files_cache(self):
if not conn:
conn = get_connection(push=True)
sock_send(conn, ssig, cnt, node.abspath())
Logs.debug('netcache: sent %r', node)
except Exception as e:
Logs.debug('netcache: could not push the files %r', e)