@@ -179,6 +179,7 @@ if __name__ == '__main__':
dest='git_repo', default='../kernel',
help=('git repository from which to read commit logs '
'(default: ../kernel)'),
+ type=kernel_sec.branch.check_git_repo,
metavar='DIRECTORY')
parser.add_argument('--remote-name',
dest='remote_name', action='append', default=[],
@@ -219,3 +219,14 @@ def get_remotes(mappings, mainline=None, stable=None):
if stable:
remotes['stable']['git_name'] = stable
return remotes
+
+
+def check_git_repo(git_repo):
+ import argparse
+ if not os.path.isdir(git_repo):
+ msg = "directory %r not present" % git_repo
+ raise argparse.ArgumentTypeError(msg)
+ if not os.path.isdir(os.path.join(git_repo, '.git')):
+ msg = "directory %r is not a git repository" % git_repo
+ raise argparse.ArgumentTypeError(msg)
+ return git_repo
@@ -72,6 +72,7 @@ if __name__ == '__main__':
dest='git_repo', default='../kernel',
help=('git repository from which to read commit logs '
'(default: ../kernel)'),
+ type=kernel_sec.branch.check_git_repo,
metavar='DIRECTORY')
parser.add_argument('--remote-name',
dest='remote_name', action='append', default=[],
@@ -202,6 +202,7 @@ if __name__ == '__main__':
dest='git_repo', default='../kernel',
help=('git repository from which to read commit logs '
'(default: ../kernel)'),
+ type=kernel_sec.branch.check_git_repo,
metavar='DIRECTORY')
parser.add_argument('--remote-name',
dest='remote_name', action='append', default=[],
Users are required to prepare a local git repository, by default "../kernel", however there is no check at the moment. Alternatively, we could also create a repository for them (mkdir ../kernel; git init .) but that for now let's just spit an error. Signed-off-by: Daniel Sangorrin <daniel.sangorrin@toshiba.co.jp> --- scripts/import_stable.py | 1 + scripts/kernel_sec/branch.py | 11 +++++++++++ scripts/report_affected.py | 1 + scripts/webview.py | 1 + 4 files changed, 14 insertions(+)