cros_workon_make: stop using common.sh

We want to kill off common.sh entirely.  This uses it for a few things:
* shflags
* GCLIENT_ROOT
* DEFAULT_BOARD
* info/warn/error/die helpers

These are simple enough that we can just inline them in the script
to make it standalone.

BUG=None
TEST=`cros_workon_make --board betty dev-install` builds dev-install
TEST=`cros lint` doesn't point out any missing vars

Change-Id: Icce3c3ea199fa54db40b9872f96ef5251028b3f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/1843272
Reviewed-by: Alex Klein <saklein@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/host/cros_workon_make b/host/cros_workon_make
index 4e58268..9a469ae 100755
--- a/host/cros_workon_make
+++ b/host/cros_workon_make
@@ -7,7 +7,15 @@
 # Simple wrapper script to build a cros_workon package incrementally.
 # You must already be cros_workon'ing the package in question.
 
-. /usr/lib/crosutils/common.sh || exit 1
+. /usr/share/misc/shflags || exit 1
+
+GCLIENT_ROOT="/mnt/host/source"
+DEFAULT_BOARD="$(cat "${GCLIENT_ROOT}"/src/scripts/.default_board 2>/dev/null)"
+
+info() { echo "INFO: $*"; }
+warn() { echo "WARN: $*"; }
+error() { echo "ERROR: $*"; }
+die() { error "$@"; exit 1; }
 
 DEFINE_string board "${DEFAULT_BOARD}" \
     "Board for which to build the package."
@@ -30,8 +38,11 @@
   exit 1
 fi
 
+if [ -z "${FLAGS_board}" ]; then
+  die "--board is required"
+fi
+
 if [ -n "${FLAGS_board}" ]; then
-  BOARD_DIR=/build/"${FLAGS_board}"
   EBUILDCMD=ebuild-"${FLAGS_board}"
   EMERGECMD=emerge-"${FLAGS_board}"
   EQUERYCMD=equery-"${FLAGS_board}"
@@ -66,8 +77,7 @@
   if egrep -qi "^y(es)?$" <(echo -n "${resp}"); then
     eval $(${EBUILDCMD} $(${EQUERYCMD} which ${workon_name}) info)
     srcdir=$(readlink -m ${CROS_WORKON_SRCDIR})
-    trunkdir=$(readlink -m ${CHROOT_TRUNK_DIR})
-    project_path=${srcdir#${trunkdir}/}
+    project_path=${srcdir#${GCLIENT_ROOT}/}
     if ! (cd "${GCLIENT_ROOT}/${project_path}" && git clean -dxf); then
       die "Could not scrub source directory"
     fi