Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions build-scripts/autogen
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ nova)
;;
*)
if [ -z "${PROJECT}" ]; then
echo "$(basename "$0"): Error: Expected environment variable PROJECT=[community|nova]"
log_error "Expected environment variable PROJECT=[community|nova]"
else
echo "$(basename "$0"): Error: Unknown project '$PROJECT', expected 'community' or 'nova'"
log_error "Unknown project '$PROJECT', expected 'community' or 'nova'"
fi
echo "Usage: PROJECT=[community|nova] $0"
exit 42
Expand All @@ -51,15 +51,14 @@ fi
# running the autogen.sh.
for proj in $projects; do
if [ ! -d "$BASEDIR/$proj" ]; then
echo "$(basename "$0"): Error: Expected to find the '$proj' repository in '$BASEDIR', but it's not there"
exit 1
fatal "Expected to find the '$proj' repository in '$BASEDIR', but it's not there"
fi
done

# Run autogen.sh on each repository
for proj in $projects; do
# autogen.sh is quite verbose, so only print the output in case of failure
echo "$(basename "$0"): Debug: Running autogen.sh for project $proj..."
log_debug "Running autogen.sh for project $proj..."
(
cd "$BASEDIR/$proj"
NO_CONFIGURE=1 run_and_print_on_failure ./autogen.sh
Expand Down
24 changes: 12 additions & 12 deletions build-scripts/bootstrap-tarballs
Original file line number Diff line number Diff line change
Expand Up @@ -94,27 +94,27 @@ cd "$BASEDIR"/core
rm -f cfengine-3.*.tar.gz
git rev-parse HEAD >"$BASEDIR"/output/core-commitID
# Configure in order to run "make dist", deleted later.
echo "$(basename "$0"): Debug: Running configure on core repository..."
log_debug "Running configure on core repository..."
run_and_print_on_failure ./configure -C
echo "$(basename "$0"): Debug: Running make dist on core repository..."
log_debug "Running make dist on core repository..."
run_and_print_on_failure make dist
mv cfengine-3.*.tar.gz "$BASEDIR"/output/tarballs/
echo "$(basename "$0"): Debug: Running make distclean on core repository..."
log_debug "Running make distclean on core repository..."
run_and_print_on_failure make distclean

# Build tarballs from masterfiles repository
cd "$BASEDIR"/masterfiles
rm -f cfengine-masterfiles*.tar.gz
git rev-parse HEAD >"$BASEDIR"/output/masterfiles-commitID
# Configure in order to run "make dist", deleted later.
echo "$(basename "$0"): Debug: Running configure on masterfiles repository..."
log_debug "Running configure on masterfiles repository..."
run_and_print_on_failure ./configure
echo "$(basename "$0"): Debug: Running make dist on masterfiles repository..."
log_debug "Running make dist on masterfiles repository..."
run_and_print_on_failure make dist # source tarball
echo "$(basename "$0"): Debug: Running make tar-package on masterfiles repository..."
log_debug "Running make tar-package on masterfiles repository..."
run_and_print_on_failure make tar-package # package tarball (containing all files as if they were installed under "prefix".)
mv cfengine-masterfiles*.tar.gz "$BASEDIR"/output/tarballs/
echo "$(basename "$0"): Debug: Running make distclean on masterfiles repository..."
log_debug "Running make distclean on masterfiles repository..."
run_and_print_on_failure make distclean

# Compute a checksum list that can be used to verify the integrity of the
Expand All @@ -126,7 +126,7 @@ sha256sum -- *.tar.gz >sha256sums.txt
CKSUM=$(sum sha256sums.txt | cut -d ' ' -f 1)
mv sha256sums.txt sha256sums."$CKSUM".txt

echo "$(basename "$0"): Debug: Installing javascript npm dependencies..."
log_debug "Installing javascript npm dependencies..."
(
if test -f "$BASEDIR"/mission-portal/public/scripts/package.json; then
cd "$BASEDIR"/mission-portal/public/scripts
Expand All @@ -142,7 +142,7 @@ echo "$(basename "$0"): Debug: Installing javascript npm dependencies..."
fi
)

echo "$(basename "$0"): Debug: Installing PHP composer dependencies from mission-portal repository..."
log_debug "Installing PHP composer dependencies from mission-portal repository..."
(
if test -f "$BASEDIR"/mission-portal/composer.json; then
cd "$BASEDIR"/mission-portal
Expand All @@ -151,7 +151,7 @@ echo "$(basename "$0"): Debug: Installing PHP composer dependencies from mission
fi
)

echo "$(basename "$0"): Debug: Installing PHP composer dependencies from nova repository..."
log_debug "Installing PHP composer dependencies from nova repository..."
(
if test -f "$BASEDIR"/nova/api/http/composer.json; then
cd "$BASEDIR"/nova/api/http
Expand All @@ -160,15 +160,15 @@ echo "$(basename "$0"): Debug: Installing PHP composer dependencies from nova re
fi
)

echo "$(basename "$0"): Debug: Compiling Mission Portal styles..."
log_debug "Compiling Mission Portal styles..."
(
if test -f "$BASEDIR"/mission-portal/public/themes/default/bootstrap/cfengine_theme.less; then
cd "$BASEDIR"/mission-portal/public/themes/default/bootstrap
run_and_print_on_failure npx -p less lessc --compress ./cfengine_theme.less ./compiled/css/cfengine.less.css
fi
)

echo "$(basename "$0"): Debug: Installing LDAP API PHP composer dependencies..."
log_debug "Installing LDAP API PHP composer dependencies..."
(
if test -f "$BASEDIR"/mission-portal/ldap/composer.json; then
cd "$BASEDIR"/mission-portal/ldap
Expand Down
5 changes: 2 additions & 3 deletions build-scripts/clean-buildmachine
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
uninstall_cfbuild

if [ -z "$PREFIX" ] || [ "$PREFIX" = "/" ]; then
echo "$(basename "$0"): Error: \$PREFIX is not defined, is empty, or is set to the root directory. Aborting to prevent accidental deletion."
exit 1
fatal "\$PREFIX is not defined, is empty, or is set to the root directory. Aborting to prevent accidental deletion."
fi

echo "$(basename "$0"): Debug: Cleaning build host by deleting $PREFIX"
log_debug "Cleaning build host by deleting $PREFIX"
case $OS in
aix)
sudo rm -rf "$PREFIX"/*
Expand Down
6 changes: 3 additions & 3 deletions build-scripts/compare-versions
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ nova)
;;
*)
if [ -z "${PROJECT}" ]; then
echo "$(basename "$0"): Error: Expected environment variable PROJECT=[community|nova]"
log_error "Expected environment variable PROJECT=[community|nova]"
else
echo "$(basename "$0"): Error: Unknown project '$PROJECT', expected 'community' or 'nova'"
log_error "Unknown project '$PROJECT', expected 'community' or 'nova'"
fi
echo "Usage: PROJECT=[community|nova] $0"
exit 42
Expand All @@ -59,7 +59,7 @@ for proj_i in $projects; do
version_j=$(<"$BASEDIR/$proj_j/CFVERSION" tr ' ' '\n' |
sed -e 's/\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/')
if [ "$version_i" != "$version_j" ]; then
echo "$(basename "$0"): Error: Detected version mismatch: $proj_i $version_i != $proj_j $version_j"
log_error "Detected version mismatch: $proj_i $version_i != $proj_j $version_j"
exit 33
fi
done
Expand Down
18 changes: 9 additions & 9 deletions build-scripts/compile
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,30 @@ nova)
NOVA=yes
;;
*)
echo "$(basename "$0"): Error: Unknown project '$PROJECT'"
log_error "Unknown project '$PROJECT'"
exit 42
;;
esac

echo "$(basename "$0"): Debug: Running make in core repo..."
log_debug "Running make in core repo..."
run_and_print_on_failure "$MAKE" -C "$BASEDIR"/core -k
echo "$(basename "$0"): Debug: Running make install in core repo..."
log_debug "Running make install in core repo..."
run_and_print_on_failure "$MAKE" -C "$BASEDIR"/core install DESTDIR="$BASEDIR"/cfengine/dist

if [ "$NOVA" = yes ]; then
echo "$(basename "$0"): Debug: Running make in enterprise repo..."
log_debug "Running make in enterprise repo..."
run_and_print_on_failure "$MAKE" -C "$BASEDIR"/enterprise -k
echo "$(basename "$0"): Debug: Running make install in enterprise repo..."
log_debug "Running make install in enterprise repo..."
run_and_print_on_failure "$MAKE" -C "$BASEDIR"/enterprise install DESTDIR="$BASEDIR"/cfengine/dist
if [ "$ROLE" = hub ]; then
echo "$(basename "$0"): Debug: Running make in nova repo..."
log_debug "Running make in nova repo..."
run_and_print_on_failure "$MAKE" -C "$BASEDIR"/nova -k
echo "$(basename "$0"): Debug: Running make install in nova repo..."
log_debug "Running make install in nova repo..."
run_and_print_on_failure "$MAKE" -C "$BASEDIR"/nova install DESTDIR="$BASEDIR"/cfengine/dist
echo "$(basename "$0"): Debug: Running make install in masterfiles repo..."
log_debug "Running make install in masterfiles repo..."
run_and_print_on_failure "$MAKE" -C "$BASEDIR"/masterfiles install DESTDIR="$BASEDIR"/cfengine/dist
fi
else
echo "$(basename "$0"): Debug: Running make install in masterfiles repo..."
log_debug "Running make install in masterfiles repo..."
run_and_print_on_failure "$MAKE" -C "$BASEDIR"/masterfiles install DESTDIR="$BASEDIR"/cfengine/dist
fi
57 changes: 29 additions & 28 deletions build-scripts/detect-environment
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ detect_cross_target() {
esac

if [ -n "$CROSS_TARGET" ]; then
echo "Detected cross target $CROSS_TARGET"
log_debug "Detected cross target $CROSS_TARGET"
else
echo "No cross target detected"
log_debug "No cross target detected"
fi
}

Expand Down Expand Up @@ -91,7 +91,7 @@ detect_os() {
OS_VERSION=$UNAME_R
;;
*)
echo "Unable to detect operating system: $UNAME_S"
log_error "Unable to detect operating system: $UNAME_S"
exit 42
;;
esac
Expand All @@ -101,12 +101,12 @@ detect_os() {
OS=mingw
;;
*)
echo "Unknown cross-compilation target: $CROSS_TARGET"
log_error "Unknown cross-compilation target: $CROSS_TARGET"
exit 42
;;
esac

echo "Detected OS $OS $OS_VERSION"
log_debug "Detected OS $OS $OS_VERSION"
export OS OS_VERSION
}

Expand All @@ -129,7 +129,7 @@ detect_distribution() {
OS=rhel
;;
*)
echo "Error: Could not determine Linux distro from /etc/redhat-release: $REL"
log_error "Could not determine Linux distro from /etc/redhat-release: $REL"
exit 42
;;
esac
Expand All @@ -141,7 +141,7 @@ detect_distribution() {

# Make sure we actually found a match
if [ -z "$version_string" ]; then
echo "Error: Could not determine version number from /etc/redhat-release: $REL"
log_error "Could not determine version number from /etc/redhat-release: $REL"
exit 42
fi
OS_VERSION=$version_string
Expand Down Expand Up @@ -173,7 +173,7 @@ detect_distribution() {
case "$REL" in
[0-9][0-9].[0-9][0-9]) ;;
*)
echo "Unknown Ubuntu release: $REL"
log_error "Unknown Ubuntu release: $REL"
exit 42
;;
esac
Expand All @@ -188,7 +188,7 @@ detect_distribution() {

REL=$(cat /etc/debian_version)
if ! echo "$REL" | grep -E '^[0-9]+\.[0-9]+(\.[0-9]+)?$' >/dev/null; then
echo "Unable to detect version of Debian: $REL"
log_error "Unable to detect version of Debian: $REL"
exit 42
fi

Expand Down Expand Up @@ -222,12 +222,12 @@ detect_distribution() {
fi

if [ -z "$OS" ]; then
echo "Failed to detect Linux distribution"
log_error "Failed to detect Linux distribution"
exit 42
fi

if [ -z "$OS_VERSION" ]; then
echo "Failed to detect Linux distribution version"
log_error "Failed to detect Linux distribution version"
exit 42
fi
}
Expand All @@ -252,7 +252,7 @@ detect_packaging() {
elif [ -f /usr/sbin/swinstall ]; then
DEP_PACKAGING=hpux
else
echo "Unknown packaging system"
log_error "Unknown packaging system"
exit 42
fi

Expand All @@ -268,8 +268,8 @@ detect_packaging() {
;;
esac

echo "Detected dependency packaging $DEP_PACKAGING"
echo "Detected packaging $PACKAGING"
log_debug "Detected dependency packaging $DEP_PACKAGING"
log_debug "Detected packaging $PACKAGING"
export DEP_PACKAGING PACKAGING
}

Expand All @@ -293,7 +293,8 @@ detect_arch() {
ARCH=i86pc
;;
*)
echo "Unknown Solaris architecture: $UNAME_M"
log_error "Unknown Solaris architecture: $UNAME_M"
Comment thread
larsewi marked this conversation as resolved.
exit 42
;;
esac
;;
Expand All @@ -305,7 +306,7 @@ detect_arch() {
ARCH=$UNAME_M
;;
*)
echo "Unknown packaging system"
log_error "Unknown packaging system"
exit 42
;;
esac
Expand All @@ -322,12 +323,12 @@ detect_arch() {
ARCH=x64
;;
*)
echo "Unknown cross-compilation target: $CROSS_TARGET"
log_error "Unknown cross-compilation target: $CROSS_TARGET"
exit 42
;;
esac

echo "Detected architecture $ARCH"
log_debug "Detected architecture $ARCH"
export ARCH
}

Expand All @@ -341,9 +342,9 @@ detect_tools() {

if $MAKE -v | grep GNU; then
export MAKE
echo "Detected make path $MAKE"
log_debug "Detected make path $MAKE"
else
echo "Error: GNU Make not found"
log_error "GNU Make not found"
exit 42
fi

Expand All @@ -353,12 +354,12 @@ detect_tools() {
# systems. We use it to kill processes that can mess with the build process.
FUSER=$(func_whereis fuser)
export FUSER
echo "Detected fuser path $FUSER"
log_debug "Detected fuser path $FUSER"

# We use patch to apply patches to the dependencies.
PATCH=$(func_whereis gpatch patch)
export PATCH
echo "Detected patch path $PATCH"
log_debug "Detected patch path $PATCH"
}

# This function appends the -j/--jobs option to the MAKEFLAGS environment
Expand All @@ -368,29 +369,29 @@ detect_tools() {
detect_cores() {
case "$OS_FAMILY" in
aix)
echo "Detected OS family is aix"
log_debug "Detected OS family is aix"
NUM_CORES="$(lscfg | grep -c proc)"
;;
solaris)
echo "Detected OS family is solaris"
log_debug "Detected OS family is solaris"
NUM_CORES="$(psrinfo | wc -l)"
;;
linux)
echo "Detected OS family is linux"
log_debug "Detected OS family is linux"
NUM_CORES="$(grep -c '^processor' /proc/cpuinfo)"
;;
hpux)
echo "Detected OS family is hpux"
log_debug "Detected OS family is hpux"
NUM_CORES="$(ioscan -k -C processor | grep -c processor)"
;;
*)
echo "Detected OS family is UNKNOWN, defaulting amount of CPU cores to 1"
log_debug "Detected OS family is UNKNOWN, defaulting amount of CPU cores to 1"
NUM_CORES=1
;;
esac

# Make number of jobs one higher than core count, to account for I/O, network, etc.
echo "Detected amount of CPU cores is $NUM_CORES"
log_debug "Detected amount of CPU cores is $NUM_CORES"
MAKEFLAGS="${MAKEFLAGS:--j$((NUM_CORES + 1))}"
export MAKEFLAGS
}
Expand Down
Loading