Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAchilleas Pipinellis <axil@gitlab.com>2023-11-17 17:29:04 +0300
committerAchilleas Pipinellis <axil@gitlab.com>2023-11-17 17:34:56 +0300
commit1a38528d56f89a0fc4e381d28485d3ca4ef063d2 (patch)
treed69b442effe179f3b285a7e2c5eaafe6c290750a
parent175897054a482c2de7556f28ffe64ce3e68486e0 (diff)
Make the post-processing script fasteraxil-speedy-gonzales
Use multiple procecess with xargs. -n max-args: Use at most max-args arguments per command line. -P max-procs: Run up to max-procs processes at a time. If max-procs is 0, xargs will run as many processes as possible at a time.
-rwxr-xr-xscripts/normalize-links.sh6
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/normalize-links.sh b/scripts/normalize-links.sh
index 31a33427..95d8aa28 100755
--- a/scripts/normalize-links.sh
+++ b/scripts/normalize-links.sh
@@ -51,7 +51,8 @@ fi
# shellcheck disable=2059
printf "${COLOR_GREEN}INFO: Replacing relative URLs in $INPUT for HTML files...${COLOR_RESET}\n"
-find "${INPUT}" -type f -name '*.html' -print0 | xargs -0 "$SED" -i -e 's|href="/ee/|href="/'"$VER"'/ee/|g' \
+find "${INPUT}" -type f -name '*.html' -print0 | xargs -0 -n 2 -P 0 "$SED" -i \
+ -e 's|href="/ee/|href="/'"$VER"'/ee/|g' \
-e 's|href="/runner/|href="/'"$VER"'/runner/|g' \
-e 's|href="/omnibus/|href="/'"$VER"'/omnibus/|g' \
-e 's|href="/charts/|href="/'"$VER"'/charts/|g' \
@@ -79,7 +80,8 @@ find "${INPUT}" -type f -name '*.js' -print0 | xargs -0 "$SED" -i -e 's|/search/
#
# shellcheck disable=2059
printf "${COLOR_GREEN}INFO: Replacing full URLs in $INPUT for HTML files...${COLOR_RESET}\n"
-find "${INPUT}" -type f -name '*.html' -print0 | xargs -0 "$SED" -i -e '/\(rel="canonical"\|property="og:url"\)/! s|href="https://docs.gitlab.com/ee/|href="/'"$VER"'/ee/|g' \
+find "${INPUT}" -type f -name '*.html' -print0 | xargs -0 -n 2 -P 0 "$SED" -i \
+ -e '/\(rel="canonical"\|property="og:url"\)/! s|href="https://docs.gitlab.com/ee/|href="/'"$VER"'/ee/|g' \
-e '/\(rel="canonical"\|property="og:url"\)/! s|href="https://docs.gitlab.com/runner/|href="/'"$VER"'/runner/|g' \
-e '/\(rel="canonical"\|property="og:url"\)/! s|href="https://docs.gitlab.com/omnibus/|href="/'"$VER"'/omnibus/|g' \
-e '/\(rel="canonical"\|property="og:url"\)/! s|href="https://docs.gitlab.com/charts/|href="/'"$VER"'/charts/|g' \