[Webkit-unassigned] [Bug 192612] HTTPS Upgrade: Scripts / preprocessing necessary to create new database in future

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Dec 11 21:50:19 PST 2018


https://bugs.webkit.org/show_bug.cgi?id=192612

--- Comment #4 from Vivek Seth <v_seth at apple.com> ---
Comment on attachment 357101
  --> https://bugs.webkit.org/attachment.cgi?id=357101
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=357101&action=review

> Source/WebKit/WebKit.xcodeproj/project.pbxproj:10447
> +			shellScript = "# This script requires that HTTPSUpgradeList.txt has the following format:\n#   1. It must be a plain text file with domains delimited by new lines (\"\\n\").\n#   2. The file must not contain duplicate domains.\n#   3. All domains must be lowercase.\n#   4. All domains must be IDNA encoded.\n\nset -e\n\n# Do not create database if feature flag is disabled. \nif [[ -z \"${ENABLE_HTTPS_UPGRADE}\" ]]; then\n    exit 0\nfi\n\nWK_ADDITIONS_PATH=\"usr/local/include/WebKitAdditions\"\n\nINPUT_FILE_PATH=\"${BUILT_PRODUCTS_DIR}/${WK_ADDITIONS_PATH}/HTTPSUpgradeList.txt\"\nOUTPUT_FILE_PATH=\"${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/HTTPSUpgradeList.db\"\n\nDB_VERSION=\"1\";\nDB_SCHEMA=\"CREATE TABLE hosts (host TEXT PRIMARY KEY);\"\n\n# Return early if we don't have HTTPSUpgradeList.txt\nif [[ ! -f \"${INPUT_FILE_PATH}\" ]]; then\n    exit 0\nfi\n\n# Only create database for macOS and iOS.\nif [[ \"${WK_PLATFORM_NAME}\" != \"macosx\" && \"${WK_PLATFORM_NAME}\" != \"iphoneos\" ]]; then\n    exit 0\nfi\n\n# Delete database if it exists.\nif [[ -f \"${OUTPUT_FILE_PATH}\" ]]; then   \n    rm \"${OUTPUT_FILE_PATH}\"\nfi\n\n# Create database.\nsqlite3 \"${OUTPUT_FILE_PATH}\" \"PRAGMA user_version=${DB_VERSION}\" \"${DB_SCHEMA}\" \".import ${INPUT_FILE_PATH} hosts\" \".exit\"\n";

This is the script: 

```
# 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"
```

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20181212/27164e56/attachment.html>


More information about the webkit-unassigned mailing list