summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gentoobrowse/.htaccess11
-rw-r--r--gentoobrowse/base.xslt58
-rw-r--r--gentoobrowse/browse.xslt111
-rw-r--r--gentoobrowse/datasources/postgres.xml8
-rw-r--r--gentoobrowse/favicon.icobin0 -> 1086 bytes
-rw-r--r--gentoobrowse/home.xslt50
-rw-r--r--gentoobrowse/images/glogo-small.pngbin0 -> 17506 bytes
-rw-r--r--gentoobrowse/login.xslt7
-rw-r--r--gentoobrowse/present/index.xml4
-rw-r--r--gentoobrowse/search.xslt33
-rw-r--r--gentoobrowse/style.css84
-rw-r--r--gentoobrowse/views/newebuilds.xml16
12 files changed, 382 insertions, 0 deletions
diff --git a/gentoobrowse/.htaccess b/gentoobrowse/.htaccess
new file mode 100644
index 0000000..19986cc
--- /dev/null
+++ b/gentoobrowse/.htaccess
@@ -0,0 +1,11 @@
+<Files "p2web">
+ sethandler fcgid-script
+</Files>
+RewriteEngine on
+RewriteCond %{REQUEST_URI} !\.
+RewriteCond %{REQUEST_URI} !^/p2web
+RewriteCond %{REQUEST_URI} !^/env
+RewriteRule ^(.*) /p2web/\1 [L]
+
+AddOutputFilterByType XSLT text/xml-xslt
+
diff --git a/gentoobrowse/base.xslt b/gentoobrowse/base.xslt
new file mode 100644
index 0000000..b723c59
--- /dev/null
+++ b/gentoobrowse/base.xslt
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes"
+ doctype-system="http://www.w3.org/TR/html4/loose.dtd"
+ doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" />
+ <xsl:template match="/gentoo">
+ <html>
+ <head>
+ <link rel="stylesheet" href="/style.css" type="text/css" />
+ <link rel="shortcut icon" href="/images/glogo-small.png" type="image/png" />
+ <title>Gentoo Browse</title>
+ <meta http-equiv="Expires" content="0" />
+ </head>
+ <body>
+ <h1>Gentoo Browse</h1>
+ <div class="tabs">
+ <a href="/">Home</a> |
+ <a href="/categories">Browse</a> |
+ <a href="/search">Search</a> |
+ <a href="/login">Login</a>
+ </div>
+ <table width="100%">
+ <tr>
+ <td class="colLeft">
+ <h2>News</h2>
+ </td>
+ <td class="content">
+ <xsl:call-template name="content" />
+ </td>
+ </tr>
+ </table>
+ <div class="trademark">
+ This website is not an official Gentoo website.
+ The name "Gentoo" and the "g" logo are trademarks of the Gentoo Foundation, Inc.
+ </div>
+ <div class="poweredby">
+ Powered by
+ <a href="http://www.gentoo.org/">Gentoo</a>,
+ <a href="http://httpd.apache.org/">Apache</a>,
+ <a href="http://www.postgresql.org/">PostgreSQL</a> and
+ <a href="http://www.w3.org/TR/xslt">XSLT</a> - Driven by dbweb
+ </div>
+ </body>
+ </html>
+ </xsl:template>
+ <xsl:template name="content">
+ </xsl:template>
+ <xsl:template match="package">
+ <li>
+ <a>
+ <xsl:attribute name="href">
+ /package/<xsl:value-of select="catname" />/<xsl:value-of select="pkgname" />
+ </xsl:attribute>
+ <xsl:value-of select="catname" />/<xsl:value-of select="pkgname" />
+ </a> - <xsl:value-of select="description" />
+ </li>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/gentoobrowse/browse.xslt b/gentoobrowse/browse.xslt
new file mode 100644
index 0000000..c62e886
--- /dev/null
+++ b/gentoobrowse/browse.xslt
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:import href="base.xslt" />
+ <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes"
+ doctype-system="http://www.w3.org/TR/html4/loose.dtd"
+ doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" />
+ <xsl:template name="content">
+ <xsl:apply-templates select="/gentoo/categories" />
+ <xsl:apply-templates select="/gentoo/packages" />
+ <xsl:apply-templates select="/gentoo/summary/package" />
+ </xsl:template>
+ <xsl:template match="/gentoo/categories">
+ <h2>Package groups</h2>
+ <table class="grps">
+ <tr>
+ <th>Category</th>
+ <th>Packages</th>
+ </tr>
+ <xsl:apply-templates select="/gentoo/categories/category" />
+ </table>
+ </xsl:template>
+ <xsl:template match="/gentoo/categories/category">
+ <tr>
+ <td>
+ <a>
+ <xsl:attribute name="href">
+ /category/<xsl:value-of select="catname" />
+ </xsl:attribute>
+ <xsl:value-of select="catname" />
+ </a>
+ </td>
+ <td>
+ <xsl:value-of select="packages" />
+ </td>
+ </tr>
+ </xsl:template>
+ <xsl:template match="/gentoo/packages">
+ <h2>Packages</h2>
+ <ul>
+ <xsl:apply-templates select="/gentoo/packages/package" />
+ </ul>
+ </xsl:template>
+ <xsl:template match="/gentoo/summary/package/versions">
+ <table class="versions">
+ <xsl:apply-templates select="version" />
+ </table>
+ </xsl:template>
+ <xsl:template match="/gentoo/summary/package/versions/version">
+ <tr class="row1">
+ <td class="ver">
+ v<xsl:value-of select="version" />
+ </td>
+ <td class="archs">
+ <xsl:apply-templates select="../../versionArchs/arch[ebuildid=current()/ebuildid]">
+ <xsl:sort select="arch" />
+ </xsl:apply-templates>
+ </td>
+ </tr>
+ <tr class="row2">
+ <td colspan="2" class="use">
+ Use flags:
+ <xsl:apply-templates select="../../versionUses/use[ebuildid=current()/ebuildid]">
+ <xsl:sort select="use" />
+ </xsl:apply-templates>
+ </td>
+ </tr>
+ </xsl:template>
+ <xsl:template match="/gentoo/summary/package">
+ <h2>
+ <a>
+ <xsl:attribute name="href">
+ /category/<xsl:value-of select="catname" />
+ </xsl:attribute>
+ <xsl:value-of select="catname" />
+ </a>/<xsl:value-of select="pkgname" />
+ </h2>
+ <p>
+ <xsl:value-of select="description" />
+ </p>
+ <xsl:apply-templates select="packageUrls" />
+ <xsl:apply-templates select="versions" />
+ <xsl:apply-templates select="deps" />
+ </xsl:template>
+ <xsl:template match="/gentoo/summary/package/packageUrls">
+ <ul>
+ <xsl:apply-templates match="url" />
+ </ul>
+ </xsl:template>
+ <xsl:template match="/gentoo/summary/package/packageUrls/url">
+ <a target="_blank">
+ <xsl:attribute name="href">
+ <xsl:value-of select="url" />
+ </xsl:attribute>
+ <xsl:value-of select="url" />
+ </a>
+ </xsl:template>
+ <xsl:template match="/gentoo/summary/package/versionUses/use">
+ <xsl:value-of select="use" />
+ <xsl:text> </xsl:text>
+ </xsl:template>
+ <xsl:template match="/gentoo/summary/package/versionArchs/arch">
+ <xsl:value-of select="arch" />
+ <xsl:text> </xsl:text>
+ </xsl:template>
+ <xsl:template match="/gentoo/summary/package/deps">
+ <h3>Dependencies</h3>
+ <ul>
+ <xsl:apply-templates match="/gentoo/summary/package/deps/package" />
+ </ul>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/gentoobrowse/datasources/postgres.xml b/gentoobrowse/datasources/postgres.xml
new file mode 100644
index 0000000..221b05d
--- /dev/null
+++ b/gentoobrowse/datasources/postgres.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<rdbmsdatasource name="postgres">
+ <readonly preferlocal="true">
+ <dsn>Driver=postgresql;Readonly=yes;ServerName=firebrand.random.lan;Username=gentoo;Database=gentoo;Password=gentoo;</dsn>
+ <dsn>Driver=postgresql;Readonly=yes;ServerName=defiant.random.lan;Username=gentoo;Database=gentoo;Password=gentoo;</dsn>
+ </readonly>
+ <masterdsn>Driver=postgresql;Readonly=no;ServerName=postgresql.random.lan;Username=gentoo;Database=gentoo;Password=gentoo;</masterdsn>
+</rdbmsdatasource>
diff --git a/gentoobrowse/favicon.ico b/gentoobrowse/favicon.ico
new file mode 100644
index 0000000..db2c7bd
--- /dev/null
+++ b/gentoobrowse/favicon.ico
Binary files differ
diff --git a/gentoobrowse/home.xslt b/gentoobrowse/home.xslt
new file mode 100644
index 0000000..368d481
--- /dev/null
+++ b/gentoobrowse/home.xslt
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:import href="base.xslt" />
+ <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes"
+ doctype-system="http://www.w3.org/TR/html4/loose.dtd"
+ doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" />
+ <xsl:template name="content">
+ <xsl:apply-templates select="/gentoo/newebuilds" />
+ </xsl:template>
+ <xsl:template match="/gentoo/newebuilds">
+ <h2>Newest ebuilds</h2>
+ <table class="newebuilds">
+ <tr>
+ <th>Today</th>
+ <th>Yesterday</th>
+ <th>The day before</th>
+ </tr>
+ <tr>
+ <td valign="top">
+ <ul>
+ <xsl:apply-templates select="/gentoo/newebuilds/ebuild[age=0]" />
+ </ul>
+ </td>
+ <td valign="top">
+ <ul>
+ <xsl:apply-templates select="/gentoo/newebuilds/ebuild[age=1]" />
+ </ul>
+ </td>
+ <td valign="top">
+ <ul>
+ <xsl:apply-templates select="/gentoo/newebuilds/ebuild[age=2]" />
+ </ul>
+ </td>
+ </tr>
+ </table>
+ </xsl:template>
+ <xsl:template match="/gentoo/newebuilds/ebuild">
+ <li>
+ <a>
+ <xsl:attribute name="title">
+ <xsl:value-of select="description" /> (updated <xsl:value-of select="moddate" />)
+ </xsl:attribute>
+ <xsl:attribute name="href">
+ /package/<xsl:value-of select="catname" />/<xsl:value-of select="pkgname" />
+ </xsl:attribute>
+ <xsl:value-of select="filename" />
+ </a>
+ </li>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/gentoobrowse/images/glogo-small.png b/gentoobrowse/images/glogo-small.png
new file mode 100644
index 0000000..b1df6ab
--- /dev/null
+++ b/gentoobrowse/images/glogo-small.png
Binary files differ
diff --git a/gentoobrowse/login.xslt b/gentoobrowse/login.xslt
new file mode 100644
index 0000000..4ea8536
--- /dev/null
+++ b/gentoobrowse/login.xslt
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:import href="base.xslt" />
+ <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes"
+ doctype-system="http://www.w3.org/TR/html4/loose.dtd"
+ doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" />
+</xsl:stylesheet>
diff --git a/gentoobrowse/present/index.xml b/gentoobrowse/present/index.xml
new file mode 100644
index 0000000..15dacee
--- /dev/null
+++ b/gentoobrowse/present/index.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<view name="index" root="gentoo" style="home.xslt" xmlns:xi="http://www.w3.org/2001/XInclude">
+ <xi:include href="../views/newebuilds.xml" />
+</view>
diff --git a/gentoobrowse/search.xslt b/gentoobrowse/search.xslt
new file mode 100644
index 0000000..c17a5a8
--- /dev/null
+++ b/gentoobrowse/search.xslt
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:dbweb="http://dbweb.randomdan.homeip.net/">
+ <xsl:import href="base.xslt" />
+ <xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes"
+ doctype-system="http://www.w3.org/TR/html4/loose.dtd"
+ doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" />
+ <xsl:template name="content">
+ <h2>Search</h2>
+ <form action="/search" method="get">
+ <input type="textbox" name="criteria">
+ <xsl:attribute name="value">
+ <xsl:value-of select="/gentoo/dbweb:params/dbweb:param[@name='criteria']" />
+ </xsl:attribute>
+ </input>
+ <input type="submit" />
+ </form>
+ <xsl:apply-templates select="/gentoo/searchResults" />
+ </xsl:template>
+ <xsl:template match="/gentoo/searchResults">
+ <xsl:if test="/gentoo/dbweb:params/dbweb:param[@name='criteria'] != ''">
+ <xsl:if test="count(/gentoo/searchResults/package) &gt; 0">
+ <h2>Search Results</h2>
+ <ul>
+ <xsl:apply-templates select="/gentoo/searchResults/package" />
+ </ul>
+ </xsl:if>
+ <xsl:if test="count(/gentoo/searchResults/package) = 0">
+ <p class="warning">Nothing found</p>
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/gentoobrowse/style.css b/gentoobrowse/style.css
new file mode 100644
index 0000000..195a109
--- /dev/null
+++ b/gentoobrowse/style.css
@@ -0,0 +1,84 @@
+html {
+ background: white url('/images/glogo-small.png') no-repeat 10px 5px;
+ font-family: cursive;
+}
+body {
+ font-size: 11px;
+}
+h1 {
+ font-style: italic;
+ font-weight: bold;
+ font-size: 45px;
+ margin: 20px 160px 5px;
+ border-bottom: 1px solid black;
+}
+.tabs {
+ font-size: 15px;
+ text-align: center;
+}
+h2 {
+ padding: 0;
+ margin: 0;
+ font-size: 18px;
+}
+p {
+}
+
+.colLeft {
+ vertical-align: top;
+ width: 130px;
+ padding: 5px;
+}
+.content {
+ vertical-align: top;
+ border-left: 3px dotted black;
+ padding: 5px;
+}
+
+.newebuilds th {
+ margin: 0;
+ width: 33%;
+}
+.newebuilds ul {
+ margin: 0;
+}
+
+.versions {
+ border-collapse: collapse;
+width: 95%;
+}
+.versions td {
+border: 1px solid gray;
+}
+.versions .row1 td {
+ border-top: 2px solid black;
+}
+.versions .row2 td {
+ border-bottom: 2px solid black;
+}
+.versions .ver {
+ font-size: large;
+ padding: 5px 20px;
+ white-space: nowrap;
+}
+.versions .use, .versions .archs {
+padding: 10px 5px;
+}
+
+table.grps {
+ border-collapse: collapse;
+}
+table.grps td {
+ border: 1px solid black;
+ padding: 5px 20px;
+}
+div.trademark, div.poweredby {
+ text-align: center;
+ color: gray;
+ font-size: 9px;
+ margin: 10px;
+}
+.warning {
+ color: red;
+ font-weight: bold;
+}
diff --git a/gentoobrowse/views/newebuilds.xml b/gentoobrowse/views/newebuilds.xml
new file mode 100644
index 0000000..d27ee70
--- /dev/null
+++ b/gentoobrowse/views/newebuilds.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<block xmlns:xi="http://www.w3.org/2001/XInclude">
+ <xi:include href="../datasources/postgres.xml" />
+ <sqlview name="newebuilds" recordname="ebuild" datasource="postgres">
+ <sql>
+ SELECT filename, EXTRACT('day' FROM NOW() - f.firstseen) AS age, description,
+ moddate, p.name AS pkgname, c.name AS catname
+ FROM ebuilds e, files f, packages p, categories c
+ WHERE e.ebuildid = f.fileid
+ AND e.packageid = p.packageid
+ AND p.categoryid = c.categoryid
+ AND f.firstseen &gt; DATE_TRUNC('day', NOW()) - INTERVAL '3 days'
+ ORDER BY c.name, p.name, e.versioninst
+ </sql>
+ </sqlview>
+</block>