Skip to content

Commit 505b9c8

Browse files
authored
Fix md5 checks for onedir conda-standalone (#1007)
1 parent 8d7c17e commit 505b9c8

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

constructor/header.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ cd "$PREFIX"
473473
unset PYTHON_SYSCONFIGDATA_NAME _CONDA_PYTHON_SYSCONFIGDATA_NAME
474474
475475
# the first binary payload: the standalone conda executable
476-
printf "Unpacking bootstrapper ...\n"
476+
printf "Unpacking bootstrapper...\n"
477477
CONDA_EXEC="$PREFIX/_conda"
478478
extract_range "${boundary0}" "${boundary1}" > "$CONDA_EXEC"
479479
chmod +x "$CONDA_EXEC"

constructor/shar.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def get_header(conda_exec, tarball, info):
8989
variables["installer_name"] = name
9090
variables["installer_version"] = info["version"]
9191
variables["installer_platform"] = info["_platform"]
92-
variables["installer_md5"] = hash_files([conda_exec, tarball])
92+
variables["installer_md5"] = hash_files([conda_exec, *info["_internal_conda_files"], tarball])
9393
variables["default_prefix"] = info.get("default_prefix", "${HOME:-/opt}/%s" % name.lower())
9494
variables["first_payload_size"] = getsize(conda_exec)
9595
variables["second_payload_size"] = getsize(tarball)
@@ -196,13 +196,13 @@ def create(info, verbose=False):
196196
t.add(join(info["_download_dir"], fn), "pkgs/" + fn)
197197
t.close()
198198

199-
internal_conda_files = copy_conda_exe(tmp_dir, "_conda", info["_conda_exe"])
200-
if internal_conda_files:
199+
info["_internal_conda_files"] = copy_conda_exe(tmp_dir, "_conda", info["_conda_exe"])
200+
if info["_internal_conda_files"]:
201201
conda_exe_payloads: dict[str, tuple[int, int, bool]] = {}
202202
memfile = BytesIO()
203203
start = 0
204204
end = 0
205-
for path in internal_conda_files:
205+
for path in info["_internal_conda_files"]:
206206
relative_path = str(path.relative_to(tmp_dir))
207207
memfile.write(path.read_bytes())
208208
size = os.path.getsize(path)

news/993-onedir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
### Enhancements
22

3-
* Add compatibility for `onedir` variants of `conda-standalone`, which are pre-extracted and have smaller start overheads. (#993)
3+
* Add compatibility for `onedir` variants of `conda-standalone`, which are pre-extracted and have smaller start overheads. (#993, #1007)
44

55
### Bug fixes
66

tests/test_examples.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,10 @@ def _run_installer_sh(
234234
if CONSTRUCTOR_DEBUG:
235235
cmd.append("-x")
236236
cmd += [installer, "-b", *options, "-p", install_dir]
237-
return _execute(cmd, installer_input=installer_input, timeout=timeout, check=check)
237+
process = _execute(cmd, installer_input=installer_input, timeout=timeout, check=check)
238+
if "WARNING: md5sum mismatch of tar archive" in process.stdout + process.stderr:
239+
raise AssertionError("MD5 mismatch in SH payload!")
240+
return process
238241

239242

240243
def _run_installer_pkg(

0 commit comments

Comments
 (0)