From: Daan De Meyer Date: Fri, 1 Sep 2023 08:44:25 +0000 (+0200) Subject: SourceDateEpoch followups X-Git-Tag: v16~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0acda13b3cfb6fc5502848bb7055ce0331cfbee9;p=thirdparty%2Fmkosi.git SourceDateEpoch followups - Move normalize_mtime() a little close to where its used - Put the --source-date-epoch argument on one line like the others --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index ece33ea4d..0a8951efe 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -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)