Gentoo Archives: gentoo-alt

From: Etienne Buira <etienne.buira.lists@××××.fr>
To: gentoo-alt@l.g.o
Subject: [gentoo-alt] bootstrap-prefix.sh: fix portdir update logic
Date: Wed, 17 Aug 2022 03:08:54
Message-Id: YvxbwrldSDagJyw6@Z926fQmE5jqhFMgp6
1 bootstrap-prefix.sh: fix portdir update logic
2
3 It was previously triggering unneeded updates, potentially based on
4 non-existing file timestamp.
5
6 diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh
7 index 0635887745..0d842f984b 100755
8 --- a/scripts/bootstrap-prefix.sh
9 +++ b/scripts/bootstrap-prefix.sh
10 @@ -2249,18 +2249,18 @@ bootstrap_stage3() {
11 # Switch to the proper portage.
12 hash -r
13
14 - # Update the portage tree.
15 estatus "stage3: updating Portage tree"
16 - treedate=$(date -f "${PORTDIR}"/metadata/timestamp +%s)
17 - nowdate=$(date +%s)
18 - [[ ( ! -e ${PORTDIR}/.unpacked ) && \
19 - $((nowdate - (60 * 60 * 24))) -lt ${treedate} ]] || \
20 - if [[ ${OFFLINE_MODE} ]]; then
21 - # --keep used ${DISTDIR}, which make it easier to download a
22 - # snapshot beforehand
23 - emerge-webrsync --keep || return 1
24 - else
25 - emerge --color n --sync || emerge-webrsync || return 1
26 + if [[ -e "${PORTDIR}"/metadata/timestamp ]]; then
27 + treedate=$(date -f "${PORTDIR}"/metadata/timestamp +%s)
28 + nowdate=$(date +%s)
29 + [[ $((nowdate - (60 * 60 * 24))) -lt ${treedate} ]] && \
30 + if [[ ${OFFLINE_MODE} ]]; then
31 + # --keep used ${DISTDIR}, which make it easier to download a
32 + # snapshot beforehand
33 + emerge-webrsync --keep || return 1
34 + else
35 + emerge --color n --sync || emerge-webrsync || return 1
36 + fi
37 fi
38
39 # Avoid installing git or encryption just for fun while completing @system