1#!/usr/bin/env nix-shell
6# This script takes one command-line argument of a package set tag which is
7# about to be released, and updates the latest-compatible-sets.json file where
8# necessary so that the new package set is marked as the latest compatible set
9# for the appropriate compiler version.
12 echo >&2 "Expected one argument, got $#"
13 echo >&2 "Usage: update-latest-compatible-sets.sh PACKAGE_SET_VERSION"
17function get_inputs() {
18 # Get the existing mapping of compiler versions to latest package sets for
20 cat latest-compatible-sets.json
21 # Print a JSON object in the same schema as the latest-compatible-sets.json
22 # file, containing just the version which is about to be released. e.g.
23 # { "0.13.8": "psc-0.13.8-20200911-2" }
24 echo $1 | jq --raw-input '{ (split("-")[1]): .}'
28 # Change the input JSON object into an array of objects like
30 # { key: "0.13.8", value: "psc-0.13.8-20200911-2" }
32 # then sort by 'value' so that more recent releases come later, and finally
33 # convert back to a JSON object. The sorting is important so that newer
34 # releases for a given compiler version that they take precedence when we
35 # combine the array back into a single object.
36 jq --slurp 'map(to_entries | .[]) | sort_by(.value) | from_entries'
40echo >&2 "Updating latest-compatible-sets.json for $tag"
41get_inputs $tag | combine > latest-compatible-sets.json.tmp
42mv latest-compatible-sets.json.tmp latest-compatible-sets.json
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list