]> Git — Sourcephile - sourcephile-nix.git/blob - nixpkgs/patches.sh
apparmor: update to upstream nixpkgs#101071
[sourcephile-nix.git] / nixpkgs / patches.sh
1 #!/usr/bin/env bash
2 set -eux
3 githubToken=$(pass julm/github.com/token/nixpkgs-patches.sh)
4 {
5 echo '['
6 for pr in \
7 83904 \
8 93305_ \
9 93293_ \
10 93457_ \
11 93659 \
12 93629 \
13 94938 \
14 96655 \
15 97740 \
16 98455 \
17 98734 \
18 101071 \
19 104457 \
20 104460 \
21 ; do
22 PR=${pr%_}
23 test $PR = $pr || echo '/*'
24 # pkgs.fetchpatch tries to normalize the patch using filterdiff after downloading it
25 # https://github.com/NixOS/nixpkgs/issues/41401#issuecomment-394173658
26 nix=$(mktemp)
27 trap "rm $nix" EXIT
28 cat >"$nix" <<EOF
29 { pkgs ? import <nixpkgs> {} }:
30 pkgs.fetchpatch {
31 url = "https://github.com/NixOS/nixpkgs/pull/$PR.diff";
32 sha256 = "0000000000000000000000000000000000000000000000000000";
33 }
34 EOF
35 hash=$(nix -L build -f "$nix" |& sed -ne 's/^ *got: *//p')
36 test -n "$hash"
37 # Token generated on https://github.com/settings/tokens
38 info=$(curl -Ls -H "Authorization: token $githubToken" \
39 https://api.github.com/repos/NixOS/nixpkgs/pulls/$PR)
40 description=$(printf %s "$info" | jq --raw-output .title)
41 cat <<EOF
42 {$(test "$(printf %s "$info" | jq --raw-output .merged)" = false || echo " # merged")
43 meta.description = "$description";
44 url = "https://github.com/NixOS/nixpkgs/pull/$PR.diff";
45 sha256 = "$hash";
46 }
47 EOF
48 test $PR = $pr || echo '*/'
49 done
50 echo ']'
51 } >"${0%.sh}".nix
52