Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions constructor/preconda.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ def write_files(info: dict, workspace: str):

- `conda-meta/initial-state.explicit.txt`: Lockfile to provision the base environment.
- `conda-meta/history`: Prepared history file with the right requested specs in input file.
- `conda-meta/frozen`: Frozen marker file used to protect conda environment state.
- `pkgs/urls` and `pkgs/urls.txt`: Direct URLs of packages used, with and without MD5 hashes.
- `pkgs/cache/*.json`: Trimmed repodata to mock offline channels in use.
- `pkgs/channels.txt`: Channels in use.
Expand Down Expand Up @@ -199,6 +200,9 @@ def write_files(info: dict, workspace: str):
# (list of specs/dists to install)
write_initial_state_explicit_txt(info, join(workspace, "conda-meta"), final_urls_md5s)

# base environment frozen marker files
write_frozen(info.get("freeze_base"), join(workspace, "conda-meta"))

for fn in files:
os.chmod(join(workspace, fn), 0o664)

Expand All @@ -218,6 +222,8 @@ def write_files(info: dict, workspace: str):
write_channels_txt(info, env_pkgs, env_config)
# shortcuts
write_shortcuts_txt(info, env_pkgs, env_config)
# frozen marker file
write_frozen(env_config.get("freeze_env"), env_conda_meta)


def write_conda_meta(info, dst_dir, final_urls_md5s, user_requested_specs=None):
Expand All @@ -244,6 +250,14 @@ def write_conda_meta(info, dst_dir, final_urls_md5s, user_requested_specs=None):
fh.write("\n".join(builder))


def write_frozen(freeze_info, dst_dir):
if not freeze_info or "conda" not in freeze_info:
return
frozen_path = join(dst_dir, "frozen")
with open(frozen_path, "w") as ff:
json.dump(freeze_info["conda"], ff)


def write_repodata_record(info, dst_dir):
all_dists = info["_dists"].copy()
for env_data in info.get("_extra_envs_info", {}).values():
Expand Down
8 changes: 8 additions & 0 deletions constructor/shar.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,20 @@ def create(info, verbose=False):
pre_t.addfile(tarinfo=tarfile.TarInfo("conda-meta/history"))
post_t.add(join(tmp_dir, "conda-meta", "history"), "conda-meta/history")

if os.path.exists(join(tmp_dir, "conda-meta", "frozen")):
post_t.add(join(tmp_dir, "conda-meta", "frozen"), "conda-meta/frozen")

for env_name in info.get("_extra_envs_info", {}):
pre_t.addfile(tarinfo=tarfile.TarInfo(f"envs/{env_name}/conda-meta/history"))
post_t.add(
join(tmp_dir, "envs", env_name, "conda-meta", "history"),
f"envs/{env_name}/conda-meta/history",
)
if os.path.exists(join(tmp_dir, "envs", env_name, "conda-meta", "frozen")):
post_t.add(
join(tmp_dir, "envs", env_name, "conda-meta", "frozen"),
f"envs/{env_name}/conda-meta/frozen",
)

extra_files = copy_extra_files(info.get("extra_files", []), tmp_dir)
for path in extra_files:
Expand Down
Loading