diff options
Diffstat (limited to 'scripts/buildhistory-collect-srcrevs')
-rwxr-xr-x | scripts/buildhistory-collect-srcrevs | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/scripts/buildhistory-collect-srcrevs b/scripts/buildhistory-collect-srcrevs index 58a2708032..f3eb76bd0d 100755 --- a/scripts/buildhistory-collect-srcrevs +++ b/scripts/buildhistory-collect-srcrevs | |||
@@ -18,7 +18,9 @@ | |||
18 | # with this program; if not, write to the Free Software Foundation, Inc., | 18 | # with this program; if not, write to the Free Software Foundation, Inc., |
19 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 19 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
20 | 20 | ||
21 | import os, sys | 21 | import collections |
22 | import os | ||
23 | import sys | ||
22 | import optparse | 24 | import optparse |
23 | import logging | 25 | import logging |
24 | 26 | ||
@@ -65,16 +67,13 @@ def main(): | |||
65 | else: | 67 | else: |
66 | forcevariable = '' | 68 | forcevariable = '' |
67 | 69 | ||
68 | lastdir = '' | 70 | all_srcrevs = collections.defaultdict(list) |
69 | for root, dirs, files in os.walk(options.buildhistory_dir): | 71 | for root, dirs, files in os.walk(options.buildhistory_dir): |
70 | if '.git' in dirs: | 72 | if '.git' in dirs: |
71 | dirs.remove('.git') | 73 | dirs.remove('.git') |
72 | for fn in files: | 74 | for fn in files: |
73 | if fn == 'latest_srcrev': | 75 | if fn == 'latest_srcrev': |
74 | curdir = os.path.basename(os.path.dirname(root)) | 76 | curdir = os.path.basename(os.path.dirname(root)) |
75 | if lastdir != curdir: | ||
76 | print('# %s' % curdir) | ||
77 | lastdir = curdir | ||
78 | fullpath = os.path.join(root, fn) | 77 | fullpath = os.path.join(root, fn) |
79 | pn = os.path.basename(root) | 78 | pn = os.path.basename(root) |
80 | srcrev = None | 79 | srcrev = None |
@@ -98,11 +97,20 @@ def main(): | |||
98 | name = splitval[0].split('_')[1].strip() | 97 | name = splitval[0].split('_')[1].strip() |
99 | srcrevs[name] = value | 98 | srcrevs[name] = value |
100 | if srcrev and (options.reportall or srcrev != orig_srcrev): | 99 | if srcrev and (options.reportall or srcrev != orig_srcrev): |
101 | print('SRCREV_pn-%s%s = "%s"' % (pn, forcevariable, srcrev)) | 100 | all_srcrevs[curdir].append((pn, None, srcrev)) |
102 | for name, value in srcrevs.items(): | 101 | for name, value in srcrevs.items(): |
103 | orig = orig_srcrevs.get(name, orig_srcrev) | 102 | orig = orig_srcrevs.get(name, orig_srcrev) |
104 | if options.reportall or value != orig: | 103 | if options.reportall or value != orig: |
105 | print('SRCREV_%s_pn-%s%s = "%s"' % (name, pn, forcevariable, value)) | 104 | all_srcrevs[curdir].append((pn, name, srcrev)) |
105 | |||
106 | for curdir, srcrevs in sorted(all_srcrevs.iteritems()): | ||
107 | if srcrevs: | ||
108 | print('# %s' % curdir) | ||
109 | for pn, name, srcrev in srcrevs: | ||
110 | if name: | ||
111 | print('SRCREV_%s_pn-%s%s = "%s"' % (name, pn, forcevariable, srcrev)) | ||
112 | else: | ||
113 | print('SRCREV_pn-%s%s = "%s"' % (pn, forcevariable, srcrev)) | ||
106 | 114 | ||
107 | 115 | ||
108 | if __name__ == "__main__": | 116 | if __name__ == "__main__": |