Skip to content
Open
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 components/bugzilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class CommentTemplates:
@staticmethod
def UPDATE_SUMMARY(library, new_release_version, release_timestamp):
return "Update %s to new version %s from %s" % (
return "Update %s to new version %s from %s UTC" % (
library.name, new_release_version, release_timestamp)

@staticmethod
Expand Down
9 changes: 8 additions & 1 deletion components/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import functools
import time

from datetime import timezone
from dateutil.parser import parse

RETRY_TIMES_OVERRIDE = None
Expand Down Expand Up @@ -66,7 +67,13 @@ def raise_(e):


def string_date_to_uniform_string_date(s):
return parse(s).strftime('%Y-%m-%d %H:%M:%S')
# Hosts report commit times with an offset (gitlab: "...+10:00"), as UTC
# ("...Z"), or with no zone at all (googlesource, which is UTC). Normalize
# them all to UTC so the result doesn't depend on the committer's timezone.
d = parse(s)
if d.tzinfo is not None:
d = d.astimezone(timezone.utc)
return d.strftime('%Y-%m-%d %H:%M:%S')


def merge_dictionaries(a, b, ignored_dicts=[], ignored_keys=[]):
Expand Down
2 changes: 1 addition & 1 deletion tests/bugzilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def do_POST(self):
'product': 'Core',
'component': 'ImageLib',
'type': "enhancement",
'summary': 'Update dav1d to new version V1 from 2020-08-21 15:13:49',
'summary': 'Update dav1d to new version V1 from 2020-08-21 13:13:49 UTC',
'description': '',
'whiteboard': '[3pl-filed]' + task_id_whiteboard(),
'cc': ['tom@mozilla.com', 'jewilde@mozilla.com', 'additional@example.com'],
Expand Down
12 changes: 12 additions & 0 deletions tests/mach_vendor.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@ def testISO8601Timestamp(self):
self._check_for_update(REVISION + " 2026-09-09T17:56:48Z"),
(REVISION, "2026-09-09 17:56:48"))

def testOffsetTimestampIsConvertedToUTC(self):
# gitlab and codeberg report the committer's local time with an offset;
# the uniform date must be UTC, not the committer's wall-clock time.
self.assertEqual(
self._check_for_update(REVISION + " 2026-09-25T12:59:00.000+10:00"),
(REVISION, "2026-09-25 02:59:00"))

def testNegativeOffsetCrossesMidnight(self):
self.assertEqual(
self._check_for_update(REVISION + " 2026-09-17T22:36:18.000-04:00"),
(REVISION, "2026-09-18 02:36:18"))

def testNoUpdateAvailable(self):
self.assertEqual(self._check_for_update(""), (None, None))

Expand Down
Loading