Skip to content

Commit f28930a

Browse files
committed
install-dependencies: decreased verbosity of script
and added debug log messages Ticket: ENT-12600 Signed-off-by: Lars Erik Wik <[email protected]>
1 parent da4eee8 commit f28930a

File tree

1 file changed

+28
-12
lines changed

1 file changed

+28
-12
lines changed

build-scripts/install-dependencies

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,17 @@ check_and_install_perl()
3939
PERL_OK=yes
4040
PERL_MINOR_VERSION=$($PERL -e 'print "$]"."\n"' | cut -d. -f2)
4141
if [ "$PERL_MINOR_VERSION" -lt 013004 ]; then
42-
echo "$PERL version is $PERL_MINOR_VERSION," \
43-
"too old"
42+
log_debug $PERL version is too old (minor version $PERL_MINOR_VERSION)
4443
PERL_OK="no"
4544
fi
4645

4746
if ! $PERL -e 'use List::Util qw(pairs);'; then
48-
echo "$PERL has List::Util that does not export pairs. Needs to be at least version 1.29 for OpenSSL version 3.3.2."
47+
log_debug $PERL has List::Util that does not export pairs. Needs to be at least version 1.29 for OpenSSL version 3.3.2.
4948
PERL_OK="no"
5049
fi
5150

5251
if [ "$PERL_OK" != "yes" ]; then
53-
echo "$PERL is too old or modules are missing, building new one from source..."
52+
log_debug $PERL is too old or modules are missing, building new one from source...
5453

5554
# -fno-stack-protector: Ensure built perl will not depend on libssp.so
5655
if echo | gcc -E -fno-stack-protector - >/dev/null 2>&1; then
@@ -77,16 +76,26 @@ check_and_install_perl()
7776
# from the perl dev team - they are only intended for development
7877
PERL_VERSION=5.40.1
7978
PERL_SHA256=02f8c45bb379ed0c3de7514fad48c714fd46be8f0b536bfd5320050165a1ee26
80-
wget https://www.cpan.org/src/5.0/perl-${PERL_VERSION}.tar.gz
79+
80+
log_debug Fetching perl tarball...
81+
run_and_print_on_failure wget https://www.cpan.org/src/5.0/perl-${PERL_VERSION}.tar.gz
8182
if [ "$(func_sha256 perl-${PERL_VERSION}.tar.gz)" != "${PERL_SHA256}" ]; then
8283
fatal "perl checksum error"
8384
fi
85+
86+
log_debug Extracting perl tarball...
8487
gzip -dc perl-${PERL_VERSION}.tar.gz | tar xf -
8588
cd perl-${PERL_VERSION}
86-
./Configure -des -Dprefix="$HOME"/perl-my -Dcc=gcc -Dmake="$MAKE" \
89+
90+
log_debug Running ./Configure on perl project...
91+
run_and_print_on_failure ./Configure -des -Dprefix="$HOME"/perl-my -Dcc=gcc -Dmake="$MAKE" \
8792
"$PERL_EXTRA_FLAGS" "$PERL_CFLAGS" "$PERL_LDFLAGS" "$PERL_LDDLFLAGS"
88-
$MAKE
89-
$MAKE install
93+
94+
log_debug Running make on perl project...
95+
run_and_print_on_failure $MAKE
96+
97+
log_debug Running make install on perl project...
98+
run_and_print_on_failure $MAKE install
9099
PERL=$HOME/perl-my/bin/perl
91100
fi
92101

@@ -111,6 +120,7 @@ fi
111120

112121
# Override for manual testing
113122
if [ -n "$1" ]; then
123+
log_debug "Overriding dependency list (manual testing)"
114124
DEPS="$*"
115125
fi
116126

@@ -130,8 +140,7 @@ do
130140
tests=yes
131141
;;
132142
*)
133-
echo "Unknown build type: $BUILD_TYPE"
134-
exit 42
143+
fatal "Unknown build type: $BUILD_TYPE"
135144
;;
136145
esac
137146

@@ -146,6 +155,7 @@ do
146155
;;
147156
esac
148157

158+
# Add $PREFIX to version of built dependencies so they get different package names and are distinguishable from each
149159
revision=$(cat "$BASEDIR"/buildscripts/deps-packaging/revision)
150160
if [ "$BUILDPREFIX" != "/var/cfengine" ]; then
151161
safe_prefix="+$(echo "$PREFIX" | sed 's:/::g')"
@@ -157,28 +167,33 @@ do
157167

158168
# If package cache did not have the packages
159169
if [ -z "$package_files" ]; then
170+
log_debug Building package $dep...
160171
# BUILD the packages
161172
if [ "$dep" = "lmdb" ] && [ "$BUILD_TYPE" != "RELEASE" ]; then
162-
# Always build LMDB with debug symbols in non-release builds
173+
# Always build LMDB with debug symbols in non-release builds.
174+
# The reason is an ongoing issue where we fail to open database transactions.
175+
# See ENT-10777 for more info.
163176
"$BASEDIR/buildscripts/deps-packaging/pkg-build-$DEP_PACKAGING" \
164177
"$dep" "$tests" "$cross" "$optimize" yes "$version"
165178
else
166179
"$BASEDIR/buildscripts/deps-packaging/pkg-build-$DEP_PACKAGING" \
167180
"$dep" "$tests" "$cross" "$optimize" "$debugsym" "$version"
168181
fi
169182

183+
# Make sure package is there after building it
170184
package_files=$("pkg-find-$DEP_PACKAGING" "$BASEDIR/$dep")
171-
172185
if [ -z "$package_files" ]; then
173186
fatal "Empty output dir after building dependency: $dep"
174187
fi
175188

176189
# CACHE the newly built package
177190
# shellcheck disable=SC2086
191+
log_debug Caching package $dep...
178192
pkg-cache putpkg "$dep-$version" $package_files
179193

180194
# CLEAN UP
181195
# shellcheck disable=SC2086
196+
log_debug Removing package files for $dep...
182197
rm -f $package_files
183198

184199
# Now the package should be in the local cache
@@ -190,6 +205,7 @@ do
190205

191206
# INSTALL the packages
192207
# shellcheck disable=SC2086
208+
log_debug Installing package files for $dep...
193209
install_pkg_files $package_files
194210

195211
# keep 50 most recent packages to preserve disk space

0 commit comments

Comments
 (0)