diff options
-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; } |