From d162d2b3987d24c0c337d0415955144589b5c359 Mon Sep 17 00:00:00 2001 From: Yanko Kaneti Date: Feb 24 2023 01:30:48 +0000 Subject: download-build: preserve build artefacts last modification time --- diff --git a/cli/koji_cli/lib.py b/cli/koji_cli/lib.py index 02c0cb9..565fb15 100644 --- a/cli/koji_cli/lib.py +++ b/cli/koji_cli/lib.py @@ -607,6 +607,11 @@ def download_file(url, relpath, quiet=False, noprogress=False, size=None, _download_progress(length, pos, filesize) if not length and not (quiet or noprogress): _download_progress(pos, pos, filesize) + last_modified = response.headers.get('last-modified') + if last_modified: + mtime = dateutil.parser.parse(last_modified) + if mtime: + os.utime(relpath, (time.time() ,time.mktime(mtime.astimezone().timetuple()))) finally: f.close() if pos == 0: