]> Git — Sourcephile - sourcephile-nix.git/blob - nixpkgs/patches/sourcehut.diff
sourcehut: initialize OAuth only for enabled services
[sourcephile-nix.git] / nixpkgs / patches / sourcehut.diff
1 diff --git a/pkgs/applications/version-management/sourcehut/builds.nix b/pkgs/applications/version-management/sourcehut/builds.nix
2 index c8163caf8ea..24ec5fe4e63 100644
3 --- a/pkgs/applications/version-management/sourcehut/builds.nix
4 +++ b/pkgs/applications/version-management/sourcehut/builds.nix
5 @@ -11,13 +11,13 @@
6 , python
7 }:
8 let
9 - version = "0.66.7";
10 + version = "0.70.8";
11
12 buildWorker = src: buildGoModule {
13 inherit src version;
14 pname = "builds-sr-ht-worker";
15
16 - vendorSha256 = "sha256-giOaldV46aBqXyFH/cQVsbUr6Rb4VMhbBO86o48tRZY=";
17 + vendorSha256 = "sha256-ZEarWM/33t+pNXUEIpfd/DkBkhu3UUg17Hh8XXWOepA=";
18 };
19 in
20 buildPythonPackage rec {
21 @@ -28,7 +28,7 @@ buildPythonPackage rec {
22 owner = "~sircmpwn";
23 repo = "builds.sr.ht";
24 rev = version;
25 - sha256 = "sha256-2MLs/DOXHjEYarXDVUcPZe3o0fmZbzVxn528SE72lhM=";
26 + sha256 = "sha256-0guAknoCUGmREZTu1KYs+TPd1jmLlgapriyoi5eg2Ig=";
27 };
28
29 nativeBuildInputs = srht.nativeBuildInputs;
30 diff --git a/pkgs/applications/version-management/sourcehut/core.nix b/pkgs/applications/version-management/sourcehut/core.nix
31 index d359d524eb2..b872208cb40 100644
32 --- a/pkgs/applications/version-management/sourcehut/core.nix
33 +++ b/pkgs/applications/version-management/sourcehut/core.nix
34 @@ -30,12 +30,12 @@
35
36 buildPythonPackage rec {
37 pname = "srht";
38 - version = "0.67.4";
39 + version = "0.67.13";
40
41 src = fetchgit {
42 url = "https://git.sr.ht/~sircmpwn/core.sr.ht";
43 rev = version;
44 - sha256 = "sha256-XvzFfcBK5Mq8p7xEBAF/eupUE1kkUBh5k+ByM/WA9bc=";
45 + sha256 = "sha256-hwoG/xEE+58a9+MO7ViCr70qSIm/Oyr6qy3QYfmI6Uw=";
46 fetchSubmodules = true;
47 };
48
49 diff --git a/pkgs/applications/version-management/sourcehut/dispatch.nix b/pkgs/applications/version-management/sourcehut/dispatch.nix
50 index 637c6f9c1df..0aec2210599 100644
51 --- a/pkgs/applications/version-management/sourcehut/dispatch.nix
52 +++ b/pkgs/applications/version-management/sourcehut/dispatch.nix
53 @@ -9,13 +9,13 @@
54
55 buildPythonPackage rec {
56 pname = "dispatchsrht";
57 - version = "0.15.8";
58 + version = "0.15.31";
59
60 src = fetchFromSourcehut {
61 owner = "~sircmpwn";
62 repo = "dispatch.sr.ht";
63 rev = version;
64 - sha256 = "sha256-zWCGPjIgMKHXHJUs9aciV7IFgo0rpahon6KXHDwcfss=";
65 + sha256 = "sha256-y+7Q6yEwmGYTZakHLvNTNazOQOlv7oa8Z9K1jccj19M=";
66 };
67
68 nativeBuildInputs = srht.nativeBuildInputs;
69 diff --git a/pkgs/applications/version-management/sourcehut/git.nix b/pkgs/applications/version-management/sourcehut/git.nix
70 index e44fb9cd6c6..3b76bda965f 100644
71 --- a/pkgs/applications/version-management/sourcehut/git.nix
72 +++ b/pkgs/applications/version-management/sourcehut/git.nix
73 @@ -8,13 +8,13 @@
74 , scmsrht
75 }:
76 let
77 - version = "0.72.8";
78 + version = "0.72.40";
79
80 src = fetchFromSourcehut {
81 owner = "~sircmpwn";
82 repo = "git.sr.ht";
83 rev = version;
84 - sha256 = "sha256-AB2uzajO5PtcpJfbOOTfuDFM6is5K39v3AZJ1hShRNc=";
85 + sha256 = "sha256-Y5485XY614AfAO65jtA72ylZ1LZC2DKFBN4Ijh4anFg=";
86 };
87
88 buildShell = src: buildGoModule {
89 diff --git a/pkgs/applications/version-management/sourcehut/hg.nix b/pkgs/applications/version-management/sourcehut/hg.nix
90 index cddb76cabf2..a7317980134 100644
91 --- a/pkgs/applications/version-management/sourcehut/hg.nix
92 +++ b/pkgs/applications/version-management/sourcehut/hg.nix
93 @@ -10,12 +10,12 @@
94
95 buildPythonPackage rec {
96 pname = "hgsrht";
97 - version = "0.27.4";
98 + version = "0.27.6";
99
100 src = fetchhg {
101 url = "https://hg.sr.ht/~sircmpwn/hg.sr.ht";
102 rev = version;
103 - sha256 = "1c0qfi0gmbfngvds6917fy9ii2iglawn429757rh7b4bvzn7n6mr";
104 + sha256 = "ibijvKjS4CiWTYrO6Qdh3RkD0EUE7BY8wjdPwrD6vkA=";
105 };
106
107 nativeBuildInputs = srht.nativeBuildInputs;
108 diff --git a/pkgs/applications/version-management/sourcehut/hub.nix b/pkgs/applications/version-management/sourcehut/hub.nix
109 index 17cb3fe4b61..ff5ffcca38a 100644
110 --- a/pkgs/applications/version-management/sourcehut/hub.nix
111 +++ b/pkgs/applications/version-management/sourcehut/hub.nix
112 @@ -6,13 +6,13 @@
113
114 buildPythonPackage rec {
115 pname = "hubsrht";
116 - version = "0.13.1";
117 + version = "0.13.5";
118
119 src = fetchFromSourcehut {
120 owner = "~sircmpwn";
121 repo = "hub.sr.ht";
122 rev = version;
123 - sha256 = "sha256-Kqzy4mh5Nn1emzHBco/LVuXro/tW3NX+OYqdEwBSQ/U=";
124 + sha256 = "sha256-hCsHwKCnXOdUnJuklb0C7+yq2JduswMjaYGWmNS6rkc=";
125 };
126
127 nativeBuildInputs = srht.nativeBuildInputs;
128 diff --git a/pkgs/applications/version-management/sourcehut/lists.nix b/pkgs/applications/version-management/sourcehut/lists.nix
129 index b419b49f7b5..b98f7b38918 100644
130 --- a/pkgs/applications/version-management/sourcehut/lists.nix
131 +++ b/pkgs/applications/version-management/sourcehut/lists.nix
132 @@ -12,13 +12,13 @@
133
134 buildPythonPackage rec {
135 pname = "listssrht";
136 - version = "0.48.19";
137 + version = "0.48.24";
138
139 src = fetchFromSourcehut {
140 owner = "~sircmpwn";
141 repo = "lists.sr.ht";
142 rev = version;
143 - sha256 = "sha256-bsakEMyvWaxiE4/SGcAP4mlGG9jkdHfFxpt9H+TJn/8=";
144 + sha256 = "sha256-2WU+Q33rZnth0y87blr7dSiy4iV1ZD9xx51gAks1z/Y=";
145 };
146
147 nativeBuildInputs = srht.nativeBuildInputs;
148 diff --git a/pkgs/applications/version-management/sourcehut/man.nix b/pkgs/applications/version-management/sourcehut/man.nix
149 index bd331f000a7..effe70059df 100644
150 --- a/pkgs/applications/version-management/sourcehut/man.nix
151 +++ b/pkgs/applications/version-management/sourcehut/man.nix
152 @@ -8,13 +8,13 @@
153
154 buildPythonPackage rec {
155 pname = "mansrht";
156 - version = "0.15.12";
157 + version = "0.15.18";
158
159 src = fetchFromSourcehut {
160 owner = "~sircmpwn";
161 repo = "man.sr.ht";
162 rev = version;
163 - sha256 = "sha256-MqH/8K9XRvEg6P7GHE6XXtWnhDP3wT8iGoNaFtYQbio=";
164 + sha256 = "sha256-hlp3WBKgRHEWlQvs2Ep1sWA8gVR91pQnd7gvl8jMaVE=";
165 };
166
167 nativeBuildInputs = srht.nativeBuildInputs;
168 diff --git a/pkgs/applications/version-management/sourcehut/meta.nix b/pkgs/applications/version-management/sourcehut/meta.nix
169 index a285d484ed2..9e514022a2e 100644
170 --- a/pkgs/applications/version-management/sourcehut/meta.nix
171 +++ b/pkgs/applications/version-management/sourcehut/meta.nix
172 @@ -18,13 +18,13 @@
173 , python
174 }:
175 let
176 - version = "0.53.14";
177 + version = "0.54.0";
178
179 src = fetchFromSourcehut {
180 owner = "~sircmpwn";
181 repo = "meta.sr.ht";
182 rev = version;
183 - sha256 = "sha256-/+r/XLDkcSTW647xPMh5bcJmR2xZNNH74AJ5jemna2k=";
184 + sha256 = "sha256-OrtYdKjO8jLoamGHW9sSJ1WpE/7yESk2yPUQhwD19vU=";
185 };
186
187 buildApi = src: buildGoModule {
188 diff --git a/pkgs/applications/version-management/sourcehut/paste.nix b/pkgs/applications/version-management/sourcehut/paste.nix
189 index 0d8c9135493..884b9bf6c6f 100644
190 --- a/pkgs/applications/version-management/sourcehut/paste.nix
191 +++ b/pkgs/applications/version-management/sourcehut/paste.nix
192 @@ -8,13 +8,13 @@
193
194 buildPythonPackage rec {
195 pname = "pastesrht";
196 - version = "0.12.1";
197 + version = "0.12.3";
198
199 src = fetchFromSourcehut {
200 owner = "~sircmpwn";
201 repo = "paste.sr.ht";
202 rev = version;
203 - sha256 = "sha256-QQhd2LeH9BLmlHilhsv+9fZ+RPNmEMSmOpFA3dsMBFc=";
204 + sha256 = "sha256-cBIeK3wBzIYDOed8zvz8+abcLvFAeWua44UWlhO0ZEY=";
205 };
206
207 nativeBuildInputs = srht.nativeBuildInputs;
208 diff --git a/pkgs/applications/version-management/sourcehut/scm.nix b/pkgs/applications/version-management/sourcehut/scm.nix
209 index 1f385265360..1ce3fe867ed 100644
210 --- a/pkgs/applications/version-management/sourcehut/scm.nix
211 +++ b/pkgs/applications/version-management/sourcehut/scm.nix
212 @@ -10,13 +10,13 @@
213
214 buildPythonPackage rec {
215 pname = "scmsrht";
216 - version = "0.22.9";
217 + version = "0.22.12";
218
219 src = fetchFromSourcehut {
220 owner = "~sircmpwn";
221 repo = "scm.sr.ht";
222 rev = version;
223 - sha256 = "sha256-327G6C8FW+iZx+167D7TQsFtV6FGc8MpMVo9L/cUUqU=";
224 + sha256 = "sha256-ktDQ0pVljt85sN2v5QgBiqaW5wtVc5pRC8WT31HSwpI=";
225 };
226
227 nativeBuildInputs = srht.nativeBuildInputs;
228 diff --git a/pkgs/applications/version-management/sourcehut/todo.nix b/pkgs/applications/version-management/sourcehut/todo.nix
229 index 85e1f5637b6..218e958f3a6 100644
230 --- a/pkgs/applications/version-management/sourcehut/todo.nix
231 +++ b/pkgs/applications/version-management/sourcehut/todo.nix
232 @@ -12,13 +12,13 @@
233
234 buildPythonPackage rec {
235 pname = "todosrht";
236 - version = "0.64.14";
237 + version = "0.64.21";
238
239 src = fetchFromSourcehut {
240 owner = "~sircmpwn";
241 repo = "todo.sr.ht";
242 rev = version;
243 - sha256 = "sha256-huIAhn6h1F5w5ST4/yBwr82kAzyYwhLu+gpRuOQgnsE=";
244 + sha256 = "sha256-kPO9A0g/i7xbVQ+PQ4+QDfP5zQrTiftmeIA1sTP/0AA=";
245 };
246
247 nativeBuildInputs = srht.nativeBuildInputs;
248 diff --git a/pkgs/applications/version-management/sourcehut/update.sh b/pkgs/applications/version-management/sourcehut/update.sh
249 index 156d4cc35e4..8cb4f708006 100755
250 --- a/pkgs/applications/version-management/sourcehut/update.sh
251 +++ b/pkgs/applications/version-management/sourcehut/update.sh
252 @@ -1,8 +1,11 @@
253 #! /usr/bin/env nix-shell
254 #! nix-shell -i bash -p git mercurial common-updater-scripts
255 +set -x
256
257 -cd "$(dirname "${BASH_SOURCE[0]}")"
258 +cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1
259 root=../../../..
260 +tmp=$(mktemp -d)
261 +trap 'rm -rf "$tmp"' EXIT
262
263 default() {
264 (cd "$root" && nix-instantiate --eval --strict -A "sourcehut.python.pkgs.$1.meta.position" | sed -re 's/^"(.*):[0-9]+"$/\1/')
265 @@ -13,19 +16,18 @@ version() {
266 }
267
268 src_url() {
269 - (cd "$root" && nix-instantiate --eval --strict -A "sourcehut.python.pkgs.$1.src.drvAttrs.url" | tr -d '"')
270 + 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 '"'
271 }
272
273 get_latest_version() {
274 src="$(src_url "$1")"
275 - tmp=$(mktemp -d)
276 -
277 + rm -rf "$tmp"
278 if [ "$1" = "hgsrht" ]; then
279 - hg clone "$src" "$tmp" &> /dev/null
280 + hg clone "$src" "$tmp" >/dev/null
281 printf "%s" "$(cd "$tmp" && hg log --limit 1 --template '{latesttag}')"
282 else
283 - git clone "$src" "$tmp"
284 - printf "%s" "$(cd "$tmp" && git describe $(git rev-list --tags --max-count=1))"
285 + git clone "$src" "$tmp" >/dev/null
286 + printf "%s" "$(cd "$tmp" && git describe "$(git rev-list --tags --max-count=1)")"
287 fi
288 }
289
290 @@ -36,19 +38,33 @@ update_version() {
291
292 (cd "$root" && update-source-version "sourcehut.python.pkgs.$1" "$version")
293
294 + # Update vendorSha256 of Go modules
295 + nixFile="${1%srht}".nix
296 + nixFile="${nixFile/build/builds}"
297 + retry=true
298 + while "$retry"; do
299 + retry=false;
300 + exec < <(exec nix -L build -f "$root" sourcehut.python.pkgs."$1" 2>&1)
301 + while IFS=' :' read -r origin hash; do
302 + case "$origin" in
303 + (expected|specified) oldHash="$hash";;
304 + (got) sed -i "s|$oldHash|$(nix hash to-sri --type sha256 "$hash")|" "$nixFile"; retry=true; break;;
305 + (*) printf >&2 "%s\n" "$origin${hash:+:$hash}"
306 + esac
307 + done
308 + done
309 +
310 git add "$default_nix"
311 git commit -m "$1: $version_old -> $version"
312 }
313
314 -services=( "srht" "buildsrht" "dispatchsrht" "gitsrht" "hgsrht" "hubsrht" "listssrht" "mansrht"
315 - "metasrht" "pastesrht" "todosrht" "scmsrht" )
316 -
317 -# Whether or not a specific service is requested
318 -if [ -n "$1" ]; then
319 - version="$(get_latest_version "$1")"
320 - (cd "$root" && update-source-version "sourcehut.python.pkgs.$1" "$version")
321 +if [ $# -gt 0 ]; then
322 + services=("$@")
323 else
324 - for service in "${services[@]}"; do
325 - update_version "$service"
326 - done
327 + services=( "srht" "buildsrht" "dispatchsrht" "gitsrht" "hgsrht" "hubsrht" "listssrht" "mansrht"
328 + "metasrht" "pastesrht" "todosrht" "scmsrht" )
329 fi
330 +
331 +for service in "${services[@]}"; do
332 + update_version "$service"
333 +done