Speedup ports install
Baptiste Daroussin
bapt at FreeBSD.org
Wed Oct 28 07:22:39 UTC 2015
On Tue, Oct 27, 2015 at 10:05:49PM -0700, soralx at cydem.org wrote:
>
> Howdy!
>
> I have a suggestion: to significantly speedup the packaging phase
> when installing ports, pass '-f tgz' flag to `pkg create`:
> --- Mk/bsd.commands.mk (revision 400371)
> +++ Mk/bsd.commands.mk (working copy)
> @@ -126,7 +126,7 @@
> PKG_DELETE?= ${PKG_BIN} delete -y
> PKG_INFO?= ${PKG_BIN} info -g
> PKG_VERSION?= ${PKG_BIN} version
> -PKG_CREATE?= ${PKG_BIN} create
> +PKG_CREATE?= ${PKG_BIN} create -f tgz
> PKG_ADD?= ${PKG_BIN} add
> PKG_QUERY?= ${PKG_BIN} query
>
> This way, gzip will be used instead of default xz (which
> is very slow). The extra compression of xz is not needed,
> as the package file will be deleted shortly anyway.
>
> Same idea applies to portmaster. Change
> pkg_create="pkg create "
> to
> pkg_create="pkg create -f tgz "
> on line 1916 of 'portmaster' script.
>
> Ports install a lot faster this way, even on a machine with a fast CPU
> (especially noticeable when doing portupgrade with lots of small ports).
>
> Example. [root at soralx /usr/ports/science/paraview]# time make package
> With xz:
> ===> Building package for paraview-4.3.1_1
> real 1m41.120s
> user 1m40.070s
> sys 0m1.089s
> With gzip:
> ===> Building package for paraview-4.3.1_1
> real 0m15.931s
> user 0m15.010s
> sys 0m0.925s
> Note that `make package` will still produce xz-compressed file after
> the flag is added to "PKG_CREATE"; I changed the behaviour only for
> this example, to demonstrate the time difference (factor of ~6.7).
>
When installing a port there is no packaging phase. pkg register which is used
during make install uses the stage directory "as an archive" directly so there
is no compression at all.
portupgrade/portmaster is another storry, IIRC portmaster only creates packages
as backup of the installed version just in case the new package will fail it can
reinstall the old one in that case, yes a tgz would be way faster, you can even
chose plain tar to even more reduce the over head. for portupgrade I do not
remember what it does. Note that the backup thing of portmaster could now
possibly be removed since the ports tree support staging because now the ports
tree checks that everything is ok before installing on the system, but that
would require even more refactoring.
Bapt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20151028/15c9c444/attachment.bin>
More information about the freebsd-ports
mailing list