This is a CGI application to provide package information using apt. Currently available at https://pkginfo.devuan.org/cgi-bin/policy-query.xml
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Ralph Rönnquist a9edf8735d add submit button to the search form 1 day ago
css reorganized sources 7 months ago
etc/apt added ppc64el 2 weeks ago
templates add submit button to the search form 1 day ago
usr initial capture 8 months ago
var/lib/dpkg initial capture 8 months ago
.gitignore added 5 months ago
README.adoc editorial 5 months ago
debtree-query.sh added Content-Type 1 day ago
description.xml added 5 months ago
file-query.sh added Content-Type 1 day ago
package-query.sh added Content-Type 1 day ago
policy-query.sh added Content-Type 1 day ago
update.sh Merge branch 'server-xslt' 5 months ago
whatsit.conf Merge branch 'server-xslt' 5 months ago

README.adoc

tellpackage

This is a CGI application to provide package information using apt.

Currently available at https://pkginfo.devuan.org

Description

The Web interface includes a "search box" for filling in an argument for an apt-cache policy run in an apt runtime context that includes all current Devuan source points. The result of that run is presented as given and including links for a package version detail lookup using apt-cache show.

The package detail view includes links to perform new pacakge-query lookups for related (dependent) packages, as well as for manually downloading the deb file concerned. There is also a button to trigger a debtree run for the (unversioned) package name to get the resulting diagram presented as an inline svg image.

Note that debtree is not strong in handling package versions and it simply shows a graph involving the "latest" of everything rather than a graph relating to the original (versioned) package view.

Thus, the CGI application runs three command lines:

  $ apt-cache policy "$QUERY"
  $ apt-cache show "$PACKAGE=$VERSION"
  $ debtree "$PACKAGE"

The command outputs are further filtered into bespoke XML 1.0 representations that become the bases for the views that browsers typically render by applying the nominated XSL 3.0 stylesheets.

In other words, a request handling flow is as follows:

  1. The request is first translated into its servicing script by means of a link from the interface name (e.g., package-query.xml or package-query.html) to the actual script (e.g., package-query.sh). As per the normal CGI 1.1 Specification the query string is given to the script via the environment variable QUERY_STRING.

  2. The servicing script runs the actual command with its argument provided as detail for the q parameter in the query string, and decorates the command output to make up an XML object tree that includes a stylesheet link for the applicable stylesheet (e.g. css/package-query.xsl).

  3. The XML file has an XSL association for translating the XML "tree" into an HTML tree. If the servicing cgi script is accessed via an ".html" filename, then the XSL processing is done by the server, and otherwise the "raw" XML is passed on for XSL processing by client browser.

    Either way the server or client processes the associated XSL stylesheet, to transform the bespoke XML into an HTML 4.01 document according to the transformation rules. The HTML document is a bare structure of plain elements with bespoke identities and class assignments. It also includes nominations fo CSS 2.1 files to load for layout particulars and looks.

  4. The browser upon processing the HTML document discovers the CSS associations and therefore loads and processes the associated CSS stylesheets.

  5. Eventually the browser will map the rendered result to the display for the user to view.

Installation

The scripts use a local apt environment which consists of a special purpose configuration file whatis.conf that in particular nominates a RootDir that is the root directory for the pathnames to other configuration files and working directories. Especially the etc/apt/sources.list.d/ directory that contains the lists files of source points for package collections.

The CGI application includes a background job (./update.sh) to keep the local configuration up to date with the source points. This is simply a regular apt-get update run in the local apt environment.

The interface side includes a "cgi directory" with links:

the cgi-bin/ links
debtree-query.html -> ../../tellpackage/debtree-query.sh
debtree-query.xml  -> ../../tellpackage/debtree-query.sh
file-query.html    -> ../../tellpackage/file-query.sh
file-query.xml     -> ../../tellpackage/file-query.sh
package-query.html -> ../../tellpackage/package-query.sh
package-query.xml  -> ../../tellpackage/package-query.sh
policy-query.html  -> ../../tellpackage/policy-query.sh
policy-query.xml   -> ../../tellpackage/policy-query.sh

The *.xml links implement client-side XSLT access, and the \*.html links implement server-side XSLT access.

The app uses CSS from https://beta.devuan.org/ui/css/pkginfo which is hard-coded into templates/common.xsl.

nginx configuration fragments

# This rewrite preserves the now outdated access URLs
rewrite ^/xsl-bin/(.*)$ /cgi-bin/$1 permanent;
# Redirect blank access to /index.html
location ~ ^/$ {
    return 301 https://$server_name/index.html;
}
# Redirect /index.html to an empty policy-query
location /index.html {
    return 301 https://$server_name/cgi-bin/policy-query.html;
}
# Serve xsl files verbatim
location /cgi-bin/templates/ {
    root /nfs/web/pkginfo.devuan.org/tellpackage;
    rewrite ^/cgi-bin/(.*)$ /$1 break;
}
# Serve description.xml verbatim (for client-side xslt)
location /cgi-bin/description.xml {
    root /nfs/web/pkginfo.devuan.org/tellpackage;
    rewrite ^/cgi-bin/(.*)$ /$1 break;
}
# Serve /cgi-bin/ via the web app
location /cgi-bin/ {
    gzip off;
    autoindex off;
    root  /nfs/web/pkginfo.devuan.org/public;
    # Fastcgi socket
    fastcgi_pass  unix:/var/run/fcgiwrap.socket;
    # Fastcgi parameters, include the standard ones
    include /etc/nginx/fastcgi_params;
}