Fix for new paths and add build info.

Signed-off-by: Tim 'mithro' Ansell <tansell@google.com>
diff --git a/open_pdks/build-info.py b/open_pdks/build-info.py
new file mode 100755
index 0000000..128b2a6
--- /dev/null
+++ b/open_pdks/build-info.py
@@ -0,0 +1,97 @@
+#!/usr/bin/env python
+# Copyright 2021 SkyWater PDK Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+import subprocess
+import json
+
+GIT_DESCRIBE_CMD="git describe --long --always"
+GIT_LOG_CMD="git log -n 1 --stat"
+
+versions = {
+    'builder': {
+        'name': 'Builder',
+        'dir': 'git/builder',
+        'commit': {},
+    },
+    'skywater_pdk': {
+        'name': 'SkyWater PDK',
+        'dir': 'github/google/skywater-pdk',
+        'commit': {},
+    },
+    'open_pdks': {
+        'name': 'Open-PDKs',
+        'dir': 'github/RTimothyEdwards/open_pdks',
+        'commit': {},
+    },
+    'magic': {
+        'name': 'Magic',
+        'dir': 'github/RTimothyEdwards/magic',
+        'commit': {},
+    },
+}
+
+out_version = [0, 0, 0, 0]
+for k in versions:
+    v_str = subprocess.check_output(
+        GIT_DESCRIBE_CMD.split(),
+        cwd=versions[k]['dir'],
+    ).strip()
+    if v_str[0] != 'v':
+        v_str = 'v'+v_str
+    versions[k]['version'] = v_str
+
+    ver, count, commit = v_str.split('-')
+    assert commit.startswith('g'), commit
+    commit = commit[1:]
+
+    versions[k]['commit']['hash'] = commit
+    ver = [int(i) for i in ver[1:].split('.')]
+    if len(ver) < 3:
+        ver.append(0)
+    ver.append(int(count))
+
+    versions[k]['v'] = ver
+    for i in range(0, len(out_version)):
+        out_version[i] += ver[i]
+
+    versions[k]['commit']['msg'] = subprocess.check_output(
+        (GIT_LOG_CMD+' '+commit).split(),
+        cwd=versions[k]['dir'],
+    ).strip()
+
+
+version_strings = {'final': 'v{0}.{1}.{2}-{3}'.format(*out_version)}
+for k in versions:
+    version_strings[k] = versions[k]['version']
+
+info = """\
+ SKY130A PDK version: {final}
+
+ Which was built using:
+       Builder: {builder}
+  SkyWater PDK: {skywater_pdk}
+     Open-PDKs: {open_pdks}
+         Magic: {magic}
+""".format(**version_strings)
+
+print(info)
+
+with open('out/build.info', 'w') as f:
+    f.write(info)
+
+with open('out/build.json', 'w') as f:
+    json.dump(versions, f, sort_keys=True, indent=2)
diff --git a/open_pdks/build-magic.sh b/open_pdks/build-magic.sh
index e535a66..3a2365d 100755
--- a/open_pdks/build-magic.sh
+++ b/open_pdks/build-magic.sh
@@ -51,7 +51,7 @@
 apt-get -y autoremove
 rm -rf /var/lib/apt/lists/*
 
-cd /host/github/magic
+cd /host/github/RTimothyEdwards/magic
 git describe
 ./configure --prefix=/host/out/magic
 make -j$(nproc)
diff --git a/open_pdks/build-open_pdks.sh b/open_pdks/build-open_pdks.sh
index bff92f1..fc6f51b 100755
--- a/open_pdks/build-open_pdks.sh
+++ b/open_pdks/build-open_pdks.sh
@@ -19,7 +19,7 @@
 
 export PATH=/host/out/magic/bin:$PATH
 
-cd /host/github/open_pdks
+cd /host/github/RTimothyEdwards/open_pdks
 git describe
 
 POSSIBLE_TOOLS="all" # klayout magic netgen irsim openlane qflow xschem"
@@ -79,7 +79,7 @@
   echo " Building PDK files for $TTOOL"
   echo "-----------------------------------------"
   ./configure \
-	--enable-sky130-pdk=/host/github/skywater-pdk \
+	--enable-sky130-pdk=/host/github/google/skywater-pdk \
 	--enable-alpha-sky130 \
 	--prefix=/usr/local \
         $KLAYOUT \
diff --git a/open_pdks/build-skywater-pdk.sh b/open_pdks/build-skywater-pdk.sh
index 981f95b..714898b 100755
--- a/open_pdks/build-skywater-pdk.sh
+++ b/open_pdks/build-skywater-pdk.sh
@@ -17,7 +17,7 @@
 
 set -xe
 
-cd /host/github/skywater-pdk
+cd /host/github/google/skywater-pdk
 git describe
 
 git submodule init libraries/sky130_fd_io/latest
diff --git a/open_pdks/continous.cfg b/open_pdks/continous.cfg
index b9b4f2c..129caeb 100644
--- a/open_pdks/continous.cfg
+++ b/open_pdks/continous.cfg
@@ -9,6 +9,8 @@
     # File types
     regex: "out/*.tar.xz"
     regex: "out/*.log"
+    regex: "out/*.info"
+    regex: "out/*.json"
     strip_prefix: "out"
   }
 }
diff --git a/open_pdks/run.sh b/open_pdks/run.sh
index 8848d18..fa54dec 100755
--- a/open_pdks/run.sh
+++ b/open_pdks/run.sh
@@ -30,6 +30,9 @@
 echo "                         Script: $SCRIPT_SRC"
 echo "         Directory with scripts: $SCRIPT_DIR"
 echo "Relative directory with scripts: $SCRIPT_DIR_REL"
+
+$SCRIPT_DIR/build-info.py
+
 echo
 
 find $PWD -type d | sort