diff options
author | Florian Weimer <fweimer@redhat.com> | 2020-02-28 12:32:28 +0100 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2020-03-03 07:39:16 +0100 |
commit | c592721a5b88806ecdf840269d4e27c17cef47d7 (patch) | |
tree | ac5b55d5e4a78292f9d11014ca807ccab700aadc | |
parent | 542160f0b6a7c26758c9575a8876f6624a5dd65f (diff) | |
download | glibc-c592721a5b88806ecdf840269d4e27c17cef47d7.tar.gz glibc-c592721a5b88806ecdf840269d4e27c17cef47d7.tar.xz glibc-c592721a5b88806ecdf840269d4e27c17cef47d7.zip |
build-many-glibcs.py: Add --shallow option
The history is not used by build-many-glibcs.py itself. --replace-sources deletes an existing source tree before switching the version. But some users prefer to have the full history available, therefore make shallow clones optional with the --shallow option.
-rwxr-xr-x | scripts/build-many-glibcs.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py index 6add364720..c822f3b588 100755 --- a/scripts/build-many-glibcs.py +++ b/scripts/build-many-glibcs.py @@ -80,7 +80,7 @@ class Context(object): """The global state associated with builds in a given directory.""" def __init__(self, topdir, parallelism, keep, replace_sources, strip, - full_gcc, action): + full_gcc, action, shallow=False): """Initialize the context.""" self.topdir = topdir self.parallelism = parallelism @@ -88,6 +88,7 @@ class Context(object): self.replace_sources = replace_sources self.strip = strip self.full_gcc = full_gcc + self.shallow = shallow self.srcdir = os.path.join(topdir, 'src') self.versions_json = os.path.join(self.srcdir, 'versions.json') self.build_state_json = os.path.join(topdir, 'build-state.json') @@ -852,7 +853,12 @@ class Context(object): subprocess.run(['git', 'pull', '-q'], cwd=self.component_srcdir(component), check=True) else: - subprocess.run(['git', 'clone', '-q', '-b', git_branch, git_url, + if self.shallow: + depth_arg = ('--depth', '1') + else: + depth_arg = () + subprocess.run(['git', 'clone', '-q', '-b', git_branch, + *depth_arg, git_url, self.component_srcdir(component)], check=True) r = subprocess.run(['git', 'rev-parse', 'HEAD'], cwd=self.component_srcdir(component), @@ -1771,6 +1777,8 @@ def get_parser(): help='Strip installed glibc libraries') parser.add_argument('--full-gcc', action='store_true', help='Build GCC with all languages and libsanitizer') + parser.add_argument('--shallow', action='store_true', + help='Do not download Git history during checkout') parser.add_argument('topdir', help='Toplevel working directory') parser.add_argument('action', @@ -1790,7 +1798,8 @@ def main(argv): opts = parser.parse_args(argv) topdir = os.path.abspath(opts.topdir) ctx = Context(topdir, opts.parallelism, opts.keep, opts.replace_sources, - opts.strip, opts.full_gcc, opts.action) + opts.strip, opts.full_gcc, opts.action, + shallow=opts.shallow) ctx.run_builds(opts.action, opts.configs) |