Debian Codegraph @

util/update_public_suffix_list.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 # Copyright (C) 2023 The Qt Company Ltd.
3 # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
4
5 PICK_TO_BRANCHES="6.9 6.8 6.5 6.2 5.15"
6 UPSTREAM=https://publicsuffix.org/list/public_suffix_list.dat
7
8 THIS="util/update_public_suffix_list.sh"
9 PUBLIC_SUFFIX_LIST_DAT_DIR="$(mktempscip-shell system . . mktemp. -d)"
10 MAKE_DAFSA=src/3rdparty/libpsl/src/psl-make-dafsa
11 PSL_DATA_CPP=src/3rdparty/libpsl/psl_data.cpp
12 PUBLIC_SUFFIX_LIST_DAFSA=tests/auto/network/access/qnetworkcookiejar/testdata/publicsuffix/public_suffix_list.dafsa
13 ATTRIBUTION_JSON=src/3rdparty/libpsl/qt_attribution.json
14
15 function msgscip-shell shell qt6-base 6.10.2+dfsg-15 msg().() {
16 echoscip-shell system . . echo. "$@" 1>&2
17 }
18
19 function diescip-shell shell qt6-base 6.10.2+dfsg-15 die().() {
20 msgscip-shell shell qt6-base 6.10.2+dfsg-15 msg(). "$@"
21 exit 1
22 }
23
24 function check_or_diescip-shell shell qt6-base 6.10.2+dfsg-15 check_or_die().() {
25 TYPE=$1
26 OP=$2
27 FILE="$3"
28 testscip-shell system . . test. $OP "$FILE" || diescip-shell shell qt6-base 6.10.2+dfsg-15 die(). "$TYPE \"$FILE\" not found (test $OP \"$FILE\" failed). Please run $THIS from \$SRCDIR/qtbase."
29 }
30
31 function run_or_diescip-shell shell qt6-base 6.10.2+dfsg-15 run_or_die().() {
32 msgscip-shell shell qt6-base 6.10.2+dfsg-15 msg(). -n "Running \"$@\"..."
33 "$@" || diescip-shell shell qt6-base 6.10.2+dfsg-15 die(). "Failed"
34 msgscip-shell shell qt6-base 6.10.2+dfsg-15 msg(). "Done"
35 }
36
37 DAT_FILE="$PUBLIC_SUFFIX_LIST_DAT_DIR/public_suffix_list.dat"
38
39 check_or_diescip-shell shell qt6-base 6.10.2+dfsg-15 check_or_die(). tool -x "$MAKE_DAFSA"
40 check_or_diescip-shell shell qt6-base 6.10.2+dfsg-15 check_or_die(). directory -d "$PUBLIC_SUFFIX_LIST_DAT_DIR"
41 run_or_diescip-shell shell qt6-base 6.10.2+dfsg-15 run_or_die(). wget $UPSTREAM -O "$DAT_FILE"
42
43 check_or_diescip-shell shell qt6-base 6.10.2+dfsg-15 check_or_die(). input -r "$DAT_FILE"
44 check_or_diescip-shell shell qt6-base 6.10.2+dfsg-15 check_or_die(). output -w "$PSL_DATA_CPP"
45 check_or_diescip-shell shell qt6-base 6.10.2+dfsg-15 check_or_die(). binary-output -w "$PUBLIC_SUFFIX_LIST_DAFSA"
46
47 VERSION=$(run_or_diescip-shell shell qt6-base 6.10.2+dfsg-15 run_or_die(). sed -nE 's,^// VERSION: (.*)$,\1,p' "$DAT_FILE")
48 if [[ -z "$VERSION" ]]; then
49 diescip-shell shell qt6-base 6.10.2+dfsg-15 die(). "Something is wrong! Recheck the VERSION line in $DAT_FILE and update the script."
50 fi
51 GITSHA=$(run_or_diescip-shell shell qt6-base 6.10.2+dfsg-15 run_or_die(). sed -nE 's,^// COMMIT: (.*)$,\1,p' "$DAT_FILE")
52 msgscip-shell shell qt6-base 6.10.2+dfsg-15 msg(). "Using $DAT_FILE @ ${VERSION} (commit ${GITSHA})"
53
54 run_or_diescip-shell shell qt6-base 6.10.2+dfsg-15 run_or_die(). "$MAKE_DAFSA" "$DAT_FILE" "$PSL_DATA_CPP"
55 run_or_diescip-shell shell qt6-base 6.10.2+dfsg-15 run_or_die(). "$MAKE_DAFSA" --output-format=binary "$DAT_FILE" "$PUBLIC_SUFFIX_LIST_DAFSA"
56 rmscip-shell system . . rm. "$DAT_FILE"
57
58 # update the first Version line in qt_attribution.json with the new SHA1 and date:
59 run_or_diescip-shell shell qt6-base 6.10.2+dfsg-15 run_or_die(). sed -i -E -e "1,/\"Version\":/{ /\"Version\":/ { s/(Version\": )\".*?\"/\\1\"${VERSION}\"/ } }" "$ATTRIBUTION_JSON"
60
61 # update the first "PURL" line with the new SHA1:
62 run_or_diescip-shell shell qt6-base 6.10.2+dfsg-15 run_or_die(). sed -i -E -e "1,/\"PURL\":/{ /\"PURL\":/ { s/@.*?\\?/@${GITSHA}\\?/ } }" "$ATTRIBUTION_JSON"
63
64
65 run_or_diescip-shell shell qt6-base 6.10.2+dfsg-15 run_or_die(). git add "$PSL_DATA_CPP"
66 run_or_diescip-shell shell qt6-base 6.10.2+dfsg-15 run_or_die(). git add "$PUBLIC_SUFFIX_LIST_DAFSA"
67 run_or_diescip-shell shell qt6-base 6.10.2+dfsg-15 run_or_die(). git add "$ATTRIBUTION_JSON"
68
69 run_or_diescip-shell shell qt6-base 6.10.2+dfsg-15 run_or_die(). git commit -m "Update public suffix list
70
71 Version ${VERSION}.
72
73 [ChangeLog][Third-Party Code] Updated the public suffix list to upstream
74 version ${VERSION}.
75
76 Pick-to: $PICK_TO_BRANCHES
77 " --edit
78
79 msgscip-shell shell qt6-base 6.10.2+dfsg-15 msg(). "Please use topic=publicsuffix-list-${VERSION} when pushing."