[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] reproducible: apache: use the correct variable to match possible existing files on disk

Mattia Rizzolo (@mattia) gitlab at salsa.debian.org
Tue Aug 17 12:50:40 BST 2021



Mattia Rizzolo pushed to branch master at Debian QA / jenkins.debian.net


Commits:
29c25838 by Mattia Rizzolo at 2021-08-17T13:50:25+02:00
reproducible: apache: use the correct variable to match possible existing files on disk

REQUEST_FILENAME may or may not be a full pathname, depending on when
it's expanded.

>From the docs:
    REQUEST_FILENAME
    The full local filesystem path to the file or script matching the
    request, if this has already been determined by the server at the
    time REQUEST_FILENAME is referenced. Otherwise, such as when used in
    virtual host context, the same value as REQUEST_URI

Since we are using virtual hosts (like, uh, everybody since apache 2.2?!)
REQUEST_FILENAME is not much of use.

Signed-off-by: Mattia Rizzolo <mattia at debian.org>

- - - - -


1 changed file:

- hosts/jenkins/etc/apache2/reproduciblemap.conf


Changes:

=====================================
hosts/jenkins/etc/apache2/reproduciblemap.conf
=====================================
@@ -5,8 +5,8 @@ RewriteCond %{REQUEST_URI} ^/$
 RewriteRule ^/(.*) https://reproducible-builds.org/citests/ [R,L]
 
 # drop the (old|ugly) /userContent/ directory from the url
-RewriteCond %{REQUEST_FILENAME} !-f
-RewriteCond %{REQUEST_FILENAME} !-d
+RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
+RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
 RewriteCond %{REQUEST_URI} ^/userContent
 RewriteRule ^/userContent/(.*)$ /$1 [R=301,L]
 
