Mercurial > dotfiles
comparison .chezmoiscripts/run_onchange_after_22-install-devtools.sh.tmpl @ 840:f3e87577dd3a
fix: sort keys from template dicts to determistically generate scripts
From http://masterminds.github.io/sprig/dicts.html
> The keys function will return a list of all of the keys in one or more dict types.
> Since a dictionary is unordered, the keys will not be in a predictable order.
> They can be sorted with sortAlpha.
This results in a different ordering of commands in the generated scripts
which break the hashing in chezmoi to determine whether the scripts needs to
be re-run.
author | zegervdv <zegervdv@me.com> |
---|---|
date | Fri, 02 Feb 2024 17:44:49 +0100 |
parents | 3f2440bfd0de |
children | 62335df560d9 03de8f9ab845 |
comparison
equal
deleted
inserted
replaced
839:053b735696ba | 840:f3e87577dd3a |
---|---|
15 mkdir -p $MANPAGE_DIR | 15 mkdir -p $MANPAGE_DIR |
16 | 16 |
17 mkdir -p $DOWNLOAD_DIR | 17 mkdir -p $DOWNLOAD_DIR |
18 pushd $DOWNLOAD_DIR | 18 pushd $DOWNLOAD_DIR |
19 | 19 |
20 {{ range keys $packages }} | 20 {{ range keys $packages | sortAlpha }} |
21 {{ $meta := get $packages . -}} | 21 {{ $meta := get $packages . -}} |
22 VERSION={{ get $meta "version" }} | 22 VERSION={{ get $meta "version" }} |
23 echo "Downloading {{ . }} v{{ get $meta "version" }} ..." | 23 echo "Downloading {{ . }} v{{ get $meta "version" }} ..." |
24 curl -fsSL {{ get $meta "url" }} | tar --strip-components=1 -xz | 24 curl -fsSL {{ get $meta "url" }} | tar --strip-components=1 -xz |
25 install -m 755 $DOWNLOAD_DIR/{{ . }} $INSTALL_DIR/{{ . }} | 25 install -m 755 $DOWNLOAD_DIR/{{ . }} $INSTALL_DIR/{{ . }} |