From f4a397fcf6abdb93d49b6fd1f2d2d093104a1257 Mon Sep 17 00:00:00 2001 From: Jon Seager Date: Thu, 1 Aug 2024 21:16:48 +0100 Subject: [PATCH] revert: build: enable the `build:dns-fallback` step from `npm run generate` --- snap/patches/dns-fallback-use-resolve.patch | 83 --------------------- snap/snapcraft.yaml | 7 -- 2 files changed, 90 deletions(-) delete mode 100644 snap/patches/dns-fallback-use-resolve.patch diff --git a/snap/patches/dns-fallback-use-resolve.patch b/snap/patches/dns-fallback-use-resolve.patch deleted file mode 100644 index 8a9c83549..000000000 --- a/snap/patches/dns-fallback-use-resolve.patch +++ /dev/null @@ -1,83 +0,0 @@ -diff --git a/ts/scripts/generate-dns-fallback.ts b/ts/scripts/generate-dns-fallback.ts -index 39f442f4b..f204fe784 100644 ---- a/ts/scripts/generate-dns-fallback.ts -+++ b/ts/scripts/generate-dns-fallback.ts -@@ -1,15 +1,15 @@ - // Copyright 2024 Signal Messenger, LLC - // SPDX-License-Identifier: AGPL-3.0-only - --import { join } from 'path'; --import { lookup as lookupCb } from 'dns'; -+import { resolve4 as resolve4Cb, resolve6 as resolve6Cb } from 'dns'; - import { writeFile } from 'fs/promises'; -+import { join } from 'path'; - import { promisify } from 'util'; --import type { ResolvedEndpoint } from 'electron'; - - import { isNotNil } from '../util/isNotNil'; - --const lookup = promisify(lookupCb); -+const resolve4 = promisify(resolve4Cb); -+const resolve6 = promisify(resolve6Cb); - - const FALLBACK_DOMAINS = [ - 'chat.signal.org', -@@ -25,35 +25,31 @@ const FALLBACK_DOMAINS = [ - async function main() { - const config = await Promise.all( - FALLBACK_DOMAINS.sort().map(async domain => { -- const addresses = await lookup(domain, { all: true }); - -- const endpoints = addresses -- .map(({ address, family }): ResolvedEndpoint | null => { -- if (family === 4) { -- return { family: 'ipv4', address }; -- } -- if (family === 6) { -- return { family: 'ipv6', address }; -- } -- return null; -- }) -- .filter(isNotNil) -- .sort((a, b) => { -- if (a.family < b.family) { -- return -1; -- } -- if (a.family > b.family) { -- return 1; -- } -+ const ipv4endpoints = (await resolve4(domain)) -+ .map(a => ({"family": "ipv4", "address": a})) -+ -+ const ipv6endpoints = (await resolve6(domain)) -+ .map(a => ({"family": "ipv6", "address": a})) -+ -+ const endpoints = [...ipv4endpoints, ...ipv6endpoints] -+ .filter(isNotNil) -+ .sort((a, b) => { -+ if (a.family < b.family) { -+ return -1; -+ } -+ if (a.family > b.family) { -+ return 1; -+ } - -- if (a.address < b.address) { -- return -1; -- } -- if (a.address > b.address) { -- return 1; -- } -- return 0; -- }); -+ if (a.address < b.address) { -+ return -1; -+ } -+ if (a.address > b.address) { -+ return 1; -+ } -+ return 0; -+ }) - - return { domain, endpoints }; - }) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index f8876805a..e7e174bee 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -131,12 +131,6 @@ parts: git lfs install - # When running `npm run build:dns-fallback`, the code tries to use `dns.lookup` from - # the NodeJS standard library, which makes a `getaddrinfo` syscall to try and resolve - # domain names, which seems to fail on Launchpad builders. This patch replaces the - # logic to use `dns.resolve4` and `dns.resolve6` instead. - git apply $CRAFT_PROJECT_DIR/snap/patches/dns-fallback-use-resolve.patch - # Update the package.json so the build uses the patched libraries cat package.json \ | jq -r --arg f "file:${PWD}/../../better-sqlite3/build" '.dependencies."@signalapp/better-sqlite3"=$f' \ @@ -158,7 +152,6 @@ parts: npm run build-protobuf npm run build:esbuild npm run build:icu-types - npm run build:dns-fallback npm run build:compact-locales npm run sass npm run get-expire-time