sourcehut: update packages
authorJulien Moutinho <julm@sourcephile.fr>
Tue, 20 Jul 2021 10:22:55 +0000 (12:22 +0200)
committerJulien Moutinho <julm@sourcephile.fr>
Wed, 21 Jul 2021 23:59:11 +0000 (01:59 +0200)
nixpkgs/patches/sourcehut.diff [new file with mode: 0644]

diff --git a/nixpkgs/patches/sourcehut.diff b/nixpkgs/patches/sourcehut.diff
new file mode 100644 (file)
index 0000000..26bbe21
--- /dev/null
@@ -0,0 +1,333 @@
+diff --git a/pkgs/applications/version-management/sourcehut/builds.nix b/pkgs/applications/version-management/sourcehut/builds.nix
+index c8163caf8ea..24ec5fe4e63 100644
+--- a/pkgs/applications/version-management/sourcehut/builds.nix
++++ b/pkgs/applications/version-management/sourcehut/builds.nix
+@@ -11,13 +11,13 @@
+ , python
+ }:
+ let
+-  version = "0.66.7";
++  version = "0.70.8";
+   buildWorker = src: buildGoModule {
+     inherit src version;
+     pname = "builds-sr-ht-worker";
+-    vendorSha256 = "sha256-giOaldV46aBqXyFH/cQVsbUr6Rb4VMhbBO86o48tRZY=";
++    vendorSha256 = "sha256-ZEarWM/33t+pNXUEIpfd/DkBkhu3UUg17Hh8XXWOepA=";
+   };
+ in
+ buildPythonPackage rec {
+@@ -28,7 +28,7 @@ buildPythonPackage rec {
+     owner = "~sircmpwn";
+     repo = "builds.sr.ht";
+     rev = version;
+-    sha256 = "sha256-2MLs/DOXHjEYarXDVUcPZe3o0fmZbzVxn528SE72lhM=";
++    sha256 = "sha256-0guAknoCUGmREZTu1KYs+TPd1jmLlgapriyoi5eg2Ig=";
+   };
+   nativeBuildInputs = srht.nativeBuildInputs;
+diff --git a/pkgs/applications/version-management/sourcehut/core.nix b/pkgs/applications/version-management/sourcehut/core.nix
+index d359d524eb2..b872208cb40 100644
+--- a/pkgs/applications/version-management/sourcehut/core.nix
++++ b/pkgs/applications/version-management/sourcehut/core.nix
+@@ -30,12 +30,12 @@
+ buildPythonPackage rec {
+   pname = "srht";
+-  version = "0.67.4";
++  version = "0.67.13";
+   src = fetchgit {
+     url = "https://git.sr.ht/~sircmpwn/core.sr.ht";
+     rev = version;
+-    sha256 = "sha256-XvzFfcBK5Mq8p7xEBAF/eupUE1kkUBh5k+ByM/WA9bc=";
++    sha256 = "sha256-hwoG/xEE+58a9+MO7ViCr70qSIm/Oyr6qy3QYfmI6Uw=";
+     fetchSubmodules = true;
+   };
+diff --git a/pkgs/applications/version-management/sourcehut/dispatch.nix b/pkgs/applications/version-management/sourcehut/dispatch.nix
+index 637c6f9c1df..0aec2210599 100644
+--- a/pkgs/applications/version-management/sourcehut/dispatch.nix
++++ b/pkgs/applications/version-management/sourcehut/dispatch.nix
+@@ -9,13 +9,13 @@
+ buildPythonPackage rec {
+   pname = "dispatchsrht";
+-  version = "0.15.8";
++  version = "0.15.31";
+   src = fetchFromSourcehut {
+     owner = "~sircmpwn";
+     repo = "dispatch.sr.ht";
+     rev = version;
+-    sha256 = "sha256-zWCGPjIgMKHXHJUs9aciV7IFgo0rpahon6KXHDwcfss=";
++    sha256 = "sha256-y+7Q6yEwmGYTZakHLvNTNazOQOlv7oa8Z9K1jccj19M=";
+   };
+   nativeBuildInputs = srht.nativeBuildInputs;
+diff --git a/pkgs/applications/version-management/sourcehut/git.nix b/pkgs/applications/version-management/sourcehut/git.nix
+index e44fb9cd6c6..3b76bda965f 100644
+--- a/pkgs/applications/version-management/sourcehut/git.nix
++++ b/pkgs/applications/version-management/sourcehut/git.nix
+@@ -8,13 +8,13 @@
+ , scmsrht
+ }:
+ let
+-  version = "0.72.8";
++  version = "0.72.40";
+   src = fetchFromSourcehut {
+     owner = "~sircmpwn";
+     repo = "git.sr.ht";
+     rev = version;
+-    sha256 = "sha256-AB2uzajO5PtcpJfbOOTfuDFM6is5K39v3AZJ1hShRNc=";
++    sha256 = "sha256-Y5485XY614AfAO65jtA72ylZ1LZC2DKFBN4Ijh4anFg=";
+   };
+   buildShell = src: buildGoModule {
+diff --git a/pkgs/applications/version-management/sourcehut/hg.nix b/pkgs/applications/version-management/sourcehut/hg.nix
+index cddb76cabf2..a7317980134 100644
+--- a/pkgs/applications/version-management/sourcehut/hg.nix
++++ b/pkgs/applications/version-management/sourcehut/hg.nix
+@@ -10,12 +10,12 @@
+ buildPythonPackage rec {
+   pname = "hgsrht";
+-  version = "0.27.4";
++  version = "0.27.6";
+   src = fetchhg {
+     url = "https://hg.sr.ht/~sircmpwn/hg.sr.ht";
+     rev = version;
+-    sha256 = "1c0qfi0gmbfngvds6917fy9ii2iglawn429757rh7b4bvzn7n6mr";
++    sha256 = "ibijvKjS4CiWTYrO6Qdh3RkD0EUE7BY8wjdPwrD6vkA=";
+   };
+   nativeBuildInputs = srht.nativeBuildInputs;
+diff --git a/pkgs/applications/version-management/sourcehut/hub.nix b/pkgs/applications/version-management/sourcehut/hub.nix
+index 17cb3fe4b61..ff5ffcca38a 100644
+--- a/pkgs/applications/version-management/sourcehut/hub.nix
++++ b/pkgs/applications/version-management/sourcehut/hub.nix
+@@ -6,13 +6,13 @@
+ buildPythonPackage rec {
+   pname = "hubsrht";
+-  version = "0.13.1";
++  version = "0.13.5";
+   src = fetchFromSourcehut {
+     owner = "~sircmpwn";
+     repo = "hub.sr.ht";
+     rev = version;
+-    sha256 = "sha256-Kqzy4mh5Nn1emzHBco/LVuXro/tW3NX+OYqdEwBSQ/U=";
++    sha256 = "sha256-hCsHwKCnXOdUnJuklb0C7+yq2JduswMjaYGWmNS6rkc=";
+   };
+   nativeBuildInputs = srht.nativeBuildInputs;
+diff --git a/pkgs/applications/version-management/sourcehut/lists.nix b/pkgs/applications/version-management/sourcehut/lists.nix
+index b419b49f7b5..b98f7b38918 100644
+--- a/pkgs/applications/version-management/sourcehut/lists.nix
++++ b/pkgs/applications/version-management/sourcehut/lists.nix
+@@ -12,13 +12,13 @@
+ buildPythonPackage rec {
+   pname = "listssrht";
+-  version = "0.48.19";
++  version = "0.48.24";
+   src = fetchFromSourcehut {
+     owner = "~sircmpwn";
+     repo = "lists.sr.ht";
+     rev = version;
+-    sha256 = "sha256-bsakEMyvWaxiE4/SGcAP4mlGG9jkdHfFxpt9H+TJn/8=";
++    sha256 = "sha256-2WU+Q33rZnth0y87blr7dSiy4iV1ZD9xx51gAks1z/Y=";
+   };
+   nativeBuildInputs = srht.nativeBuildInputs;
+diff --git a/pkgs/applications/version-management/sourcehut/man.nix b/pkgs/applications/version-management/sourcehut/man.nix
+index bd331f000a7..effe70059df 100644
+--- a/pkgs/applications/version-management/sourcehut/man.nix
++++ b/pkgs/applications/version-management/sourcehut/man.nix
+@@ -8,13 +8,13 @@
+ buildPythonPackage rec {
+   pname = "mansrht";
+-  version = "0.15.12";
++  version = "0.15.18";
+   src = fetchFromSourcehut {
+     owner = "~sircmpwn";
+     repo = "man.sr.ht";
+     rev = version;
+-    sha256 = "sha256-MqH/8K9XRvEg6P7GHE6XXtWnhDP3wT8iGoNaFtYQbio=";
++    sha256 = "sha256-hlp3WBKgRHEWlQvs2Ep1sWA8gVR91pQnd7gvl8jMaVE=";
+   };
+   nativeBuildInputs = srht.nativeBuildInputs;
+diff --git a/pkgs/applications/version-management/sourcehut/meta.nix b/pkgs/applications/version-management/sourcehut/meta.nix
+index a285d484ed2..9e514022a2e 100644
+--- a/pkgs/applications/version-management/sourcehut/meta.nix
++++ b/pkgs/applications/version-management/sourcehut/meta.nix
+@@ -18,13 +18,13 @@
+ , python
+ }:
+ let
+-  version = "0.53.14";
++  version = "0.54.0";
+   src = fetchFromSourcehut {
+     owner = "~sircmpwn";
+     repo = "meta.sr.ht";
+     rev = version;
+-    sha256 = "sha256-/+r/XLDkcSTW647xPMh5bcJmR2xZNNH74AJ5jemna2k=";
++    sha256 = "sha256-OrtYdKjO8jLoamGHW9sSJ1WpE/7yESk2yPUQhwD19vU=";
+   };
+   buildApi = src: buildGoModule {
+diff --git a/pkgs/applications/version-management/sourcehut/paste.nix b/pkgs/applications/version-management/sourcehut/paste.nix
+index 0d8c9135493..884b9bf6c6f 100644
+--- a/pkgs/applications/version-management/sourcehut/paste.nix
++++ b/pkgs/applications/version-management/sourcehut/paste.nix
+@@ -8,13 +8,13 @@
+ buildPythonPackage rec {
+   pname = "pastesrht";
+-  version = "0.12.1";
++  version = "0.12.3";
+   src = fetchFromSourcehut {
+     owner = "~sircmpwn";
+     repo = "paste.sr.ht";
+     rev = version;
+-    sha256 = "sha256-QQhd2LeH9BLmlHilhsv+9fZ+RPNmEMSmOpFA3dsMBFc=";
++    sha256 = "sha256-cBIeK3wBzIYDOed8zvz8+abcLvFAeWua44UWlhO0ZEY=";
+   };
+   nativeBuildInputs = srht.nativeBuildInputs;
+diff --git a/pkgs/applications/version-management/sourcehut/scm.nix b/pkgs/applications/version-management/sourcehut/scm.nix
+index 1f385265360..1ce3fe867ed 100644
+--- a/pkgs/applications/version-management/sourcehut/scm.nix
++++ b/pkgs/applications/version-management/sourcehut/scm.nix
+@@ -10,13 +10,13 @@
+ buildPythonPackage rec {
+   pname = "scmsrht";
+-  version = "0.22.9";
++  version = "0.22.12";
+   src = fetchFromSourcehut {
+     owner = "~sircmpwn";
+     repo = "scm.sr.ht";
+     rev = version;
+-    sha256 = "sha256-327G6C8FW+iZx+167D7TQsFtV6FGc8MpMVo9L/cUUqU=";
++    sha256 = "sha256-ktDQ0pVljt85sN2v5QgBiqaW5wtVc5pRC8WT31HSwpI=";
+   };
+   nativeBuildInputs = srht.nativeBuildInputs;
+diff --git a/pkgs/applications/version-management/sourcehut/todo.nix b/pkgs/applications/version-management/sourcehut/todo.nix
+index 85e1f5637b6..218e958f3a6 100644
+--- a/pkgs/applications/version-management/sourcehut/todo.nix
++++ b/pkgs/applications/version-management/sourcehut/todo.nix
+@@ -12,13 +12,13 @@
+ buildPythonPackage rec {
+   pname = "todosrht";
+-  version = "0.64.14";
++  version = "0.64.21";
+   src = fetchFromSourcehut {
+     owner = "~sircmpwn";
+     repo = "todo.sr.ht";
+     rev = version;
+-    sha256 = "sha256-huIAhn6h1F5w5ST4/yBwr82kAzyYwhLu+gpRuOQgnsE=";
++    sha256 = "sha256-kPO9A0g/i7xbVQ+PQ4+QDfP5zQrTiftmeIA1sTP/0AA=";
+   };
+   nativeBuildInputs = srht.nativeBuildInputs;
+diff --git a/pkgs/applications/version-management/sourcehut/update.sh b/pkgs/applications/version-management/sourcehut/update.sh
+index 156d4cc35e4..8cb4f708006 100755
+--- a/pkgs/applications/version-management/sourcehut/update.sh
++++ b/pkgs/applications/version-management/sourcehut/update.sh
+@@ -1,8 +1,11 @@
+ #! /usr/bin/env nix-shell
+ #! nix-shell -i bash -p git mercurial common-updater-scripts
++set -x
+-cd "$(dirname "${BASH_SOURCE[0]}")"
++cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1
+ root=../../../..
++tmp=$(mktemp -d)
++trap 'rm -rf "$tmp"' EXIT
+ default() {
+   (cd "$root" && nix-instantiate --eval --strict -A "sourcehut.python.pkgs.$1.meta.position" | sed -re 's/^"(.*):[0-9]+"$/\1/')
+@@ -13,19 +16,18 @@ version() {
+ }
+ src_url() {
+-  (cd "$root" && nix-instantiate --eval --strict -A "sourcehut.python.pkgs.$1.src.drvAttrs.url" | tr -d '"')
++  nix-instantiate --eval --strict --expr " with import $root {}; let src = sourcehut.python.pkgs.$1.drvAttrs.src; in src.url or src.meta.homepage" | tr -d '"'
+ }
+ get_latest_version() {
+   src="$(src_url "$1")"
+-  tmp=$(mktemp -d)
+-
++  rm -rf "$tmp"
+   if [ "$1" = "hgsrht" ]; then
+-    hg clone "$src" "$tmp" &> /dev/null
++    hg clone "$src" "$tmp" >/dev/null
+     printf "%s" "$(cd "$tmp" && hg log --limit 1 --template '{latesttag}')"
+   else
+-    git clone "$src" "$tmp"
+-    printf "%s" "$(cd "$tmp" && git describe $(git rev-list --tags --max-count=1))"
++    git clone "$src" "$tmp" >/dev/null
++    printf "%s" "$(cd "$tmp" && git describe "$(git rev-list --tags --max-count=1)")"
+   fi
+ }
+@@ -36,19 +38,33 @@ update_version() {
+   (cd "$root" && update-source-version "sourcehut.python.pkgs.$1" "$version")
++  # Update vendorSha256 of Go modules
++  nixFile="${1%srht}".nix
++  nixFile="${nixFile/build/builds}"
++  retry=true
++  while "$retry"; do
++    retry=false;
++    exec < <(exec nix -L build -f "$root" sourcehut.python.pkgs."$1" 2>&1)
++    while IFS=' :' read -r origin hash; do
++      case "$origin" in
++        (expected|specified) oldHash="$hash";;
++        (got) sed -i "s|$oldHash|$(nix hash to-sri --type sha256 "$hash")|" "$nixFile"; retry=true; break;;
++        (*) printf >&2 "%s\n" "$origin${hash:+:$hash}"
++      esac
++    done
++  done
++
+   git add "$default_nix"
+   git commit -m "$1: $version_old -> $version"
+ }
+-services=( "srht" "buildsrht" "dispatchsrht" "gitsrht" "hgsrht" "hubsrht" "listssrht" "mansrht"
+-           "metasrht" "pastesrht" "todosrht" "scmsrht" )
+-
+-# Whether or not a specific service is requested
+-if [ -n "$1" ]; then
+-  version="$(get_latest_version "$1")"
+-  (cd "$root" && update-source-version "sourcehut.python.pkgs.$1" "$version")
++if [ $# -gt 0 ]; then
++  services=("$@")
+ else
+-  for service in "${services[@]}"; do
+-    update_version "$service"
+-  done
++  services=( "srht" "buildsrht" "dispatchsrht" "gitsrht" "hgsrht" "hubsrht" "listssrht" "mansrht"
++             "metasrht" "pastesrht" "todosrht" "scmsrht" )
+ fi
++
++for service in "${services[@]}"; do
++  update_version "$service"
++done