From: Otto Moerbeek Date: Wed, 2 Jul 2025 08:25:36 +0000 (+0200) Subject: Don't save the .dat file, only the generated pubsuffix.cc X-Git-Tag: rec-5.3.0-alpha2~11^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ed580a4859e1dd39bcc4911b0fef14e4f43c8dce;p=thirdparty%2Fpdns.git Don't save the .dat file, only the generated pubsuffix.cc Signed-off-by: Otto Moerbeek --- diff --git a/pdns/recursordist/meson.build b/pdns/recursordist/meson.build index 1b79818b37..9f37468907 100644 --- a/pdns/recursordist/meson.build +++ b/pdns/recursordist/meson.build @@ -353,22 +353,20 @@ librec_signers_openssl = declare_dependency( ) ) -# If we have pubsuffix.cc in the source tree, use it. Otherwise download and build it. -pubsuffix_dl_source = 'effective_tld_names.dat' -pubsuffix_cc = src_dir / 'pubsuffix.cc' -if not fs.is_file(pubsuffix_cc) - curl_command = find_program('curl', required: true) - pubsuffix_dl_source = custom_target( - 'pubsuffix-dl', - command: [curl_command, '-s', '-S', '-o', '@OUTPUT@', 'https://publicsuffix.org/list/public_suffix_list.dat'], - output: pubsuffix_dl_source +# If we have pubsuffix.cc in the source tree, use it. Otherwise download data and build it in the build dir. +if fs.is_file(src_dir / 'pubsuffix.cc') + cp_command = find_program('cp') + pubsuffix_cc = custom_target( + 'cp-pubsuffix', + command: [cp_command, '-p', '@INPUT@', '@OUTPUT@'], + input: src_dir / 'pubsuffix.cc', + output: 'pubsuffix.cc', ) - +else mkpubsuffix_command = find_program('mkpubsuffixcc', required: true) pubsuffix_cc = custom_target( 'pubsuffix-cc', - command: [mkpubsuffix_command, '@INPUT@', '@OUTPUT@'], - input: pubsuffix_dl_source, + command: [mkpubsuffix_command, '@OUTPUT@'], output: 'pubsuffix.cc', ) endif diff --git a/pdns/recursordist/mkpubsuffixcc b/pdns/recursordist/mkpubsuffixcc index 54e3e819ea..b976b51a8b 100755 --- a/pdns/recursordist/mkpubsuffixcc +++ b/pdns/recursordist/mkpubsuffixcc @@ -1,12 +1,15 @@ #!/bin/sh -if [ -z "$1" ] || [ -z "$2" ]; then - echo "Usage: $0 effective_tld_names.dat pubsuffix.cc" +if [ -z "$1" ]; then + echo "Usage: $0 pubsuffix.cc" exit 1 fi set -e -(echo "const char* g_pubsuffix[]={"; - for a in $(grep -v "//" "$1" | grep \\. | egrep "^[.0-9a-z-]*$") - do +temp=$(mktemp pubsuffixXXXXXX) +curl -s -S https://publicsuffix.org/list/public_suffix_list.dat > $temp +(echo "const char* g_pubsuffix[]={"; + for a in $(grep -v "//" "$temp" | grep \\. | egrep "^[.0-9a-z-]*$") + do echo \"$a\", - done -echo "0};") > "$2" + done +echo "0};") > "$1" +rm -f "$temp"