Thursday, October 10, 2024

Extracting all distfiles

Sometimes people wish to grep for something over the extracted
distfiles of all ports.

Extracting all distfiles takes about 428G of disk space right now.
You need to have these extraction tools installed:
bzip2, cabextract, gtar, rpm2cpio, unrar, unzip, xz, zstd.

In /usr/ports, use this command:
$ make extract WRKOBJDIR=/some/path NO_DEPENDS=1 NO_IGNORE=1 \
REPORT_PROBLEM=true

Some ports may report errors because they try to run complex commands
in post-extract for which you don't have the dependencies installed.
We can ignore that. REPORT_PROBLEM is a hook for actions when a
port errors out; setting it to run true(1) just ignores the error.

Note that you can also use SKIPDIR='foo/bar baz/qux' to skip
individual ports, and STARTDIR=foo/bar to start from a particular
port rather than the beginning.

You probably want to dedicate a separate file system or even drive
to hold the extracted source, and you want to mount it async for
the extraction. Unpacking all distfiles will take a while; five
hours on my machine.

The most convenient way to fetch all distfiles in the first place
is "dpb -F<n>", where <n> is the number of parallel fetches to run.
This doesn't need any dpb(1) setup.

--
Christian "naddy" Weisgerber naddy@mips.inka.de

No comments:

Post a Comment