]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
SourceDateEpoch followups
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 1 Sep 2023 08:44:25 +0000 (10:44 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 1 Sep 2023 08:48:24 +0000 (10:48 +0200)
- Move normalize_mtime() a little close to where its used
- Put the --source-date-epoch argument on one line like the others

mkosi/__init__.py

index ece33ea4d1a29c34782543bf0885cc4c421abc7e..0a8951efe5e460305a13efccb84408143d941186 100644 (file)
@@ -934,8 +934,7 @@ def build_initrd(state: MkosiState) -> Path:
         "--make-initrd", "yes",
         "--bootable", "no",
         "--manifest-format", "",
-        *(["--source-date-epoch", str(state.config.source_date_epoch)]
-                if state.config.source_date_epoch is not None else []),
+        *(["--source-date-epoch", str(state.config.source_date_epoch)] if state.config.source_date_epoch is not None else []),
         *(["--locale", state.config.locale] if state.config.locale else []),
         *(["--locale-messages", state.config.locale_messages] if state.config.locale_messages else []),
         *(["--keymap", state.config.keymap] if state.config.keymap else []),
@@ -1756,6 +1755,18 @@ def finalize_staging(state: MkosiState) -> None:
         move_tree(state.config, f, state.config.output_dir)
 
 
+def normalize_mtime(root: Path, mtime: Optional[int], directory: Optional[Path] = None) -> None:
+    if mtime is None:
+        return
+
+    directory = directory or Path("")
+
+    with complete_step(f"Normalizing modification times of /{directory}"):
+        os.utime(root / directory, (mtime, mtime), follow_symlinks=False)
+        for p in (root / directory).rglob("*"):
+            os.utime(p, (mtime, mtime), follow_symlinks=False)
+
+
 def build_image(args: MkosiArgs, config: MkosiConfig) -> None:
     manifest = Manifest(config) if config.manifest_format else None
     workspace = tempfile.TemporaryDirectory(dir=config.workspace_dir, prefix=".mkosi-tmp")
@@ -2260,14 +2271,3 @@ def run_verb(args: MkosiArgs, presets: Sequence[MkosiConfig]) -> None:
 
             if args.verb == Verb.serve:
                 run_serve(last)
-
-
-def normalize_mtime(root: Path, mtime: Optional[int], directory: Optional[Path] = None) -> None:
-    directory = directory or Path("")
-    if mtime is None:
-        return
-
-    with complete_step(f"Normalizing modification times of /{directory}"):
-        os.utime(root / directory, (mtime, mtime), follow_symlinks=False)
-        for p in (root / directory).rglob("*"):
-            os.utime(p, (mtime, mtime), follow_symlinks=False)