From 4be05e5d7cf8f9f9d0af5d1ca666209285ddc187 Mon Sep 17 00:00:00 2001 From: Jose V Beneyto Date: Fri, 17 Dec 2010 14:36:00 +0100 Subject: portdb: added support for listing files (Pkgfile, etc.) on rsync based repos (but only localrepos hosted in crux.nu for now) --- portdb/portdb/index.php | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) (limited to 'portdb') diff --git a/portdb/portdb/index.php b/portdb/portdb/index.php index 4d14d37..5ce7c25 100755 --- a/portdb/portdb/index.php +++ b/portdb/portdb/index.php @@ -14,6 +14,15 @@ function sanitize($str) { return $str; } +function localrepo($name) { + if (is_dir("/home/crux/git-to-rsync-working-copy/crux-2.7/{$name}")) { + return "http://crux.nu/ports/crux-2.7/{$name}/"; + } + else { + return ""; + } +} + class Repo { public $name; @@ -92,11 +101,16 @@ class Port function filesToXML() { $xml = ""; if ($this->repo->type == "httpup") { - $base_url = "{$this->repo->url}/{$this->name}/"; + $base_url = "{$this->repo->url}/"; + } + else { + $base_url = localrepo($this->repo->name); + } + if ($base_url != "") { $xml = ""; - $xml .= "{$base_url}Pkgfile"; - $xml .= "{$base_url}.footprint"; - $xml .= "{$base_url}.md5sum"; + $xml .= "{$base_url}{$this->name}/Pkgfile"; + $xml .= "{$base_url}{$this->name}/.footprint"; + $xml .= "{$base_url}{$this->name}/.md5sum"; $xml .= ""; } return $xml; @@ -105,10 +119,15 @@ class Port function filesToHTML() { $html = ""; if ($this->repo->type == "httpup") { - $base_url = "{$this->repo->url}/{$this->name}/"; - $html = "P "; - $html .= "F "; - $html .= "M"; + $base_url = "{$this->repo->url}/"; + } + else { + $base_url = localrepo($this->repo->name); + } + if ($base_url != "") { + $html = "name}/Pkgfile\">P "; + $html .= "name}/.footprint\">F "; + $html .= "name}/.md5sum\">M"; } return $html; } -- cgit v1.2.3