Date: Wed, 28 Apr 2021 05:33:59 GMT From: Tobias Kortkamp <tobik@FreeBSD.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-branches@FreeBSD.org Subject: git: 057872f5b803 - 2021Q2 - Speed up USES=cargo ports ops Message-ID: <202104280533.13S5XxXW046672@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch 2021Q2 has been updated by tobik: URL: https://cgit.FreeBSD.org/ports/commit/?id=057872f5b803cff3eed89921a54a2e70f7c7dc9e commit 057872f5b803cff3eed89921a54a2e70f7c7dc9e Author: Tobias Kortkamp <tobik@FreeBSD.org> AuthorDate: 2021-04-14 11:53:37 +0000 Commit: Tobias Kortkamp <tobik@FreeBSD.org> CommitDate: 2021-04-28 05:31:36 +0000 Speed up USES=cargo ports ops MASTER_SITES aliases processing in the framework is very inefficient and the CRATESIO indirection is not worth it. Normally ports only have a handful of sites at most, but USES=cargo currently adds one site for each crate by necessity. The inefficiency suddenly matters a lot. By consuming MASTER_SITE_CRATESIO directly we can sidestep this issue without losing anything. Before: $ time make -C www/zola -V MASTER_SITES >/dev/null 4.21 real 4.14 user 0.03 sys After: $ time make -C www/zola -V MASTER_SITES >/dev/null 0.60 real 0.58 user 0.02 sys (cherry picked from commit ffd4db6b940600e78ab01f8ef06bb3e7629f48e6) --- Mk/Uses/cargo.mk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Mk/Uses/cargo.mk b/Mk/Uses/cargo.mk index 226e3ebdb132..36bf3c72c2d6 100644 --- a/Mk/Uses/cargo.mk +++ b/Mk/Uses/cargo.mk @@ -15,7 +15,7 @@ IGNORE+= USES=cargo takes no arguments .endif # List of static dependencies. The format is cratename-version. -# CARGO_CRATES will be downloaded from MASTER_SITES_CRATESIO. +# CARGO_CRATES will be downloaded from MASTER_SITE_CRATESIO. CARGO_CRATES?= # List of features to build (space separated list). @@ -35,7 +35,8 @@ CARGO_DIST_SUBDIR?= rust/crates # Generate list of DISTFILES. .for _crate in ${CARGO_CRATES} -MASTER_SITES+= CRATESIO/${_crate:C/^([-_a-zA-Z0-9]+)-[0-9].*/\1/}/${_crate:C/^[-_a-zA-Z0-9]+-([0-9].*)/\1/}:cargo_${_crate:C/[^a-zA-Z0-9_]//g} +# Resolving CRATESIO alias is very inefficient with many MASTER_SITES, consume MASTER_SITE_CRATESIO directly +MASTER_SITES+= ${MASTER_SITE_CRATESIO:S,%SUBDIR%,${_crate:C/^([-_a-zA-Z0-9]+)-[0-9].*/\1/}/${_crate:C/^[-_a-zA-Z0-9]+-([0-9].*)/\1/},:S,$,:cargo_${_crate:C/[^a-zA-Z0-9_]//g},} DISTFILES+= ${CARGO_DIST_SUBDIR}/${_crate}.tar.gz:cargo_${_crate:C/[^a-zA-Z0-9_]//g} .endfor
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202104280533.13S5XxXW046672>