2 # utility functions to support the build farm
3 # Copyright (C) tridge@samba.org, 2001
4 # Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2010
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 """load a list from a file, using : to separate"""
28 for l in f.readlines():
38 def FileLoad(filename):
39 """read a file into a string"""
40 f = open(filename, 'r')
46 def SambaWebFileLoad(webdir, filename):
47 """loads file and changes the links to suit buildfarm"""
49 f = open(os.path.join(webdir, filename), 'r')
55 def add_virtual_headers(m):
57 f = open(os.path.join(webdir, m.group(1)), 'r')
64 text = re.sub('<!--#include virtual="/samba/(.*)" -->',add_virtual_headers , text)
65 text = re.sub('href="/samba', 'href="http://www.samba.org/samba', text)
69 """display a time as days, hours, minutes"""
70 days = int(sec / (60*60*24));
71 hour = int(sec / (60*60)) % 24;
72 min = int(sec / 60) % 60;
78 return "%dd %dh %dm" % (days, hour, min)
80 return "%dh %dm" % (hour, min)