Go to file
John McQuah c1676f0167 prtcreate: edit templates
portspage: fall back to $PWD when no args are passed
2024-04-21 02:09:22 +00:00
doc Makefile: bump version to 1.3.3 2024-04-18 01:00:34 +00:00
lib/prtverify Makefile: bump version to 1.3.3 2024-04-18 01:00:34 +00:00
revdep added README, reorganized repo into subdirectories 2024-03-31 00:12:10 +00:00
scripts prtcreate: edit templates 2024-04-21 02:09:22 +00:00
share prtcreate: edit templates 2024-04-21 02:09:22 +00:00
CHANGES portspage: recurse subdirectories only to depth 1 2024-04-16 19:03:02 +00:00
INSTALL added README, reorganized repo into subdirectories 2024-03-31 00:12:10 +00:00
Makefile Makefile: bump version to 1.3.3 2024-04-18 01:00:34 +00:00
README.md Makefile: bump version to 1.3.3 2024-04-18 01:00:34 +00:00
TODO man-pages: fix some groff syntax errors 2024-03-29 12:49:51 +00:00


prt-utils is a collection of tools for CRUX, mainly oriented towards package and port management. prt-utils is available in the opt collection.


Please refer to the manual pages included in the package.

Included tools

Name Author(s) Description
dllist Johannes Winkelmann List files to be downloaded to install a port
finddeps Johannes Winkelmann Find actual dependencies for a port
findredundantdeps Han Boetes, Johannes Winkelmann Find unnecessary dependencies of a port
oldfiles Simone Rota List old sources and packages from centralized dirs
pkg_installed Han Boetes Create under /usr/ports/installed a symlink to each installed port
pkgexport Andrew Green Reconstruct a native CRUX package from the components installed on main or mounted filesystem
pkgfoster Jukka Heino Clean up orphaned packages, i.e., packages which no other package depends on
pkgsize Damir Saric Calculate the disk usage of an installed package
portspage Jukka Heino Generate html index of a directory containing ports
prtcheck Martin Opel Ensure that the port directory is complete and the Pkgfile defines essential fields
prtcheckmissing Martin Opel Check for missing files
prtcheckperms John McQuah Check for permissions that have diverged from what the maintainer intended
prtcreate Martin Opel Create a Pkgfile from a template for new ports
prtorphan Martin Opel Check for orphaned packages or files on your system
prtrej Markus Ackermann, Martin Opel Interactively go through the list of files that have been rejected by pkgadd, and decide what to do about each one
prtsweep Martin Opel Remove old files from the ports tree
prtverify Jürgen Daubert Validate CRUX ports with an extensive set of tests
prtwash Simone Rota Clean up a ports tree
revdep James Buren Check for installed packages that are linked to nonexistent libraries

Sorted by language

Language Tool(s)
bash dllist, findredundantdeps, pkg_installed, pkgexport, pkgfoster, pkgsize, prtcheck, prtcreate, prtrej
C++ revdep
awk finddeps, prtverify
perl oldfiles, portspage, prtcheckmissing, prtcheckperms, prtsweep, prtwash

Sorted by the way they get their information

This table might prove useful if we later make breaking changes to pkgutils (specifically the Pkgfile format and the package database), prt-get, or their config files.

Data source Tool(s)
package database (opened directly by the program itself) finddeps, oldfiles, prtcheckmissing, prtcheckperms, prtorphan, prtverify, revdep
package database (opened by calling pkginfo) pkgsize
signature or footprint parsed in the script itself oldfiles, prtcheck, prtsweep, prtverify
/etc/pkgmk.conf parsed by the script oldfiles, dllist
Pkgfile parsed in the script (not sourced) prtverify, portspage
Pkgfile sourced by the script or a subshell dllist, pkgsize, prtcheck, prtwash
/etc/prt-get.conf parsed by the script itself pkgfoster, prtorphan, oldfiles, prtwash
prt-get printf finddeps, oldfiles, pkg_installed, prtcheckperms
prt-get (other command) dllist, findredundantdeps, pkgexport, pkgfoster, pkgsize, prtorphan, prtwash, prtverify

Sorted by expected environment and argument

(empty field = no restrictions)

$PWD Argument Tool(s) Historical precedent
the directory of a port collection portspage httpup-repgen
the directory of a port collection not required, only toggles the mode portspage httpup-repgen
the directory of an individual port not required, only toggles the mode prtcheck, prtcreate pkgmk
not required, only toggles the mode oldfiles, pkgfoster, pkg_installed, prtrej, prtcheckmissing, prtcheckperms prt-get listinst
at least one directory prtverify none?
either the "automatic mode" option, or at least one directory prtwash, prtsweep none?
one installed port pkgexport pkginfo -l
one port in an active collection dllist, finddeps, findredundantdeps prt-get info
one or more port names, found in the package database or in the active collections pkgsize none?
one or more port names (must belong to an active collection) dllist, findredundantdeps prt-get depinst


Sourcing Pkgfile

The tools that require sourcing the Pkgfile either do so themselves, or spawn another bash process to obtain the necessary information. Thus, to implement such a tool in a language other than bash would insert an extra layer between the user-facing side and the side that deals with the ports tree. For now the only tool with such a translation layer is prtwash. The most promising candidates for a future rewrite are:

  • dllist
  • pkgsize
  • prtcheck

Open a Gitea pull request if you write a replacement for one of the scripts above and want it included in the next version of prt-utils.

History of rewrites

  • revdep was the original name of a shell script by Johannes Winkelmann, which proved so popular that the same name was retained for the C++ rewrite.
  • finddeps attracted attention beyond the CRUX community thanks to the blog posts of a former Slackware user, who developed a workflow for deploying binary packages that relied heavily on finddeps. With such a reputation to uphold, the awk rewrite of finddeps (first unveiled in prt-utils 1.3.2) cannot afford to exhibit worse performance than its bash predecessor. If you observe such a degradation, file a Gitea issue here.
  • prtsweep and prtwash were rewritten in Perl for prt-utils 1.3, incorporating the well-established Perl idioms of oldfiles and prtcheckmissing for parsing the ports drivers and prt-get.conf. Their previous incarnations as bash scripts had grown too unwieldy in the aftermath of pkgmk becoming able to rename downloaded sources, and it was deemed easier to start afresh in a new language.
  • prtverify was originally designed with the user-facing part written in bash and the modules written in awk. Starting with prt-utils 1.3.2, the default prtverify program uses awk as its sole interpreter (with the bash wrapper available as a fallback for those users who prefer not changing things that aren't broken).

Consistency with httup-repgen

The tools descended from httpup-repgen diverged in the way they chose to interpret the first (non-mandatory) argument passed on the command line:

  • as the name of a directory, the same way httpup-repgen does (portspage)
  • as the name of a subdirectory under $PWD (pkg-repgen)

Starting with prt-utils 1.3.3, portspage will now treat any subsequent arguments the same way that pkg-repgen treats its non-mandatory arguments: as the names of individual ports that should be inserted or overwritten in the previously-generated index. This feature lets you apply quick updates to a large port collection, without needing to recurse through every subdirectory. But portspage continues to interpret its first argument as the name of a directory, in keeping with its intended use as a cgi script on a webserver (where it might be desired to serve the index from a nearby directory, not the collection itself). Until pkg-repgen adopts a similar convention (distinguishing between $ARGV[1] and subsequent arguments), users who invoke all three tools outside of a scripted update procedure are thus advised to remind themselves how to construct each command.