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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "toltecmk"
version = "0.5.1"
version = "0.5.2"
authors = [
{ name="Mattéo Delabre", email="git.matteo@delab.re" },
{ name="Eeems", email="eeems@eeems.email" },
Expand Down
20 changes: 9 additions & 11 deletions toltec/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
from types import TracebackType
import re
import os
import shlex
import logging
import textwrap
from inspect import getsource
from importlib.util import find_spec, module_from_spec
import docker
import requests
Expand Down Expand Up @@ -405,19 +405,17 @@ def _build(self, recipe: Recipe, src_dir: str) -> None:
repo_src = "/repo"
uid = os.getuid()
gid = os.getgid()
restore_script: list[str] = []

# Set fixed atime and mtime for all the source files
epoch = int(recipe.timestamp.timestamp())
for file_path in util.list_tree(src_dir):
docker_path = shlex.quote(
os.path.join(mount_src, os.path.relpath(file_path, src_dir))
)
restore_script.append(
'echo "import os; os.utime('
+ f'\\"{docker_path}\\", ns=({epoch}, {epoch})'
+ ')" | python3 -u'
)
restore_script: list[str] = [
"python3 -u <<EOF",
"import os",
getsource(util.list_tree),
f'for file_path in list_tree("{mount_src}"):',
f" os.utime(file_path, ns=({epoch}, {epoch}))",
"EOF",
]

logs = self._run_script(
[
Expand Down