summaryrefslogtreecommitdiffstats
path: root/update.sh
diff options
context:
space:
mode:
authorCole Mickens <cole.mickens@gmail.com>2018-10-27 04:16:30 -0700
committerCole Mickens <cole.mickens@gmail.com>2018-10-27 04:17:29 -0700
commit2d94fe3f3f01a8c6bcf6f51629373aefeec41ead (patch)
tree7d77315d742c990916a232a7f60235eff63b59fe /update.sh
parentf523a1ec8f9989b10f1d6ba7f130fa6e126de9a7 (diff)
nicer README.md
Diffstat (limited to 'update.sh')
-rwxr-xr-xupdate.sh30
1 files changed, 17 insertions, 13 deletions
diff --git a/update.sh b/update.sh
index ba94015..0542ef9 100755
--- a/update.sh
+++ b/update.sh
@@ -7,7 +7,7 @@ GHPASS="${GHPASS:-"$(cat /etc/nixos/secrets/github-token)"}"
# keep track of what we build and only upload at the end
builtattrs=()
-pkglist=""
+pkgentries=()
function update() {
attr="${1}"
@@ -18,8 +18,8 @@ function update() {
rev=""
commitdate=""
url="https://api.github.com/repos/${owner}/${repo}/commits?sha=${ref}"
- commit="$(curl --silent --fail "${url}")"
- #commit="$(curl -u "${GHUSER}:${GHPASS}" --silent --fail "${url}")"
+ #commit="$(curl --silent --fail "${url}")"
+ commit="$(curl -u "${GHUSER}:${GHPASS}" --silent --fail "${url}")"
rev="$(echo "${commit}" | jq -r ".[0].sha")"
commitdate="$(echo "${commit}" | jq -r ".[0].commit.committer.date")"
sha256="$(nix-prefetch-url --unpack "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz" 2>/dev/null)"
@@ -33,15 +33,14 @@ function update() {
readarray -t out <<< "$(echo "${results}")"
builtattrs=("${builtattrs[@]}" "${out[@]}")
- # update the README with the latest date/url
- d="$(date -Iseconds)"
+ d="$(date '+%Y-%M-%d %H:%M' --date="${commitdate}")"
m='(.*)'
- txt="| ${attr} | [${commitdate}](https://github.com/${owner}/${repo}/commits/${rev}) |"
- pkglist="$(printf "%s\n%s" "${pkglist}" "${txt}")" # bashism
+ txt="| ${attr} | [${d}](https://github.com/${owner}/${repo}/commits/${rev}) |"
+ pkgentries=("${pkgentries[@]}" "${txt}")
}
# attr_name repo_owner repo_name repo_rev
-update "nixpkgs" "nixos" "nixpkgs-channels" "nixos-unstable"
+#update "nixpkgs" "nixos" "nixpkgs-channels" "nixos-unstable"
update "wlroots" "swaywm" "wlroots" "master"
update "sway-beta" "swaywm" "sway" "master"
update "slurp" "emersion" "slurp" "master"
@@ -51,6 +50,7 @@ update "waybar" "Alexays" "waybar" "master"
update "wayfire" "WayfireWM" "wayfire" "master"
update "wf-config" "WayfireWM" "wf-config" "master"
update "redshift-wayland" "minus7" "redshift" "wayland"
+
#update "bspwc" "Bl4ckb0ne" "bspwc" "master"
#update "mahogany" "sdilts" "mahogany" "master"
#update "tablecloth" "topisani" "tablecloth" "master"
@@ -60,18 +60,22 @@ update "redshift-wayland" "minus7" "redshift" "wayland"
#update "waymonad" "waymonad" "waymonad" "master"
# update README.md
-replace="$(printf "| Attribute Name | Last Upstream Commit Time |\n")"
-replace="$(printf "%s| -------------- | ------------------------- |\n" "${replace}")"
-replace="$(printf "%s%s\n" "${replace}" "${pkglist}")"
+replace="$(printf "<!--pkgs-->")"
+replace="$(printf "%s\n| Attribute Name | Last Upstream Commit Time |" "${replace}")"
+replace="$(printf "%s\n| -------------- | ------------------------- |" "${replace}")"
+for p in "${pkgentries[@]}"; do
+ replace="$(printf "%s\n%s\n" "${replace}" "${p}")"
+done
+replace="$(printf "%s\n<!--pkgs-->" "${replace}")"
+
rg \
--multiline '(?s)(.*)<!--pkgs-->(.*)<!--pkgs-->(.*)' \
"README.md" \
- --replace "\$1<!--pkgs-->${replace}<!--pkgs-->\$3" \
+ --replace "\$1${replace}\$3" \
> README2.md
mv README2.md README.md
# optimisitically upload any "builtattrs" to our cache
-unset builtattrs[0]
copy="/etc/nixcfg/utils/azure/nix-copy-azure.sh"
[[ -f "${copy}" ]] \
&& printf "==> uploading" \