diff options
Diffstat (limited to 'scripts/buildhistory-collect-srcrevs')
-rwxr-xr-x | scripts/buildhistory-collect-srcrevs | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/scripts/buildhistory-collect-srcrevs b/scripts/buildhistory-collect-srcrevs index 58a2708032..c937e49c2a 100755 --- a/scripts/buildhistory-collect-srcrevs +++ b/scripts/buildhistory-collect-srcrevs @@ -1,24 +1,16 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Collects the recorded SRCREV values from buildhistory and reports on them # # Copyright 2013 Intel Corporation # Authored-by: Paul Eggleton <paul.eggleton@intel.com> # -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as -# published by the Free Software Foundation. +# SPDX-License-Identifier: GPL-2.0-only # -# 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, sys +import collections +import os +import sys import optparse import logging @@ -61,20 +53,18 @@ def main(): sys.exit(1) if options.forcevariable: - forcevariable = '_forcevariable' + forcevariable = ':forcevariable' else: forcevariable = '' - lastdir = '' + all_srcrevs = collections.defaultdict(list) for root, dirs, files in os.walk(options.buildhistory_dir): + dirs.sort() if '.git' in dirs: dirs.remove('.git') for fn in files: if fn == 'latest_srcrev': curdir = os.path.basename(os.path.dirname(root)) - if lastdir != curdir: - print('# %s' % curdir) - lastdir = curdir fullpath = os.path.join(root, fn) pn = os.path.basename(root) srcrev = None @@ -98,11 +88,20 @@ def main(): name = splitval[0].split('_')[1].strip() srcrevs[name] = value if srcrev and (options.reportall or srcrev != orig_srcrev): - print('SRCREV_pn-%s%s = "%s"' % (pn, forcevariable, srcrev)) + all_srcrevs[curdir].append((pn, None, srcrev)) for name, value in srcrevs.items(): orig = orig_srcrevs.get(name, orig_srcrev) if options.reportall or value != orig: - print('SRCREV_%s_pn-%s%s = "%s"' % (name, pn, forcevariable, value)) + all_srcrevs[curdir].append((pn, name, value)) + + for curdir, srcrevs in sorted(all_srcrevs.items()): + if srcrevs: + print('# %s' % curdir) + for pn, name, srcrev in srcrevs: + if name: + print('SRCREV_%s:pn-%s%s = "%s"' % (name, pn, forcevariable, srcrev)) + else: + print('SRCREV:pn-%s%s = "%s"' % (pn, forcevariable, srcrev)) if __name__ == "__main__": |