Skip to content

Commit 968e500

Browse files
authored
Merge pull request #1857 from mayeut/git-lfs
2 parents 88fbfb3 + a2a6797 commit 968e500

File tree

7 files changed

+105
-3
lines changed

7 files changed

+105
-3
lines changed

docker/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ ARG PREPEND_PATH=/usr/local/bin:${DEVTOOLSET_ROOTPATH}/usr/bin:
88
ARG MANYLINUX_BUILDARCH=${BUILDARCH}
99
ARG MANYLINUX_DISABLE_CLANG=0
1010
ARG MANYLINUX_DISABLE_CLANG_FOR_CPYTHON=0
11+
ARG MANYLINUX_CLANG_VERSION=21.1.4.0
12+
ARG MANYLINUX_COSIGN_VERSION=3.0.2
1113

1214

1315
FROM $BASEIMAGE AS runtime_base_packages
@@ -48,7 +50,7 @@ COPY build_scripts/build_utils.sh /build_scripts/
4850

4951

5052
# prepare cross-compilation support
51-
FROM --platform=linux/${MANYLINUX_BUILDARCH} ghcr.io/mayeut/static-clang:21.1.4.0 AS static_clang_bin
53+
FROM --platform=linux/${MANYLINUX_BUILDARCH} ghcr.io/mayeut/static-clang:${MANYLINUX_CLANG_VERSION} AS static_clang_bin
5254
FROM runtime_base_packages AS static_clang_prepare
5355
ARG MANYLINUX_DISABLE_CLANG
5456
COPY build_scripts/install-clang-static.sh /build_scripts/
@@ -139,7 +141,7 @@ RUN --mount=type=bind,from=static_clang,target=/tmp/cross-compiler,ro \
139141
/tmp/cross-compiler/entrypoint /build_scripts/build-mpdecimal.sh
140142

141143

142-
FROM --platform=${BUILDPLATFORM} ghcr.io/sigstore/cosign/cosign:v2.5.0 AS cosign-bin
144+
FROM --platform=${BUILDPLATFORM} ghcr.io/sigstore/cosign/cosign:v${MANYLINUX_COSIGN_VERSION} AS cosign-bin
143145

144146

145147
FROM build_base AS build_cpython

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: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,57 @@ 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+
222+
def _update_image(tool, dry_run):
223+
repo = {
224+
"clang": "mayeut/static-clang-images",
225+
"cosign": "sigstore/cosign",
226+
}
227+
lines = DOCKERFILE.read_text().splitlines()
228+
re_ = re.compile(rf"^ARG MANYLINUX_{tool.upper()}_VERSION=(?P<version>\S+)$")
229+
for i in range(len(lines)):
230+
match = re_.match(lines[i])
231+
if match is None:
232+
continue
233+
current_version = Version(match["version"])
234+
latest_version = latest(repo.get(tool, tool))
235+
if latest_version > current_version:
236+
lines[i] = f"ARG MANYLINUX_{tool.upper()}_VERSION={latest_version}"
237+
message = f"Bump {tool} {current_version}{latest_version}"
238+
print(message)
239+
if not dry_run:
240+
DOCKERFILE.write_text("\n".join(lines) + "\n")
241+
subprocess.check_call(["git", "commit", "-am", message])
242+
break
243+
244+
202245
def main():
203246
parser = argparse.ArgumentParser()
204247
parser.add_argument("--dry-run", dest="dry_run", action="store_true", help="dry run")
205248
args = parser.parse_args()
249+
_update_image("clang", args.dry_run)
250+
_update_image("cosign", args.dry_run)
206251
_update_cpython(args.dry_run)
252+
_update_git_lfs(args.dry_run)
207253
_update_sqlite(args.dry_run)
208254
_update_tcltk(args.dry_run)
209255
for tool in ["autoconf", "automake", "libtool", "git", "openssl", "curl"]:

0 commit comments

Comments
 (0)