@@ -16,20 +16,20 @@ RewriteCond %{REQUEST_URI} ^/(static|stretch|testing|unstable|experimental|histo
 RewriteRule ^/(.*) /debian/$1 [R=302,L]
 
 # redirect t.r-b.o/issues/$ISSUE → t.r-b.o/issues/unstable/$ISSUE
-RewriteCond %{REQUEST_FILENAME} !-f
-RewriteCond %{REQUEST_FILENAME} !-d
+RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
+RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
 RewriteCond /var/lib/jenkins/userContent/reproducible/debian/issues/unstable/$2 -f
 RewriteRule ^/(debian/|)issues/([a-z0-9.+-_]+) /debian/issues/unstable/$2 [R=302,L]
 
 # redirect t.r-b.o/$PKG → t.r-b.o/rb-pkg/unstable/amd64/$PKG.html
-RewriteCond %{REQUEST_FILENAME} !-f
-RewriteCond %{REQUEST_FILENAME} !-d
+RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
+RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
 RewriteCond /var/lib/jenkins/userContent/reproducible/debian/rb-pkg/unstable/amd64/$2.html -f
 RewriteRule ^/(debian/)([a-z0-9.+-]+) /debian/rb-pkg/unstable/amd64/$2.html [R=302,L]
 
 # redirect t.r-b.o/redirect/?SrcPkg=$PKG → t.r-b.o/rb-pkg/unstable/amd64/$PKG.html
-RewriteCond %{REQUEST_FILENAME} !-f
-RewriteCond %{REQUEST_FILENAME} !-d
+RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
+RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
 RewriteCond %{QUERY_STRING} ^(\w+)=([a-z0-9.+-]+)$
 RewriteCond /var/lib/jenkins/userContent/reproducible/debian/rb-pkg/unstable/amd64/%2.html -f
 RewriteRule ^/redirect /debian/rb-pkg/unstable/amd64/%2.html? [R=302,L]
@@ -37,48 +37,48 @@ RewriteRule ^/redirect /debian/rb-pkg/unstable/amd64/%2.html? [R=302,L]
 # the following two rules are fallbacks for the previous two redirects and should only catch packages which are only in experimental
 
 # redirect t.r-b.o/$PKG → t.r-b.o/rb-pkg/experimental/amd64/$PKG.html
-RewriteCond %{REQUEST_FILENAME} !-f
-RewriteCond %{REQUEST_FILENAME} !-d
+RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
+RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
 RewriteCond /var/lib/jenkins/userContent/reproducible/debian/rb-pkg/experimental/amd64/$2.html -f
 RewriteRule ^/(debian/|)([a-z0-9.+-]+) /debian/rb-pkg/experimental/amd64/$2.html [R=302,L]
 
 # redirect t.r-b.o/redirect/?SrcPkg=$PKG → t.r-b.o/rb-pkg/experimental/amd64/$PKG.html
-RewriteCond %{REQUEST_FILENAME} !-f
-RewriteCond %{REQUEST_FILENAME} !-d
+RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
+RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
 RewriteCond %{QUERY_STRING} ^(\w+)=([a-z0-9.+-]+)$
 RewriteCond /var/lib/jenkins/userContent/reproducible/debian/rb-pkg/experimental/amd64/%2.html -f
 RewriteRule ^/redirect /debian/rb-pkg/experimental/amd64/%2.html? [R=302,L]
 
 # redirect t.r-b.o/$suite/(amd64|arm64|armhf|i386)/$PKG → t.r-b.o/rb-pkg/$suite/$arch/$PKG.html
-RewriteCond %{REQUEST_FILENAME} !-f
-RewriteCond %{REQUEST_FILENAME} !-d
+RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
+RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
 RewriteCond /var/lib/jenkins/userContent/reproducible/debian/rb-pkg/$2/$3/$4.html -f
 RewriteRule ^/(debian/|)(stretch|testing|unstable|experimental)/([a-z0-9]+)/([a-z0-9.+-]+) /debian/rb-pkg/$2/$3/$4.html [R=302,L]
 
 # redirect t.r-b.o/rb-pkg/$PKG.html → t.r-b.o/rb-pkg/unstable/amd64/$PKG.html
-RewriteCond %{REQUEST_FILENAME} !-f
-RewriteCond %{REQUEST_FILENAME} !-d
+RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
+RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
 RewriteCond /var/lib/jenkins/userContent/reproducible/debian/rb-pkg/unstable/amd64/$2 -f
 RewriteRule ^/(debian/|)rb-pkg/([a-z0-9.+-]+) /debian/rb-pkg/unstable/amd64/$2 [R,L]
 
 # the same for /dbd/
-RewriteCond %{REQUEST_FILENAME} !-f
-RewriteCond %{REQUEST_FILENAME} !-d
+RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
+RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
 RewriteCond /var/lib/jenkins/userContent/reproducible/debian/dbd/unstable/amd64/$2 -f
 RewriteRule ^/(debian/|)dbd/([a-z0-9.+-_]+) /debian/dbd/unstable/amd64/$2 [R,L]
 # the same for /rbuild/
-RewriteCond %{REQUEST_FILENAME} !-f
-RewriteCond %{REQUEST_FILENAME} !-d
+RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
+RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
 RewriteCond /var/lib/jenkins/userContent/reproducible/debian/rbuild/unstable/amd64/$2 -f
 RewriteRule ^/(debian/|)rbuild/([a-z0-9.+-_]+) /debian/rbuild/unstable/amd64/$2 [R,L]
 # the same for /buildinfo/
-RewriteCond %{REQUEST_FILENAME} !-f
-RewriteCond %{REQUEST_FILENAME} !-d
+RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
+RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
 RewriteCond /var/lib/jenkins/userContent/reproducible/debian/buildinfo/unstable/amd64/$2 -f
 RewriteRule ^/(debian/|)buildinfo/([a-z0-9.+-_]+) /debian/buildinfo/unstable/amd64/$2 [R,L]
 # redirect some t.r-b.o/index_*.html to the suite/arch relative one
-RewriteCond %{REQUEST_FILENAME} !-f
-RewriteCond %{REQUEST_FILENAME} !-d
+RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
+RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
 RewriteCond %{REQUEST_URI} ^/(debian/|)index_reproducible.html$ [or]
 RewriteCond %{REQUEST_URI} ^/(debian/|)index_FTBR.html$ [or]
 RewriteCond %{REQUEST_URI} ^/(debian/|)index_FTBFS.html$ [or]



View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/29c258389404a9e435ff8d8212e0cf855bd935a3

-- 
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/29c258389404a9e435ff8d8212e0cf855bd935a3
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/qa-jenkins-scm/attachments/20210817/fe366168/attachment-0001.htm>


More information about the Qa-jenkins-scm mailing list