diff options
author | Carlo Landmeter <clandmeter@gmail.com> | 2015-03-22 19:24:35 +0000 |
---|---|---|
committer | Carlo Landmeter <clandmeter@gmail.com> | 2015-03-22 19:24:35 +0000 |
commit | af9eb91e8f9985f23d9ff8dfc4c6ce8c979a9dcf (patch) | |
tree | 5dc6698664de1ce48ba7e47baa1e68d2c896d106 | |
parent | 13044379d2741cd255e01dcd4a950ff1788aeea7 (diff) | |
download | aports-turbo-af9eb91e8f9985f23d9ff8dfc4c6ce8c979a9dcf.tar.bz2 aports-turbo-af9eb91e8f9985f23d9ff8dfc4c6ce8c979a9dcf.tar.xz |
add arch to queries and cleanup package tpl
-rwxr-xr-x | aports.lua | 26 | ||||
-rw-r--r-- | tpl/package.tpl | 16 |
2 files changed, 17 insertions, 25 deletions
@@ -81,11 +81,11 @@ function PackageRenderer:get(arch, name) if table ~= nil then table.install_size = human_bytes(table.install_size) table.size = human_bytes(table.size) - table.deps = QueryDeps(table.deps) + table.deps = QueryDeps(table.deps, arch) table.deps_qty = (table.deps ~= nil) and #table.deps or "0" - table.reqbys = QueryRequiredBy(table.provides) - table.reqdeps_qty = (table.reqdeps ~= nil) and #table.reqdeps or "0" - table.subpkgs = QuerySubPackages(table.origin, table.name) + table.reqbys = QueryRequiredBy(table.provides, arch) + table.reqbys_qty = (table.reqbys ~= nil) and #table.reqbys or "0" + table.subpkgs = QuerySubPackages(table.origin, table.name, arch) table.subpkgs_qty = (table.subpkgs ~= nil) and #table.subpkgs or "0" table.maintainer = (table.maintainer ~= "") and string.gsub(table.maintainer, '<.*>', '') or "None" for k in pairs (table) do @@ -158,14 +158,14 @@ function QueryPackage(name, arch) return r end -function QueryDeps(deps) +function QueryDeps(deps, arch) require('DBI') local names = {} local dbh = assert(DBI.Connect('SQLite3', 'db/apkindex.db')) - local sth = assert(dbh:prepare('select name from apkindex where provides like ?')) + local sth = assert(dbh:prepare('select name from apkindex where provides like ? and arch like ?')) for _,k in pairs (deps:split(" ")) do if k:begins('so:') then - sth:execute("%"..k.."%") + sth:execute("%"..k.."%", arch) local l = sth:fetch(true) if l ~= nil then names[l.name] = l.name @@ -184,15 +184,15 @@ function QueryDeps(deps) end end -function QueryRequiredBy(provides) +function QueryRequiredBy(provides, arch) require('DBI') local names = {} local dbh = assert(DBI.Connect('SQLite3', 'db/apkindex.db')) - local sth = assert(dbh:prepare('select name from apkindex where deps like ?')) + local sth = assert(dbh:prepare('select name from apkindex where deps like ? and arch like ?')) for _,d in pairs (provides:split(" ")) do if d:begins('so:') then d = string.gsub(d, '=.*', '') - sth:execute("%"..d.."%") + sth:execute("%"..d.."%", arch) for row in sth:rows(true) do if row ~= nil then names[row.name] = row.name @@ -210,12 +210,12 @@ function QueryRequiredBy(provides) end end -function QuerySubPackages(origin, name) +function QuerySubPackages(origin, name, arch) require('DBI') local names = {} local dbh = assert(DBI.Connect('SQLite3', 'db/apkindex.db')) - local sth = assert(dbh:prepare('select name from apkindex where origin like ?')) - sth:execute(origin) + local sth = assert(dbh:prepare('select name from apkindex where origin like ? and arch like ?')) + sth:execute(origin, arch) local r = {} for row in sth:rows(true) do if row.name ~= name then diff --git a/tpl/package.tpl b/tpl/package.tpl index 9114555..898faa0 100644 --- a/tpl/package.tpl +++ b/tpl/package.tpl @@ -25,7 +25,7 @@ </tr> <tr> <th>Project:</th> - <td><a href="{{{url}}}">URL</a></td> + <td><a href="{{{url}}}">{{{url}}}</a></td> </tr> <tr> <th>Licence:</th> @@ -36,24 +36,16 @@ <td>{{{arch}}}</td> </tr> <tr> - <th>Checksum:</th> - <td>{{{csum}}}</td> - </tr> - <tr> <th>Size:</th> <td>{{{size}}}</td> </tr>{{#install_size}} <tr> <th>Installed size:</th> <td>{{{install_size}}}</td> - </tr>{{/install_size}}{{#provides}} - <tr> - <th>Provides:</th> - <td>{{{provides}}}</td> - </tr>{{/provides}}{{#install_if}} + </tr>{{/install_size}}{{#install_if}} <tr> <th>Install if:</th> - <td>{{{install_if}}}</td> + <td><a href="/package/{{{arch}}}/{{{install_if}}}">{{{install_if}}}</a></td> </tr>{{/install_if}}{{#name}} <tr> <th>Origin:</th> @@ -96,7 +88,7 @@ </div> <div class="panel panel-default"> <div class="panel-heading"> - <a class="accordion-toggle" data-toggle="collapse" href="#collapseReqBy" aria-expanded="false">Required by ({{reqdeps_qty}})</a> + <a class="accordion-toggle" data-toggle="collapse" href="#collapseReqBy" aria-expanded="false">Required by ({{reqbys_qty}})</a> </div> <div id="collapseReqBy" class="panel-collapse collapse"> <ul class="list-group">{{#reqbys}} |