summaryrefslogtreecommitdiffstats
path: root/pkgs
diff options
context:
space:
mode:
authorMichael Weiss <dev.primeos@gmail.com>2021-01-14 20:37:01 +0100
committerMichael Weiss <dev.primeos@gmail.com>2021-01-14 21:02:16 +0100
commit76fe724675d9674564a79de8c1036aee9be05e14 (patch)
treefdbe48d3963690c10cb79e88dff11f4620b11d2e /pkgs
parent1fa1ae39f57675a0785bb6242bca1477029a80e4 (diff)
chromium: Extend update.py to print a summary of the updates
As a first step to automate the commit messages as well.
Diffstat (limited to 'pkgs')
-rwxr-xr-xpkgs/applications/networking/browsers/chromium/update.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/pkgs/applications/networking/browsers/chromium/update.py b/pkgs/applications/networking/browsers/chromium/update.py
index 2b9f9232c24d..314d000e08a2 100755
--- a/pkgs/applications/networking/browsers/chromium/update.py
+++ b/pkgs/applications/networking/browsers/chromium/update.py
@@ -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 = {}
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))
json.dump(sorted_channels, out, indent=2)
out.write('\n')
+ print_updates(last_channels, sorted_channels)