[aur-dev] [PATCH v2] UPGRADING: Add note on backward compatible package URLs

Dave Reisner d at falconindy.com
Wed Aug 10 15:29:59 EDT 2011


On Wed, Aug 10, 2011 at 04:27:57PM +0200, Lukas Fleischer wrote:
> Signed-off-by: Lukas Fleischer <archlinux at cryptocrack.de>
> ---
> Forgot to consider package names with length 1 here. We could probably
> also merge both RewriteRules. The resulting rule might be quite
> confusing, though.
> 
>  UPGRADING |   12 ++++++++++++
>  1 files changed, 12 insertions(+), 0 deletions(-)
> 
> diff --git a/UPGRADING b/UPGRADING
> index 331870e..fd10707 100644
> --- a/UPGRADING
> +++ b/UPGRADING
> @@ -22,6 +22,18 @@ ALTER TABLE PackageDepends ADD INDEX (DepName);
>  6. Run the upload directory transform script ("scripts/uploadbuckets.sh") and
>  rotate the converted directory structure into place.
>  
> +7. If you want to provide backward compatible package URLs, enable mod_rewrite
> +and add the following to your Apache configuration (inside the "VirtualHost"
> +container or optionally create a ".htaccess" file in the upload directory):
> +
> +----
> +RewriteEngine on
> +RewriteRule /packages/([^/])(/[^/]*)?$ /packages/$1/$1$2
> +RewriteRule /packages/([^/]{2})([^/]*(/[^/]*)?)$ /packages/$1/$1$2

This can be written as a single rule, courtesy of DJ Mills:

RewriteRule ^/packages/([^/]{1,2})(/\1)? /packages/$1/$1

And there's a test script for this: http://paste.xinu.at/9D1/

Disclaimer: I don't know for sure that backrefs are valid in the search
pattern.

d

> +----
> +
> +If you use a non-standard URL_DIR, slight modifications might be necessary.
> +
>  From 1.8.1 to 1.8.2
>  -------------------
>  
> -- 
> 1.7.6
> 


More information about the aur-dev mailing list