scripts/unit-test.py: Don't build repositories already present

The previous change enhances the docker build script to bake some
heavily-used repositories straight into the docker image as a way to
save time.

We use a file at the magic path /root/.depcache to hold a
comma-separated list of of $PACKAGE:$COMMIT_ID pairs, where $COMMIT_ID
represents the commit at the tip of the master branch of the associated
$PACKAGE (from https://github.com/openbmc/) built into the Docker image.

We can skip building any package listed in /root/.depcache as it's
already present, so don't add it to the dependency graph.

Tested: Ran run-unit-test-docker.sh, confirmed no unnecessary building
of packages.

Change-Id: If59a2813b8e7331b1706e4c09ee7080d72b95e3c
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/scripts/unit-test.py b/scripts/unit-test.py
index a2ad824..8d7067b 100755
--- a/scripts/unit-test.py
+++ b/scripts/unit-test.py
@@ -313,10 +313,14 @@
         dep_tree = head
     os.chdir(pkgdir)
     # Open package's configure.ac
+    with open("/root/.depcache", "r") as depcache:
+        cached = depcache.readline()
     with open("configure.ac", "rt") as configure_ac:
         # Retrieve dependency list from package's configure.ac
         configure_ac_deps = get_deps(configure_ac)
         for dep_pkg in configure_ac_deps:
+            if dep_pkg in cached:
+                continue
             # Dependency package not already known
             if dep_added.get(dep_pkg) is None:
                 # Dependency package not added