Skip to content

ENT-12600: compile: Documented script #1775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
67 changes: 44 additions & 23 deletions build-scripts/compile
Original file line number Diff line number Diff line change
@@ -1,34 +1,55 @@
#!/bin/sh -x
#!/bin/sh

. `dirname "$0"`/functions
# Usage: PROJECT=[nova|community] ROLE=[hub|agent] ./buildscripts/build-scripts/compile
#
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for this PR, but we should probably align this with the names we use elsewhere, i.e.
enterprise instead of nova and client instead of agent.

# This script compiles and installs the CFEngine repositories into
# '$BASEDIR/cfengine/dist'. You should first run the 'autogen' script, then
# 'configure' script before running this script.
#
# The script expects the following repositories to exist side by side:
# .
# ├── buildscripts
# ├── core
# ├── enterprise
# ├── nova
# └── masterfiles
Comment on lines +13 to +14
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here, as in another script I reviewed you might include two blocks: one for community, the other for ent.


. "$(dirname "$0")"/functions
. detect-environment
. compile-options

case "$PROJECT" in
community)
NOVA=no
;;
nova)
NOVA=yes
;;
*)
echo "Unknown project: $PROJECT"
exit 42;;
community)
NOVA=no
;;
nova)
NOVA=yes
;;
*)
echo "$(basename "$0"): Error: Unknown project: $PROJECT"
exit 42
;;
esac

$MAKE -C $BASEDIR/core -k
$MAKE -C $BASEDIR/core install DESTDIR=$BASEDIR/cfengine/dist
echo "$(basename "$0"): 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..."
run_and_print_on_failure $MAKE -C "$BASEDIR"/core install DESTDIR="$BASEDIR"/cfengine/dist

if test "x$NOVA" = "xyes"; then
$MAKE -C $BASEDIR/enterprise -k
$MAKE -C $BASEDIR/enterprise install DESTDIR=$BASEDIR/cfengine/dist
if test "x$ROLE" = "xhub"; then
$MAKE -C $BASEDIR/nova -k
$MAKE -C $BASEDIR/nova install DESTDIR=$BASEDIR/cfengine/dist
$MAKE -C $BASEDIR/masterfiles install DESTDIR=$BASEDIR/cfengine/dist
if [ "$NOVA" = yes ]; then
echo "$(basename "$0"): 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..."
run_and_print_on_failure $MAKE -C "$BASEDIR"/enterprise install DESTDIR="$BASEDIR"/cfengine/dist
if [ "$ROLE" = hub ]; then
Comment on lines +40 to +43
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting to break it up separate for nova and the -k for keep going. I suppose these are reasonable but I wonder if just make install wouldn't make more sense. We should get about the same output. The advantage of -k is we get more of the problems with each run. I never use that option as I guess I would prefer to see the first error, fix it, repeat. Also if -j is anything but 1 I'm not sure if -k really buys us much in terms of readability.

echo "$(basename "$0"): 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..."
run_and_print_on_failure $MAKE -C "$BASEDIR"/nova install DESTDIR="$BASEDIR"/cfengine/dist
echo "$(basename "$0"): Debug: Running make install in masterfiles repo..."
run_and_print_on_failure $MAKE -C "$BASEDIR"/masterfiles install DESTDIR="$BASEDIR"/cfengine/dist
fi
else
$MAKE -C $BASEDIR/masterfiles install DESTDIR=$BASEDIR/cfengine/dist
echo "$(basename "$0"): Debug: Running make install in masterfiles repo..."
run_and_print_on_failure $MAKE -C "$BASEDIR"/masterfiles install DESTDIR="$BASEDIR"/cfengine/dist
fi


Loading