aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSheng Yu <syu.os@protonmail.com>2023-06-24 16:28:20 -0400
committerSam James <sam@gentoo.org>2023-06-29 09:22:53 +0100
commit59973d0f5829ebbae615a001a97abb652431a61b (patch)
treec6a147f7e75102164e7074184d36f956e650d80c
parentbin/install-qa-check.d/05prefix: prefixify init-script shebangs. (diff)
downloadportage-59973d0f.tar.gz
portage-59973d0f.tar.bz2
portage-59973d0f.zip
gpkg: fix incorrect gpkg timestamp
[sam: Quoting dwfreed from the bug: "utcnow() produces a naive datetime object, and most methods of datetime objects treat naive datetime objects as local time."] Bug: https://bugs.gentoo.org/909067 Signed-off-by: Sheng Yu <syu.os@protonmail.com> Closes: https://github.com/gentoo/portage/pull/1060 Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--lib/portage/gpkg.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/portage/gpkg.py b/lib/portage/gpkg.py
index 7451c68c2..6ed2a6d00 100644
--- a/lib/portage/gpkg.py
+++ b/lib/portage/gpkg.py
@@ -1012,7 +1012,7 @@ class gpkg:
gpkg_version_file = tarfile.TarInfo(
os.path.join(self.basename, self.gpkg_version)
)
- gpkg_version_file.mtime = datetime.utcnow().timestamp()
+ gpkg_version_file.mtime = datetime.now().timestamp()
container.addfile(gpkg_version_file)
checksum_info = checksum_helper(self.settings)
checksum_info.finish()
@@ -1032,7 +1032,7 @@ class gpkg:
checksum_info = checksum_helper(self.settings)
image_tarinfo = self._create_tarinfo("image")
- image_tarinfo.mtime = datetime.utcnow().timestamp()
+ image_tarinfo.mtime = datetime.now().timestamp()
with tar_stream_writer(
image_tarinfo, container, image_tar_format, compression_cmd, checksum_info
) as image_writer:
@@ -1114,7 +1114,7 @@ class gpkg:
gpkg_version_file = tarfile.TarInfo(
os.path.join(new_basename, self.gpkg_version)
)
- gpkg_version_file.mtime = datetime.utcnow().timestamp()
+ gpkg_version_file.mtime = datetime.now().timestamp()
container.addfile(gpkg_version_file)
checksum_info = checksum_helper(self.settings)
checksum_info.finish()
@@ -1182,7 +1182,7 @@ class gpkg:
gpkg_version_file = tarfile.TarInfo(
os.path.join(self.prefix, self.gpkg_version)
)
- gpkg_version_file.mtime = datetime.utcnow().timestamp()
+ gpkg_version_file.mtime = datetime.now().timestamp()
container.addfile(gpkg_version_file)
checksum_info = checksum_helper(self.settings)
checksum_info.finish()
@@ -1253,7 +1253,7 @@ class gpkg:
if metadata is None:
metadata = {}
metadata_tarinfo = self._create_tarinfo("metadata")
- metadata_tarinfo.mtime = datetime.utcnow().timestamp()
+ metadata_tarinfo.mtime = datetime.now().timestamp()
if self.create_signature:
checksum_info = checksum_helper(
@@ -1274,7 +1274,7 @@ class gpkg:
) as metadata_tar:
for m in metadata:
m_info = tarfile.TarInfo(os.path.join("metadata", m))
- m_info.mtime = datetime.utcnow().timestamp()
+ m_info.mtime = datetime.now().timestamp()
if isinstance(metadata[m], bytes):
m_data = io.BytesIO(metadata[m])
@@ -1329,7 +1329,7 @@ class gpkg:
gpkg_version_file = tarfile.TarInfo(
os.path.join(self.basename, self.gpkg_version)
)
- gpkg_version_file.mtime = datetime.utcnow().timestamp()
+ gpkg_version_file.mtime = datetime.now().timestamp()
container.addfile(gpkg_version_file)
checksum_info = checksum_helper(self.settings)
checksum_info.finish()
@@ -1350,7 +1350,7 @@ class gpkg:
paths = list(contents)
paths.sort()
image_tarinfo = self._create_tarinfo("image")
- image_tarinfo.mtime = datetime.utcnow().timestamp()
+ image_tarinfo.mtime = datetime.now().timestamp()
with tar_stream_writer(
image_tarinfo, container, image_tar_format, compression_cmd, checksum_info
) as image_writer:
@@ -1518,7 +1518,7 @@ class gpkg:
manifest_tarinfo = tarfile.TarInfo(os.path.join(basename, "Manifest"))
manifest_tarinfo.size = manifest.tell()
- manifest_tarinfo.mtime = datetime.utcnow().timestamp()
+ manifest_tarinfo.mtime = datetime.now().timestamp()
manifest.seek(0)
container.addfile(manifest_tarinfo, manifest)
manifest.close()
@@ -1562,7 +1562,7 @@ class gpkg:
signature = io.BytesIO(checksum_info.gpg_output)
signature_tarinfo = tarfile.TarInfo(f"{tarinfo.name}.sig")
signature_tarinfo.size = len(signature.getvalue())
- signature_tarinfo.mtime = datetime.utcnow().timestamp()
+ signature_tarinfo.mtime = datetime.now().timestamp()
container.addfile(signature_tarinfo, signature)
if manifest: