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

Dave Reisner d at falconindy.com
Wed Aug 10 17:02:40 EDT 2011


On Wed, Aug 10, 2011 at 10:53:31PM +0200, Lukas Fleischer wrote:
> On Wed, Aug 10, 2011 at 04:29:28PM -0400, Dave Reisner wrote:
> > On Wed, Aug 10, 2011 at 10:12:44PM +0200, Lukas Fleischer wrote:
> > > On Wed, Aug 10, 2011 at 03:29:59PM -0400, Dave Reisner wrote:
> > > > 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
> > > 
> > > mod_rewrite doesn't work like sed(1). It always replaces the whole URL,
> > > not just the part matched by the search pattern. Anyway, good idea to
> > > take advantage of greediness. How about this one:
> > 
> > Yeah, I was afraid of that. I'm familiar enough with apache's
> > mod_rewrite, but I don't have a lighty setup to test on.
> 
> Mh. Now that you mention it - we should probably add some lighty
> instructions here as well (primarily since we're running a lighttpd
> setup on sigurd).
> 
> > 
> > > 
> > >   RewriteRule ^/packages/([^/]{1,2})([^/]*(/[^/]*)?)$ /packages/$1/$1$2
> > > 
> > > Well, this will kinda fail when requesting "/packages/fo/foo" as it will
> > > try to rewrite that. Given that this rewrite rule is used to provide
> > > backward compatibility for broken AUR helpers only, I would say that
> > > this is ok, though.
> > 
> > Rewriting /packages/fo/foo is bad, always. The anti-backwards compat
> > view would be that not rewriting /packages/fo would be "good". If
> > there's a solution that handles both, I say we go for it. Seems this
> > might be a little difficult though...
> 
> Not sure if I understood you correctly, but my "rewrite PKGBUILD/source
> package" URLs only approach below already does that. It does indeed
> rewrite everything except for requests trying to "fetch" any of the
> directories containing the source tarball and the PKGBUILD (given that
> such a directory doesn't contain anything else).

Then _I_ misunderstood. Carry on.

> > 
> > > Maybe we should even ignore everything but PKGBUILDs and source
> > > packages:
> > > 
> > >   RewriteRule ^/packages/([^/]{1,2})([^/]*/(PKGBUILD|.*\.tar\.gz))$ /packages/$1/$1$2
> > > 
> > > Opinions?
> > 
> > -1 from me. Not extensible, but I'll make reference again to
> > aforementioned difficulty in a 'one size fits all' solution.
> 
> Any reasons?

Just because maybe in the future we'd have some other file in the
package directory that we'd want to make accessible. Do we plan to
expire the old URLs at some point (i.e. remove the redirect)?

dave



More information about the aur-dev mailing list