summaryrefslogtreecommitdiff
path: root/pkgs/build-support/fetchpatch/tests.nix
blob: fac768421a60806454570048330091f3570e4338 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
{ testers, fetchpatch, ... }:

let
  isFetchpatch2 = fetchpatch.version == 2;
in

{
  simple = testers.invalidateFetcherByDrvHash fetchpatch {
    url = "https://github.com/facebook/zstd/commit/e1f85dbca3a0ed5ef06c8396912a0914db8dea6a.patch?full_index=1";
    sha256 =
      if isFetchpatch2 then
        "sha256-2kFh8FC96njAKH69uJp1vZSye47Suf76RfBodqosLU0="
      else
        "sha256-PuYAqnJWAE+L9bsroOnnBGJhERW8LHrGSLtIEkKU9vg=";
  };

  relative = testers.invalidateFetcherByDrvHash fetchpatch {
    url = "https://github.com/boostorg/math/commit/7d482f6ebc356e6ec455ccb5f51a23971bf6ce5b.patch?full_index=1";
    relative = "include";
    sha256 =
      if isFetchpatch2 then
        "sha256-NS1CH+V5I29Yc0PHXdVxAn5tAHTvnGphRjhv4hZGYIo="
      else
        "sha256-KlmIbixcds6GyKYt1fx5BxDIrU7msrgDdYo9Va/KJR4=";
  };

  hunks = testers.invalidateFetcherByDrvHash fetchpatch {
    url = "https://github.com/openssh/openssh-portable/commit/35d5917652106aede47621bb3f64044604164043.patch?full_index=1";
    stripLen = 1;
    hunks = [
      2
      3
      4
      5
      6
      7
    ];
    sha256 =
      if isFetchpatch2 then
        "sha256-2eiufShDHVpiK9DaGUzfu1MlGrgE9OJAhmQcEcAViQw="
      else
        "sha256-MV7uGgA1ESMR7W6H5FjAIxKcpySdQjWB+L2zaHjd96M=";
  };

  full = testers.invalidateFetcherByDrvHash fetchpatch {
    url = "https://github.com/boostorg/math/commit/7d482f6ebc356e6ec455ccb5f51a23971bf6ce5b.patch?full_index=1";
    relative = "test";
    stripLen = 1;
    extraPrefix = "foo/bar/";
    excludes = [ "foo/bar/bernoulli_no_atomic_mp.cpp" ];
    # Should result in no change.
    hunks = [ "1-" ];
    revert = true;
    sha256 = "sha256-+UKmEbr2rIAweCav/hR/7d4ZrYV84ht/domTrHtm8sM=";
  };

  decode = testers.invalidateFetcherByDrvHash fetchpatch {
    name = "gcc.patch";
    url = "https://chromium.googlesource.com/aosp/platform/external/libchrome/+/f37ae3b1a873d74182a2ac31d96742ead9c1f523^!?format=TEXT";
    decode = "base64 -d";
    sha256 =
      if isFetchpatch2 then
        "sha256-oMvPlmzE51ArI+EvFxONXkqmNee39106/O1ikG0Bdso="
      else
        "sha256-SJHk8XrutqAyoIdORlhCpBCN626P+uzed7mjKz5eQYY=";
  };

  fileWithSpace = testers.invalidateFetcherByDrvHash fetchpatch {
    url = "https://github.com/jfly/annoying-filenames/commit/1e86a219f5fc9c4137b409bc9c38036f3922724b.patch?full_index=1";
    sha256 =
      if isFetchpatch2 then
        "sha256-HIS/I7tLl/XYcyLuyjrIkPmLPxJPAuAguMUmhL9Ei8g="
      else
        "sha256-aptUvVojqIIIVNuHqkl+C+dZBGFfs+1MUd0FNV+4j4E=";
  };

  fileWithApostrophe = testers.invalidateFetcherByDrvHash fetchpatch {
    url = "https://github.com/jfly/annoying-filenames/commit/8b6d8f8d7094ce646523b3369cfdf5030289c66c.patch";
    sha256 =
      if isFetchpatch2 then
        "sha256-CrQFmVvLEvWpo2ucVrWyLb5qk2GVOxyUbFN3hp9sV68="
      else
        "sha256-CrQFmVvLEvWpo2ucVrWyLb5qk2GVOxyUbFN3hp9sV68=";
  };
}