mktool

pkgsrc mk helper tool

Downloads
8.1K
Stars
4

mktool

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

Benchmarks

The main focus is on performance. Here are some real-world numbers showing improvements seen, compared to the baseline shell/awk implementations:

Script / Target Without mktool With mktool Speedup
check-portability 35s 1s 30x
check-shlibs 20s <1s 30x
checksum 10s 2s 5x
ctfconvert 40m 39s 5m 13s 8x
distinfo 3m 30s 2s 100x
fetch 47m 58s 5s 500x
wrapper 1m 41s 9s 11x

User Improvements

As well as superior performance, where possible mktool also aims to provide an improved user experience. For example the fetch replacement features a significantly better progress bar and streamlined output compared to other available fetch backends (see terminal recording).

Installation

The preferred method of installation is using cargo:

$ cargo install mktool

and adding the following to mk.conf:

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

However there is also a pkgtools/mktool package if you prefer to use that.

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.

See the FAQ below for why this is not yet committed.

Commands

These are the commands currently implemented:

Command Replaces
check-portability mk/check/check-portability.awk
check-shlibs mk/check/check-shlibs-*.awk
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, with the exception of fetch which also requires FETCH_USING=mktool in case the user has specific requirements for their fetch program.

In addition, packages no longer have build dependencies on pkgtools/digest and pkgtools/mktools (unless specifically requested).

FAQ

Why Have The Patches Not Been Merged Into pkgsrc?

I am uncomfortable committing changes that other developers have objections to. While the overwhelming response has been positive, there are still concerns from some that introducing mktool support will eventually lead to a mandatory requirement on Rust in the future. I hope that my actions will eventually lead to these fears being allayed and the patches can be committed.

Will This Ever Be Mandatory?

No. pkgsrc supports over 20 operating systems, and on NetBSD alone 16 different CPU architectures. Rust will never support all of those systems, so the default will always be the portable shell and awk scripts.

What Is The 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.