#shell #script #performance #go #module #awk #pkgsrc

build mktool

General purpose utility to enhance pkgsrc/mk infrastructure

24 releases (3 stable)

new 1.1.0 Sep 13, 2024
1.0.1 Sep 13, 2024
0.1.21 Sep 10, 2024
0.1.20 Aug 29, 2024

#19 in Build Utils

Download history 82/week @ 2024-07-28 702/week @ 2024-08-04 27/week @ 2024-08-11 760/week @ 2024-08-18 545/week @ 2024-08-25 24/week @ 2024-09-01 508/week @ 2024-09-08

1,838 downloads per month

ISC license

53KB
870 lines

mktool

This is a collection of utilities that provide alternate implementations for parts of the pkgsrc mk infrastructure.

Many targets under pkgsrc/mk are implemented using a combination of shell and awk, and can suffer from a lack of performance, especially when input sizes grow.

For example, with the profligation of Go modules used in newer Go software, www/grafana now has over 5,000 distfiles. This exposes various issues in the current pkgsrc scripts that are difficult to work around. This tool implements replacements with the following performance improvements when running in www/grafana on a 32-core SmartOS host:

Command Existing pkgsrc scripts mktool Speedup
bmake checksum 10 seconds 2 seconds 5x
bmake distinfo 3 minutes, 30 seconds 2 seconds 100x
bmake fetch 47 minutes, 58 seconds 5 seconds 500x

As pkgsrc strives to be as portable as possible, at no point will any of the commands implemented by mktool become mandatory. This tool simply exists for those who are able to run Rust software to dramatically improve pkgsrc performance.

Installation

Install using cargo:

$ cargo install mktool

and add the following to mk.conf:

TOOLS_PLATFORM.mktool=  ${HOME}/.cargo/bin/mktool

You will also need to apply changes to pkgsrc. The changes are in the dev/mktool branch, and you can get them all as a single patch file here.

Commands

These are the commands currently implemented:

Command Replaces
checksum mk/checksum/checksum.awk
ctfconvert mk/install/install.mk:install-ctf
digest pkgtools/digest
distinfo mk/checksum/distinfo.awk
fetch mk/fetch/fetch
symlinks pkgtools/mktools

All of the replacements are activated upon setting TOOLS_PLATFORM.mktool. In addition, packages no longer have build dependencies on pkgtools/digest and pkgtools/mktools (unless specifically requested).

Minimum Support Rust Version

Currently 1.74.0.

The edition is set to 2021, so in theory I'd like to have 1.56.0 as the MSRV, but newer releases are currently required due to clap and tokio dependency requirements.

Dependencies

~11–24MB
~394K SLoC