Skip to content

Commit dc8a127

Browse files
committed
feat: add git-lfs
1 parent ffb1bb1 commit dc8a127

File tree

6 files changed

+76
-1
lines changed

6 files changed

+76
-1
lines changed

docker/build_scripts/finalize.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ for TOOL_PATH in "${MY_DIR}/requirements-tools/"*; do
9191
esac
9292
done
9393

94+
"${MY_DIR}/install-git-lfs.sh"
95+
9496
# We do not need the precompiled .pyc and .pyo files.
9597
clean_pyc /opt/_internal
9698

62.9 KB
Binary file not shown.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
# Top-level build script called from Dockerfile
3+
4+
# Stop at any error, show all commands
5+
set -exuo pipefail
6+
7+
# Get script directory
8+
MY_DIR=$(dirname "${BASH_SOURCE[0]}")
9+
10+
# Get build utilities
11+
# shellcheck source-path=SCRIPTDIR
12+
source "${MY_DIR}/build_utils.sh"
13+
14+
cd /tmp
15+
case "${AUDITWHEEL_ARCH}" in
16+
x86_64) GOARCH=amd64;;
17+
i686) GOARCH=386;;
18+
aarch64) GOARCH=arm64;;
19+
armv7l) GOARCH=arm;;
20+
*) GOARCH="${AUDITWHEEL_ARCH}";;
21+
esac
22+
23+
GIT_LFS_VERSION=3.7.1
24+
GIT_LFS_SHA256=sha256sums.asc
25+
GIT_LFS_ARCHIVE="git-lfs-linux-${GOARCH}-v${GIT_LFS_VERSION}.tar.gz"
26+
27+
# for some reason, using --homedir gpg option fails, let's backup instead
28+
if [ -d ~/.gnupg ]; then
29+
mv ~/.gnupg ~/.gnupg.backup
30+
fi
31+
32+
tar -Ozxf "${MY_DIR}/git-lfs-core-gpg-keys" | gpg --import -
33+
34+
curl -fsSLo "${GIT_LFS_SHA256}" "https://github.com/git-lfs/git-lfs/releases/download/v${GIT_LFS_VERSION}/sha256sums.asc"
35+
curl -fsSLo "${GIT_LFS_ARCHIVE}" "https://github.com/git-lfs/git-lfs/releases/download/v${GIT_LFS_VERSION}/${GIT_LFS_ARCHIVE}"
36+
37+
gpg -d "${GIT_LFS_SHA256}" | grep "${GIT_LFS_ARCHIVE}" | sha256sum -c
38+
if [ "${AUDITWHEEL_POLICY}" != "manylinux2014" ]; then
39+
gpgconf --kill gpg-agent
40+
fi
41+
42+
mkdir git-lfs
43+
tar -C git-lfs -xf "${GIT_LFS_ARCHIVE}" --strip-components 1
44+
./git-lfs/install.sh
45+
46+
rm -rf ~/.gnupg
47+
if [ -d ~/.gnupg.backup ]; then
48+
mv ~/.gnupg.backup ~/.gnupg
49+
fi
50+
51+
rm -rf "${GIT_LFS_SHA256}" "${GIT_LFS_ARCHIVE}" ./git-lfs

docker/build_scripts/install-runtime-packages.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ if [ "${AUDITWHEEL_POLICY}" == "manylinux2014" ]; then
117117
fi
118118
fixup-mirrors
119119
elif [ "${OS_ID_LIKE}" == "rhel" ]; then
120-
BASE_TOOLS+=(glibc-locale-source glibc-langpack-en gzip hardlink hostname libcurl libnsl libxcrypt which)
120+
BASE_TOOLS+=(glibc-locale-source glibc-langpack-en gnupg2 gzip hardlink hostname libcurl libnsl libxcrypt which)
121121
echo "tsflags=nodocs" >> /etc/dnf/dnf.conf
122122
dnf -y upgrade
123123
EPEL=epel-release

docker/tests/run_tests.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ automake --version
119119
libtoolize --version
120120
patchelf --version
121121
git --version
122+
git lfs --version
122123
cmake --version
123124
swig -version
124125
pipx run nox --version

tools/update_native_dependencies.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,32 @@ def _update_tcltk(dry_run):
199199
break
200200

201201

202+
def _update_git_lfs(dry_run):
203+
file = PROJECT_ROOT / "docker" / "build_scripts" / "install-git-lfs.sh"
204+
lines = file.read_text().splitlines()
205+
re_ = re.compile(r"^GIT_LFS_VERSION=(?P<version>\S+)$")
206+
for i in range(len(lines)):
207+
match = re_.match(lines[i])
208+
if match is None:
209+
continue
210+
current_version = Version(match["version"])
211+
latest_version = latest("git-lfs")
212+
if latest_version > current_version:
213+
lines[i] = f"GIT_LFS_VERSION={latest_version}"
214+
message = f"Bump git-lfs {current_version}{latest_version}"
215+
print(message)
216+
if not dry_run:
217+
file.write_text("\n".join(lines) + "\n")
218+
subprocess.check_call(["git", "commit", "-am", message])
219+
break
220+
221+
202222
def main():
203223
parser = argparse.ArgumentParser()
204224
parser.add_argument("--dry-run", dest="dry_run", action="store_true", help="dry run")
205225
args = parser.parse_args()
206226
_update_cpython(args.dry_run)
227+
_update_git_lfs(args.dry_run)
207228
_update_sqlite(args.dry_run)
208229
_update_tcltk(args.dry_run)
209230
for tool in ["autoconf", "automake", "libtool", "git", "openssl", "curl"]:

0 commit comments

Comments
 (0)