<html>
    <head>
      <base href="https://bugs.webkit.org/">
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - HTTPS Upgrade: Scripts / preprocessing necessary to create new database in future"
   href="https://bugs.webkit.org/show_bug.cgi?id=192612#c3">Comment # 3</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - HTTPS Upgrade: Scripts / preprocessing necessary to create new database in future"
   href="https://bugs.webkit.org/show_bug.cgi?id=192612">bug 192612</a>
              from <span class="vcard"><a class="email" href="mailto:v_seth@apple.com" title="Vivek Seth <v_seth@apple.com>"> <span class="fn">Vivek Seth</span></a>
</span></b>
        <pre>This is the script used in my new build stage: 

```
# This script requires that HTTPSUpgradeList.txt has the following format:
#   1. It must be a plain text file with domains delimited by new lines ("\n").
#   2. The file must not contain duplicate domains.
#   3. All domains must be lowercase.
#   4. All domains must be IDNA encoded.

set -e

# Do not create database if feature flag is disabled. 
if [[ -z "${ENABLE_HTTPS_UPGRADE}" ]]; then
    exit 0
fi

WK_ADDITIONS_PATH="usr/local/include/WebKitAdditions"

INPUT_FILE_PATH="${BUILT_PRODUCTS_DIR}/${WK_ADDITIONS_PATH}/HTTPSUpgradeList.txt"
OUTPUT_FILE_PATH="${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/HTTPSUpgradeList.db"

DB_VERSION="1";
DB_SCHEMA="CREATE TABLE hosts (host TEXT PRIMARY KEY);"

# Return early if we don't have HTTPSUpgradeList.txt
if [[ ! -f "${INPUT_FILE_PATH}" ]]; then
    exit 0
fi

# Only create database for macOS and iOS.
if [[ "${WK_PLATFORM_NAME}" != "macosx" && "${WK_PLATFORM_NAME}" != "iphoneos" ]]; then
    exit 0
fi

# Delete database if it exists.
if [[ -f "${OUTPUT_FILE_PATH}" ]]; then   
    rm "${OUTPUT_FILE_PATH}"
fi

# Create database.
sqlite3 "${OUTPUT_FILE_PATH}" "PRAGMA user_version=${DB_VERSION}" "${DB_SCHEMA}" ".import ${INPUT_FILE_PATH} hosts" ".exit"
```</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>