[openssl-commits] [web] master update

Richard Levitte levitte at openssl.org
Thu Jul 9 21:38:50 UTC 2015


The branch master has been updated
       via  46d1ed4f31a316a870bf319a5ba61cb08b2cb294 (commit)
      from  bd2dd9e5f5521fae2631f8a54f7b9947a352ce2f (commit)


- Log -----------------------------------------------------------------
commit 46d1ed4f31a316a870bf319a5ba61cb08b2cb294
Author: Richard Levitte <levitte at openssl.org>
Date:   Thu Jul 9 23:34:17 2015 +0200

    Rewrite the source/.htaccess hack
    
    source/.htaccess only had a redirection for latest.tar.gz, we then had
    series specific URLs via symlinks.  This changes does away with all
    that places all of those redirects in source/.htaccess.
    
    This is, btw, some cool use of wml.

-----------------------------------------------------------------------

Summary of changes:
 Makefile                               |  5 +----
 source/{.htaccess.in => .htaccess.wml} | 23 ++++++++++++++++++++---
 2 files changed, 21 insertions(+), 7 deletions(-)
 rename source/{.htaccess.in => .htaccess.wml} (52%)

diff --git a/Makefile b/Makefile
index 3f2f4d5..ddb9619 100644
--- a/Makefile
+++ b/Makefile
@@ -27,10 +27,7 @@ simple: rebuild hack-source_htaccess
 rebuild:
 	wmk $(FORCE) -I $(SNAP) -a $(DIRS) index.wml
 hack-source_htaccess:
-	latest=`grep '<span class="latest">' < source/index.html | \
-		sed -e 's|^.*<span class="latest">||' -e 's|</span>.*$$||'`; \
-	    sed -e "s|%%LATEST%%|$$latest|" \
-		< source/.htaccess.in > source/.htaccess
+	( cd source && wml -o .htaccess .htaccess.wml )
 
 manpages:
 	sh ./run-pod2html.sh $(PODSHOME)
diff --git a/source/.htaccess.in b/source/.htaccess.wml
similarity index 52%
rename from source/.htaccess.in
rename to source/.htaccess.wml
index ee5c94e..9b79140 100644
--- a/source/.htaccess.in
+++ b/source/.htaccess.wml
@@ -1,4 +1,4 @@
-##
+<protect>##
 ##  .htaccess -- Apache per-dir config
 ##
 
@@ -30,5 +30,22 @@ RewriteRule openssl-(fips.*)  old/fips/openssl-$1 [L]
     RemoveEncoding .gz
 </Files>
 
-RewriteBase /source
-RewriteRule ^latest\.tar\.gz$ %%LATEST%% [R=302,NC]
+</protect>RewriteBase /source
+<:{
+    my @tarballs =
+        sort grep /openssl-\d+\.\d+\.\d+[a-z]*\.tar\.gz$/, glob("openssl-*.tar.gz");
+    my %series = ();
+    foreach(@tarballs) {
+        my ($version, $serie) = /^openssl-((\d+\.\d+\.\d+)[a-z]*)\./;
+	$series{$serie} = $_;
+    }
+
+    my $latest = $series{ (reverse sort keys %series)[0] };
+    print "RewriteRule ^latest\\.tar\\.gz\$ $latest [R=302,NC]\n";
+
+    foreach (sort keys %series) {
+        my $rule = "openssl-$_-latest.tar.gz"; $rule =~ s|\.|\\.|g;
+	my $target = $series{$_};
+        print "RewriteRule ^$rule\$ $target [R=302,NC]\n";
+    }
+}:>


More information about the openssl-commits mailing list