chromium: Extend update.py to print a summary of the updates
As a first step to automate the commit messages as well.
This commit is contained in:
parent
1fa1ae39f5
commit
76fe724675
1 changed files with 26 additions and 0 deletions
|
@ -102,6 +102,31 @@ def get_latest_ungoogled_chromium_build():
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def channel_name_to_attr_name(channel_name):
|
||||||
|
"""Maps a channel name to the corresponding main Nixpkgs attribute name."""
|
||||||
|
if channel_name == 'stable':
|
||||||
|
return 'chromium'
|
||||||
|
if channel_name == 'beta':
|
||||||
|
return 'chromiumBeta'
|
||||||
|
if channel_name == 'dev':
|
||||||
|
return 'chromiumDev'
|
||||||
|
if channel_name == 'ungoogled-chromium':
|
||||||
|
return 'ungoogled-chromium'
|
||||||
|
print(f'Error: Unexpected channel: {channel_name}', file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
def print_updates(channels_old, channels_new):
|
||||||
|
"""Print a summary of the updates."""
|
||||||
|
print('Updates:')
|
||||||
|
for channel_name in channels_old:
|
||||||
|
version_old = channels_old[channel_name]["version"]
|
||||||
|
version_new = channels_new[channel_name]["version"]
|
||||||
|
if version_old < version_new:
|
||||||
|
attr_name = channel_name_to_attr_name(channel_name)
|
||||||
|
print(f'- {attr_name}: {version_old} -> {version_new}')
|
||||||
|
|
||||||
|
|
||||||
channels = {}
|
channels = {}
|
||||||
last_channels = load_json(JSON_PATH)
|
last_channels = load_json(JSON_PATH)
|
||||||
|
|
||||||
|
@ -174,3 +199,4 @@ with open(JSON_PATH, 'w') as out:
|
||||||
sorted_channels = OrderedDict(sorted(channels.items(), key=get_channel_key))
|
sorted_channels = OrderedDict(sorted(channels.items(), key=get_channel_key))
|
||||||
json.dump(sorted_channels, out, indent=2)
|
json.dump(sorted_channels, out, indent=2)
|
||||||
out.write('\n')
|
out.write('\n')
|
||||||
|
print_updates(last_channels, sorted_channels)
|
||||||
|
|
Loading…
Reference in a new issue