diff options
author | Jose V Beneyto <sepen@crux.nu> | 2010-12-17 14:36:00 +0100 |
---|---|---|
committer | Jose V Beneyto <sepen@crux.nu> | 2010-12-17 14:36:00 +0100 |
commit | 4be05e5d7cf8f9f9d0af5d1ca666209285ddc187 (patch) | |
tree | ae67b44b7b19bf3fac85512a264ca1d6cc8e7248 | |
parent | 2a6c0139f5e6672e1e42b4aa3ea87434bfbd774a (diff) | |
download | webtools-4be05e5d7cf8f9f9d0af5d1ca666209285ddc187.tar.gz webtools-4be05e5d7cf8f9f9d0af5d1ca666209285ddc187.tar.xz |
portdb: added support for listing files (Pkgfile, etc.) on rsync based repos (but only localrepos hosted in crux.nu for now)
-rwxr-xr-x | portdb/portdb/index.php | 35 |
1 files changed, 27 insertions, 8 deletions
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 = "<files>"; - $xml .= "<pkgfile>{$base_url}Pkgfile</pkgfile>"; - $xml .= "<footprint>{$base_url}.footprint</footprint>"; - $xml .= "<md5sum>{$base_url}.md5sum</md5sum>"; + $xml .= "<pkgfile>{$base_url}{$this->name}/Pkgfile</pkgfile>"; + $xml .= "<footprint>{$base_url}{$this->name}/.footprint</footprint>"; + $xml .= "<md5sum>{$base_url}{$this->name}/.md5sum</md5sum>"; $xml .= "</files>"; } return $xml; @@ -105,10 +119,15 @@ class Port function filesToHTML() { $html = ""; if ($this->repo->type == "httpup") { - $base_url = "{$this->repo->url}/{$this->name}/"; - $html = "<a href=\"{$base_url}Pkgfile\">P</a> "; - $html .= "<a href=\"{$base_url}.footprint\">F</a> "; - $html .= "<a href=\"{$base_url}.md5sum\">M</a>"; + $base_url = "{$this->repo->url}/"; + } + else { + $base_url = localrepo($this->repo->name); + } + if ($base_url != "") { + $html = "<a href=\"{$base_url}{$this->name}/Pkgfile\">P</a> "; + $html .= "<a href=\"{$base_url}{$this->name}/.footprint\">F</a> "; + $html .= "<a href=\"{$base_url}{$this->name}/.md5sum\">M</a>"; } return $html; } |