Add meta links for search results

- homepage
- dep tree
- cvs web
- github
This commit is contained in:
Aaron Bieber 2023-08-08 07:12:47 -06:00
parent 509c568865
commit 7a86e5d41e
No known key found for this signature in database
2 changed files with 61 additions and 18 deletions

View File

@ -62,6 +62,7 @@ my $query = q{
FULLPKGPATH, FULLPKGPATH,
COMMENT, COMMENT,
DESCRIPTION, DESCRIPTION,
HOMEPAGE,
highlight(%s, 2, '**', '**') AS COMMENT_MATCH, highlight(%s, 2, '**', '**') AS COMMENT_MATCH,
highlight(%s, 3, '**', '**') AS DESCR_MATCH highlight(%s, 3, '**', '**') AS DESCR_MATCH
FROM %s FROM %s
@ -282,7 +283,7 @@ __DATA__
<thead> <thead>
<tr> <tr>
<th class="nowrap">Package Name</th> <th class="nowrap">Package Name</th>
<th>Path</th> <th>Details</th>
<th>Comment</th> <th>Comment</th>
<th>Description</th> <th>Description</th>
</tr> </tr>
@ -291,10 +292,36 @@ __DATA__
<tr> <tr>
<td class="nowrap"><%= $result->{FULLPKGNAME} %></td> <td class="nowrap"><%= $result->{FULLPKGNAME} %></td>
<td class="nowrap"> <td class="nowrap">
<ul>
<li>
<%= $result->{FULLPKGPATH} %>
</li>
<ul>
<li>
<a <a
href="/tree?name=<%= $result->{FULLPKGPATH} %>" href="<%= $result->{HOMEPAGE} %>"
title="Home page for <%= $result->{FULLPKGNAME} %>"
>Home page</a>
</li>
<li>
<a href="/tree?name=<%= $result->{FULLPKGPATH} %>"
title="Dependencies for <%= $result->{FULLPKGNAME} %>" title="Dependencies for <%= $result->{FULLPKGNAME} %>"
><%= $result->{FULLPKGPATH} %></a> >Dep Tree</a>
</li>
<li>
<a
href="https://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/<%= $result->{FULLPKGPATH} %>"
title="CVSWeb page for <%= $result->{FULLPKGNAME} %>"
>CVS Web</a>
</li>
<li>
<a
href="https://github.com/openbsd/ports/tree/master/<%= $result->{FULLPKGPATH} %>"
title="OpenBSD GitHub page for <%= $result->{FULLPKGNAME} %>"
>GitHub</a>
</li>
</ul>
</ul>
</td> </td>
<td class=""><%== $result->{COMMENT_MATCH} %></td> <td class=""><%== $result->{COMMENT_MATCH} %></td>
<td><%== $result->{DESCR_MATCH} %></td> <td><%== $result->{DESCR_MATCH} %></td>

View File

@ -1,17 +1,20 @@
#!/usr/bin/env sh #!/usr/bin/env sh
set -e set -xe
mkdir -p /tmp/openbsd_app/{stable,current} mkdir -p /tmp/openbsd_app/{stable,current}
CURRENT_FILE=${1:-/tmp/openbsd_app/current/share/sqlports} CURRENT_FILE=${1:-/tmp/openbsd_app/current/share/sqlports}
STABLE_FILE=${2:-/tmp/openbsd_app/stable/share/sqlports} STABLE_FILE=${2:-/tmp/openbsd_app/stable/share/sqlports}
SIGNIFY="${SIGNIFY:-signify}"
CURRENT_PUB=$(readlink -f /etc/signify/openbsd-73-pkg.pub)
STABLE_PUB=$(readlink -f /etc/signify/openbsd-73-pkg.pub)
( (
cd /tmp/openbsd_app/current cd /tmp/openbsd_app/current
curl -L -O https://cdn.openbsd.org/pub/OpenBSD/snapshots/packages/amd64/sqlports-7.38.tgz curl -L -O https://cdn.openbsd.org/pub/OpenBSD/snapshots/packages/amd64/sqlports-7.38.tgz
curl -L -O https://cdn.openbsd.org/pub/OpenBSD/snapshots/packages/amd64/SHA256.sig curl -L -O https://cdn.openbsd.org/pub/OpenBSD/snapshots/packages/amd64/SHA256.sig
signify -C -p /etc/signify/openbsd-73-pkg.pub -x SHA256.sig sqlports-7.38.tgz ${SIGNIFY} -C -p ${CURRENT_PUB} -x SHA256.sig sqlports-7.38.tgz
tar -C . -zxvf sqlports-7.38.tgz tar -C . -zxvf sqlports-7.38.tgz
) )
@ -19,7 +22,7 @@ STABLE_FILE=${2:-/tmp/openbsd_app/stable/share/sqlports}
cd /tmp/openbsd_app/stable cd /tmp/openbsd_app/stable
curl -L -O https://cdn.openbsd.org/pub/OpenBSD/7.3/packages/amd64/sqlports-7.37.tgz curl -L -O https://cdn.openbsd.org/pub/OpenBSD/7.3/packages/amd64/sqlports-7.37.tgz
curl -L -O https://cdn.openbsd.org/pub/OpenBSD/7.3/packages/amd64/SHA256.sig curl -L -O https://cdn.openbsd.org/pub/OpenBSD/7.3/packages/amd64/SHA256.sig
signify -C -p /etc/signify/openbsd-73-pkg.pub -x SHA256.sig sqlports-7.37.tgz ${SIGNIFY} -C -p ${STABLE_PUB} -x SHA256.sig sqlports-7.37.tgz
tar -C . -zxvf sqlports-7.37.tgz tar -C . -zxvf sqlports-7.37.tgz
) )
@ -32,16 +35,18 @@ SQL=$(cat <<EOF
FULLPKGNAME, FULLPKGNAME,
FULLPKGPATH, FULLPKGPATH,
COMMENT, COMMENT,
DESCRIPTION); DESCRIPTION,
HOMEPAGE);
INSERT INTO INSERT INTO
%s %s
(FULLPKGNAME, FULLPKGPATH, COMMENT, DESCRIPTION) (FULLPKGNAME, FULLPKGPATH, COMMENT, DESCRIPTION, HOMEPAGE)
SELECT SELECT
fullpkgname, fullpkgname,
_paths.fullpkgpath, _paths.fullpkgpath,
comment, comment,
_descr.value _descr.value,
homepage
FROM FROM
ports._ports ports._ports
JOIN _paths ON _paths.id=_ports.fullpkgpath JOIN _paths ON _paths.id=_ports.fullpkgpath
@ -50,10 +55,21 @@ SQL=$(cat <<EOF
EOF EOF
) )
rm -f ~/openbsd.app/combined.db if [ -d ~/openbsd.app ]; then
printf "$SQL\n" ${CURRENT_FILE} \ rm -f ~/openbsd.app/combined.db
printf "$SQL\n" ${CURRENT_FILE} \
"current_ports_fts" \ "current_ports_fts" \
"current_ports_fts" | sqlite3 ~/openbsd.app/combined.db "current_ports_fts" | sqlite3 ~/openbsd.app/combined.db
printf "$SQL\n" ${STABLE_FILE} \ printf "$SQL\n" ${STABLE_FILE} \
"stable_ports_fts" \ "stable_ports_fts" \
"stable_ports_fts" | sqlite3 ~/openbsd.app/combined.db "stable_ports_fts" | sqlite3 ~/openbsd.app/combined.db
else
# dev mode
rm -f ~/src/openbsd.app/combined.db
printf "$SQL\n" ${CURRENT_FILE} \
"current_ports_fts" \
"current_ports_fts" | sqlite3 ~/src/openbsd.app/combined.db
printf "$SQL\n" ${STABLE_FILE} \
"stable_ports_fts" \
"stable_ports_fts" | sqlite3 ~/src/openbsd.app/combined.db
fi