Gentoo Archives: gentoo-commits

From: Fabian Groffen <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/prefix:master commit in: scripts/
Date: Sat, 02 Jan 2021 11:35:28
Message-Id: 1609587228.9fcb6ef5e9520ac812f28feae6044a9b79712ecf.grobian@gentoo
1 commit: 9fcb6ef5e9520ac812f28feae6044a9b79712ecf
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Sat Jan 2 11:33:48 2021 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Sat Jan 2 11:33:48 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=9fcb6ef5
7
8 scripts/bootstrap-prefix: show bootstrap status in terminal window title
9
10 This really is unnecessary candy,
11 but I like something sweet during the long wait.
12
13 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
14
15 scripts/bootstrap-prefix.sh | 40 ++++++++++++++++++++++++++++++----------
16 1 file changed, 30 insertions(+), 10 deletions(-)
17
18 diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh
19 index e5bcff41a6..82b8693832 100755
20 --- a/scripts/bootstrap-prefix.sh
21 +++ b/scripts/bootstrap-prefix.sh
22 @@ -3,22 +3,26 @@
23
24 trap 'exit 1' TERM KILL INT QUIT ABRT
25
26 -# some basic output functions
27 -eerror() { echo "!!! $*" 1>&2; }
28 -einfo() { echo "* $*"; }
29 -
30 # RAP (libc) mode is triggered on Linux kernel and glibc.
31 is-rap() { [[ ${PREFIX_DISABLE_RAP} != "yes" && ${CHOST} = *linux-gnu* ]]; }
32 rapx() { is-rap && echo $1 || echo $2; }
33
34 ## Functions Start Here
35
36 -v() {
37 - echo "$@"
38 - "$@"
39 +estatus() {
40 + # this can give some garbage in the logs, but it shouldn't be too
41 + # disturbing -- if it works, it makes it easy to see where we are in
42 + # the bootstrap from the terminal status line (usually the window
43 + # name)
44 + printf '\033]2;'"$*"'\007'
45 }
46
47 +eerror() { estatus $*; echo "!!! $*" 1>&2; }
48 +einfo() { echo "* $*"; }
49 +v() { echo "$@"; "$@"; }
50 +
51 econf() {
52 + estatus "stage1: configuring ${PWD##*/}"
53 v ${CONFIG_SHELL} ./configure \
54 --host=${CHOST} \
55 --prefix="${ROOT}"/tmp/usr \
56 @@ -32,6 +36,9 @@ econf() {
57 }
58
59 emake() {
60 + [[ $* == *install* ]] \
61 + && estatus "stage1: installing ${PWD##*/}" \
62 + || estatus "stage1: building ${PWD##*/}"
63 v $MAKE ${MAKEOPTS} "$@" || return 1
64 }
65
66 @@ -41,7 +48,7 @@ efetch() {
67 echo "I need ${1##*/} from $1 in $DISTDIR, can you give it to me?"
68 read
69 [[ -e ${DISTDIR}/${1##*/} ]] && return 0
70 - #Give fetch a try
71 + # Give fetch a try
72 fi
73
74 if [[ -z ${FETCH_COMMAND} ]] ; then
75 @@ -69,6 +76,7 @@ efetch() {
76
77 mkdir -p "${DISTDIR}" >& /dev/null
78 einfo "Fetching ${1##*/}"
79 + estatus "stage1: fetching ${1##*/}"
80 pushd "${DISTDIR}" > /dev/null
81
82 # try for mirrors first, fall back to distfiles, then try given location
83 @@ -513,6 +521,7 @@ do_tree() {
84 fi
85 [[ -e ${PORTDIR} ]] || mkdir -p ${PORTDIR}
86 einfo "Unpacking, this may take a while"
87 + estatus "stage1: unpacking Portage tree"
88 bzip2 -dc ${DISTDIR}/$2 | \
89 tar -xf - -C ${PORTDIR} --strip-components=1 || return 1
90 touch ${PORTDIR}/.unpacked
91 @@ -530,6 +539,7 @@ bootstrap_tree() {
92 fi
93 local ret=$?
94 if [[ -n ${TREE_FROM_SRC} ]]; then
95 + estatus "stage1: rsyncing Portage tree"
96 rsync -av --delete \
97 --exclude=.unpacked \
98 --exclude=distfiles \
99 @@ -904,6 +914,7 @@ bootstrap_gnu() {
100 einfo "Compiling ${A%.tar.*}"
101 econf ${myconf} || return 1
102 if [[ ${PN} == "make" && $(type -t $MAKE) != "file" ]]; then
103 + estatus "stage1: building ${A%.tar.*}"
104 v ./build.sh || return 1
105 else
106 emake || return 1
107 @@ -911,6 +922,7 @@ bootstrap_gnu() {
108
109 einfo "Installing ${A%.tar.*}"
110 if [[ ${PN} == "make" && $(type -t $MAKE) != "file" ]]; then
111 + estatus "stage1: installing ${A%.tar.*}"
112 v ./make install MAKE="${S}/make" || return 1
113 else
114 emake install || return 1
115 @@ -1115,6 +1127,7 @@ bootstrap_cmake() {
116 Source/cmTimestamp.cxx
117
118 einfo "Bootstrapping ${A%.tar.*}"
119 + estatus "stage1: configuring ${A%.tar.*}"
120 ./bootstrap --prefix="${ROOT}"/tmp/usr || return 1
121
122 einfo "Compiling ${A%.tar.*}"
123 @@ -1509,6 +1522,7 @@ bootstrap_stage1() {
124 [[ -e ${ROOT}/tmp/usr/bin/emerge ]] || (bootstrap_portage) || return 1
125 prepare_portage
126
127 + estatus "stage1 finished"
128 einfo "stage1 successfully finished"
129 }
130
131 @@ -1598,6 +1612,7 @@ do_emerge_pkgs() {
132 # defaults).
133 echo "USE=${myuse[*]} PKG=${pkg}"
134 (
135 + estatus "${STAGE}: emerge ${pkg}"
136 unset CFLAGS CXXFLAGS
137 [[ -n ${OVERRIDE_CFLAGS} ]] \
138 && export CFLAGS=${OVERRIDE_CFLAGS}
139 @@ -1640,6 +1655,7 @@ bootstrap_stage2() {
140
141 emerge_pkgs() {
142 EPREFIX="${ROOT}"/tmp \
143 + STAGE=stage2 \
144 do_emerge_pkgs "$@"
145 }
146
147 @@ -1789,6 +1805,7 @@ bootstrap_stage2() {
148 cp "${ROOT}"/tmp/usr/${CHOST}/lib/gcc/* "${ROOT}"/usr/${CHOST}/lib/gcc
149 fi
150
151 + estatus "stage2 finished"
152 einfo "stage2 successfully finished"
153 }
154
155 @@ -1857,6 +1874,7 @@ bootstrap_stage3() {
156 EPREFIX="${ROOT}" PORTAGE_TMPDIR="${PORTAGE_TMPDIR}" \
157 FEATURES="${FEATURES} force-prefix" \
158 EMERGE_LOG_DIR="${ROOT}"/var/log \
159 + STAGE=stage3 \
160 do_emerge_pkgs "$@"
161 }
162
163 @@ -1954,8 +1972,8 @@ bootstrap_stage3() {
164
165 # avoid circular deps with sys-libs/pam, bug#712020
166 pkgs=(
167 - sys-apps/attr
168 - sys-libs/libcap
169 + sys-apps/attr
170 + sys-libs/libcap
171 )
172 BOOTSTRAP_RAP=yes \
173 USE="${USE} -pam" \
174 @@ -2063,6 +2081,7 @@ bootstrap_stage3() {
175 hash -r
176
177 # Update the portage tree.
178 + estatus "stage3: updating Portage tree"
179 treedate=$(date -f "${PORTDIR}"/metadata/timestamp +%s)
180 nowdate=$(date +%s)
181 [[ ( ! -e ${PORTDIR}/.unpacked ) && \
182 @@ -2094,6 +2113,7 @@ bootstrap_stage3() {
183 # (--depclean may fail, which is ok)
184 sed -i -e 's/resume/cleared/' "${ROOT}"/var/cache/edb/mtimedb
185
186 + estatus "stage3 finished"
187 einfo "stage3 successfully finished"
188 }