diff --git a/pkgs/applications/version-management/sourcehut/builds.nix b/pkgs/applications/version-management/sourcehut/builds.nix index c8163caf8ea..76786ea1ad3 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.71.0"; 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-S3mMndUdVGi+YxAOI3wSNlSZrH3cwumxatXpErS2yQI="; }; nativeBuildInputs = srht.nativeBuildInputs; diff --git a/pkgs/applications/version-management/sourcehut/core.nix b/pkgs/applications/version-management/sourcehut/core.nix index d359d524eb2..4c7e7873739 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.18"; src = fetchgit { url = "https://git.sr.ht/~sircmpwn/core.sr.ht"; rev = version; - sha256 = "sha256-XvzFfcBK5Mq8p7xEBAF/eupUE1kkUBh5k+ByM/WA9bc="; + sha256 = "sha256-lPPB1DRWHANGBBfWeu0pUn1xBkd37ZhyreozLlxX6cA="; fetchSubmodules = true; }; diff --git a/pkgs/applications/version-management/sourcehut/default.nix b/pkgs/applications/version-management/sourcehut/default.nix index 401a1437b7d..00810f208cc 100644 --- a/pkgs/applications/version-management/sourcehut/default.nix +++ b/pkgs/applications/version-management/sourcehut/default.nix @@ -22,6 +22,7 @@ let listssrht = self.callPackage ./lists.nix { }; mansrht = self.callPackage ./man.nix { }; metasrht = self.callPackage ./meta.nix { }; + pagessrht = self.callPackage ./pages.nix { }; pastesrht = self.callPackage ./paste.nix { }; todosrht = self.callPackage ./todo.nix { }; @@ -40,6 +41,7 @@ with python.pkgs; recurseIntoAttrs { listssrht = toPythonApplication listssrht; mansrht = toPythonApplication mansrht; metasrht = toPythonApplication metasrht; + pagessrht = pagessrht; pastesrht = toPythonApplication pastesrht; todosrht = toPythonApplication todosrht; } diff --git a/pkgs/applications/version-management/sourcehut/dispatch.nix b/pkgs/applications/version-management/sourcehut/dispatch.nix index 637c6f9c1df..af2ea1e9a4f 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.32"; src = fetchFromSourcehut { owner = "~sircmpwn"; repo = "dispatch.sr.ht"; rev = version; - sha256 = "sha256-zWCGPjIgMKHXHJUs9aciV7IFgo0rpahon6KXHDwcfss="; + sha256 = "sha256-4P4cXhjcZ8IBzpRfmYIJkzl9U4Plo36a48Pf/KjmhFY="; }; nativeBuildInputs = srht.nativeBuildInputs; diff --git a/pkgs/applications/version-management/sourcehut/git.nix b/pkgs/applications/version-management/sourcehut/git.nix index e44fb9cd6c6..7c6b0985ca1 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.44"; src = fetchFromSourcehut { owner = "~sircmpwn"; repo = "git.sr.ht"; rev = version; - sha256 = "sha256-AB2uzajO5PtcpJfbOOTfuDFM6is5K39v3AZJ1hShRNc="; + sha256 = "sha256-U+hJiQpAJIHBC//M/Lfw82DLhZF46qHhz8zZW1ZvJoo="; }; 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..3d1aa8fd319 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.8"; src = fetchFromSourcehut { owner = "~sircmpwn"; repo = "hub.sr.ht"; rev = version; - sha256 = "sha256-Kqzy4mh5Nn1emzHBco/LVuXro/tW3NX+OYqdEwBSQ/U="; + sha256 = "sha256-RsRJxwViEoQLh86o+8kQE5PBlLrOyIFM7hkSGjXhqdg="; }; nativeBuildInputs = srht.nativeBuildInputs; diff --git a/pkgs/applications/version-management/sourcehut/lists.nix b/pkgs/applications/version-management/sourcehut/lists.nix index b419b49f7b5..f0977b69775 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.49.3"; src = fetchFromSourcehut { owner = "~sircmpwn"; repo = "lists.sr.ht"; rev = version; - sha256 = "sha256-bsakEMyvWaxiE4/SGcAP4mlGG9jkdHfFxpt9H+TJn/8="; + sha256 = "sha256-kEzKgB8godIL7hEXMrqaxVte6RJAegjT4keZifXbOq0="; }; nativeBuildInputs = srht.nativeBuildInputs; diff --git a/pkgs/applications/version-management/sourcehut/man.nix b/pkgs/applications/version-management/sourcehut/man.nix index bd331f000a7..2096d9a96f3 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.20"; src = fetchFromSourcehut { owner = "~sircmpwn"; repo = "man.sr.ht"; rev = version; - sha256 = "sha256-MqH/8K9XRvEg6P7GHE6XXtWnhDP3wT8iGoNaFtYQbio="; + sha256 = "sha256-ulwdrVrw2bwdafgc3NrJ1J15evQ5btpHLTaiqsyA58U="; }; nativeBuildInputs = srht.nativeBuildInputs; diff --git a/pkgs/applications/version-management/sourcehut/meta.nix b/pkgs/applications/version-management/sourcehut/meta.nix index a285d484ed2..81572c6f09b 100644 --- a/pkgs/applications/version-management/sourcehut/meta.nix +++ b/pkgs/applications/version-management/sourcehut/meta.nix @@ -18,19 +18,19 @@ , python }: let - version = "0.53.14"; + version = "0.54.4"; src = fetchFromSourcehut { owner = "~sircmpwn"; repo = "meta.sr.ht"; rev = version; - sha256 = "sha256-/+r/XLDkcSTW647xPMh5bcJmR2xZNNH74AJ5jemna2k="; + sha256 = "sha256-MleyF6aqFWbYtxRdMHXpy7HBgJKL9doBmDcYLLe8bW4="; }; buildApi = src: buildGoModule { inherit src version; pname = "metasrht-api"; - vendorSha256 = "sha256-eZyDrr2VcNMxI++18qUy7LA1Q1YDlWCoRtl00L8lfR4="; + vendorSha256 = "sha256-gi+dGQPVzrZI+1s9SSa2M3bdgi8vwpR/ofaLG2ZX4kU="; }; in diff --git a/pkgs/applications/version-management/sourcehut/pages-fix-syntax-error-in-schema.sql.patch b/pkgs/applications/version-management/sourcehut/pages-fix-syntax-error-in-schema.sql.patch new file mode 100644 index 00000000000..9b3f6fbc6fb --- /dev/null +++ b/pkgs/applications/version-management/sourcehut/pages-fix-syntax-error-in-schema.sql.patch @@ -0,0 +1,27 @@ +From 3df160ad289b25574322f587095d00d6641f057c Mon Sep 17 00:00:00 2001 +From: Juan Picca +Date: Wed, 21 Jul 2021 08:26:56 -0300 +Subject: [PATCH] Fix syntax error in schema.sql + +--- + schema.sql | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/schema.sql b/schema.sql +index 168377f..2e473ea 100644 +--- a/schema.sql ++++ b/schema.sql +@@ -28,8 +28,8 @@ CREATE TABLE sites ( + user_id integer NOT NULL references "user"(id), + domain varchar NOT NULL, + protocol protocol NOT NULL, +- version varchar NOT NULL +- UNIQUE (domain, protocol), ++ version varchar NOT NULL, ++ UNIQUE (domain, protocol) + ); + + COMMIT; +-- +2.32.0 + diff --git a/pkgs/applications/version-management/sourcehut/pages.nix b/pkgs/applications/version-management/sourcehut/pages.nix new file mode 100644 index 00000000000..420045ec837 --- /dev/null +++ b/pkgs/applications/version-management/sourcehut/pages.nix @@ -0,0 +1,37 @@ +{ lib +, fetchFromSourcehut +, buildGoModule +}: +let + version = "0.4.8"; + + src = fetchFromSourcehut { + owner = "~sircmpwn"; + repo = "pages.sr.ht"; + rev = version; + sha256 = "sha256-z9w8v5e6LY6VUEczltyD55KEUUH7Gw1vUO00KPmT+D8="; + }; + +in +buildGoModule { + inherit src version; + pname = "pagessrht"; + vendorSha256 = "sha256-xOd9i+PNlLxZrw/+z/C9V+AbOLEociW2YHY+x1K+mJI="; + + patches = [ + # Upstream after 0.4.8 + ./pages-fix-syntax-error-in-schema.sql.patch + ]; + + postInstall = '' + mkdir -p $out/share/sql/ + cp -r -t $out/share/sql/ schema.sql migrations + ''; + + meta = with lib; { + homepage = "https://git.sr.ht/~sircmpwn/pages.sr.ht"; + description = "Web hosting service for the sr.ht network"; + license = licenses.agpl3; + maintainers = with maintainers; [ eadwu ]; + }; +} diff --git a/pkgs/applications/version-management/sourcehut/paste.nix b/pkgs/applications/version-management/sourcehut/paste.nix index 0d8c9135493..71a95bb10b0 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.4"; src = fetchFromSourcehut { owner = "~sircmpwn"; repo = "paste.sr.ht"; rev = version; - sha256 = "sha256-QQhd2LeH9BLmlHilhsv+9fZ+RPNmEMSmOpFA3dsMBFc="; + sha256 = "sha256-hFjWa7L7JiQoG3Hm9NyoP2FNypDiW+nGDmQ2DoZkAIw="; }; nativeBuildInputs = srht.nativeBuildInputs; diff --git a/pkgs/applications/version-management/sourcehut/scm.nix b/pkgs/applications/version-management/sourcehut/scm.nix index 1f385265360..bc6d7949002 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.13"; src = fetchFromSourcehut { owner = "~sircmpwn"; repo = "scm.sr.ht"; rev = version; - sha256 = "sha256-327G6C8FW+iZx+167D7TQsFtV6FGc8MpMVo9L/cUUqU="; + sha256 = "sha256-9iRmQBt4Cxr5itTk34b8iDRyXYDHTDfZjV0SIDT/kkM="; }; nativeBuildInputs = srht.nativeBuildInputs; diff --git a/pkgs/applications/version-management/sourcehut/todo.nix b/pkgs/applications/version-management/sourcehut/todo.nix index 85e1f5637b6..a6615b19748 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.24"; src = fetchFromSourcehut { owner = "~sircmpwn"; repo = "todo.sr.ht"; rev = version; - sha256 = "sha256-huIAhn6h1F5w5ST4/yBwr82kAzyYwhLu+gpRuOQgnsE="; + sha256 = "sha256-H2XGOxHyurXw3GekZJXSO6RMChRjNbjqxik/mvFVqfY="; }; nativeBuildInputs = srht.nativeBuildInputs; diff --git a/pkgs/applications/version-management/sourcehut/update.sh b/pkgs/applications/version-management/sourcehut/update.sh index 156d4cc35e4..36040c6d14f 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" "pagessrht" "pastesrht" "todosrht" "scmsrht" ) fi + +for service in "${services[@]}"; do + update_version "$service" +done