From f2015d75e15660bcfb716fe19219a4878f0377a9 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Thu, 3 Aug 2017 15:49:56 +0200 Subject: [PATCH] Adjust all the redirects for the disappearance of cgit Signed-off-by: Pierre-Yves Chibon --- roles/distgit/files/cgit.conf | 11 +- roles/distgit/files/git-smart-http.conf | 2 - roles/distgit/files/redirect.conf | 154 ------------------------ roles/distgit/tasks/main.yml | 4 +- 4 files changed, 5 insertions(+), 166 deletions(-) delete mode 100644 roles/distgit/files/redirect.conf diff --git a/roles/distgit/files/cgit.conf b/roles/distgit/files/cgit.conf index 09b08cc185..9d31cda70f 100644 --- a/roles/distgit/files/cgit.conf +++ b/roles/distgit/files/cgit.conf @@ -1,8 +1,3 @@ -# Redirect requests to un-namespaced repos to their new namespaced home -RedirectMatch 302 "^/cgit/((?!(rpms|container|modules|test)).*)" "/cgit/rpms/$1" - -Alias /cgit-data /usr/share/cgit -ScriptAlias /cgit /var/www/cgi-bin/cgit - - Require all granted - +RedirectMatch permanent "/cgit/rpms/$" "/" +Redirect /cgit/rpms/ /rpms/ +Redirect permanent /cgit/ / diff --git a/roles/distgit/files/git-smart-http.conf b/roles/distgit/files/git-smart-http.conf index ea8845a593..96ddf1075f 100644 --- a/roles/distgit/files/git-smart-http.conf +++ b/roles/distgit/files/git-smart-http.conf @@ -1,8 +1,6 @@ SetEnv GIT_PROJECT_ROOT /srv/git/repositories SetEnv GIT_HTTP_EXPORT_ALL ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/ -Alias /rpms /srv/git/repositories/rpms/ -Alias /git /srv/git Options ExecCGI Indexes diff --git a/roles/distgit/files/redirect.conf b/roles/distgit/files/redirect.conf deleted file mode 100644 index d4116a06fd..0000000000 --- a/roles/distgit/files/redirect.conf +++ /dev/null @@ -1,154 +0,0 @@ -RedirectMatch permanent ^/$ https://src.fedoraproject.org/cgit/ - -RewriteEngine on - -# Use cgit and redirect (some) old gitweb-caching things -RewriteRule ^/cgit-data/(.*)$ /cgit-data/$1 [L,PT] -RewriteRule ^/cgit/(.*)$ /cgit/$1 [L,PT] - -# blob -RewriteCond %{REQUEST_URI} /(.+)(\.git)/blob/(.+)/(.+):/(.+) [OR] -RewriteCond %{query_string} p=(.+)(\.git);a=blob;h=(.+);hb=(.+);f=(.+) -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/tree/%5?id=%3;id2=%4 [R,L,NE] - -RewriteCond %{REQUEST_URI} /(.+)(\.git)/blob/(.+):/(.+) [OR] -RewriteCond %{query_string} p=(.+)(\.git);a=blob;hb=(.+);f=(.+) -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/tree/%4?id=%3 [R,L,NE] - -RewriteCond %{query_string} p=(.+)(\.git);a=blob;f=(.+);h=(.+);hb=(.+) -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/tree/%3?id=%4;id2=%5 [R,L,NE] - -RewriteCond %{query_string} p=(.+)(\.git);a=blob;f=(.+);h=(.+) -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/tree/%3?id=%4 [R,L,NE] - -# tree -RewriteCond %{REQUEST_URI} /(.+)(\.git)/tree/(.+)/(.+):/(.+) [OR] -RewriteCond %{query_string} p=(.+)(\.git);a=tree;h=(.+);hb=(.+);f=(.+) -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/tree/%5?id=%4 [R,L,NE] - -RewriteCond %{REQUEST_URI} /(.+)(\.git)/tree/(.+):/(.+) [OR] -RewriteCond %{query_string} p=(.+)(\.git);a=tree;hb=(.+);f=(.+) -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/tree/%4?id=%3 [R,L,NE] - -RewriteCond %{REQUEST_URI} /(.+)(\.git)/tree/(.+)/(.+) [OR] -RewriteCond %{query_string} p=(.+)(\.git);a=tree;h=(.+);hb=(.+) -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/tree/?id=%4 [R,L,NE] - -RewriteCond %{REQUEST_URI} /(.+)(\.git)/tree/(.+) [OR] -RewriteCond %{query_string} p=(.+)(\.git);a=tree;hb=(.+) -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/tree/?id=%3 [R,L,NE] - -RewriteCond %{REQUEST_URI} /(.+)(\.git)/tree [OR] -RewriteCond %{query_string} p=(.+)(\.git);a=tree -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/tree/? [R,L,NE] - -# commitdiff -RewriteCond %{REQUEST_URI} /(.+)(\.git)/commitdiff/(.+)/(.+):/(.+) [OR] -RewriteCond %{query_string} p=(.+)(\.git);a=blobdiff;h=(.+);hp=(.+);hb=(.+);f=(.+) -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/diff/%6?id2=%4;id=%3;id3=%5 [R,L,NE] - -RewriteCond %{REQUEST_URI} /(.+)(\.git)/commitdiff/(.+)/(.+) [OR] -RewriteCond %{query_string} p=(.+)(\.git);a=commitdiff;h=(.+);hp=(.+) -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/diff/?id=%4;id2=%3 [R,L,NE] - -RewriteCond %{REQUEST_URI} /(.+)(\.git)/commitdiff/(.+) [OR] -RewriteCond %{query_string} p=(.+)(\.git);a=commitdiff;h=(.+) -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/diff/?id=%3 [R,L,NE] - -# commit -RewriteCond %{REQUEST_URI} /(.+)(\.git)/commit/(.+) [OR] -RewriteCond %{query_string} p=(.+)(\.git);a=commit;h=(.+) -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/commit/?id=%3 [R,L,NE] - -# summary -RewriteCond %{REQUEST_URI} /(.+)(\.git)/summary [OR] -RewriteCond %{query_string} p=(.+)(\.git);a=summary -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/? [R,L,NE] - -# shortlog -RewriteCond %{REQUEST_URI} /(.+)(\.git)/shortlog/(.+) [OR] -RewriteCond %{query_string} p=(.+)(\.git);a=shortlog;h=(.+) -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/log/?id=%3 [R,L,NE] - -RewriteCond %{REQUEST_URI} /(.+)(\.git)/shortlog [OR] -RewriteCond %{query_string} p=(.+)(\.git);a=shortlog -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/log/? [R,L,NE] - -# log -RewriteCond %{REQUEST_URI} /(.+)(\.git)/log/(.+) [OR] -RewriteCond %{query_string} p=(.+)(\.git);a=log;h=(.+) -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/log/?id=%3 [R,L,NE] - -RewriteCond %{REQUEST_URI} /(.+)(\.git)/log [OR] -RewriteCond %{query_string} p=(.+)(\.git);a=log -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/log? [R,L,NE] - -# history -RewriteCond %{REQUEST_URI} /(.+)(\.git)/history/(.+)/(.+):/(.+) [OR] -RewriteCond %{query_string} p=(.+)(\.git);a=history;h=(.+);hb=(.+);f=(.+) -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/log/%5?id=%4 [R,L,NE] - -RewriteCond %{query_string} p=(.+)(\.git);a=history;f=(.+);h=(.+);hb=(.+) -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/log/%3?id=%4;id2=%5 [R,L,NE] - -RewriteCond %{REQUEST_URI} /(.+)(\.git)/history/(.+):/(.+) -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/log/%4?id=%3 [R,L,NE] - -RewriteCond %{query_string} p=(.+)(\.git);a=history;f=(.+);h=(.+) -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/log/%3?id=%4 [R,L,NE] - -RewriteCond %{REQUEST_URI} /(.+)(\.git)/history/(.+)/(.+) [OR] -RewriteCond %{query_string} p=(.+)(\.git);a=history;h=(.+);hb=(.+) -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/log/?id=%4 [R,L,NE] - -RewriteCond %{REQUEST_URI} /(.+)(\.git)/history/(.+):/(.+) [OR] -RewriteCond %{query_string} p=(.+)(\.git);a=history;hb=(.+);f=(.+) -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/log/%4?id=%3 [R,L,NE] - -RewriteCond %{REQUEST_URI} /(.+)(\.git)/history/(.+) [OR] -RewriteCond %{query_string} p=(.+)(\.git);a=history;hb=(.+) -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/log/?id=%3 [R,L,NE] - -# tag -RewriteCond %{REQUEST_URI} /(.+)(\.git)/tag/(.+) [OR] -RewriteCond %{query_string} p=(.+)(\.git);a=tag;h=(.+) -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/tag/?id=%3 [R,L,NE] - -# blob_plain -RewriteCond %{REQUEST_URI} /(.+)(\.git)/blob_plain/(.+):/(.+) [OR] -RewriteCond %{query_string} p=(.+)(\.git);a=blob_plain;h=(.+);f=(.+) -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/plain/%4?id=%3 [R,L,NE] - -RewriteCond %{query_string} p=(.+)(\.git);a=blob_plain;f=(.+);hb=(.+) -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/plain/%3?id2=%4 [R,L,NE] - -RewriteCond %{REQUEST_URI} /(.+)(\.git)/blob_plain/(.+) [OR] -RewriteCond %{query_string} p=(.+)(\.git);a=blob_plain;f=(.+) -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/plain/%3 [R,L,NE] - -# rss|atom -RewriteCond %{REQUEST_URI} /(.+)(\.git)/(rss|atom)/refs/heads/(.+) [OR] -RewriteCond %{query_string} p=(.+)(\.git);a=(rss|atom);h=refsheads/(.+) -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/atom?h=%4 [R,L,NE] - -RewriteCond %{REQUEST_URI} /(.+)(\.git)/(rss|atom) [OR] -RewriteCond %{query_string} p=(.+)(\.git);a=(rss|atom) -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/atom? [R,L,NE] - -# snapshot -RewriteCond %{REQUEST_URI} /(.+)(\.git)/snapshot/(.+)(\.tar\.gz|\.tar\.bz2) [OR] -RewriteCond %{query_string} p=(.+)(\.git);a=snapshot;h=(.+);sf=(.+) -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/snapshot/%3.tar.gz [R,L,NE] - -# base old gitweb project -RewriteCond %{REQUEST_URI} /gitweb/(.+)\.git.* [OR] -RewriteCond %{query_string} p=(.+)\.git.* -RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/? [R,L,NE] - -# Fail safes incase nothing above matches, try at least to put the person in the project -#RewriteCond %{REQUEST_URI} /(.+)\.git.* [OR] -#RewriteCond %{query_string} p=(.+)\.git.* -#RewriteRule ^/.*$ https://src.fedoraproject.org/cgit/%1.git/? [R,L,NE] - -# Or else in the root of cgit -#RewriteRule ^.* https://src.fedoraproject.org/cgit/ [R,L,NE] diff --git a/roles/distgit/tasks/main.yml b/roles/distgit/tasks/main.yml index 10b0e1a590..7cdd7a1a5a 100644 --- a/roles/distgit/tasks/main.yml +++ b/roles/distgit/tasks/main.yml @@ -324,8 +324,8 @@ notify: - reload httpd -- name: install the CGit-related httpd redirect config - copy: src=redirect.conf dest=/etc/httpd/conf.d/dist-git/redirect.conf +- name: Remove the old cgit related redirect config + file: path=/etc/httpd/conf.d/dist-git/redirect.conf state=absent tags: - distgit - cgit