]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Don't save the .dat file, only the generated pubsuffix.cc
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 2 Jul 2025 08:25:36 +0000 (10:25 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 2 Jul 2025 08:25:36 +0000 (10:25 +0200)
Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
pdns/recursordist/meson.build
pdns/recursordist/mkpubsuffixcc

index 1b79818b3722f17bbe0fc2cec8238fa73fb066bd..9f374689072a441d48068b18ae76a495959b5c0c 100644 (file)
@@ -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
index 54e3e819eafa277e53cc2700fa451eeba7634164..b976b51a8bb6c08f31b3aed4b456c963ff7d91e0 100755 (executable)
@@ -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"