Resolve circular dependency when tracking dependencies.

When TRACK_DEPENDS=True, there is a circular dependency wherein virtualenv is
used to install virtualenv before a virtualenv has been established.
TRACK_DEPENDS does not work in any use case without this fix.

Change-Id: I7a6652ba091cb95dac3871b6c71edcd762a7be62
Closes-Bug: 1208867
diff --git a/functions-common b/functions-common
index 2df5e1d..13bc1cf 100644
--- a/functions-common
+++ b/functions-common
@@ -1328,7 +1328,10 @@
     if [[ -z "$os_PACKAGE" ]]; then
         GetOSVersion
     fi
-    if [[ $TRACK_DEPENDS = True ]]; then
+    if [[ $TRACK_DEPENDS = True && ! "$@" =~ virtualenv ]]; then
+        # TRACK_DEPENDS=True installation creates a circular dependency when
+        # we attempt to install virtualenv into a virualenv, so we must global
+        # that installation.
         source $DEST/.venv/bin/activate
         CMD_PIP=$DEST/.venv/bin/pip
         SUDO_PIP="env"