Skip to content

Commit ad981c4

Browse files
committed
squash! use gitTracked
1 parent 8f31398 commit ad981c4

File tree

4 files changed

+56
-64
lines changed

4 files changed

+56
-64
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,6 +1212,7 @@ $(TARBALL): release-only doc-only
12121212
mkdir -p $(TARNAME)/doc/api
12131213
cp doc/node.1 $(TARNAME)/doc/node.1
12141214
cp -r out/doc/api/* $(TARNAME)/doc/api/
1215+
sed 's/fileset = fileset.intersection (fileset.gitTracked root)/fileset =/' tools/nix/v8.nix > $(TARNAME)/tools/nix/v8.nix
12151216
$(RM) -r $(TARNAME)/.editorconfig
12161217
$(RM) -r $(TARNAME)/.git*
12171218
$(RM) -r $(TARNAME)/.mailmap

tools/dep_updaters/update-gyp-next.sh

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,24 +39,16 @@ GYP_NEXT_TARBALL="$NEW_VERSION.tar.gz"
3939

4040
cd "$WORKSPACE"
4141

42-
URL="https://github.com/nodejs/gyp-next/archive/refs/tags/v$NEW_VERSION.tar.gz"
43-
curl -sL -o "$GYP_NEXT_TARBALL" "$URL"
42+
curl -sL -o "$GYP_NEXT_TARBALL" "https://github.com/nodejs/gyp-next/archive/refs/tags/v$NEW_VERSION.tar.gz"
4443

45-
HASH=$(log_and_verify_sha256sum "gyp-next" "$GYP_NEXT_TARBALL")
44+
log_and_verify_sha256sum "gyp-next" "$GYP_NEXT_TARBALL"
4645

4746
gzip -dc "$GYP_NEXT_TARBALL" | tar xf -
4847

4948
rm "$GYP_NEXT_TARBALL"
5049

5150
mv "gyp-next-$NEW_VERSION" gyp
5251

53-
cat -> "$WORKSPACE/gyp/src.nix" <<EOF
54-
builtins.fetchurl {
55-
url = "$URL";
56-
sha256 = "${HASH##*= }";
57-
}
58-
EOF
59-
6052
rm -rf "$WORKSPACE/gyp/.github"
6153

6254
rm -rf "$BASE_DIR/tools/gyp"

tools/gyp/src.nix

Lines changed: 0 additions & 4 deletions
This file was deleted.

tools/nix/v8.nix

Lines changed: 53 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,51 @@
2323
}:
2424

2525
let
26-
v8Dir = ../../deps/v8;
26+
src =
27+
let
28+
inherit (lib) fileset;
29+
root = ../../.;
30+
files = [
31+
../../common.gypi
32+
../../configure.py
33+
../../deps/v8
34+
../../node.gyp
35+
../../node.gypi
36+
../../src/node_version.h
37+
../../tools/configure.d/nodedownload.py
38+
../../tools/getmoduleversion.py
39+
../../tools/getnapibuildversion.py
40+
../../tools/gyp/pylib
41+
../../tools/gyp_node.py
42+
../../tools/utils.py
43+
../../tools/v8_gypfiles/abseil.gyp
44+
../../tools/v8_gypfiles/features.gypi
45+
../../tools/v8_gypfiles/ForEachFormat.py
46+
../../tools/v8_gypfiles/ForEachReplace.py
47+
../../tools/v8_gypfiles/GN-scraper.py
48+
../../tools/v8_gypfiles/inspector.gypi
49+
../../tools/v8_gypfiles/toolchain.gypi
50+
../../tools/v8_gypfiles/v8.gyp
51+
]
52+
++ lib.optionals (icu != null) [
53+
../../tools/icu/icu_versions.json
54+
../../tools/icu/icu-system.gyp
55+
]
56+
++ lib.optionals (icu == "small") [
57+
../../deps/icu-small
58+
../../tools/icu/current_ver.dep
59+
../../tools/icu/icu_small.json
60+
../../tools/icu/icu-generic.gyp
61+
../../tools/icu/iculslocs.cc
62+
../../tools/icu/icutrim.py
63+
../../tools/icu/no-op.cc
64+
];
65+
in
66+
fileset.toSource {
67+
inherit root;
68+
fileset = fileset.intersection (fileset.gitTracked root) (fileset.unions files);
69+
};
70+
v8Dir = "${src}/deps/v8";
2771
in
2872
stdenv.mkDerivation (finalAttrs: {
2973
pname = "v8";
@@ -36,64 +80,20 @@ stdenv.mkDerivation (finalAttrs: {
3680
+ "#define V8_PATCH_LEVEL ([0-9]+).*"
3781
) (builtins.readFile "${v8Dir}/include/v8-version.h");
3882
v8_embedder_string = builtins.match ".*'v8_embedder_string': '-(node.[0-9]+)'.*" (
39-
builtins.readFile ../../common.gypi
83+
builtins.readFile "${src}/common.gypi"
4084
);
4185
in
4286
if v8Version == null || v8_embedder_string == null then
4387
throw "V8 version not found"
4488
else
4589
"${builtins.elemAt v8Version 0}.${builtins.elemAt v8Version 1}.${builtins.elemAt v8Version 2}.${builtins.elemAt v8Version 3}-${builtins.elemAt v8_embedder_string 0}";
46-
src =
47-
let
48-
inherit (lib) fileset;
49-
in
50-
fileset.toSource {
51-
root = ../../.;
52-
fileset = fileset.unions (
53-
[
54-
v8Dir
55-
../../common.gypi
56-
../../configure.py
57-
../../node.gyp
58-
../../node.gypi
59-
../../src/node_version.h
60-
../../tools/configure.d/nodedownload.py
61-
../../tools/getmoduleversion.py
62-
../../tools/getnapibuildversion.py
63-
../../tools/gyp_node.py
64-
../../tools/utils.py
65-
../../tools/v8_gypfiles/abseil.gyp
66-
../../tools/v8_gypfiles/features.gypi
67-
../../tools/v8_gypfiles/ForEachFormat.py
68-
../../tools/v8_gypfiles/ForEachReplace.py
69-
../../tools/v8_gypfiles/GN-scraper.py
70-
../../tools/v8_gypfiles/inspector.gypi
71-
../../tools/v8_gypfiles/toolchain.gypi
72-
../../tools/v8_gypfiles/v8.gyp
73-
]
74-
++ lib.optionals (icu != null) [
75-
../../tools/icu/icu_versions.json
76-
../../tools/icu/icu-system.gyp
77-
]
78-
++ lib.optionals (icu == "small") [
79-
../../deps/icu-small
80-
../../tools/icu/current_ver.dep
81-
../../tools/icu/icu_small.json
82-
../../tools/icu/icu-generic.gyp
83-
../../tools/icu/iculslocs.cc
84-
../../tools/icu/icutrim.py
85-
../../tools/icu/no-op.cc
86-
]
87-
);
88-
};
8990

9091
patches = lib.optional (
9192
# V8 accesses internal ICU headers and methods in the Temporal files.
9293
!(builtins.isString icu) && builtins.elem "--v8-enable-temporal-support" configureFlags
9394
) ./temporal-no-vendored-icu.patch;
9495

95-
# We need to download and patch GYP to work from within Nix sandbox
96-
# and so the local pycache does not pollute the hash.
96+
# We need to patch tools/gyp/ to work from within Nix sandbox
9797
prePatch = ''
9898
${lib.optionalString (builtins.length finalAttrs.patches == 0) "patches=()"}
9999
for patch in ${lib.concatStringsSep " " patches}; do
@@ -103,8 +103,6 @@ stdenv.mkDerivation (finalAttrs: {
103103
patches+=("$filtered")
104104
fi
105105
done
106-
tar -C tools -xzf ${import ../../tools/gyp/src.nix} --wildcards 'gyp-*/pylib'
107-
mv tools/gyp-* tools/gyp
108106
'';
109107
# We need to remove the node_inspector.gypi ref so GYP does not search for it.
110108
postPatch = ''
@@ -117,7 +115,12 @@ stdenv.mkDerivation (finalAttrs: {
117115
"icu_versions = { 'minimum_icu': 1 }"
118116
'';
119117

120-
inherit configureScript configureFlags buildInputs;
118+
inherit
119+
src
120+
configureScript
121+
configureFlags
122+
buildInputs
123+
;
121124

122125
nativeBuildInputs = nativeBuildInputs ++ [
123126
patchutils

0 commit comments

Comments
 (0)