Merge pull request #191 from dramforever/nix-channels-new-tagline

nix-channels: Tolerate new release taglines
This commit is contained in:
Shengqi Chen 2025-11-27 15:12:42 +08:00 committed by GitHub
commit 6672864095
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -194,7 +194,11 @@ def clone_channels():
tagline = node('p').text()
tagline_res = re.match(r'^Released on (.+) from', tagline)
# Examples:
#
# Released on yyyy-mm-dd hh:mm UTC from Git commit ...
# Released on yyyy-mm-dd hh:mm from ...
tagline_res = re.match(r'^Released on (.+?) (?:UTC )?from', tagline)
if tagline_res is None:
logging.warning(f' - Invalid tagline: {tagline}')
@ -385,6 +389,9 @@ def garbage_collect():
channel = release.name.split('@')[0]
date_str = (release / '.released-time').read_text()
date_match = re.match(r'\d+-\d+-\d+ \d+:\d+', date_str)
assert date_match is not None, f'Release {release!r} has invalid time {date_str!r}'
date_str = date_match[0]
released_date = datetime.strptime(date_str, '%Y-%m-%d %H:%M:%S')
if released_date >= time_threshold: