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
|
#!/usr/bin/env python
# SPDX-License-Identifier: GPL-2.0-or-later
# vim: set ts=4 sw=4 et:
#
# Copyright (c) 2015 Intel Corporation
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
import os
import logging as log
from logging import debug as D
from logging import info as I
from logging import warning as W
from logging import error as E
from logging import critical as C
import sys
from errors import *
from utils.git import Git
from utils.bitbake import *
class BuildHistory(object):
def __init__(self, bb, pn, workdir):
self.bb = bb
self.pn = pn
self.workdir = workdir
def init(self, machines):
for machine in machines:
try:
self.bb.complete(self.pn, machine)
except Error as e:
for line in e.stdout.split("\n") + e.stderr.split("\n"):
# version going backwards is not a real error
if re.match(".* went backwards which would break package feeds .*", line):
break
else:
raise e
def diff(self):
try:
cmd = "buildhistory-diff"
stdout, stderr = bb.process.run(cmd)
if stdout and os.path.exists(self.workdir):
with open(os.path.join(self.workdir, "buildhistory-diff.txt"),
"w+") as log:
log.write(stdout)
cmd_full = "buildhistory-diff -a"
stdout, stderr = bb.process.run(cmd_full)
if stdout and os.path.exists(self.workdir):
with open(os.path.join(self.workdir, "buildhistory-diff-full.txt"),
"w+") as log:
log.write(stdout)
except bb.process.ExecutionError as e:
W( "%s: Buildhistory checking fails\n%s" % (self.pn, e.stdout))
|