[website] 01/01: Include josmredir.php from pkg-osm and update for pkg-grass.
Bas Couwenberg
sebastic at xs4all.nl
Sun Oct 26 22:20:39 UTC 2014
This is an automated email from the git hooks/post-receive script.
sebastic-guest pushed a commit to branch master
in repository website.
commit 6bfc8ba46a817a76920098fd6f6155d3be9d8dc3
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date: Sun Oct 26 23:20:33 2014 +0100
Include josmredir.php from pkg-osm and update for pkg-grass.
---
josmredir.php | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 128 insertions(+)
diff --git a/josmredir.php b/josmredir.php
new file mode 100755
index 0000000..43a5883
--- /dev/null
+++ b/josmredir.php
@@ -0,0 +1,128 @@
+<?php
+$url = "http://josm.openstreetmap.de/version";
+
+$tested_re = "/josm-tested.jar: (\d+)/";
+$latest_re = "/josm-latest.jar: (\d+)/";
+
+$svnrepo = "http://josm.openstreetmap.de/svn/trunk";
+$i18nrepo = "http://svn.openstreetmap.org/applications/editors/josm/i18n/";
+
+#echo "<pre>";
+#print_r($_GET);
+#echo "</pre>";
+
+if (isset($_GET["rev"])) {
+ $destdir = "josm/".uniqid("josm-");
+ $dfsg = (isset($_GET["debian"]) and $_GET["debian"] == "yes") ? true : false;
+ $svnrev = intval($_GET["rev"]);
+
+ # lock the directory we're working on
+ file_put_contents("josm/josm.lock", $destdir);
+
+ # do the job
+ $desttgz = "josm/josm_0.0.svn$svnrev.orig.tar.gz";
+ exec("svn export -r $svnrev $svnrepo $destdir");
+ exec("svn info --xml -r $svnrev $svnrepo > $destdir/REVISION");
+ exec("svn export $i18nrepo $destdir/i18n");
+
+ if ($dfsg) {
+ exec("rm -rf $destdir/images/styles/standard");
+ exec("find $destdir -name '*.jar' -exec rm {} \;");
+ exec("rm -rf $destdir/data_nodist");
+ }
+
+ exec("tar czf ".basename($desttgz)." -C josm ".basename($destdir));
+ exec("rm -rf $destdir");
+
+ # remove the lock on the directory
+ unlink("josm/josm.lock");
+
+ # Send the file
+ header("Content-Type: application/force-download");
+ header("Content-Type: application/octet-stream");
+ header("Content-Type: application/download");
+ header("Content-Disposition: attachment; filename=".basename($desttgz).";");
+ header("Content-Transfer-Encoding: binary");
+ header("Content-Length: ".filesize($desttgz));
+ readfile($desttgz);
+ unlink($desttgz);
+ exit();
+}
+else {
+ $re = $tested_re;
+ $text = "tested";
+ if (isset($_GET["get"])) {
+ switch ($_GET["get"]) {
+ case "latest":
+ $re = $latest_re;
+ $text = "latest";
+ break;
+ default:
+ break;
+ }
+ }
+
+ $query = "";
+ if (isset($_GET["debian"])) {
+ $query .= ($_GET["debian"] == "yes") ? "&debian=yes" : "";
+ }
+?>
+<!DOCTYPE html>
+<html>
+<head>
+ <title>JOSM Redirector</title>
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+</head>
+
+<body>
+
+<h1>JOSM Redirector</h1>
+
+<p>
+ This page is mainly meant to be used with
+ <tt><a href="http://packages.debian.org/sid/devscripts">uscan</a><a href="http://manpages.debian.org/cgi-bin/man.cgi?query=uscan">(1)</a></tt>.
+</p>
+<p>
+ You can pass different arguments to the query string:
+</p>
+<ul>
+ <li>
+ <dt>debian</dt>
+ <dd>"<em>yes</em>" makes it generate a source packages as used by the Debian GNU distribution;</dd>
+ </li>
+ <li>
+ <dt>get</dt>
+ <dd>"<em>latest</em>" makes it look for (and generate) the source package for josm-latest.jar. Any other value makes it act on josm-tested.jar.</dd>
+ </li>
+</ul>
+
+<?php
+ $handle = @fopen($url, "r");
+ if ($handle) {
+ while (!feof($handle)) {
+ $buffer = fgets($handle);
+# echo "<pre>";print_r(htmlentities($re));echo "</pre>";
+# echo "<pre>";print_r(htmlentities($buffer));echo "</pre>";
+ if (preg_match($re, $buffer, $matches)) {
+ $version = $matches[1];
+?>
+<a href='<?= $_SERVER["PHP_SELF"] ?>?rev=<?= $version ?><?= $query ?>'>JOSM <?= $text ?> <?= $version ?></a>
+<?php
+ break;
+ }
+ }
+ fclose($handle);
+ }
+?>
+
+<hr />
+<address>
+ For any issue contact the <a href="mailto:debian-gis at lists.debian.org">Debian GIS mailinglist</a>.<br/>
+ <small>Source code available at alioth:/home/groups/pkg-grass/htdocs/josmredir.php.</small>
+</address>
+
+</body>
+</html>
+<?php
+}
+?>
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/website.git
More information about the Pkg-grass-devel
mailing list