From fa95507f2f0c91022b4ae883d7aeb13702bf7469 Mon Sep 17 00:00:00 2001 From: Lu zhiping Date: Tue, 16 Aug 2022 11:14:24 +0800 Subject: [PATCH] changed debian/source/format to native --- debian/patches/2012_kfreebsd.patch | 135 -- debian/patches/2017_mips_configure_fpu.patch | 34 - ...03cfaf8bdbcd8b19037531c8998709d2b949.patch | 32 - ...c2a1604d241ce0455d919ba9b0b8e9959f81.patch | 59 - debian/patches/ares_compat.patch | 23 - debian/patches/atomic.patch | 21 - debian/patches/benchmark_without_alice.patch | 61 - debian/patches/cjs-module-lexer.patch | 32 - .../dfhs_module_path_arch_triplet.patch | 103 - ...e053a2fda35f38272fb023f543e52ae77566.patch | 46 - debian/patches/fix-for-js-yaml-4.patch | 16 - debian/patches/fix_disable_cctest.patch | 20 - .../large_pages_assembly_gnu_stack.patch | 12 - debian/patches/localhost-no-addrconfig.patch | 42 - debian/patches/make-doc.patch | 1674 ----------------- debian/patches/mips-fix.patch | 210 --- debian/patches/mips-less-memory.patch | 26 - debian/patches/mips-no-jitless.patch | 16 - debian/patches/ppc64.patch | 47 - debian/patches/privacy_breach.patch | 18 - debian/patches/python3.patch | 32 - .../patches/revert_fix_missing_extra_ca.patch | 169 -- debian/patches/series | 26 - debian/patches/shared_uv_from_uvwasi.patch | 26 - debian/patches/test-lowerseclevel.patch | 32 - debian/patches/test_ci_buildd.patch | 180 -- .../upstream-fix-test-worker-prof.patch | 93 - debian/patches/use_system_node_gyp.patch | 23 - debian/source/format | 2 +- 29 files changed, 1 insertion(+), 3209 deletions(-) delete mode 100644 debian/patches/2012_kfreebsd.patch delete mode 100644 debian/patches/2017_mips_configure_fpu.patch delete mode 100644 debian/patches/24c403cfaf8bdbcd8b19037531c8998709d2b949.patch delete mode 100644 debian/patches/7232c2a1604d241ce0455d919ba9b0b8e9959f81.patch delete mode 100644 debian/patches/ares_compat.patch delete mode 100644 debian/patches/atomic.patch delete mode 100644 debian/patches/benchmark_without_alice.patch delete mode 100644 debian/patches/cjs-module-lexer.patch delete mode 100644 debian/patches/dfhs_module_path_arch_triplet.patch delete mode 100644 debian/patches/e548e053a2fda35f38272fb023f543e52ae77566.patch delete mode 100644 debian/patches/fix-for-js-yaml-4.patch delete mode 100644 debian/patches/fix_disable_cctest.patch delete mode 100644 debian/patches/large_pages_assembly_gnu_stack.patch delete mode 100644 debian/patches/localhost-no-addrconfig.patch delete mode 100644 debian/patches/make-doc.patch delete mode 100644 debian/patches/mips-fix.patch delete mode 100644 debian/patches/mips-less-memory.patch delete mode 100644 debian/patches/mips-no-jitless.patch delete mode 100644 debian/patches/ppc64.patch delete mode 100644 debian/patches/privacy_breach.patch delete mode 100644 debian/patches/python3.patch delete mode 100644 debian/patches/revert_fix_missing_extra_ca.patch delete mode 100644 debian/patches/series delete mode 100644 debian/patches/shared_uv_from_uvwasi.patch delete mode 100644 debian/patches/test-lowerseclevel.patch delete mode 100644 debian/patches/test_ci_buildd.patch delete mode 100644 debian/patches/upstream-fix-test-worker-prof.patch delete mode 100644 debian/patches/use_system_node_gyp.patch diff --git a/debian/patches/2012_kfreebsd.patch b/debian/patches/2012_kfreebsd.patch deleted file mode 100644 index b85279b0..00000000 --- a/debian/patches/2012_kfreebsd.patch +++ /dev/null @@ -1,135 +0,0 @@ -Description: add __FreeBSD_kernel__ to the list of *bsd conditions -Forwarded: not-needed, not yet tested enough -Author: Jérémy Lal -Last-Update: 2015-09-18 ---- a/tools/install.py -+++ b/tools/install.py -@@ -136,7 +136,7 @@ - action(['deps/v8/tools/lldbinit'], 'share/doc/node/') - action(['deps/v8/tools/lldb_commands.py'], 'share/doc/node/') - -- if 'freebsd' in sys.platform or 'openbsd' in sys.platform: -+ if ('freebsd' in sys.platform and not 'kfreebsd' in sys.platform) or 'openbsd' in sys.platform: - action(['doc/node.1'], 'man/man1/') - else: - action(['doc/node.1'], 'share/man/man1/') ---- a/node.gyp -+++ b/node.gyp -@@ -533,6 +533,11 @@ - '_LINUX_SOURCE_COMPAT', - ], - }], -+ [ 'OS=="kfreebsd"', { -+ 'libraries': [ -+ '-lkvm', -+ ], -+ }], - [ 'OS=="solaris"', { - 'libraries': [ - '-lkstat', ---- a/common.gypi -+++ b/common.gypi -@@ -393,7 +393,7 @@ - }], - ], - }], -- ['OS=="freebsd" and node_use_dtrace=="true"', { -+ ['(OS=="freebsd" or OS=="kfreebsd") and node_use_dtrace=="true"', { - 'libraries': [ '-lelf' ], - }], - ['OS=="freebsd"', { ---- a/deps/v8/include/v8config.h -+++ b/deps/v8/include/v8config.h -@@ -95,7 +95,7 @@ - #elif defined(_AIX) - #define V8_OS_POSIX 1 - #define V8_OS_AIX 1 --#elif defined(__FreeBSD__) -+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - # define V8_OS_BSD 1 - # define V8_OS_FREEBSD 1 - # define V8_OS_POSIX 1 ---- a/deps/v8/src/base/platform/platform-posix.cc -+++ b/deps/v8/src/base/platform/platform-posix.cc -@@ -23,7 +23,7 @@ - #include - #include - #if defined(__APPLE__) || defined(__DragonFly__) || defined(__FreeBSD__) || \ -- defined(__NetBSD__) || defined(__OpenBSD__) -+ defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD_kernel__) - #include // NOLINT, for sysctl - #endif - -@@ -345,7 +345,7 @@ - return static_cast(gettid()); - #elif V8_OS_AIX - return static_cast(thread_self()); --#elif V8_OS_SOLARIS -+#elif V8_OS_SOLARIS || defined(__FreeBSD_kernel__) - return static_cast(pthread_self()); - #else - return static_cast(reinterpret_cast(pthread_self())); -@@ -563,7 +563,8 @@ - - - static void SetThreadName(const char* name) { --#if V8_OS_DRAGONFLYBSD || V8_OS_FREEBSD || V8_OS_OPENBSD -+ -+#if (V8_OS_DRAGONFLYBSD || V8_OS_FREEBSD || V8_OS_OPENBSD ) && !defined(__FreeBSD_kernel__) - pthread_set_name_np(pthread_self(), name); - #elif V8_OS_NETBSD - STATIC_ASSERT(Thread::kMaxThreadNameLength <= PTHREAD_MAX_NAMELEN_NP); ---- a/deps/v8/src/d8-posix.cc -+++ b/deps/v8/src/d8-posix.cc -@@ -372,7 +372,7 @@ - // See http://code.google.com/p/v8/issues/detail?id=401. - #if defined(WNOWAIT) && !defined(ANDROID) && !defined(__APPLE__) \ - && !defined(__NetBSD__) --#if !defined(__FreeBSD__) -+#if !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) - #define HAS_WAITID 1 - #endif - #endif ---- a/src/node.cc -+++ b/src/node.cc -@@ -3474,7 +3474,7 @@ - - void SignalExit(int signo) { - uv_tty_reset_mode(); --#ifdef __FreeBSD__ -+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - // FreeBSD has a nasty bug, see RegisterSignalHandler for details - struct sigaction sa; - memset(&sa, 0, sizeof(sa)); ---- a/deps/v8/tools/gyp/v8.gyp -+++ b/deps/v8/tools/gyp/v8.gyp -@@ -1827,7 +1827,6 @@ - ['OS=="freebsd"', { - 'link_settings': { - 'libraries': [ -- '-L/usr/local/lib -lexecinfo', - ]}, - 'sources': [ - '../../src/base/platform/platform-freebsd.cc', ---- a/deps/v8/src/base/platform/platform-linux.cc -+++ b/deps/v8/src/base/platform/platform-linux.cc -@@ -49,6 +49,8 @@ - // PNaCL doesn't have this, so we always grab all of the memory, which is bad. - #define MAP_NORESERVE 0 - #endif -+#elif defined(__FreeBSD_kernel__) -+#include - #else - #include - #include ---- a/tools/utils.py -+++ b/tools/utils.py -@@ -47,6 +47,8 @@ - id = platform.system() - if id == 'Linux': - return 'linux' -+ elif id == 'GNU/kFreeBSD': -+ return 'freebsd' - elif id == 'Darwin': - return 'macos' - elif id.find('CYGWIN') >= 0: diff --git a/debian/patches/2017_mips_configure_fpu.patch b/debian/patches/2017_mips_configure_fpu.patch deleted file mode 100644 index 350d1e1e..00000000 --- a/debian/patches/2017_mips_configure_fpu.patch +++ /dev/null @@ -1,34 +0,0 @@ -Description: use configuration directive to set mips fpu mode -Author: YunQiang Su -Forwarded: https://github.com/paul99/v8m-rb/issues/192 -Last-Update: 2015-09-29 ---- a/deps/v8/src/base/cpu.cc -+++ b/deps/v8/src/base/cpu.cc -@@ -140,22 +140,11 @@ - - #if V8_HOST_ARCH_MIPS - int __detect_fp64_mode(void) { -- double result = 0; -- // Bit representation of (double)1 is 0x3FF0000000000000. -- __asm__ volatile( -- ".set push\n\t" -- ".set noreorder\n\t" -- ".set oddspreg\n\t" -- "lui $t0, 0x3FF0\n\t" -- "ldc1 $f0, %0\n\t" -- "mtc1 $t0, $f1\n\t" -- "sdc1 $f0, %0\n\t" -- ".set pop\n\t" -- : "+m"(result) -- : -- : "t0", "$f0", "$f1", "memory"); -- -- return !(result == 1); -+#ifdef FPU_MODE_FP64 -+ return 1; -+#else -+ return 0; -+#endif - } - - diff --git a/debian/patches/24c403cfaf8bdbcd8b19037531c8998709d2b949.patch b/debian/patches/24c403cfaf8bdbcd8b19037531c8998709d2b949.patch deleted file mode 100644 index 7c6790d1..00000000 --- a/debian/patches/24c403cfaf8bdbcd8b19037531c8998709d2b949.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 24c403cfaf8bdbcd8b19037531c8998709d2b949 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= -Date: Tue, 5 Oct 2021 13:34:39 +0200 -Subject: [PATCH] tools: patch jinja2 for Python 3.10 compat -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -PR-URL: https://github.com/nodejs/node/pull/40296 -Fixes: https://github.com/nodejs/node/issues/40294 -Reviewed-By: Jiawen Geng -Reviewed-By: James M Snell -Reviewed-By: Richard Lau -Reviewed-By: Christian Clauss -Reviewed-By: Michaël Zasso ---- - tools/inspector_protocol/jinja2/tests.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tools/inspector_protocol/jinja2/tests.py b/tools/inspector_protocol/jinja2/tests.py -index 0adc3d4dbcbb..b14f85ff148c 100644 ---- a/tools/inspector_protocol/jinja2/tests.py -+++ b/tools/inspector_protocol/jinja2/tests.py -@@ -10,7 +10,7 @@ - """ - import operator - import re --from collections import Mapping -+from collections.abc import Mapping - from jinja2.runtime import Undefined - from jinja2._compat import text_type, string_types, integer_types - import decimal diff --git a/debian/patches/7232c2a1604d241ce0455d919ba9b0b8e9959f81.patch b/debian/patches/7232c2a1604d241ce0455d919ba9b0b8e9959f81.patch deleted file mode 100644 index c9a0a2eb..00000000 --- a/debian/patches/7232c2a1604d241ce0455d919ba9b0b8e9959f81.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 7232c2a1604d241ce0455d919ba9b0b8e9959f81 Mon Sep 17 00:00:00 2001 -From: Daniel Bevenius -Date: Tue, 2 Jun 2020 05:33:25 +0200 -Subject: [PATCH] src: use getauxval in node_main.cc - -This commit suggests using getauxval in node_main.cc. - -The motivation for this is that getauxval was introduced in glibc 2.16 -and looking at BUILDING.md, in the 'Platform list' section, it looks -like we now support glibc >= 2.17 and perhaps this change would be -alright now. - -PR-URL: https://github.com/nodejs/node/pull/33693 -Refs: https://github.com/nodejs/node/pull/12548 -Reviewed-By: Ben Noordhuis -Reviewed-By: David Carlier -Reviewed-By: Anna Henningsen -Reviewed-By: Colin Ihrig -Reviewed-By: James M Snell ---- - src/node_main.cc | 18 ++---------------- - 1 file changed, 2 insertions(+), 16 deletions(-) - -diff --git a/src/node_main.cc b/src/node_main.cc -index 9f4ea22d12c6..6bac10759325 100644 ---- a/src/node_main.cc -+++ b/src/node_main.cc -@@ -74,13 +74,7 @@ int wmain(int argc, wchar_t* wargv[]) { - #else - // UNIX - #ifdef __linux__ --#include --#ifdef __LP64__ --#define Elf_auxv_t Elf64_auxv_t --#else --#define Elf_auxv_t Elf32_auxv_t --#endif // __LP64__ --extern char** environ; -+#include - #endif // __linux__ - #if defined(__POSIX__) && defined(NODE_SHARED_MODE) - #include -@@ -109,15 +103,7 @@ int main(int argc, char* argv[]) { - #endif - - #if defined(__linux__) -- char** envp = environ; -- while (*envp++ != nullptr) {} -- Elf_auxv_t* auxv = reinterpret_cast(envp); -- for (; auxv->a_type != AT_NULL; auxv++) { -- if (auxv->a_type == AT_SECURE) { -- node::per_process::linux_at_secure = auxv->a_un.a_val; -- break; -- } -- } -+ node::per_process::linux_at_secure = getauxval(AT_SECURE); - #endif - // Disable stdio buffering, it interacts poorly with printf() - // calls elsewhere in the program (e.g., any logging from V8.) diff --git a/debian/patches/ares_compat.patch b/debian/patches/ares_compat.patch deleted file mode 100644 index b447421a..00000000 --- a/debian/patches/ares_compat.patch +++ /dev/null @@ -1,23 +0,0 @@ -Description: keep nodejs compatible with libc-ares 1.17.1 -Forwarded: not-needed -Last-Update: 2021-08-11 -Author: Jérémy Lal ---- a/src/cares_wrap.cc -+++ b/src/cares_wrap.cc -@@ -39,7 +39,15 @@ - # include - #endif // __POSIX__ - --# include -+#if defined(__ANDROID__) || \ -+ defined(__MINGW32__) || \ -+ defined(__OpenBSD__) || \ -+ defined(_MSC_VER) -+ -+# include -+#else -+# include -+#endif - - // OpenBSD does not define these - #ifndef AI_ALL diff --git a/debian/patches/atomic.patch b/debian/patches/atomic.patch deleted file mode 100644 index 484bc2d3..00000000 --- a/debian/patches/atomic.patch +++ /dev/null @@ -1,21 +0,0 @@ -Description: Link to -latomic by default - This avoids surprises on mips*el/ppc*el -Author: Jérémy Lal -Last-Update: 2019-10-25 -Forwarded: not-needed -Bug: https://github.com/nodejs/node/pull/28532 -Bug: https://github.com/nodejs/node/issues/30093 ---- a/node.gypi -+++ b/node.gypi -@@ -210,6 +210,11 @@ - '-lkvm', - ], - }], -+ [ 'OS=="linux"', { -+ 'libraries': [ -+ '-latomic', -+ ], -+ }], - [ 'OS=="aix"', { - 'defines': [ - '_LINUX_SOURCE_COMPAT', diff --git a/debian/patches/benchmark_without_alice.patch b/debian/patches/benchmark_without_alice.patch deleted file mode 100644 index 69f464fd..00000000 --- a/debian/patches/benchmark_without_alice.patch +++ /dev/null @@ -1,61 +0,0 @@ -Description: a test uses a benchmark that read alice.html, dfsg excluded -Author: Jérémy Lal -Forwarded: not-needed -Reviewed-By: Xavier Guimard -Last-Update: 2020-03-04 - ---- a/benchmark/buffers/buffer-indexof-number.js -+++ b/benchmark/buffers/buffer-indexof-number.js -@@ -10,7 +10,7 @@ - - function main({ n, value }) { - const aliceBuffer = fs.readFileSync( -- path.resolve(__dirname, '../fixtures/alice.html') -+ path.resolve(__dirname, '../../doc/api/all.html') - ); - - let count = 0; ---- a/benchmark/buffers/buffer-indexof.js -+++ b/benchmark/buffers/buffer-indexof.js -@@ -26,7 +26,7 @@ - - function main({ n, search, encoding, type }) { - let aliceBuffer = fs.readFileSync( -- path.resolve(__dirname, '../fixtures/alice.html') -+ path.resolve(__dirname, '../../doc/api/all.html') - ); - - if (encoding === 'undefined') { ---- a/benchmark/http2/compat.js -+++ b/benchmark/http2/compat.js -@@ -3,7 +3,7 @@ - const common = require('../common.js'); - const path = require('path'); - const fs = require('fs'); --const file = path.join(path.resolve(__dirname, '../fixtures'), 'alice.html'); -+const file = path.join(path.resolve(__dirname, '../../doc/api'), 'all.html'); - - const bench = common.createBenchmark(main, { - requests: [100, 1000, 5000], ---- a/benchmark/http2/respond-with-fd.js -+++ b/benchmark/http2/respond-with-fd.js -@@ -4,7 +4,7 @@ - const path = require('path'); - const fs = require('fs'); - --const file = path.join(path.resolve(__dirname, '../fixtures'), 'alice.html'); -+const file = path.join(path.resolve(__dirname, '../../doc/api'), 'all.html'); - - const bench = common.createBenchmark(main, { - requests: [100, 1000, 5000], ---- a/benchmark/http2/simple.js -+++ b/benchmark/http2/simple.js -@@ -3,7 +3,7 @@ - const common = require('../common.js'); - const path = require('path'); - const fs = require('fs'); --const file = path.join(path.resolve(__dirname, '../fixtures'), 'alice.html'); -+const file = path.join(path.resolve(__dirname, '../../doc/api'), 'all.html'); - - const bench = common.createBenchmark(main, { - requests: [100, 1000, 5000], diff --git a/debian/patches/cjs-module-lexer.patch b/debian/patches/cjs-module-lexer.patch deleted file mode 100644 index c2f7bd7e..00000000 --- a/debian/patches/cjs-module-lexer.patch +++ /dev/null @@ -1,32 +0,0 @@ -Description: cannot rebuilt dist/lexer.js, just use pure-js lexer -Author: Jérémy Lal -Last-Update: 2020-11-24 -Forwarded: not-needed ---- a/lib/internal/modules/esm/translators.js -+++ b/lib/internal/modules/esm/translators.js -@@ -59,14 +59,7 @@ - - let cjsParse; - async function initCJSParse() { -- if (typeof WebAssembly === 'undefined') { -- cjsParse = require('internal/deps/cjs-module-lexer/lexer').parse; -- } else { -- const { parse, init } = -- require('internal/deps/cjs-module-lexer/dist/lexer'); -- await init(); -- cjsParse = parse; -- } -+ cjsParse = require('internal/deps/cjs-module-lexer/lexer').parse; - } - - const translators = new SafeMap(); ---- a/node.gyp -+++ b/node.gyp -@@ -250,7 +250,6 @@ - 'deps/acorn-plugins/acorn-private-methods/index.js', - 'deps/acorn-plugins/acorn-static-class-features/index.js', - 'deps/cjs-module-lexer/lexer.js', -- 'deps/cjs-module-lexer/dist/lexer.js', - ], - 'node_mksnapshot_exec': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)node_mksnapshot<(EXECUTABLE_SUFFIX)', - 'mkcodecache_exec': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)mkcodecache<(EXECUTABLE_SUFFIX)', diff --git a/debian/patches/dfhs_module_path_arch_triplet.patch b/debian/patches/dfhs_module_path_arch_triplet.patch deleted file mode 100644 index a9ae33e5..00000000 --- a/debian/patches/dfhs_module_path_arch_triplet.patch +++ /dev/null @@ -1,103 +0,0 @@ -Description: Multiarch search path, arch triplet, DFHS path for modules -Author: "Bastien ROUCARIÈS" -Last-Update: 2018-09-30 -Forwarded: https://github.com/nodejs/node/issues/22745 -Reviewed-By: Xavier Guimard -Last-Update: 2020-03-04 - ---- a/lib/internal/modules/cjs/loader.js -+++ b/lib/internal/modules/cjs/loader.js -@@ -1102,6 +1102,7 @@ - Module._initPaths = function() { - const homeDir = isWindows ? process.env.USERPROFILE : safeGetenv('HOME'); - const nodePath = isWindows ? process.env.NODE_PATH : safeGetenv('NODE_PATH'); -+ const relativePaths = process.config.variables.node_relative_path; - - // process.execPath is $PREFIX/bin/node except on Windows where it is - // $PREFIX\node.exe where $PREFIX is the root of the Node.js installation. -@@ -1109,7 +1110,17 @@ - path.resolve(process.execPath, '..') : - path.resolve(process.execPath, '..', '..'); - -- let paths = [path.resolve(prefixDir, 'lib', 'node')]; -+ var postDirs = []; -+ if (relativePaths) { -+ relativePaths.split(path.delimiter).map(path => { -+ if (path) postDirs.push(path); -+ }); -+ } else { -+ postDirs.push(path.join('lib', 'node')); -+ } -+ let paths = postDirs.map(postDir => { -+ return path.resolve(prefixDir, postDir); -+ }); - - if (homeDir) { - paths.unshift(path.resolve(homeDir, '.node_libraries')); ---- a/configure.py -+++ b/configure.py -@@ -83,6 +83,11 @@ - dest='coverage', - help='Build node with code coverage enabled') - -+parser.add_option('--arch-triplet', -+ action='store', -+ dest='arch_triplet', -+ help='arch triplet used by distro') -+ - parser.add_option('--debug', - action='store_true', - dest='debug', -@@ -121,6 +126,11 @@ - dest='gdb', - help='add gdb support') - -+parser.add_option('--node-relative-path', -+ action='store', -+ dest='node_relative_path', -+ help='Node path(s) used by require, resolved relative to prefix dir.') -+ - parser.add_option('--no-ifaddrs', - action='store_true', - dest='no_ifaddrs', -@@ -1220,6 +1230,17 @@ - version = getnapibuildversion.get_napi_version() - output['variables']['napi_build_version'] = version - -+def configure_debian(output): -+ if options.arch_triplet: -+ output['variables']['arch_triplet'] = options.arch_triplet -+ else: -+ output['variables']['arch_triplet'] = 'unknown-unknown-unknown' -+ -+ if options.node_relative_path: -+ output['variables']['node_relative_path'] = options.node_relative_path -+ else: -+ output['variables']['node_relative_path']= '' -+ - def configure_library(lib, output, pkgname=None): - shared_lib = 'shared_' + lib - output['variables']['node_' + shared_lib] = b(getattr(options, shared_lib)) -@@ -1711,6 +1732,7 @@ - - configure_node(output) - configure_napi(output) -+configure_debian(output) - configure_library('zlib', output) - configure_library('http_parser', output) - configure_library('libuv', output) ---- a/test/parallel/test-module-loading-globalpaths.js -+++ b/test/parallel/test-module-loading-globalpaths.js -@@ -73,10 +73,10 @@ - - // Test module in $PREFIX/lib/node. - // Write module into $PREFIX/lib/node. -- const expectedString = '$PREFIX/lib/node'; -+ const expectedString = '$PREFIX/lib/nodejs'; - const prefixLibPath = path.join(prefixPath, 'lib'); - fs.mkdirSync(prefixLibPath); -- const prefixLibNodePath = path.join(prefixLibPath, 'node'); -+ const prefixLibNodePath = path.join(prefixLibPath, 'nodejs'); - fs.mkdirSync(prefixLibNodePath); - const pkgPath = path.join(prefixLibNodePath, `${pkgName}.js`); - fs.writeFileSync(pkgPath, `exports.string = '${expectedString}';`); diff --git a/debian/patches/e548e053a2fda35f38272fb023f543e52ae77566.patch b/debian/patches/e548e053a2fda35f38272fb023f543e52ae77566.patch deleted file mode 100644 index 98f1a9b9..00000000 --- a/debian/patches/e548e053a2fda35f38272fb023f543e52ae77566.patch +++ /dev/null @@ -1,46 +0,0 @@ -From e548e053a2fda35f38272fb023f543e52ae77566 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= -Date: Tue, 5 Oct 2021 13:33:50 +0200 -Subject: [PATCH] deps: V8: patch jinja2 for Python 3.10 compat -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -PR-URL: https://github.com/nodejs/node/pull/40296 -Fixes: https://github.com/nodejs/node/issues/40294 -Reviewed-By: Jiawen Geng -Reviewed-By: James M Snell -Reviewed-By: Richard Lau -Reviewed-By: Christian Clauss -Reviewed-By: Michaël Zasso ---- - common.gypi | 2 +- - deps/v8/third_party/jinja2/tests.py | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -#diff --git a/common.gypi b/common.gypi -#index e14b10cbe788..18e00193ffb9 100644 -#--- a/common.gypi -#+++ b/common.gypi -#@@ -36,7 +36,7 @@ -# -# # Reset this number to 0 on major V8 upgrades. -# # Increment by one for each non-official patch applied to deps/v8. -#- 'v8_embedder_string': '-node.8', -#+ 'v8_embedder_string': '-node.9', -# -# ##### V8 defaults for Node.js ##### -# -diff --git a/deps/v8/third_party/jinja2/tests.py b/deps/v8/third_party/jinja2/tests.py -index 0adc3d4dbcbb..b14f85ff148c 100644 ---- a/deps/v8/third_party/jinja2/tests.py -+++ b/deps/v8/third_party/jinja2/tests.py -@@ -10,7 +10,7 @@ - """ - import operator - import re --from collections import Mapping -+from collections.abc import Mapping - from jinja2.runtime import Undefined - from jinja2._compat import text_type, string_types, integer_types - import decimal diff --git a/debian/patches/fix-for-js-yaml-4.patch b/debian/patches/fix-for-js-yaml-4.patch deleted file mode 100644 index dc19984b..00000000 --- a/debian/patches/fix-for-js-yaml-4.patch +++ /dev/null @@ -1,16 +0,0 @@ -Description: fix for js-yaml ≥ 4 -Author: Yadd -Forwarded: not-needed -Last-Update: 2021-11-24 - ---- a/tools/doc/common.js -+++ b/tools/doc/common.js -@@ -21,7 +21,7 @@ - .replace(/-->$/, ''); - - // js-yaml.safeLoad() throws on error. -- const meta = yaml.safeLoad(text); -+ const meta = yaml.load(text); - - if (meta.added) { - // Since semver-minors can trickle down to previous major versions, diff --git a/debian/patches/fix_disable_cctest.patch b/debian/patches/fix_disable_cctest.patch deleted file mode 100644 index 3f4b1c97..00000000 --- a/debian/patches/fix_disable_cctest.patch +++ /dev/null @@ -1,20 +0,0 @@ -Description: do not build cctest, build broken on debian -Last-Update: 2017-12-18 -Author: Jérémy Lal -Forwarded: not yet ! ---- a/Makefile -+++ b/Makefile -@@ -156,8 +156,12 @@ - exit 1; \ - fi - -+build: -+ $(MAKE) $(PARALLEL_ARGS) -C out $(NODE_EXE) BUILDTYPE=$(BUILDTYPE) V=$(V) -+ ln -sf out/$(BUILDTYPE)/node . -+ - .PHONY: install --install: all ## Installs node into $PREFIX (default=/usr/local). -+install: ## Installs node into $PREFIX (default=/usr/local). - $(PYTHON) tools/install.py $@ '$(DESTDIR)' '$(PREFIX)' - - .PHONY: uninstall diff --git a/debian/patches/large_pages_assembly_gnu_stack.patch b/debian/patches/large_pages_assembly_gnu_stack.patch deleted file mode 100644 index ef9f6c09..00000000 --- a/debian/patches/large_pages_assembly_gnu_stack.patch +++ /dev/null @@ -1,12 +0,0 @@ -Description: Adds .GNU-stack section header to disable executable stack flag -Author: James Addison -Origin: https://github.com/nodejs/node/pull/37688 ---- a/src/large_pages/node_text_start.S -+++ b/src/large_pages/node_text_start.S -@@ -1,3 +1,6 @@ -+#if defined(__ELF__) -+.section .note.GNU-stack,"",@progbits -+#endif - .text - .align 0x2000 - .global __node_text_start diff --git a/debian/patches/localhost-no-addrconfig.patch b/debian/patches/localhost-no-addrconfig.patch deleted file mode 100644 index 6eada12b..00000000 --- a/debian/patches/localhost-no-addrconfig.patch +++ /dev/null @@ -1,42 +0,0 @@ -Description: do not use dns.ADDRCONFIG for localhost - it fails on IPv6-only systems. Setting it with libc fails on linux. - https://github.com/nodejs/node/issues/33279 -Author: Jérémy Lal -Last-Update: 2020-06-11 -Bug-Debian: https://bugs.debian.org/962318 -Forwarded: https://github.com/nodejs/node/issues/33816 ---- a/lib/net.js -+++ b/lib/net.js -@@ -1,4 +1,5 @@ - // Copyright Joyent, Inc. and other Node contributors. -+ - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the -@@ -1028,13 +1029,6 @@ - hints: options.hints || 0 - }; - -- if (!isWindows && -- dnsopts.family !== 4 && -- dnsopts.family !== 6 && -- dnsopts.hints === 0) { -- dnsopts.hints = dns.ADDRCONFIG; -- } -- - debug('connect: find host', host); - debug('connect: dns options', dnsopts); - self._host = host; ---- a/test/sequential/sequential.status -+++ b/test/sequential/sequential.status -@@ -17,6 +17,10 @@ - # https://github.com/nodejs/node/issues/24403 - test-cli-syntax: PASS,FLAKY - -+# does not work on IPv6 only host -+test-tls-psk-client: PASS,FLAKY -+test-tls-securepair-client: PASS,FLAKY -+ - [$system==win32] - # https://github.com/nodejs/node/issues/22327 - test-http2-large-file: PASS, FLAKY diff --git a/debian/patches/make-doc.patch b/debian/patches/make-doc.patch deleted file mode 100644 index cf836305..00000000 --- a/debian/patches/make-doc.patch +++ /dev/null @@ -1,1674 +0,0 @@ -Description: build doc using marked and js-yaml - While waiting for unified/remarked/rehyped modules to be available in debian -Author: Jérémy Lal -Forwarded: not-needed -Reviewed-By: Xavier Guimard -Last-Update: 2022-01-27 - ---- a/Makefile -+++ b/Makefile -@@ -358,14 +358,6 @@ - - node_use_openssl = $(call available-node,"-p" \ - "process.versions.openssl != undefined") --test/addons/.docbuildstamp: $(DOCBUILDSTAMP_PREREQS) tools/doc/node_modules -- @if [ "$(shell $(node_use_openssl))" != "true" ]; then \ -- echo "Skipping .docbuildstamp (no crypto)"; \ -- else \ -- $(RM) -r test/addons/??_*/; \ -- [ -x $(NODE) ] && $(NODE) $< || node $< ; \ -- touch $@; \ -- fi - - ADDONS_BINDING_GYPS := \ - $(filter-out test/addons/??_*/binding.gyp, \ -@@ -600,12 +592,6 @@ - - .PHONY: test-doc - test-doc: doc-only lint ## Builds, lints, and verifies the docs. -- @if [ "$(shell $(node_use_openssl))" != "true" ]; then \ -- echo "Skipping test-doc (no crypto)"; \ -- else \ -- $(PYTHON) tools/test.py $(PARALLEL_ARGS) doctool; \ -- fi -- $(NODE) tools/doc/checkLinks.js . - - test-known-issues: all - $(PYTHON) tools/test.py $(PARALLEL_ARGS) known_issues -@@ -712,7 +698,7 @@ - fi - - .PHONY: doc-only --doc-only: tools/doc/node_modules \ -+doc-only: \ - $(apidoc_dirs) $(apiassets) ## Builds the docs with the local or the global Node.js binary. - @if [ "$(shell $(node_use_openssl))" != "true" ]; then \ - echo "Skipping doc-only (no crypto)"; \ -@@ -730,7 +716,9 @@ - # Just copy everything under doc/api over. - out/doc/api: doc/api - mkdir -p $@ -- cp -r doc/api out/doc -+ cp -r doc/api out/doc/ -+ rm -f out/doc/api/*.html -+ rm -f out/doc/api/*.json - - # If it's a source tarball, assets are already in doc/api/assets - out/doc/api/assets: -@@ -744,27 +732,16 @@ - - run-npm-ci = $(PWD)/$(NPM) ci - --LINK_DATA = out/doc/apilinks.json --VERSIONS_DATA = out/previous-doc-versions.json --gen-api = tools/doc/generate.js --node-version=$(FULLVERSION) \ -- --apilinks=$(LINK_DATA) $< --output-directory=out/doc/api \ -- --versions-file=$(VERSIONS_DATA) --gen-apilink = tools/doc/apilinks.js $(LINK_DATA) $(wildcard lib/*.js) -- --$(LINK_DATA): $(wildcard lib/*.js) tools/doc/apilinks.js | out/doc -- $(call available-node, $(gen-apilink)) -- --# Regenerate previous versions data if the current version changes --$(VERSIONS_DATA): CHANGELOG.md src/node_version.h tools/doc/versions.js -- $(call available-node, tools/doc/versions.js $@) -- --out/doc/api/%.json out/doc/api/%.html: doc/api/%.md tools/doc/generate.js \ -- tools/doc/markdown.js tools/doc/html.js tools/doc/json.js \ -- tools/doc/apilinks.js $(VERSIONS_DATA) | $(LINK_DATA) out/doc/api -- $(call available-node, $(gen-api)) -+gen-json = tools/doc/generate.js --format=json $< > $@ -+gen-html = tools/doc/generate.js --node-version=$(FULLVERSION) --format=html $< > $@ -+ -+out/doc/api/%.json: doc/api/%.md tools/doc/generate.js tools/doc/json.js -+ $(call available-node, $(gen-json)) -+ -+out/doc/api/%.html: doc/api/%.md tools/doc/generate.js tools/doc/html.js -+ $(call available-node, $(gen-html)) - --out/doc/api/all.html: $(apidocs_html) tools/doc/allhtml.js \ -- tools/doc/apilinks.js | out/doc/api -+out/doc/api/all.html: $(apidocs_html) tools/doc/allhtml.js - $(call available-node, tools/doc/allhtml.js) - - out/doc/api/all.json: $(apidocs_json) tools/doc/alljson.js | out/doc/api ---- a/tools/doc/addon-verify.js -+++ b/tools/doc/addon-verify.js -@@ -6,33 +6,28 @@ - // Modify the require paths in the js code to pull from the build tree. - // Triggered from the build-addons target in the Makefile and vcbuild.bat. - --const { mkdir, writeFile } = require('fs'); -+const { mkdir, readFileSync, writeFile } = require('fs'); - const { resolve } = require('path'); --const vfile = require('to-vfile'); --const unified = require('unified'); --const remarkParse = require('remark-parse'); -+const { lexer } = require('marked'); - - const rootDir = resolve(__dirname, '..', '..'); - const doc = resolve(rootDir, 'doc', 'api', 'addons.md'); - const verifyDir = resolve(rootDir, 'test', 'addons'); - --const file = vfile.readSync(doc, 'utf8'); --const tree = unified().use(remarkParse).parse(file); -+const tokens = lexer(readFileSync(doc, 'utf8')); - const addons = {}; - let id = 0; - let currentHeader; - - const validNames = /^\/\/\s+(.*\.(?:cc|h|js))[\r\n]/; --tree.children.forEach((node) => { -- if (node.type === 'heading') { -- currentHeader = file.contents.slice( -- node.children[0].position.start.offset, -- node.position.end.offset); -+tokens.forEach(({ type, text }) => { -+ if (type === 'heading') { -+ currentHeader = text; - addons[currentHeader] = { files: {} }; - } else if (node.type === 'code') { - const match = node.value.match(validNames); - if (match !== null) { -- addons[currentHeader].files[match[1]] = node.value; -+ addons[currentHeader].files[match[1]] = text; - } - } - }); ---- a/tools/doc/common.js -+++ b/tools/doc/common.js -@@ -1,7 +1,7 @@ - 'use strict'; - - const yaml = -- require(`${__dirname}/../node_modules/eslint/node_modules/js-yaml`); -+ require('js-yaml'); - - function isYAMLBlock(text) { - return /^/gms, ''); --const gtocHTML = unified() -- .use(markdown) -- .use(remark2rehype, { allowDangerousHtml: true }) -- .use(raw) -- .use(navClasses) -- .use(htmlStringify) -- .processSync(gtocMD).toString(); -+const gtocHTML = marked.parse(gtocMD).replace( -+ / ` type === 'heading'); -+ const section = firstHeading ? firstHeading.text : 'Index'; -+ -+ preprocessText(lexed); -+ preprocessElements(lexed, filename); -+ -+ // Generate the table of contents. This mutates the lexed contents in-place. -+ const toc = buildToc(lexed, filename); -+ let content = ""; -+ - const id = filename.replace(/\W+/g, '-'); - - let HTML = template.replace('__ID__', id) - .replace(/__FILENAME__/g, filename) -- .replace('__SECTION__', content.section) -+ .replace('__SECTION__', section) - .replace(/__VERSION__/g, nodeVersion) -- .replace('__TOC__', content.toc) -+ .replace('__TOC__', toc) - .replace('__GTOC__', gtocHTML.replace( -- `class="nav-${id}"`, `class="nav-${id} active"`)) -- .replace('__EDIT_ON_GITHUB__', editOnGitHub(filename)) -- .replace('__CONTENT__', content.toString()); -+ `class="nav-${id}`, `class="nav-${id} active`)); - - const docCreated = input.match( - //); - if (docCreated) { -- HTML = HTML.replace('__ALTDOCS__', altDocs(filename, docCreated, versions)); -+ HTML = HTML.replace('__ALTDOCS__', await altDocs(filename, docCreated, [])); - } else { - console.error(`Failed to add alternative version links to ${filename}`); - HTML = HTML.replace('__ALTDOCS__', ''); - } - -- return HTML; --} -+ HTML = HTML.replace('__EDIT_ON_GITHUB__', editOnGitHub(filename)); - --// Set the section name based on the first header. Default to 'Index'. --function firstHeader() { -- return (tree, file) => { -- const heading = find(tree, { type: 'heading' }); -- -- if (heading && heading.children.length) { -- const recursiveTextContent = (node) => -- node.value || node.children.map(recursiveTextContent).join(''); -- file.section = recursiveTextContent(heading); -- } else { -- file.section = 'Index'; -- } -- }; -+ // Content insertion has to be the last thing we do with the lexed tokens, -+ // because it's destructive. -+ HTML = HTML.replace('__CONTENT__', marked.parser(lexed)); -+ -+ cb(null, HTML); - } - - // Handle general body-text replacements. - // For example, link man page references to the actual page. --function preprocessText({ nodeVersion }) { -- return (tree) => { -- visit(tree, null, (node) => { -- if (common.isSourceLink(node.value)) { -- const [path] = node.value.match(/(?<=)/); -- node.value = `

Source Code: ${path}

`; -- } else if (node.type === 'text' && node.value) { -- const value = linkJsTypeDocs(linkManPages(node.value)); -- if (value !== node.value) { -- node.type = 'html'; -- node.value = value; -+function preprocessText(lexed) { -+ lexed.forEach((token) => { -+ if (token.type === 'table') { -+ if (token.header) { -+ for (const tok of token.header) { -+ tok.text = replaceInText(tok.text); - } - } -- }); -- }; -+ -+ if (token.cells) { -+ token.cells.forEach((row, i) => { -+ for (const tok of token.cells[i]) { -+ tok.text = replaceInText(tok.text); -+ } -+ }); -+ } -+ } else if (token.text && token.type !== 'code') { -+ token.text = replaceInText(token.text); -+ } -+ }); -+} -+ -+// Replace placeholders in text tokens. -+function replaceInText(text = '') { -+ if (text === '') return text; -+ return linkJsTypeDocs(linkManPages(text)); - } - - // Syscalls which appear in the docs, but which only exist in BSD / macOS. - const BSD_ONLY_SYSCALLS = new Set(['lchmod']); -+const LINUX_DIE_ONLY_SYSCALLS = new Set(['uname']); -+const HAXX_ONLY_SYSCALLS = new Set(['curl']); - const MAN_PAGE = /(^|\s)([a-z.]+)\((\d)([a-z]?)\)/gm; - - // Handle references to man pages, eg "open(2)" or "lchmod(2)". -@@ -142,13 +142,20 @@ - return `${beginning}${displayAs}`; - } -+ if (LINUX_DIE_ONLY_SYSCALLS.has(name)) { -+ return `${beginning}${displayAs}`; -+ } -+ if (HAXX_ONLY_SYSCALLS.has(name)) { -+ return `${beginning}${displayAs}`; -+ } - - return `${beginning}${displayAs}`; - }); - } - --const TYPE_SIGNATURE = /\{[^}]+\}/g; -+const TYPE_SIGNATURE = /[^_]\{[^}]+\}(?!_)/g; - function linkJsTypeDocs(text) { - const parts = text.split('`'); - -@@ -162,95 +169,69 @@ - }); - } - } -- - return parts.join('`'); - } - --// Preprocess headers, stability blockquotes, and YAML blocks. --function preprocessElements({ filename }) { -- return (tree) => { -- const STABILITY_RE = /(.*:)\s*(\d)([\s\S]*)/; -- let headingIndex = -1; -- let heading = null; -- -- visit(tree, null, (node, index) => { -- if (node.type === 'heading') { -- headingIndex = index; -- heading = node; -- } else if (node.type === 'code') { -- if (!node.lang) { -- console.warn( -- `No language set in ${filename}, ` + -- `line ${node.position.start.line}`); -+// Preprocess stability blockquotes and YAML blocks. -+function preprocessElements(lexed, filename) { -+ const STABILITY_RE = /(.*:)\s*(\d)([\s\S]*)/; -+ let state = null; -+ let headingIndex = -1; -+ let heading = null; -+ -+ lexed.forEach((token, index) => { -+ if (token.type === 'heading') { -+ headingIndex = index; -+ heading = token; -+ } -+ if (token.type === 'html' && common.isYAMLBlock(token.text)) { -+ token.text = parseYAML(token.text); -+ } -+ if (token.type === 'blockquote_start') { -+ state = 'MAYBE_STABILITY_BQ'; -+ lexed[index] = { type: 'space' }; -+ } -+ if (token.type === 'blockquote_end' && state === 'MAYBE_STABILITY_BQ') { -+ state = null; -+ lexed[index] = { type: 'space' }; -+ } -+ if (token.type === 'paragraph' && state === 'MAYBE_STABILITY_BQ') { -+ if (token.text.includes('Stability:')) { -+ const [, prefix, number, explication] = token.text.match(STABILITY_RE); -+ const isStabilityIndex = -+ index - 2 === headingIndex || // General. -+ index - 3 === headingIndex; // With api_metadata block. -+ -+ if (heading && isStabilityIndex) { -+ heading.stability = number; -+ headingIndex = -1; -+ heading = null; - } -- const language = (node.lang || '').split(' ')[0]; -- const highlighted = getLanguage(language) ? -- highlight(language, node.value).value : -- node.value; -- node.type = 'html'; -- node.value = '
' +
--          `` +
--          highlighted +
--          '
'; -- } else if (node.type === 'html' && common.isYAMLBlock(node.value)) { -- node.value = parseYAML(node.value); -- -- } else if (node.type === 'blockquote') { -- const paragraph = node.children[0].type === 'paragraph' && -- node.children[0]; -- const text = paragraph && paragraph.children[0].type === 'text' && -- paragraph.children[0]; -- if (text && text.value.includes('Stability:')) { -- const [, prefix, number, explication] = -- text.value.match(STABILITY_RE); -- -- const isStabilityIndex = -- index - 2 === headingIndex || // General. -- index - 3 === headingIndex; // With api_metadata block. -- -- if (heading && isStabilityIndex) { -- heading.stability = number; -- headingIndex = -1; -- heading = null; -- } -- -- // Do not link to the section we are already in. -- const noLinking = filename.includes('documentation') && -- heading !== null && heading.children[0].value === 'Stability Index'; -- -- // Collapse blockquote and paragraph into a single node -- node.type = 'paragraph'; -- node.children.shift(); -- node.children.unshift(...paragraph.children); -- -- // Insert div with prefix and number -- node.children.unshift({ -- type: 'html', -- value: `
` + -- (noLinking ? '' : -- '') + -- `${prefix} ${number}${noLinking ? '' : ''}` -- .replace(/\n/g, ' ') -- }); - -- // Remove prefix and number from text -- text.value = explication; -- -- // close div -- node.children.push({ type: 'html', value: '
' }); -- } -+ // Do not link to the section we are already in. -+ const noLinking = filename === 'documentation' && -+ heading !== null && heading.text === 'Stability Index'; -+ token.text = `
` + -+ (noLinking ? '' : -+ '') + -+ `${prefix} ${number}${noLinking ? '' : ''}${explication}
` -+ .replace(/\n/g, ' '); -+ -+ lexed[index] = { type: 'html', text: token.text }; -+ } else if (state === 'MAYBE_STABILITY_BQ') { -+ state = null; -+ lexed[index - 1] = { type: 'blockquote_start' }; - } -- }); -- }; -+ } -+ }); - } - - function parseYAML(text) { - const meta = common.extractAndParseYAML(text); -- let result = ''; -+ return html; - } - - function minVersion(a) { -@@ -323,56 +290,49 @@ - return +b.match(numberRe)[0] - +a.match(numberRe)[0]; - } - --function buildToc({ filename, apilinks }) { -- return (tree, file) => { -- const idCounters = Object.create(null); -- let toc = ''; -- let depth = 0; -- -- visit(tree, null, (node) => { -- if (node.type !== 'heading') return; -- -- if (node.depth - depth > 1) { -- throw new Error( -- `Inappropriate heading level:\n${JSON.stringify(node)}` -- ); -- } -+function buildToc(lexed, filename) { -+ const startIncludeRefRE = /^\s*\s*$/; -+ const endIncludeRefRE = /^\s*\s*$/; -+ const realFilenames = [filename]; -+ const idCounters = Object.create(null); -+ let toc = ''; -+ let depth = 0; -+ -+ lexed.forEach((token) => { -+ // Keep track of the current filename along comment wrappers of inclusions. -+ if (token.type === 'html') { -+ const [, includedFileName] = token.text.match(startIncludeRefRE) || []; -+ if (includedFileName !== undefined) -+ realFilenames.unshift(includedFileName); -+ else if (endIncludeRefRE.test(token.text)) -+ realFilenames.shift(); -+ } - -- depth = node.depth; -- const realFilename = path.basename(filename, '.md'); -- const headingText = file.contents.slice( -- node.children[0].position.start.offset, -- node.position.end.offset).trim(); -- const id = getId(`${realFilename}_${headingText}`, idCounters); -- -- const hasStability = node.stability !== undefined; -- toc += ' '.repeat((depth - 1) * 2) + -- (hasStability ? `* ` : '* ') + -- `${headingText}${hasStability ? '' : ''}\n`; -- -- let anchor = -- `#`; -- -- if (realFilename === 'errors' && headingText.startsWith('ERR_')) { -- anchor += `#`; -- } -+ if (token.type !== 'heading') return; - -- const api = headingText.replace(/^.*:\s+/, '').replace(/\(.*/, ''); -- if (apilinks[api]) { -- anchor = `[src]${anchor}`; -- } -+ if (token.depth - depth > 1) { -+ throw new Error(`Inappropriate heading level:\n${JSON.stringify(token)}`); -+ } - -- node.children.push({ type: 'html', value: anchor }); -- }); -+ depth = token.depth; -+ const realFilename = path.basename(realFilenames[0], '.md'); -+ const headingText = token.text.trim(); -+ const id = getId(`${realFilename}_${headingText}`, idCounters); -+ -+ const hasStability = token.stability !== undefined; -+ toc += ' '.repeat((depth - 1) * 2) + -+ (hasStability ? `* ` : '* ') + -+ `${token.text}${hasStability ? '' : ''}\n`; -+ -+ let text = `#`; -+ if (realFilename === 'errors' && headingText.startsWith('ERR_')) { -+ text += `#`; -+ } -+ token.tokens.push({ type: 'text', text }); -+ }); - -- file.toc = unified() -- .use(markdown) -- .use(remark2rehype, { allowDangerousHtml: true }) -- .use(raw) -- .use(htmlStringify) -- .processSync(toc).toString(); -- }; -+ return marked.parse(toc); - } - - const notAlphaNumerics = /[^a-z0-9]+/g; ---- a/tools/doc/json.js -+++ b/tools/doc/json.js -@@ -21,267 +21,302 @@ - - 'use strict'; - --const unified = require('unified'); --const common = require('./common.js'); --const html = require('remark-html'); --const { selectAll } = require('unist-util-select'); -+module.exports = doJSON; - --module.exports = { jsonAPI }; -+// Take the lexed input, and return a JSON-encoded object. -+// A module looks like this: https://gist.github.com/1777387. - --// Unified processor: input is https://github.com/syntax-tree/mdast, --// output is: https://gist.github.com/1777387. --function jsonAPI({ filename }) { -- return (tree, file) => { -- -- const exampleHeading = /^example/i; -- const metaExpr = /\n*/g; -- const stabilityExpr = /^Stability: ([0-5])(?:\s*-\s*)?(.*)$/s; -- -- // Extract definitions. -- const definitions = selectAll('definition', tree); -- -- // Determine the start, stop, and depth of each section. -- const sections = []; -- let section = null; -- tree.children.forEach((node, i) => { -- if (node.type === 'heading' && -- !exampleHeading.test(textJoin(node.children, file))) { -- if (section) section.stop = i - 1; -- section = { start: i, stop: tree.children.length, depth: node.depth }; -- sections.push(section); -- } -- }); -+const common = require('./common.js'); -+const marked = require('marked'); - -- // Collect and capture results. -- const result = { type: 'module', source: filename }; -- while (sections.length > 0) { -- doSection(sections.shift(), result); -- } -- file.json = result; -- -- // Process a single section (recursively, including subsections). -- function doSection(section, parent) { -- if (section.depth - parent.depth > 1) { -- throw new Error('Inappropriate heading level\n' + -- JSON.stringify(section)); -+// Customized heading without id attribute. -+const renderer = new marked.Renderer(); -+renderer.heading = (text, level) => `${text}\n`; -+marked.setOptions({ renderer }); -+ -+ -+function doJSON(input, filename, cb) { -+ const root = { source: filename }; -+ const stack = [root]; -+ let depth = 0; -+ let current = root; -+ let state = null; -+ -+ const exampleHeading = /^example:/i; -+ const metaExpr = /\n*/g; -+ const stabilityExpr = /^Stability: ([0-5])(?:\s*-\s*)?(.*)$/s; -+ -+ const lexed = marked.lexer(input); -+ lexed.forEach((tok) => { -+ const { type } = tok; -+ let { text } = tok; -+ -+ // -+ // This is for cases where the markdown semantic structure is lacking. -+ if (type === 'paragraph' || type === 'html') { -+ text = text.replace(metaExpr, (_0, key, value) => { -+ current[key.trim()] = value.trim(); -+ return ''; -+ }); -+ text = text.trim(); -+ if (!text) return; -+ } -+ if (type === 'heading' && !exampleHeading.test(text.trim())) { -+ if (tok.depth - depth > 1) { -+ return cb( -+ new Error(`Inappropriate heading level\n${JSON.stringify(tok)}`)); - } - -- const current = newSection(tree.children[section.start], file); -- let nodes = tree.children.slice(section.start + 1, section.stop + 1); -- - // Sometimes we have two headings with a single blob of description. - // Treat as a clone. -- if ( -- nodes.length === 0 && sections.length > 0 && -- section.depth === sections[0].depth -- ) { -- nodes = tree.children.slice(sections[0].start + 1, -- sections[0].stop + 1); -- } -- -- // Extract (and remove) metadata that is not directly inferable -- // from the markdown itself. -- nodes.forEach((node, i) => { -- // Input: ; output: {name: module}. -- if (node.type === 'html') { -- node.value = node.value.replace(metaExpr, (_0, key, value) => { -- current[key.trim()] = value.trim(); -- return ''; -- }); -- if (!node.value.trim()) delete nodes[i]; -+ if (state === 'AFTERHEADING' && depth === tok.depth) { -+ const clone = current; -+ current = newSection(tok); -+ current.clone = clone; -+ // Don't keep it around on the stack. -+ stack.pop(); -+ } else { -+ // If the level is greater than the current depth, -+ // then it's a child, so we should just leave the stack as it is. -+ // However, if it's a sibling or higher, then it implies -+ // the closure of the other sections that came before. -+ // root is always considered the level=0 section, -+ // and the lowest heading is 1, so this should always -+ // result in having a valid parent node. -+ let closingDepth = tok.depth; -+ while (closingDepth <= depth) { -+ finishSection(stack.pop(), stack[stack.length - 1]); -+ closingDepth++; - } -+ current = newSection(tok); -+ } -+ ({ depth } = tok); -+ stack.push(current); -+ state = 'AFTERHEADING'; -+ return; -+ } - -- // Process metadata: -- // -- if (node.type === 'html' && common.isYAMLBlock(node.value)) { -- current.meta = common.extractAndParseYAML(node.value); -- delete nodes[i]; -+ // Immediately after a heading, we can expect the following: -+ // -+ // { type: 'blockquote_start' }, -+ // { type: 'paragraph', text: 'Stability: ...' }, -+ // { type: 'blockquote_end' }, -+ // -+ // A list: starting with list_start, ending with list_end, -+ // maybe containing other nested lists in each item. -+ // -+ // A metadata: -+ // -+ // -+ // If one of these isn't found, then anything that comes -+ // between here and the next heading should be parsed as the desc. -+ if (state === 'AFTERHEADING') { -+ if (type === 'blockquote_start') { -+ state = 'AFTERHEADING_BLOCKQUOTE'; -+ return; -+ } else if (type === 'list_start' && !tok.ordered) { -+ state = 'AFTERHEADING_LIST'; -+ current.list = current.list || []; -+ current.list.push(tok); -+ current.list.level = 1; -+ } else if (type === 'html' && common.isYAMLBlock(tok.text)) { -+ current.meta = common.extractAndParseYAML(tok.text); -+ } else { -+ current.desc = current.desc || []; -+ if (!Array.isArray(current.desc)) { -+ current.shortDesc = current.desc; -+ current.desc = []; - } -+ current.desc.links = lexed.links; -+ current.desc.push(tok); -+ state = 'DESC'; -+ } -+ return; -+ } - -- // Stability marker: > Stability: ... -- if ( -- node.type === 'blockquote' && node.children.length === 1 && -- node.children[0].type === 'paragraph' && -- nodes.slice(0, i).every((node) => node.type === 'list') -- ) { -- const text = textJoin(node.children[0].children, file); -- const stability = text.match(stabilityExpr); -- if (stability) { -- current.stability = parseInt(stability[1], 10); -- current.stabilityText = stability[2].trim(); -- delete nodes[i]; -- } -- } -- }); -+ if (state === 'AFTERHEADING_LIST') { -+ current.list.push(tok); -+ if (type === 'list_start') { -+ current.list.level++; -+ } else if (type === 'list_end') { -+ current.list.level--; -+ } -+ if (current.list.level === 0) { -+ state = 'AFTERHEADING'; -+ processList(current); -+ } -+ return; -+ } - -- // Compress the node array. -- nodes = nodes.filter(() => true); -+ if (state === 'AFTERHEADING_BLOCKQUOTE') { -+ if (type === 'blockquote_end') { -+ state = 'AFTERHEADING'; -+ return; -+ } - -- // If the first node is a list, extract it. -- const list = nodes[0] && nodes[0].type === 'list' ? -- nodes.shift() : null; -- -- // Now figure out what this list actually means. -- // Depending on the section type, the list could be different things. -- const values = list ? -- list.children.map((child) => parseListItem(child, file)) : []; -- -- switch (current.type) { -- case 'ctor': -- case 'classMethod': -- case 'method': -- // Each item is an argument, unless the name is 'return', -- // in which case it's the return value. -- const sig = {}; -- sig.params = values.filter((value) => { -- if (value.name === 'return') { -- sig.return = value; -- return false; -- } -- return true; -- }); -- parseSignature(current.textRaw, sig); -- current.signatures = [sig]; -- break; -- -- case 'property': -- // There should be only one item, which is the value. -- // Copy the data up to the section. -- if (values.length) { -- const signature = values[0]; -- -- // Shove the name in there for properties, -- // since they are always just going to be the value etc. -- signature.textRaw = `\`${current.name}\` ${signature.textRaw}`; -- -- for (const key in signature) { -- if (signature[key]) { -- if (key === 'type') { -- current.typeof = signature.type; -- } else { -- current[key] = signature[key]; -- } -- } -- } -- } -- break; -+ let stability; -+ if (type === 'paragraph' && (stability = text.match(stabilityExpr))) { -+ current.stability = parseInt(stability[1], 10); -+ current.stabilityText = stability[2].trim(); -+ return; -+ } -+ } - -- case 'event': -- // Event: each item is an argument. -- current.params = values; -- break; -+ current.desc = current.desc || []; -+ current.desc.links = lexed.links; -+ current.desc.push(tok); -+ }); - -- default: -- // If list wasn't consumed, put it back in the nodes list. -- if (list) nodes.unshift(list); -- } -+ // Finish any sections left open. -+ while (root !== (current = stack.pop())) { -+ finishSection(current, stack[stack.length - 1]); -+ } -+ -+ return cb(null, root); -+} - -- // Convert remaining nodes to a 'desc'. -- // Unified expects to process a string; but we ignore that as we -- // already have pre-parsed input that we can inject. -- if (nodes.length) { -- if (current.desc) current.shortDesc = current.desc; -- -- current.desc = unified() -- .use(function() { -- this.Parser = () => ( -- { type: 'root', children: nodes.concat(definitions) } -- ); -- }) -- .use(html) -- .processSync('').toString().trim(); -- if (!current.desc) delete current.desc; -- } -- -- // Process subsections. -- while (sections.length > 0 && sections[0].depth > section.depth) { -- doSection(sections.shift(), current); -- } -- -- // If type is not set, default type based on parent type, and -- // set displayName and name properties. -- if (!current.type) { -- current.type = (parent.type === 'misc' ? 'misc' : 'module'); -- current.displayName = current.name; -- current.name = current.name.toLowerCase() -- .trim().replace(/\s+/g, '_'); -- } -- -- // Pluralize type to determine which 'bucket' to put this section in. -- let plur; -- if (current.type.slice(-1) === 's') { -- plur = `${current.type}es`; -- } else if (current.type.slice(-1) === 'y') { -- plur = current.type.replace(/y$/, 'ies'); -+ -+// Go from something like this: -+// -+// [ { type: "list_item_start" }, -+// { type: "text", -+// text: "`options` {Object|string}" }, -+// { type: "list_start", -+// ordered: false }, -+// { type: "list_item_start" }, -+// { type: "text", -+// text: "`encoding` {string|null} **Default:** `'utf8'`" }, -+// { type: "list_item_end" }, -+// { type: "list_item_start" }, -+// { type: "text", -+// text: "`mode` {integer} **Default:** `0o666`" }, -+// { type: "list_item_end" }, -+// { type: "list_item_start" }, -+// { type: "text", -+// text: "`flag` {string} **Default:** `'a'`" }, -+// { type: "space" }, -+// { type: "list_item_end" }, -+// { type: "list_end" }, -+// { type: "list_item_end" } ] -+// -+// to something like: -+// -+// [ { textRaw: "`options` {Object|string} ", -+// options: [ -+// { textRaw: "`encoding` {string|null} **Default:** `'utf8'` ", -+// name: "encoding", -+// type: "string|null", -+// default: "`'utf8'`" }, -+// { textRaw: "`mode` {integer} **Default:** `0o666` ", -+// name: "mode", -+// type: "integer", -+// default: "`0o666`" }, -+// { textRaw: "`flag` {string} **Default:** `'a'` ", -+// name: "flag", -+// type: "string", -+// default: "`'a'`" } ], -+// name: "options", -+// type: "Object|string", -+// optional: true } ] -+ -+function processList(section) { -+ const { list } = section; -+ const values = []; -+ const stack = []; -+ let current; -+ -+ // For now, *just* build the hierarchical list. -+ list.forEach((tok) => { -+ const { type } = tok; -+ if (type === 'space') return; -+ if (type === 'list_item_start' || type === 'loose_item_start') { -+ const item = {}; -+ if (!current) { -+ values.push(item); -+ current = item; - } else { -- plur = `${current.type}s`; -+ current.options = current.options || []; -+ stack.push(current); -+ current.options.push(item); -+ current = item; -+ } -+ } else if (type === 'list_item_end') { -+ if (!current) { -+ throw new Error('invalid list - end without current item\n' + -+ `${JSON.stringify(tok)}\n` + -+ JSON.stringify(list)); -+ } -+ current = stack.pop(); -+ } else if (type === 'text') { -+ if (!current) { -+ throw new Error('invalid list - text without current item\n' + -+ `${JSON.stringify(tok)}\n` + -+ JSON.stringify(list)); - } -+ current.textRaw = `${current.textRaw || ''}${tok.text} `; -+ } -+ }); -+ -+ // Shove the name in there for properties, -+ // since they are always just going to be the value etc. -+ if (section.type === 'property' && values[0]) { -+ values[0].textRaw = `\`${section.name}\` ${values[0].textRaw}`; -+ } -+ -+ // Now pull the actual values out of the text bits. -+ values.forEach(parseListItem); - -- // Classes sometimes have various 'ctor' children -- // which are actually just descriptions of a constructor class signature. -- // Merge them into the parent. -- if (current.type === 'class' && current.ctors) { -- current.signatures = current.signatures || []; -- const sigs = current.signatures; -- current.ctors.forEach((ctor) => { -- ctor.signatures = ctor.signatures || [{}]; -- ctor.signatures.forEach((sig) => { -- sig.desc = ctor.desc; -- }); -- sigs.push(...ctor.signatures); -- }); -- delete current.ctors; -- } -- -- // Properties are a bit special. -- // Their "type" is the type of object, not "property". -- if (current.type === 'property') { -- if (current.typeof) { -- current.type = current.typeof; -- delete current.typeof; -- } else { -- delete current.type; -+ // Now figure out what this list actually means. -+ // Depending on the section type, the list could be different things. -+ -+ switch (section.type) { -+ case 'ctor': -+ case 'classMethod': -+ case 'method': { -+ // Each item is an argument, unless the name is 'return', -+ // in which case it's the return value. -+ const sig = {}; -+ section.signatures = section.signatures || []; -+ sig.params = values.filter((value) => { -+ if (value.name === 'return') { -+ sig.return = value; -+ return false; - } -- } -+ return true; -+ }); -+ parseSignature(section.textRaw, sig); -+ if (!sig.jump) section.signatures.push(sig); -+ break; -+ } - -- // If the parent's type is 'misc', then it's just a random -- // collection of stuff, like the "globals" section. -- // Make the children top-level items. -- if (current.type === 'misc') { -- Object.keys(current).forEach((key) => { -- switch (key) { -- case 'textRaw': -- case 'name': -- case 'type': -- case 'desc': -- case 'miscs': -- return; -- default: -- if (parent.type === 'misc') { -- return; -- } -- if (parent[key] && Array.isArray(parent[key])) { -- parent[key] = parent[key].concat(current[key]); -- } else if (!parent[key]) { -- parent[key] = current[key]; -- } -- } -- }); -- } -+ case 'property': { -+ // There should be only one item, which is the value. -+ // Copy the data up to the section. -+ const value = values[0] || {}; -+ delete value.name; -+ section.typeof = value.type || section.typeof; -+ delete value.type; -+ Object.keys(value).forEach((key) => { -+ section[key] = value[key]; -+ }); -+ break; -+ } - -- // Add this section to the parent. Sometimes we have two headings with a -- // single blob of description. If the preceding entry at this level -- // shares a name and is lacking a description, copy it backwards. -- if (!parent[plur]) parent[plur] = []; -- const prev = parent[plur].slice(-1)[0]; -- if (prev && prev.name === current.name && !prev.desc) { -- prev.desc = current.desc; -+ case 'event': -+ // Event: each item is an argument. -+ section.params = values; -+ break; -+ -+ default: -+ if (section.list.length > 0) { -+ section.desc = section.desc || []; -+ section.desc.push(...section.list); - } -- parent[plur].push(current); -- } -- }; -+ } -+ -+ delete section.list; - } - - -@@ -290,7 +325,6 @@ - // text: "someobject.someMethod(a[, b=100][, c])" - function parseSignature(text, sig) { - const list = []; -- - let [, sigParams] = text.match(paramExpr) || []; - if (!sigParams) return; - sigParams = sigParams.split(','); -@@ -346,15 +380,8 @@ - } - - if (!listParam) { -- if (sigParam.startsWith('...')) { -- listParam = { name: sigParam }; -- } else { -- throw new Error( -- `Invalid param "${sigParam}"\n` + -- ` > ${JSON.stringify(listParam)}\n` + -- ` > ${text}` -- ); -- } -+ sig.jump = true; -+ return; - } - } - -@@ -363,7 +390,6 @@ - - list.push(listParam); - }); -- - sig.params = list; - } - -@@ -374,37 +400,30 @@ - const leadingHyphen = /^-\s*/; - const defaultExpr = /\s*\*\*Default:\*\*\s*([^]+)$/i; - --function parseListItem(item, file) { -- const current = {}; -- -- current.textRaw = item.children.filter((node) => node.type !== 'list') -- .map((node) => ( -- file.contents.slice(node.position.start.offset, node.position.end.offset)) -- ) -- .join('').replace(/\s+/g, ' ').replace(//sg, ''); -- let text = current.textRaw; -- -- if (!text) { -+function parseListItem(item) { -+ if (item.options) item.options.forEach(parseListItem); -+ if (!item.textRaw) { - throw new Error(`Empty list item: ${JSON.stringify(item)}`); - } - -- // The goal here is to find the name, type, default. -+ // The goal here is to find the name, type, default, and optional. - // Anything left over is 'desc'. -+ let text = item.textRaw.trim(); - - if (returnExpr.test(text)) { -- current.name = 'return'; -+ item.name = 'return'; - text = text.replace(returnExpr, ''); - } else { - const [, name] = text.match(nameExpr) || []; - if (name) { -- current.name = name; -+ item.name = name; - text = text.replace(nameExpr, ''); - } - } - - const [, type] = text.match(typeExpr) || []; - if (type) { -- current.type = type; -+ item.type = type; - text = text.replace(typeExpr, ''); - } - -@@ -412,32 +431,154 @@ - - const [, defaultValue] = text.match(defaultExpr) || []; - if (defaultValue) { -- current.default = defaultValue.replace(/\.$/, ''); -+ item.default = defaultValue.replace(/\.$/, ''); - text = text.replace(defaultExpr, ''); - } - -- if (text) current.desc = text; -+ if (text) item.desc = text; -+} -+ -+ -+function finishSection(section, parent) { -+ if (!section || !parent) { -+ throw new Error('Invalid finishSection call\n' + -+ `${JSON.stringify(section)}\n` + -+ JSON.stringify(parent)); -+ } -+ -+ if (!section.type) { -+ section.type = 'module'; -+ if (parent.type === 'misc') { -+ section.type = 'misc'; -+ } -+ section.displayName = section.name; -+ section.name = section.name.toLowerCase() -+ .trim().replace(/\s+/g, '_'); -+ } -+ -+ if (section.desc && Array.isArray(section.desc)) { -+ section.desc.links = section.desc.links || []; -+ section.desc = marked.parser(section.desc); -+ } -+ -+ if (!section.list) section.list = []; -+ processList(section); -+ -+ // Classes sometimes have various 'ctor' children -+ // which are actually just descriptions of a constructor class signature. -+ // Merge them into the parent. -+ if (section.type === 'class' && section.ctors) { -+ section.signatures = section.signatures || []; -+ const sigs = section.signatures; -+ section.ctors.forEach((ctor) => { -+ ctor.signatures = ctor.signatures || [{}]; -+ ctor.signatures.forEach((sig) => { -+ sig.desc = ctor.desc; -+ }); -+ sigs.push(...ctor.signatures); -+ }); -+ delete section.ctors; -+ } -+ -+ // Properties are a bit special. -+ // Their "type" is the type of object, not "property". -+ if (section.properties) { -+ section.properties.forEach((prop) => { -+ if (prop.typeof) { -+ prop.type = prop.typeof; -+ delete prop.typeof; -+ } else { -+ delete prop.type; -+ } -+ }); -+ } - -- const options = item.children.find((child) => child.type === 'list'); -- if (options) { -- current.options = options.children.map((child) => ( -- parseListItem(child, file) -- )); -+ // Handle clones. -+ if (section.clone) { -+ const { clone } = section; -+ delete section.clone; -+ delete clone.clone; -+ deepCopy(section, clone); -+ finishSection(clone, parent); - } - -- return current; -+ let plur; -+ if (section.type.slice(-1) === 's') { -+ plur = `${section.type}es`; -+ } else if (section.type.slice(-1) === 'y') { -+ plur = section.type.replace(/y$/, 'ies'); -+ } else { -+ plur = `${section.type}s`; -+ } -+ -+ // If the parent's type is 'misc', then it's just a random -+ // collection of stuff, like the "globals" section. -+ // Make the children top-level items. -+ if (section.type === 'misc') { -+ Object.keys(section).forEach((key) => { -+ switch (key) { -+ case 'textRaw': -+ case 'name': -+ case 'type': -+ case 'desc': -+ case 'miscs': -+ return; -+ default: -+ if (parent.type === 'misc') { -+ return; -+ } -+ if (parent[key] && Array.isArray(parent[key])) { -+ parent[key] = parent[key].concat(section[key]); -+ } else if (!parent[key]) { -+ parent[key] = section[key]; -+ } -+ } -+ }); -+ } -+ -+ parent[plur] = parent[plur] || []; -+ parent[plur].push(section); - } - --// This section parses out the contents of an H# tag. - --// To reduce escape slashes in RegExp string components. -+// Not a general purpose deep copy. -+// But sufficient for these basic things. -+function deepCopy(src, dest) { -+ Object.keys(src) -+ .filter((key) => !dest.hasOwnProperty(key)) -+ .forEach((key) => { dest[key] = cloneValue(src[key]); }); -+} -+ -+function cloneValue(src) { -+ if (!src) return src; -+ if (Array.isArray(src)) { -+ const clone = new Array(src.length); -+ src.forEach((value, i) => { -+ clone[i] = cloneValue(value); -+ }); -+ return clone; -+ } -+ if (typeof src === 'object') { -+ const clone = {}; -+ Object.keys(src).forEach((key) => { -+ clone[key] = cloneValue(src[key]); -+ }); -+ return clone; -+ } -+ return src; -+} -+ -+ -+// This section parse out the contents of an H# tag. -+ -+// To reduse escape slashes in RegExp string components. - const r = String.raw; - - const eventPrefix = '^Event: +'; - const classPrefix = '^[Cc]lass: +'; - const ctorPrefix = '^(?:[Cc]onstructor: +)?`?new +'; - const classMethodPrefix = '^Static method: +'; --const maybeClassPropertyPrefix = '(?:Class property: +)?'; -+const maybeClassPropertyPrefix = '(?:Class Property: +)?'; - - const maybeQuote = '[\'"]?'; - const notQuotes = '[^\'"]+'; -@@ -480,9 +621,7 @@ - ]; - /* eslint-enable max-len */ - --function newSection(header, file) { -- const text = textJoin(header.children, file); -- -+function newSection({ text }) { - // Infer the type from the text. - for (const { type, re } of headingExpressions) { - const [, name] = text.match(re) || []; -@@ -493,20 +632,3 @@ - return { textRaw: text, name: text }; - } - --function textJoin(nodes, file) { -- return nodes.map((node) => { -- if (node.type === 'linkReference') { -- return file.contents.slice(node.position.start.offset, -- node.position.end.offset); -- } else if (node.type === 'inlineCode') { -- return `\`${node.value}\``; -- } else if (node.type === 'strong') { -- return `**${textJoin(node.children, file)}**`; -- } else if (node.type === 'emphasis') { -- return `_${textJoin(node.children, file)}_`; -- } else if (node.children) { -- return textJoin(node.children, file); -- } -- return node.value; -- }).join(''); --} ---- a/tools/doc/allhtml.js -+++ b/tools/doc/allhtml.js -@@ -32,7 +32,7 @@ - - // Split the doc. - const match = /(<\/ul>\s*)?<\/div>\s*
/.exec(data); -- -+ if (!match) console.info(source, link) - contents += data.slice(0, match.index) - .replace(/[\s\S]*?
\s*

.*?<\/h2>\s*(
    \s*)?/, ''); - -@@ -84,5 +84,5 @@ - - const hrefRe = / href="#(\w+)"/g; - while (match = hrefRe.exec(all)) { -- if (!ids.has(match[1])) throw new Error(`link not found: ${match[1]}`); -+ if (!ids.has(match[1])) console.warn(`link not found: ${match[1]}`); - } ---- a/tools/doc/versions.js -+++ b/tools/doc/versions.js -@@ -43,7 +43,7 @@ - changelog = readFileSync(file, { encoding: 'utf8' }); - } else { - try { -- changelog = await getUrl(url); -+ changelog = await require('fs').promises.readFile(require('path').join(__dirname, '..', '..', 'CHANGELOG.md')); - } catch (e) { - // Fail if this is a release build, otherwise fallback to local files. - if (isRelease()) { ---- a/tools/doc/type-parser.js -+++ b/tools/doc/type-parser.js -@@ -160,11 +160,12 @@ - }; - - const arrayPart = /(?:\[])+$/; -+const arrayWrap = /^\[(\w+)\]$/; - - function toLink(typeInput) { - const typeLinks = []; - typeInput = typeInput.replace('{', '').replace('}', ''); -- const typeTexts = typeInput.split('|'); -+ const typeTexts = typeInput.split(/\||,/); - - typeTexts.forEach((typeText) => { - typeText = typeText.trim(); -@@ -174,7 +175,7 @@ - // To support type[], type[][] etc., we store the full string - // and use the bracket-less version to lookup the type URL. - const typeTextFull = typeText; -- typeText = typeText.replace(arrayPart, ''); -+ typeText = typeText.replace(arrayPart, '').replace(arrayWrap, '$1'); - - const primitive = jsPrimitives[typeText]; - diff --git a/debian/patches/mips-fix.patch b/debian/patches/mips-fix.patch deleted file mode 100644 index 33a2eacf..00000000 --- a/debian/patches/mips-fix.patch +++ /dev/null @@ -1,210 +0,0 @@ -Description: upstream mips fix -Origin: https://github.com/nodejs/node/issues/31118 -Last-Update: 2020-05-30 - ---- a/deps/v8/AUTHORS -+++ b/deps/v8/AUTHORS -@@ -106,6 +106,7 @@ - James M Snell - Jianghua Yang - Jiawen Geng -+Jiaxun Yang - Joel Stanley - Johan Bergström - Jonathan Liu ---- a/deps/v8/src/snapshot/embedded/platform-embedded-file-writer-aix.cc -+++ b/deps/v8/src/snapshot/embedded/platform-embedded-file-writer-aix.cc -@@ -94,10 +94,6 @@ - - void PlatformEmbeddedFileWriterAIX::DeclareFunctionEnd(const char* name) {} - --int PlatformEmbeddedFileWriterAIX::HexLiteral(uint64_t value) { -- return fprintf(fp_, "0x%" PRIx64, value); --} -- - void PlatformEmbeddedFileWriterAIX::FilePrologue() {} - - void PlatformEmbeddedFileWriterAIX::DeclareExternalFilename( -@@ -120,12 +116,6 @@ - return kLong; - } - --int PlatformEmbeddedFileWriterAIX::WriteByteChunk(const uint8_t* data) { -- DCHECK_EQ(ByteChunkDataDirective(), kLong); -- const uint32_t* long_ptr = reinterpret_cast(data); -- return HexLiteral(*long_ptr); --} -- - #undef SYMBOL_PREFIX - - } // namespace internal ---- a/deps/v8/src/snapshot/embedded/platform-embedded-file-writer-aix.h -+++ b/deps/v8/src/snapshot/embedded/platform-embedded-file-writer-aix.h -@@ -37,8 +37,6 @@ - void DeclareFunctionBegin(const char* name) override; - void DeclareFunctionEnd(const char* name) override; - -- int HexLiteral(uint64_t value) override; -- - void Comment(const char* string) override; - - void FilePrologue() override; -@@ -48,7 +46,6 @@ - int IndentedDataDirective(DataDirective directive) override; - - DataDirective ByteChunkDataDirective() const override; -- int WriteByteChunk(const uint8_t* data) override; - - private: - void DeclareSymbolGlobal(const char* name); ---- a/deps/v8/src/snapshot/embedded/platform-embedded-file-writer-base.cc -+++ b/deps/v8/src/snapshot/embedded/platform-embedded-file-writer-base.cc -@@ -24,6 +24,10 @@ - } - } - -+int PlatformEmbeddedFileWriterBase::HexLiteral(uint64_t value) { -+ return fprintf(fp_, "0x%" PRIx64, value); -+} -+ - int DataDirectiveSize(DataDirective directive) { - switch (directive) { - case kByte: -@@ -39,24 +43,37 @@ - } - - int PlatformEmbeddedFileWriterBase::WriteByteChunk(const uint8_t* data) { -- DCHECK_EQ(ByteChunkDataDirective(), kOcta); -- -- static constexpr size_t kSize = kInt64Size; -- -- uint64_t part1, part2; -- // Use memcpy for the reads since {data} is not guaranteed to be aligned. -+ size_t kSize = DataDirectiveSize(ByteChunkDataDirective()); -+ size_t kHalfSize = kSize / 2; -+ uint64_t high = 0, low = 0; -+ -+ switch (kSize) { -+ case 1: -+ low = *data; -+ break; -+ case 4: -+ low = *reinterpret_cast(data); -+ break; -+ case 8: -+ low = *reinterpret_cast(data); -+ break; -+ case 16: - #ifdef V8_TARGET_BIG_ENDIAN -- memcpy(&part1, data, kSize); -- memcpy(&part2, data + kSize, kSize); -+ memcpy(&high, data, kHalfSize); -+ memcpy(&low, data + kHalfSize, kHalfSize); - #else -- memcpy(&part1, data + kSize, kSize); -- memcpy(&part2, data, kSize); -+ memcpy(&high, data + kHalfSize, kHalfSize); -+ memcpy(&low, data, kHalfSize); - #endif // V8_TARGET_BIG_ENDIAN -+ break; -+ default: -+ UNREACHABLE(); -+ } - -- if (part1 != 0) { -- return fprintf(fp(), "0x%" PRIx64 "%016" PRIx64, part1, part2); -+ if (high != 0) { -+ return fprintf(fp(), "0x%" PRIx64 "%016" PRIx64, high, low); - } else { -- return fprintf(fp(), "0x%" PRIx64, part2); -+ return fprintf(fp(), "0x%" PRIx64, low); - } - } - ---- a/deps/v8/src/snapshot/embedded/platform-embedded-file-writer-base.h -+++ b/deps/v8/src/snapshot/embedded/platform-embedded-file-writer-base.h -@@ -67,7 +67,7 @@ - virtual void DeclareFunctionEnd(const char* name) = 0; - - // Returns the number of printed characters. -- virtual int HexLiteral(uint64_t value) = 0; -+ virtual int HexLiteral(uint64_t value); - - virtual void Comment(const char* string) = 0; - virtual void Newline() { fprintf(fp_, "\n"); } ---- a/deps/v8/src/snapshot/embedded/platform-embedded-file-writer-generic.cc -+++ b/deps/v8/src/snapshot/embedded/platform-embedded-file-writer-generic.cc -@@ -112,10 +112,6 @@ - - void PlatformEmbeddedFileWriterGeneric::DeclareFunctionEnd(const char* name) {} - --int PlatformEmbeddedFileWriterGeneric::HexLiteral(uint64_t value) { -- return fprintf(fp_, "0x%" PRIx64, value); --} -- - void PlatformEmbeddedFileWriterGeneric::FilePrologue() {} - - void PlatformEmbeddedFileWriterGeneric::DeclareExternalFilename( -@@ -142,6 +138,18 @@ - return fprintf(fp_, " %s ", DirectiveAsString(directive)); - } - -+DataDirective PlatformEmbeddedFileWriterGeneric::ByteChunkDataDirective() -+ const { -+#if defined(V8_TARGET_ARCH_MIPS) || defined(V8_TARGET_ARCH_MIPS64) -+ // MIPS uses a fixed 4 byte instruction set, using .long -+ // to prevent any unnecessary padding. -+ return kLong; -+#else -+ // Other ISAs just listen to the base -+ return PlatformEmbeddedFileWriterBase::ByteChunkDataDirective(); -+#endif -+} -+ - #undef SYMBOL_PREFIX - - } // namespace internal ---- a/deps/v8/src/snapshot/embedded/platform-embedded-file-writer-generic.h -+++ b/deps/v8/src/snapshot/embedded/platform-embedded-file-writer-generic.h -@@ -39,8 +39,6 @@ - void DeclareFunctionBegin(const char* name) override; - void DeclareFunctionEnd(const char* name) override; - -- int HexLiteral(uint64_t value) override; -- - void Comment(const char* string) override; - - void FilePrologue() override; -@@ -49,6 +47,8 @@ - - int IndentedDataDirective(DataDirective directive) override; - -+ DataDirective ByteChunkDataDirective() const override; -+ - private: - void DeclareSymbolGlobal(const char* name); - ---- a/deps/v8/src/snapshot/embedded/platform-embedded-file-writer-mac.cc -+++ b/deps/v8/src/snapshot/embedded/platform-embedded-file-writer-mac.cc -@@ -87,10 +87,6 @@ - - void PlatformEmbeddedFileWriterMac::DeclareFunctionEnd(const char* name) {} - --int PlatformEmbeddedFileWriterMac::HexLiteral(uint64_t value) { -- return fprintf(fp_, "0x%" PRIx64, value); --} -- - void PlatformEmbeddedFileWriterMac::FilePrologue() {} - - void PlatformEmbeddedFileWriterMac::DeclareExternalFilename( ---- a/deps/v8/src/snapshot/embedded/platform-embedded-file-writer-mac.h -+++ b/deps/v8/src/snapshot/embedded/platform-embedded-file-writer-mac.h -@@ -37,8 +37,6 @@ - void DeclareFunctionBegin(const char* name) override; - void DeclareFunctionEnd(const char* name) override; - -- int HexLiteral(uint64_t value) override; -- - void Comment(const char* string) override; - - void FilePrologue() override; diff --git a/debian/patches/mips-less-memory.patch b/debian/patches/mips-less-memory.patch deleted file mode 100644 index 605b9425..00000000 --- a/debian/patches/mips-less-memory.patch +++ /dev/null @@ -1,26 +0,0 @@ -Description: mksnapshot uses too much memory on 32-bit mipsel -Author: Jérémy Lal -Last-Update: 2020-06-03 -Forwarded: https://bugs.chromium.org/p/v8/issues/detail?id=10586 ---- a/deps/v8/src/common/globals.h -+++ b/deps/v8/src/common/globals.h -@@ -206,7 +206,7 @@ - constexpr size_t kMinExpectedOSPageSize = 64 * KB; // OS page on PPC Linux - #elif V8_TARGET_ARCH_MIPS - constexpr bool kRequiresCodeRange = false; --constexpr size_t kMaximalCodeRangeSize = 2048LL * MB; -+constexpr size_t kMaximalCodeRangeSize = 512 * MB; - constexpr size_t kMinimumCodeRangeSize = 0 * MB; - constexpr size_t kMinExpectedOSPageSize = 4 * KB; // OS page. - #else ---- a/deps/v8/src/codegen/mips/constants-mips.h -+++ b/deps/v8/src/codegen/mips/constants-mips.h -@@ -137,7 +137,7 @@ - namespace v8 { - namespace internal { - --constexpr size_t kMaxPCRelativeCodeRangeInMB = 4096; -+constexpr size_t kMaxPCRelativeCodeRangeInMB = 1024; - - // ----------------------------------------------------------------------------- - // Registers and FPURegisters. diff --git a/debian/patches/mips-no-jitless.patch b/debian/patches/mips-no-jitless.patch deleted file mode 100644 index d2d2f170..00000000 --- a/debian/patches/mips-no-jitless.patch +++ /dev/null @@ -1,16 +0,0 @@ -Description: on mipsel, mips64el, node --jitless segfaults -Author: Jérémy Lal -Last-Update: 2020-06-03 -Forwarded: https://github.com/nodejs/node/issues/33703 ---- a/test/parallel/test-cli-node-options.js -+++ b/test/parallel/test-cli-node-options.js -@@ -68,7 +68,8 @@ - expect('--abort_on-uncaught_exception', 'B\n'); - expect('--disallow-code-generation-from-strings', 'B\n'); - expect('--huge-max-old-generation-size', 'B\n'); --expect('--jitless', 'B\n'); -+if (!['mipsel', 'mips64el'].includes(process.arch)) -+ expect('--jitless', 'B\n'); - expect('--max-old-space-size=0', 'B\n'); - expect('--stack-trace-limit=100', - /(\s*at f \(\[(eval|worker eval)\]:1:\d*\)\r?\n)/, diff --git a/debian/patches/ppc64.patch b/debian/patches/ppc64.patch deleted file mode 100644 index 336db7dd..00000000 --- a/debian/patches/ppc64.patch +++ /dev/null @@ -1,47 +0,0 @@ -Date: Sat, 13 Jun 2020 20:49:35 +0200 -Subject: [PATCH] Fix crashes on Linux/PPC64 ELFv1 -Origin: https://github.com/nodejs/node/pull/33866 -From: Marcus Comstedt - ---- nodejs-12.18.0~dfsg.orig/deps/v8/src/compiler/backend/instruction-selector.cc -+++ nodejs-12.18.0~dfsg/deps/v8/src/compiler/backend/instruction-selector.cc -@@ -2788,7 +2788,7 @@ void InstructionSelector::VisitCall(Node - switch (call_descriptor->kind()) { - case CallDescriptor::kCallAddress: { - int misc_field = static_cast(call_descriptor->ParameterCount()); --#if defined(_AIX) -+#if ABI_USES_FUNCTION_DESCRIPTORS - // Highest misc_field bit is used on AIX to indicate if a CFunction call - // has function descriptor or not. - misc_field |= call_descriptor->HasFunctionDescriptor() ---- nodejs-12.18.0~dfsg.orig/deps/v8/src/compiler/backend/ppc/code-generator-ppc.cc -+++ nodejs-12.18.0~dfsg/deps/v8/src/compiler/backend/ppc/code-generator-ppc.cc -@@ -1026,7 +1026,7 @@ CodeGenerator::CodeGenResult CodeGenerat - Label start_call; - bool isWasmCapiFunction = - linkage()->GetIncomingDescriptor()->IsWasmCapiFunction(); --#if defined(_AIX) -+#if ABI_USES_FUNCTION_DESCRIPTORS - // AIX/PPC64BE Linux uses a function descriptor - int kNumParametersMask = kHasFunctionDescriptorBitMask - 1; - num_parameters = kNumParametersMask & misc_field; ---- nodejs-12.18.0~dfsg.orig/deps/v8/src/execution/simulator.h -+++ nodejs-12.18.0~dfsg/deps/v8/src/execution/simulator.h -@@ -122,7 +122,7 @@ class GeneratedCode { - - DISABLE_CFI_ICALL Return Call(Args... args) { - // When running without a simulator we call the entry directly. --#if V8_OS_AIX -+#if ABI_USES_FUNCTION_DESCRIPTORS - // AIX ABI requires function descriptors (FD). Artificially create a pseudo - // FD to ensure correct dispatch to generated code. The 'volatile' - // declaration is required to avoid the compiler from not observing the -@@ -134,7 +134,7 @@ class GeneratedCode { - return fn(args...); - #else - return fn_ptr_(args...); --#endif // V8_OS_AIX -+#endif // ABI_USES_FUNCTION_DESCRIPTORS - } - #endif // USE_SIMULATOR - diff --git a/debian/patches/privacy_breach.patch b/debian/patches/privacy_breach.patch deleted file mode 100644 index 7a912c9d..00000000 --- a/debian/patches/privacy_breach.patch +++ /dev/null @@ -1,18 +0,0 @@ -Description: remove google font from template.html, and link to local -Author: Jérémy Lal -Last-Update: 2015-09-09 -Forwarded: not-needed ---- a/doc/template.html -+++ b/doc/template.html -@@ -5,10 +5,9 @@ - - - __SECTION__ | Node.js __VERSION__ Documentation -- - - -- -+ - - -
    diff --git a/debian/patches/python3.patch b/debian/patches/python3.patch deleted file mode 100644 index d80e6ef5..00000000 --- a/debian/patches/python3.patch +++ /dev/null @@ -1,32 +0,0 @@ -Description: support build with python3 -Forwarded: not-needed -Last-Update: 2020-08-08 -Author: Jérémy Lal ---- a/configure -+++ b/configure -@@ -4,7 +4,7 @@ - # mix of single and double quotes is intentional, as is the fact that - # the ] goes on a new line. - _=[ 'exec' '/bin/sh' '-c' ''' --which python2.7 >/dev/null && exec python2.7 "$0" "$@" -+which python3 >/dev/null && exec python3 "$0" "$@" - which python2 >/dev/null && exec python2 "$0" "$@" - exec python "$0" "$@" - ''' "$0" "$@" -@@ -13,16 +13,5 @@ - - import sys - from distutils.spawn import find_executable as which --if sys.version_info[:2] != (2, 7): -- sys.stderr.write('Please use Python 2.7') -- -- python2 = which('python2') or which('python2.7') -- -- if python2: -- sys.stderr.write(':\n\n') -- sys.stderr.write(' ' + python2 + ' ' + ' '.join(sys.argv)) -- -- sys.stderr.write('\n') -- sys.exit(1) - - import configure diff --git a/debian/patches/revert_fix_missing_extra_ca.patch b/debian/patches/revert_fix_missing_extra_ca.patch deleted file mode 100644 index 0a946b10..00000000 --- a/debian/patches/revert_fix_missing_extra_ca.patch +++ /dev/null @@ -1,169 +0,0 @@ -From: Eric Bickle -Date: Tue, 3 Mar 2020 13:35:28 -0800 -Subject: Revert src fix missing extra ca in tls.rootCertificates - -Revert this patch because it breaks system CA: -https://github.com/nodejs/node/pull/32315 - ---- a/src/node_crypto.cc -+++ b/src/node_crypto.cc -@@ -988,6 +988,24 @@ - } - - -+void GetRootCertificates(const FunctionCallbackInfo& args) { -+ Environment* env = Environment::GetCurrent(args); -+ Local result[arraysize(root_certs)]; -+ -+ for (size_t i = 0; i < arraysize(root_certs); i++) { -+ if (!String::NewFromOneByte( -+ env->isolate(), -+ reinterpret_cast(root_certs[i]), -+ NewStringType::kNormal).ToLocal(&result[i])) { -+ return; -+ } -+ } -+ -+ args.GetReturnValue().Set( -+ Array::New(env->isolate(), result, arraysize(root_certs))); -+} -+ -+ - void SecureContext::AddCACert(const FunctionCallbackInfo& args) { - Environment* env = Environment::GetCurrent(args); - -@@ -2664,21 +2682,6 @@ - } - } - --static MaybeLocal X509ToPEM(Environment* env, X509* cert) { -- BIOPointer bio(BIO_new(BIO_s_mem())); -- if (!bio) { -- ThrowCryptoError(env, ERR_get_error(), "BIO_new"); -- return MaybeLocal(); -- } -- -- if (PEM_write_bio_X509(bio.get(), cert) == 0) { -- ThrowCryptoError(env, ERR_get_error(), "PEM_write_bio_X509"); -- return MaybeLocal(); -- } -- -- return BIOToStringOrBuffer(env, bio.get(), kKeyFormatPEM); --} -- - static bool WritePublicKeyInner(EVP_PKEY* pkey, - const BIOPointer& bio, - const PublicKeyEncodingConfig& config) { -@@ -6676,36 +6679,6 @@ - } - - --void GetRootCertificates(const FunctionCallbackInfo& args) { -- Environment* env = Environment::GetCurrent(args); -- -- if (root_cert_store == nullptr) -- root_cert_store = NewRootCertStore(); -- -- stack_st_X509_OBJECT* objs = X509_STORE_get0_objects(root_cert_store); -- int num_objs = sk_X509_OBJECT_num(objs); -- -- std::vector> result; -- result.reserve(num_objs); -- -- for (int i = 0; i < num_objs; i++) { -- X509_OBJECT* obj = sk_X509_OBJECT_value(objs, i); -- if (X509_OBJECT_get_type(obj) == X509_LU_X509) { -- X509* cert = X509_OBJECT_get0_X509(obj); -- -- Local value; -- if (!X509ToPEM(env, cert).ToLocal(&value)) -- return; -- -- result.push_back(value); -- } -- } -- -- args.GetReturnValue().Set( -- Array::New(env->isolate(), result.data(), result.size())); --} -- -- - // Convert the input public key to compressed, uncompressed, or hybrid formats. - void ConvertKey(const FunctionCallbackInfo& args) { - MarkPopErrorOnReturn mark_pop_error_on_return; ---- a/test/parallel/test-tls-root-certificates.js -+++ b/test/parallel/test-tls-root-certificates.js -@@ -2,49 +2,30 @@ - const common = require('../common'); - if (!common.hasCrypto) common.skip('missing crypto'); - --const fixtures = require('../common/fixtures'); - const assert = require('assert'); - const tls = require('tls'); --const { fork } = require('child_process'); - --if (process.argv[2] !== 'child') { -- // Parent -- const NODE_EXTRA_CA_CERTS = fixtures.path('keys', 'ca1-cert.pem'); -- -- fork( -- __filename, -- ['child'], -- { env: { ...process.env, NODE_EXTRA_CA_CERTS } } -- ).on('exit', common.mustCall(function(status) { -- assert.strictEqual(status, 0); -- })); --} else { -- // Child -- assert(Array.isArray(tls.rootCertificates)); -- assert(tls.rootCertificates.length > 0); -- -- // Getter should return the same object. -- assert.strictEqual(tls.rootCertificates, tls.rootCertificates); -- -- // Array is immutable... -- assert.throws(() => tls.rootCertificates[0] = 0, /TypeError/); -- assert.throws(() => tls.rootCertificates.sort(), /TypeError/); -- -- // ...and so is the property. -- assert.throws(() => tls.rootCertificates = 0, /TypeError/); -- -- // Does not contain duplicates. -- assert.strictEqual(tls.rootCertificates.length, -- new Set(tls.rootCertificates).size); -- -- assert(tls.rootCertificates.every((s) => { -- return s.startsWith('-----BEGIN CERTIFICATE-----\n'); -- })); -- -- assert(tls.rootCertificates.every((s) => { -- return s.endsWith('\n-----END CERTIFICATE-----\n'); -- })); -- -- const extraCert = fixtures.readKey('ca1-cert.pem', 'utf8'); -- assert(tls.rootCertificates.includes(extraCert)); --} -+assert(Array.isArray(tls.rootCertificates)); -+assert(tls.rootCertificates.length > 0); -+ -+// Getter should return the same object. -+assert.strictEqual(tls.rootCertificates, tls.rootCertificates); -+ -+// Array is immutable... -+assert.throws(() => tls.rootCertificates[0] = 0, /TypeError/); -+assert.throws(() => tls.rootCertificates.sort(), /TypeError/); -+ -+// ...and so is the property. -+assert.throws(() => tls.rootCertificates = 0, /TypeError/); -+ -+// Does not contain duplicates. -+assert.strictEqual(tls.rootCertificates.length, -+ new Set(tls.rootCertificates).size); -+ -+assert(tls.rootCertificates.every((s) => { -+ return s.startsWith('-----BEGIN CERTIFICATE-----\n'); -+})); -+ -+assert(tls.rootCertificates.every((s) => { -+ return s.endsWith('\n-----END CERTIFICATE-----'); -+})); diff --git a/debian/patches/series b/debian/patches/series deleted file mode 100644 index 093b6fd5..00000000 --- a/debian/patches/series +++ /dev/null @@ -1,26 +0,0 @@ -test-lowerseclevel.patch -ares_compat.patch -shared_uv_from_uvwasi.patch -large_pages_assembly_gnu_stack.patch -dfhs_module_path_arch_triplet.patch -# 2012_kfreebsd.patch -use_system_node_gyp.patch -privacy_breach.patch -fix-for-js-yaml-4.patch -make-doc.patch -2017_mips_configure_fpu.patch -test_ci_buildd.patch -fix_disable_cctest.patch -benchmark_without_alice.patch -atomic.patch -mips-fix.patch -mips-less-memory.patch -mips-no-jitless.patch -localhost-no-addrconfig.patch -ppc64.patch -python3.patch -cjs-module-lexer.patch -upstream-fix-test-worker-prof.patch -7232c2a1604d241ce0455d919ba9b0b8e9959f81.patch -24c403cfaf8bdbcd8b19037531c8998709d2b949.patch -e548e053a2fda35f38272fb023f543e52ae77566.patch diff --git a/debian/patches/shared_uv_from_uvwasi.patch b/debian/patches/shared_uv_from_uvwasi.patch deleted file mode 100644 index cc97b308..00000000 --- a/debian/patches/shared_uv_from_uvwasi.patch +++ /dev/null @@ -1,26 +0,0 @@ -Description: uvwasi depends on uv.gyp and ignores shared_libuv -Author: Jérémy Lal -Last-Update: 2021-07-03 -Forwarded: https://github.com/nodejs/node/issues/39248 ---- a/deps/uvwasi/uvwasi.gyp -+++ b/deps/uvwasi/uvwasi.gyp -@@ -18,9 +18,6 @@ - 'src/wasi_rights.c', - 'src/wasi_serdes.c', - ], -- 'dependencies': [ -- '../uv/uv.gyp:libuv', -- ], - 'direct_dependent_settings': { - 'include_dirs': ['include'] - }, -@@ -31,6 +28,9 @@ - '_POSIX_C_SOURCE=200112', - ], - }], -+ [ 'node_shared_libuv=="false"', { -+ 'dependencies': [ '../uv/uv.gyp:libuv' ], -+ }], - ], - } - ] diff --git a/debian/patches/test-lowerseclevel.patch b/debian/patches/test-lowerseclevel.patch deleted file mode 100644 index 8c3a4b01..00000000 --- a/debian/patches/test-lowerseclevel.patch +++ /dev/null @@ -1,32 +0,0 @@ -Description: Lower SECLEVEL in the openssl.cnf used for testing - In Ubuntu SECLEVEL is compiled into openssl, rather than - set/unset from system openssl.cnf. -Author: Dimitri John Ledkov -Bug-Ubuntu: https://bugs.launchpad.net/bugs/1858971 - - ---- nodejs-10.17.0~dfsg.orig/deps/openssl/openssl/apps/openssl.cnf -+++ nodejs-10.17.0~dfsg/deps/openssl/openssl/apps/openssl.cnf -@@ -11,6 +11,8 @@ - # defined. - HOME = . - -+openssl_conf = default_conf -+ - # Extra OBJECT IDENTIFIER info: - #oid_file = $ENV::HOME/.oid - oid_section = new_oids -@@ -348,3 +350,13 @@ ess_cert_id_chain = no # Must the ESS ce - # (optional, default: no) - ess_cert_id_alg = sha1 # algorithm to compute certificate - # identifier (optional, default: sha1) -+ -+[default_conf] -+ssl_conf = ssl_sect -+ -+[ssl_sect] -+system_default = system_default_sect -+ -+[system_default_sect] -+MinProtocol = TLSv1.2 -+CipherString = DEFAULT@SECLEVEL=1 diff --git a/debian/patches/test_ci_buildd.patch b/debian/patches/test_ci_buildd.patch deleted file mode 100644 index b31b47ee..00000000 --- a/debian/patches/test_ci_buildd.patch +++ /dev/null @@ -1,180 +0,0 @@ -Description: adapt test-ci build target for buildd - * run tests with ./node - * remove addons from test-ci suite, because it creates a dependency loop - nodejs -> node-gyp -> nodejs which is painful to manage. - * disabled because it requires stdin: - + test-stdout-close-unref - + test-regress-GH-746 - * test-tick-processor fails on ppc64 and s390x, currently investigated - https://github.com/nodejs/node/issues/2471 - * test-cluster-disconnect sometimes fails on busy buildd, forwarded upstream - https://github.com/nodejs/node/issues/3383 - * test-fs-watch is flaky, might be related to https://github.com/nodejs/node/issues/4082 - * huge timeout value for all platforms, buildd could be busy - * test-npm-install and test-release-npm must fail, debian package dfsg-repacked npm out - * ability to override CI_NATIVE_SUITES, CI_JS_SUITES - * disable tests failing because DNS is disabled - * sequential/test-http2-session-timeout is flaky https://github.com/nodejs/node/issues/20628 -Author: Jérémy Lal -Forwarded: not-needed -Reviewed-By: Xavier Guimard -Last-Update: 2020-02-09 - ---- a/Makefile -+++ b/Makefile -@@ -508,7 +508,7 @@ - # This target should not use a native compiler at all - # Related CI job: node-test-commit-arm-fanned - test-ci-js: | clear-stalled -- $(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \ -+ $(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap \ - --mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \ - $(TEST_CI_ARGS) $(CI_JS_SUITES) - @echo "Clean up any leftover processes, error if found." ---- a/test/parallel/parallel.status -+++ b/test/parallel/parallel.status -@@ -6,6 +6,37 @@ - - [true] # This section applies to all platforms - -+test-process-config : PASS,FLAKY -+test-regress-GH-746 : PASS,FLAKY -+test-stdout-close-unref : PASS,FLAKY -+test-npm-install : FAIL -+test-npm-version : FAIL -+test-release-npm : FAIL -+# skip tests accessing network -+test-dns : SKIP -+test-net-connect-immediate-finish : SKIP -+test-net-better-error-messages-port-hostname : SKIP -+ -+# in debian build env, skip because it somehow tries to access network -+test-https-connect-address-family : SKIP -+test-tls-connect-address-family : SKIP -+test-dns-cancel-reverse-lookup: SKIP -+ -+# https://bugs.debian.org/919588 -+## flaky on some user environments -+test-net-listen-after-destroying-stdin: PASS,FLAKY -+## fails when running with eatmydata -+test-fs-error-messages: PASS,FLAKY -+ -+# should have been disabled 'cause openssl 1.1.0 -+test-tls-ecdh-disable : SKIP -+ -+# only works with zlib >= 1.2.11 -+test-zlib-failed-init: SKIP -+ -+# might fail, see https://github.com/nodejs/node/issues/17909 -+test-fs-utimes: PASS,FLAKY -+ - [$system==win32] - # https://github.com/nodejs/node/issues/20750 - test-http2-client-upload: PASS,FLAKY -@@ -39,6 +70,10 @@ - # https://github.com/nodejs/node/issues/33796 - test-fs-stream-construct: PASS,FLAKY - -+[$arch==mips64el] -+# the debug flag is for hacking v8 internals -+test-debug-args: PASS,FLAKY -+ - [$system==solaris] # Also applies to SmartOS - - [$system==freebsd] -@@ -71,3 +106,6 @@ - test-tls-env-extra-ca: SKIP - # https://github.com/nodejs/node/pull/34209 - test-dgram-error-message-address: SKIP -+ -+[$arch==mipsel] -+test-inspect-async-hook-setup-at-inspect: SKIP ---- a/test/sequential/sequential.status -+++ b/test/sequential/sequential.status -@@ -8,6 +8,15 @@ - # https://github.com/nodejs/node/issues/27611#issuecomment-613100468 - test-cpu-prof-dir-worker: PASS, FLAKY - -+# flaky or failing at least on debian build servers -+test-fs-watch : PASS,FLAKY -+test-force-repl : SKIP -+test-performance : SKIP -+test-http2-session-timeout : PASS,FLAKY -+ -+# https://github.com/nodejs/node/issues/24403 -+test-cli-syntax: PASS,FLAKY -+ - [$system==win32] - # https://github.com/nodejs/node/issues/22327 - test-http2-large-file: PASS, FLAKY -@@ -35,3 +44,10 @@ - [$arch==arm] - # https://github.com/nodejs/node/issues/26401#issuecomment-613095719 - test-worker-prof: PASS, FLAKY -+ -+[$arch==mipsel] -+test-inspector-async-hook-setup-at-inspect-brk: SKIP -+test-inspector-async-hook-setup-at-signal: SKIP -+test-inspector-async-stack-traces-set-interval: SKIP -+ -+ ---- a/tools/test.py -+++ b/tools/test.py -@@ -890,25 +890,7 @@ - self.node_has_crypto = True - - def GetVm(self, arch, mode): -- if self.vm is not None: -- return self.vm -- if arch == 'none': -- name = 'out/Debug/node' if mode == 'debug' else 'out/Release/node' -- else: -- name = 'out/%s.%s/node' % (arch, mode) -- -- # Currently GYP does not support output_dir for MSVS. -- # http://code.google.com/p/gyp/issues/detail?id=40 -- # It will put the builds into Release/node.exe or Debug/node.exe -- if utils.IsWindows(): -- if not exists(name + '.exe'): -- name = name.replace('out/', '') -- name = os.path.abspath(name + '.exe') -- -- if not exists(name): -- raise ValueError('Could not find executable. Should be ' + name) -- -- return name -+ return './node' - - def GetTimeout(self, mode): - return self.timeout * TIMEOUT_SCALEFACTOR[ARCH_GUESS or 'ia32'][mode] ---- a/test/common/index.js -+++ b/test/common/index.js -@@ -235,27 +235,7 @@ - - - function platformTimeout(ms) { -- const multipliers = typeof ms === 'bigint' ? -- { two: 2n, four: 4n, seven: 7n } : { two: 2, four: 4, seven: 7 }; -- -- if (process.features.debug) -- ms = multipliers.two * ms; -- -- if (isAIX) -- return multipliers.two * ms; // Default localhost speed is slower on AIX -- -- if (process.arch !== 'arm') -- return ms; -- -- const armv = process.config.variables.arm_version; -- -- if (armv === '6') -- return multipliers.seven * ms; // ARMv6 -- -- if (armv === '7') -- return multipliers.two * ms; // ARMv7 -- -- return ms; // ARMv8+ -+ return 20 * ms; // for debian build servers - } - - let knownGlobals = [ diff --git a/debian/patches/upstream-fix-test-worker-prof.patch b/debian/patches/upstream-fix-test-worker-prof.patch deleted file mode 100644 index 4f427ae5..00000000 --- a/debian/patches/upstream-fix-test-worker-prof.patch +++ /dev/null @@ -1,93 +0,0 @@ -From 04fb597996455d0abbe7b12bbc2d2a5ce16fbb3d Mon Sep 17 00:00:00 2001 -From: Rich Trott -Date: Sun, 14 Feb 2021 15:52:54 -0800 -Subject: [PATCH] test: fix flaky test-worker-prof -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Fixes: https://github.com/nodejs/node/issues/26401 -Co-authored-by: Gireesh Punathil - -PR-URL: https://github.com/nodejs/node/pull/37372 -Reviewed-By: Antoine du Hamel -Reviewed-By: Michaël Zasso -Reviewed-By: James M Snell -Reviewed-By: Luigi Pinca -Reviewed-By: Gireesh Punathil ---- - test/sequential/sequential.status | 4 ---- - test/sequential/test-worker-prof.js | 15 ++++++++------- - 2 files changed, 8 insertions(+), 11 deletions(-) - ---- a/test/sequential/sequential.status -+++ b/test/sequential/sequential.status -@@ -24,8 +24,6 @@ - [$system==win32] - # https://github.com/nodejs/node/issues/22327 - test-http2-large-file: PASS, FLAKY --# https://github.com/nodejs/node/issues/26401 --test-worker-prof: PASS, FLAKY - - [$system==linux] - -@@ -45,10 +43,6 @@ - # https://github.com/nodejs/node/pull/30819 - test-perf-hooks: SKIP - --[$arch==arm] --# https://github.com/nodejs/node/issues/26401#issuecomment-613095719 --test-worker-prof: PASS, FLAKY -- - [$arch==mipsel] - test-inspector-async-hook-setup-at-inspect-brk: SKIP - test-inspector-async-hook-setup-at-signal: SKIP ---- a/test/sequential/test-worker-prof.js -+++ b/test/sequential/test-worker-prof.js -@@ -23,17 +23,17 @@ - const fs = require('fs'); - const { Worker, parentPort } = require('worker_threads'); - parentPort.on('message', (m) => { -- if (counter++ === 10) -+ if (counter++ === 1024) - process.exit(0); -- parentPort.postMessage( -- fs.readFileSync(m.toString()).slice(0, 1024 * 1024)); -+ parentPort.postMessage( -+ fs.readFileSync(m.toString()).slice(0, 1024 * 1024)); - }); - `; - - const { Worker } = require('worker_threads'); - const w = new Worker(pingpong, { eval: true }); - w.on('message', (m) => { -- w.postMessage(process.execPath); -+ w.postMessage(__filename); - }); - - w.on('exit', common.mustCall(() => { -@@ -46,12 +46,13 @@ - } - process.exit(0); - })); -- w.postMessage(process.execPath); -+ w.postMessage(__filename); - } else { - tmpdir.refresh(); -+ const timeout = common.platformTimeout(30_000); - const spawnResult = spawnSync( - process.execPath, ['--prof', __filename, 'child'], -- { cwd: tmpdir.path, encoding: 'utf8', timeout: 30_000 }); -+ { cwd: tmpdir.path, encoding: 'utf8', timeout }); - assert.strictEqual(spawnResult.stderr.toString(), '', - `child exited with an error: \ - ${util.inspect(spawnResult)}`); -@@ -72,7 +73,7 @@ - // Test that at least 15 ticks have been recorded for both parent and child - // threads. When not tracking Worker threads, only 1 or 2 ticks would - // have been recorded. -- // When running locally on x64 Linux, this number is usually at least 200 -+ // When running locally, this number is usually around 200 - // for both threads, so 15 seems like a very safe threshold. - assert(ticks >= 15, `${ticks} >= 15`); - } diff --git a/debian/patches/use_system_node_gyp.patch b/debian/patches/use_system_node_gyp.patch deleted file mode 100644 index 7ffe1925..00000000 --- a/debian/patches/use_system_node_gyp.patch +++ /dev/null @@ -1,23 +0,0 @@ -Description: use system-installed node-gyp for building test modules -Author: Jérémy Lal -Last-Update: 2015-09-09 -Forwarded: not-needed ---- a/Makefile -+++ b/Makefile -@@ -376,14 +376,14 @@ - $(filter-out test/addons/??_*/*.h, $(wildcard test/addons/*/*.h)) - - ADDONS_PREREQS := config.gypi \ -- deps/npm/node_modules/node-gyp/package.json tools/build-addons.js \ -+ tools/build-addons.js \ - deps/uv/include/*.h deps/v8/include/*.h \ - src/node.h src/node_buffer.h src/node_object_wrap.h src/node_version.h - - define run_build_addons - env npm_config_loglevel=$(LOGLEVEL) npm_config_nodedir="$$PWD" \ - npm_config_python="$(PYTHON)" $(NODE) "$$PWD/tools/build-addons" \ -- "$$PWD/deps/npm/node_modules/node-gyp/bin/node-gyp.js" \ -+ "/usr/bin/node-gyp" \ - $1 - touch $2 - endef diff --git a/debian/source/format b/debian/source/format index 163aaf8d..89ae9db8 100644 --- a/debian/source/format +++ b/debian/source/format @@ -1 +1 @@ -3.0 (quilt) +3.0 (native)