diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-04-10 14:27:51 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-04-10 14:27:51 +0000 |
commit | 629f6511c5a49f56689ba18053d8cf8ff91a8829 (patch) | |
tree | 4393e565bfa4ba3117ac3ed74fabacd54e3366db /pre_commit | |
parent | Adding upstream version 2.11.1. (diff) | |
download | pre-commit-629f6511c5a49f56689ba18053d8cf8ff91a8829.tar.xz pre-commit-629f6511c5a49f56689ba18053d8cf8ff91a8829.zip |
Adding upstream version 2.12.0.upstream/2.12.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | pre_commit/resources/rbenv.tar.gz | bin | 34224 -> 34250 bytes | |||
-rw-r--r-- | pre_commit/resources/ruby-build.tar.gz | bin | 72807 -> 74218 bytes | |||
-rw-r--r-- | pre_commit/resources/ruby-download.tar.gz | bin | 5343 -> 5533 bytes | |||
-rw-r--r-- | pre_commit/xargs.py | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | testing/make-archives (renamed from pre_commit/make_archives.py) | 26 |
5 files changed, 17 insertions, 13 deletions
diff --git a/pre_commit/resources/rbenv.tar.gz b/pre_commit/resources/rbenv.tar.gz Binary files differindex 97ac469..95b5a36 100644 --- a/pre_commit/resources/rbenv.tar.gz +++ b/pre_commit/resources/rbenv.tar.gz diff --git a/pre_commit/resources/ruby-build.tar.gz b/pre_commit/resources/ruby-build.tar.gz Binary files differindex 4412ed4..ef82e2f 100644 --- a/pre_commit/resources/ruby-build.tar.gz +++ b/pre_commit/resources/ruby-build.tar.gz diff --git a/pre_commit/resources/ruby-download.tar.gz b/pre_commit/resources/ruby-download.tar.gz Binary files differindex 7ccfb6c..2e19507 100644 --- a/pre_commit/resources/ruby-download.tar.gz +++ b/pre_commit/resources/ruby-download.tar.gz diff --git a/pre_commit/xargs.py b/pre_commit/xargs.py index 60a057c..6b0fa20 100644 --- a/pre_commit/xargs.py +++ b/pre_commit/xargs.py @@ -145,7 +145,9 @@ def xargs( # this is implementation details but the command gets translated into # full/path/to/cmd.exe /c *cmd cmd_exe = parse_shebang.find_executable('cmd.exe') - _max_length = 8192 - len(cmd_exe) - len(' /c ') + # 1024 is additionally subtracted to give headroom for further + # expansion inside the batch file + _max_length = 8192 - len(cmd_exe) - len(' /c ') - 1024 partitions = partition(cmd, varargs, target_concurrency, _max_length) diff --git a/pre_commit/make_archives.py b/testing/make-archives index d320b83..b2b288c 100644..100755 --- a/pre_commit/make_archives.py +++ b/testing/make-archives @@ -1,14 +1,13 @@ +#!/usr/bin/env python3 import argparse import os.path +import shutil +import subprocess import tarfile +import tempfile from typing import Optional from typing import Sequence -from pre_commit import output -from pre_commit.util import cmd_output_b -from pre_commit.util import rmtree -from pre_commit.util import tmpdir - # This is a script for generating the tarred resources for git repo # dependencies. Currently it's just for "vendoring" ruby support packages. @@ -16,7 +15,7 @@ from pre_commit.util import tmpdir REPOS = ( ('rbenv', 'git://github.com/rbenv/rbenv', '0843745'), - ('ruby-build', 'git://github.com/rbenv/ruby-build', '258455e'), + ('ruby-build', 'git://github.com/rbenv/ruby-build', '500863c'), ( 'ruby-download', 'git://github.com/garnieretienne/rvm-download', @@ -35,18 +34,21 @@ def make_archive(name: str, repo: str, ref: str, destdir: str) -> str: :param text destdir: Directory to place archives in. """ output_path = os.path.join(destdir, f'{name}.tar.gz') - with tmpdir() as tempdir: + with tempfile.TemporaryDirectory() as tmpdir: + # this ensures that the root directory has umask permissions + gitdir = os.path.join(tmpdir, 'root') + # Clone the repository to the temporary directory - cmd_output_b('git', 'clone', repo, tempdir) - cmd_output_b('git', 'checkout', ref, cwd=tempdir) + subprocess.check_call(('git', 'clone', repo, gitdir)) + subprocess.check_call(('git', '-C', gitdir, 'checkout', ref)) # We don't want the '.git' directory # It adds a bunch of size to the archive and we don't use it at # runtime - rmtree(os.path.join(tempdir, '.git')) + shutil.rmtree(os.path.join(gitdir, '.git')) with tarfile.open(output_path, 'w|gz') as tf: - tf.add(tempdir, name) + tf.add(gitdir, name) return output_path @@ -56,7 +58,7 @@ def main(argv: Optional[Sequence[str]] = None) -> int: parser.add_argument('--dest', default='pre_commit/resources') args = parser.parse_args(argv) for archive_name, repo, ref in REPOS: - output.write_line(f'Making {archive_name}.tar.gz for {repo}@{ref}') + print(f'Making {archive_name}.tar.gz for {repo}@{ref}') make_archive(archive_name, repo, ref, args.dest) return 0 |