From ce7d4b37484ad1cc5fae1ba034b68cbbf1c7cfdc Mon Sep 17 00:00:00 2001 From: Joshua Hesketh Date: Wed, 11 May 2016 20:29:02 +1000 Subject: [PATCH] Further fixes for bandersnatch There are a couple of edge cases with the recent PEP503 workaround where packages with both .'s and -'s in the name are unable to be translated to their old 'safe names'. Add specific workarounds for known packages. Change-Id: I72bbdd4af7200f8565d7c6b7fa6d3f268c783b24 --- modules/openstack_project/templates/mirror.vhost.erb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/openstack_project/templates/mirror.vhost.erb b/modules/openstack_project/templates/mirror.vhost.erb index b46f8cb83b..9cbed20d33 100644 --- a/modules/openstack_project/templates/mirror.vhost.erb +++ b/modules/openstack_project/templates/mirror.vhost.erb @@ -53,10 +53,20 @@ NameVirtualHost <%= @vhost_name %>:<%= @port %> # TODO(jhesketh): Remove this after bandersnatch implements pep503 # https://bitbucket.org/pypa/bandersnatch/pull-requests/20/fully-implement-pep-503-normalization/diff + + # Special cases for openstack.nose_plugin & backports.* + RewriteRule ^(.*)/openstack-nose-plugin(.*)$ $1/openstack.nose_plugin$2 + RewriteRule ^(.*)/backports-(.*)$ $1/backports.$2 + + RewriteCond %{REQUEST_URI} ^/pypi/simple/([^/])([^/]*) + RewriteCond %{DOCUMENT_ROOT}/pypi/simple/$1/$1$2 -d + RewriteRule ^/pypi/simple/([^/])([^/]*)(/.*)?$ /pypi/simple/$1/$1$2$3 [L] + # Try again but replacing -'s with .'s RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI} !-f RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI} !-d - RewriteRule (.*)-(.*) $1.$2 + RewriteRule (.*)-(.*) $1.$2 [N] + RewriteCond %{REQUEST_URI} ^/pypi/simple/([^/])([^/]*) RewriteCond %{DOCUMENT_ROOT}/pypi/simple/$1/$1$2 -d RewriteRule ^/pypi/simple/([^/])([^/]*)(/.*)?$ /pypi/simple/$1/$1$2$3 [L]