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.0"
version = "0.5.1"
authors = [
{ name="Mattéo Delabre", email="git.matteo@delab.re" },
{ name="Eeems", email="eeems@eeems.email" },
Expand Down
21 changes: 15 additions & 6 deletions toltec/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from types import TracebackType
import re
import os
import shlex
import logging
import textwrap
from importlib.util import find_spec, module_from_spec
Expand Down Expand Up @@ -400,19 +401,27 @@ def _build(self, recipe: Recipe, src_dir: str) -> None:

logger.info("Building artifacts")

# Set fixed atime and mtime for all the source files
epoch = int(recipe.timestamp.timestamp())

for filename in util.list_tree(src_dir):
os.utime(filename, (epoch, epoch))

mount_src = "/src"
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'
)

logs = self._run_script(
[
*restore_script,
f'cd "{mount_src}"',
recipe.build,
f"chown -R {uid}:{gid} {mount_src} {repo_src}",
Expand Down