diff --git a/Dockerfile b/Dockerfile index 6f1e8a86564..caffab3b52b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,8 +7,12 @@ EXPOSE 8080 # Get prerequisites COPY requirements.txt /tmp/ +COPY patches /tmp/patches +COPY venvpatch /tmp/venvpatch + RUN set -x && \ - build="python3-pip" && libs="" && tools="" && \ + build="python3-pip" && libs="" && tools="patch" && \ + ln -s /usr/bin/python3 /usr/bin/python && \ apt-get -q update && \ apt-get -qy dist-upgrade && \ apt-get install -y $build $libs $tools && \ @@ -37,6 +41,8 @@ RUN set -x && \ --ignore-installed \ -c https://releases.openstack.org/constraints/upper/train \ 'django-redis>=4.10.0' && \ + # Apply custom patches. + /tmp/venvpatch /tmp/patches --apply && \ apt-get -qy remove --purge $build $tools && \ apt-get -qy autoremove --purge && \ apt-get clean && find /var/lib/apt/lists -delete && \ diff --git a/dockrun b/dockrun index 782f1eef02b..e017a6c0b0b 100755 --- a/dockrun +++ b/dockrun @@ -5,7 +5,7 @@ time python3 /app/manage.py collectstatic --noinput -v0 # Must be done when settings are available because it communicates with # the cache. -time python3 /app/manage.py compress --force 2>&1 | tail -n10 >&2 +time python3 /app/manage.py compress # Start as www-data exec /usr/bin/uwsgi /app/uwsgi.ini diff --git a/openstack_dashboard/settings.py b/openstack_dashboard/settings.py index eb02e23ecca..d41f9cd2a8c 100644 --- a/openstack_dashboard/settings.py +++ b/openstack_dashboard/settings.py @@ -393,6 +393,7 @@ # And here are sane defaults we want committed in the OSSOBV version: ALLOWED_HOSTS = ['*'] # we check this in ingress controller anyway +COMPRESS_OFFLINE = True OPENSTACK_KEYSTONE_DEFAULT_ROLE = 'user' # user exists, but has no perms OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = True diff --git a/openstack_dashboard/themes/material/static/horizon/_icons.scss b/openstack_dashboard/themes/material/static/horizon/_icons.scss index 2509ae47838..feb3b88c2cf 100644 --- a/openstack_dashboard/themes/material/static/horizon/_icons.scss +++ b/openstack_dashboard/themes/material/static/horizon/_icons.scss @@ -4,7 +4,7 @@ // a corresponding Material Design Icon. // https://materialdesignicons.com -$mdi-font-path: $static_url + "/horizon/lib/mdi/fonts"; +$mdi-font-path: $static_url + "horizon/lib/mdi/fonts"; @import "/horizon/lib/mdi/scss/materialdesignicons.scss"; .fa { diff --git a/patches/xstatic-mdi--launchpad-1771559.patch b/patches/xstatic-mdi--launchpad-1771559.patch new file mode 100644 index 00000000000..22979d2ad3e --- /dev/null +++ b/patches/xstatic-mdi--launchpad-1771559.patch @@ -0,0 +1,20 @@ +https://bugs.launchpad.net/horizon/+bug/1771559 + +--- a/xstatic/pkg/mdi/data/scss/_functions.scss 2019-10-29 16:27:09.640420707 +0100 ++++ b/xstatic/pkg/mdi/data/scss/_functions.scss 2019-10-29 16:27:24.256440797 +0100 +@@ -1,14 +1,5 @@ + @function char($character-code) { +- @if function-exists("selector-append") { +- @return unquote("\"\\#{$character-code}\""); +- } +- +- @if "\\#{'x'}" == "\\x" { +- @return str-slice("\x", 1, 1) + $character-code; +- } +- @else { +- @return #{"\"\\"}#{$character-code + "\""}; +- } ++ @return unquote("\"\\#{$character-code}\""); + } + + @function mdi($name) { diff --git a/venvpatch b/venvpatch new file mode 100755 index 00000000000..e94db1783ff --- /dev/null +++ b/venvpatch @@ -0,0 +1,151 @@ +#!/bin/sh +# venvpatch (part of ossobv/vcutil) // wdoekes/2014-2015 // Public Domain +# +# Automatically applies one or more patches to the current python environment. +# +# Use this to apply a set of patches to a python virtualenv and optionally the +# system packages. Group the patches you want to apply in a single directory +# and venvpatch will apply all unapplied ones at once. Specify --apply to +# actually do it. +# +# Usage: +# +# venvpatch PATH_WITH_PATCH_FILES [--apply] +# venvpatch SINGLE_PATCH_FILE [--apply] +# +# Common python project deployment workflow goes like this: +# +# - Create a virtual environment: +# $ mkvirtualenv PROJECT +# - Install the requirements: +# $ pip install -r requirements.txt +# - Apply a set of patches to the requirements: +# $ cdsitepackages +# $ patch -p1 < /path/to/project/patches/somepatch.patch +# $ patch -p0 < /path/to/project/patches/anotherpatch.patch +# +# The venvpatch utility will take care of: +# +# - Applying multiple patch files at once. +# - Checking whether a patch is applied already, and ignoring it otherwise. +# - Autodetecting -p0 and -p1. +# - Autodetecting the destination path, be it in the virtualenv site-packages +# or in the system-global-packages. +# +# In the following example, the first patch has been applied already: +# +# # ls ./docs/patches/1.4/ +# issue16211+14029-query-expression-extra-operators-1.4.patch +# pisa3-reportlab-version.patch +# +# # venvpatch ./docs/patches/1.4/ +# source = /srv/django-projects/test/docs/patches/1.4/ +# [X] issue16211+14029-query-expression-extra-operators-1.4.patch => \ +# /srv/virtualenvs/test/lib/python2.7/site-packages +# [ ] pisa3-reportlab-version.patch => /usr/lib/pymodules/python2.7 +# +# # venvpatch ./docs/patches/1.4/ --apply +# source = /srv/django-projects/test/docs/patches/1.4/ +# [X] issue16211+14029-query-expression-extra-operators-1.4.patch => \ +# /srv/virtualenvs/test/lib/python2.7/site-packages +# [N] pisa3-reportlab-version.patch => /usr/lib/pymodules/python2.7 +# patching file sx/pisa3/pisa_util.py +# +# A re-run of venvpatch would now show [X] next to both patches. In case of +# errors, an [E] would be shown. +# +patchpath="$1" +test -z "$patchpath" && + echo "venvpatch: Need SOURCE_PATCH_PATH as first argument" >&2 && + exit 1 +apply="$2" + + +# Init globals. +local_packages=$( + python -c 'import distutils;print(distutils.sysconfig.get_python_lib())' \ + 2>/dev/null) +other_packages=$(python -c 'import sys; print(" ".join(sys.path))') +cwd=$(pwd)/ +patchpath=$(echo "$patchpath" | sed -e 's#^\([^/]\)#'$cwd'\1#') + +# Fetch patch arguments. +patchver=$(patch --version | sed -e '1!d;s/.* //') +if test $(printf '%s\n2.7\n' $patchver | sort -V | head -n1) = 2.7; then + patchargs="--follow-symlinks --forward" +else + patchargs="--forward" +fi + + +# Echo source path so manual intervention is eased. +if test -f "$patchpath"; then + echo "source = $(dirname "$patchpath")" +else + echo "source = $patchpath" +fi + + +# Collect possible patches, and loop over them: +ret=0 +find "$patchpath" -maxdepth 1 -type f -name '*.patch' | sort | +while read patch; do + patch_basename=$(basename "$patch") + + # Get the first file to be patched. + path1=$(grep ^+++ "$patch" | head -n1 | awk '{print $2}') + + # Does it begin with a/ or b/ ? Then we should check the second path + # element instead. + # NOTE: $dir may turn out to be a plain file. + if echo "$path1" | grep -q '^[ab]/'; then + dir=$(echo "$path1" | sed -e 's#^[ab]/\([^/]*\)/.*#\1#') + level=1 + else + dir=$(echo "$path1" | sed -e 's#^\([^/]*\)/.*#\1#') + level=0 + fi + + # Where do we patch? In VIRTUAL_ENV or in global? + dest= + for path in $local_packages $other_packages; do + if test -d "$path/$dir" || test -r "$path/$dir"; then + dest="$path" + break + fi + done + if test -z "$dest"; then + cat >&2 <&1) + if test $? -eq 0; then + if test "$apply" = "--apply"; then + echo " [N] $patch_basename => $dest" + patch -p$level -i$patch $patchargs || exit 1 + else + echo " [ ] $patch_basename => $dest" + fi + elif echo "$output" | grep -q ^Reversed; then + echo " [X] $patch_basename => $dest" + else + echo " [E] $patch_basename => $dest" + echo " Output: " + echo "$output" | sed -e 's/^/ /' + echo " Permission issue? Try:" + echo " sudo env PATH=\$PATH $0 $patch" + ret=1 + fi + + test $ret = 0 # set status code +done + +# vim: set ts=8 sw=4 sts=4 et ai tw=79: