diff options
Diffstat (limited to 'scripts/buildhistory-collect-srcrevs')
-rwxr-xr-x | scripts/buildhistory-collect-srcrevs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/scripts/buildhistory-collect-srcrevs b/scripts/buildhistory-collect-srcrevs index 7f65c90376..58a2708032 100755 --- a/scripts/buildhistory-collect-srcrevs +++ b/scripts/buildhistory-collect-srcrevs | |||
@@ -34,8 +34,9 @@ logger = logger_create() | |||
34 | 34 | ||
35 | def main(): | 35 | def main(): |
36 | parser = optparse.OptionParser( | 36 | parser = optparse.OptionParser( |
37 | description = "Collects the recorded SRCREV values from buildhistory and reports on them.", | ||
37 | usage = """ | 38 | usage = """ |
38 | %prog [options] <buildhistory-dir>""") | 39 | %prog [options]""") |
39 | 40 | ||
40 | parser.add_option("-a", "--report-all", | 41 | parser.add_option("-a", "--report-all", |
41 | help = "Report all SRCREV values, not just ones where AUTOREV has been used", | 42 | help = "Report all SRCREV values, not just ones where AUTOREV has been used", |
@@ -43,16 +44,20 @@ def main(): | |||
43 | parser.add_option("-f", "--forcevariable", | 44 | parser.add_option("-f", "--forcevariable", |
44 | help = "Use forcevariable override for all output lines", | 45 | help = "Use forcevariable override for all output lines", |
45 | action="store_true", dest="forcevariable") | 46 | action="store_true", dest="forcevariable") |
47 | parser.add_option("-p", "--buildhistory-dir", | ||
48 | help = "Specify path to buildhistory directory (defaults to buildhistory/ under cwd)", | ||
49 | action="store", dest="buildhistory_dir", default='buildhistory/') | ||
46 | 50 | ||
47 | options, args = parser.parse_args(sys.argv) | 51 | options, args = parser.parse_args(sys.argv) |
48 | 52 | ||
49 | if len(args) != 2: | 53 | if len(args) > 1: |
54 | sys.stderr.write('Invalid argument(s) specified: %s\n\n' % ' '.join(args[1:])) | ||
50 | parser.print_help() | 55 | parser.print_help() |
51 | sys.exit(1) | 56 | sys.exit(1) |
52 | 57 | ||
53 | buildhistory_dir = args[1] | 58 | if not os.path.exists(options.buildhistory_dir): |
54 | if not os.path.exists(buildhistory_dir): | 59 | sys.stderr.write('Buildhistory directory "%s" does not exist\n\n' % options.buildhistory_dir) |
55 | logger.error('specified buildhistory path %s could not be found' % buildhistory_dir) | 60 | parser.print_help() |
56 | sys.exit(1) | 61 | sys.exit(1) |
57 | 62 | ||
58 | if options.forcevariable: | 63 | if options.forcevariable: |
@@ -61,7 +66,7 @@ def main(): | |||
61 | forcevariable = '' | 66 | forcevariable = '' |
62 | 67 | ||
63 | lastdir = '' | 68 | lastdir = '' |
64 | for root, dirs, files in os.walk(buildhistory_dir): | 69 | for root, dirs, files in os.walk(options.buildhistory_dir): |
65 | if '.git' in dirs: | 70 | if '.git' in dirs: |
66 | dirs.remove('.git') | 71 | dirs.remove('.git') |
67 | for fn in files: | 72 | for fn in files: |