forked from Bioconductor/BBS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BBS-make-BUILD_STATUS_DB.py
executable file
·100 lines (91 loc) · 3.75 KB
/
BBS-make-BUILD_STATUS_DB.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/usr/bin/env python3
##############################################################################
###
### This file is part of the BBS software (Bioconductor Build System).
###
### Author: Hervé Pagès <[email protected]>
### Last modification: Nov 22, 2023
###
import sys
import os
import time
import bbs.parse
import BBSutils
import BBSvars
import BBSreportutils
def _read_status_from_summary_file(pkg, node_id, stage):
summary_file = '%s.%s-summary.dcf' % (pkg, stage)
summary_path = os.path.join('products-in', node_id, stage, summary_file)
try:
summary = bbs.parse.parse_DCF(summary_path, merge_records=True)
except FileNotFoundError:
status = 'NA'
else:
status = summary['Status']
return status
def _write_status_to_BUILD_STATUS_DB(out, pkg, node_id, stage, status):
out.write('%s#%s#%s: %s\n' % (pkg, node_id, stage, status))
return
def _write_pkg_results_to_BUILD_STATUS_DB(pkg, out):
for node in BBSreportutils.supported_nodes(pkg):
# INSTALL status
if BBSvars.buildtype != 'bioc-longtests':
stage = 'install'
status = _read_status_from_summary_file(pkg, node.node_id, stage)
_write_status_to_BUILD_STATUS_DB(out, pkg, node.node_id, stage,
status)
# BUILD status
stage = 'buildsrc'
status = _read_status_from_summary_file(pkg, node.node_id, stage)
_write_status_to_BUILD_STATUS_DB(out, pkg, node.node_id, stage,
status)
skipped_is_OK = status in ['TIMEOUT', 'ERROR']
# CHECK status
if BBSvars.buildtype != 'workflows':
stage = 'checksrc'
if skipped_is_OK:
status = 'skipped'
else:
status = _read_status_from_summary_file(pkg, node.node_id,
stage)
_write_status_to_BUILD_STATUS_DB(out, pkg, node.node_id, stage,
status)
# BUILD BIN status
if BBSreportutils.is_doing_buildbin(node):
stage = 'buildbin'
if skipped_is_OK:
status = 'skipped'
else:
status = _read_status_from_summary_file(pkg, node.node_id,
stage)
_write_status_to_BUILD_STATUS_DB(out, pkg, node.node_id, stage,
status)
return
def make_BUILD_STATUS_DB(pkgs):
print('BBS> Writing %s ...' % BBSreportutils.BUILD_STATUS_DB_file, end=' ')
sys.stdout.flush()
out = open(BBSreportutils.BUILD_STATUS_DB_file, 'w')
for pkg in pkgs:
_write_pkg_results_to_BUILD_STATUS_DB(pkg, out)
out.close()
print('OK')
return
##############################################################################
### MAIN SECTION
##############################################################################
if __name__ == "__main__":
print()
if not os.path.isdir('products-in'):
print('mmh.. I don\'t see the \'products-in\' subdirectory ' + \
'in the current directory!')
print('Make sure to be in \'%s/\' ' % BBSvars.Central_rdir.path)
print('before running the BBS-make-BUILD_STATUS_DB.py script.')
sys.exit('=> EXIT.')
print('BBS> ==============================================================')
print('BBS> [stage6a] STARTING stage6a on %s...' % time.asctime())
sys.stdout.flush()
report_nodes = BBSutils.getenv('BBS_REPORT_NODES')
BBSreportutils.set_NODES(report_nodes)
pkgs = bbs.parse.get_meat_packages(BBSutils.meat_index_file)
make_BUILD_STATUS_DB(pkgs)
print('BBS> [stage6a] DONE on %s.' % time.asctime())