Skip to content

Commit

Permalink
hotfix: include submodules for IHP builds
Browse files Browse the repository at this point in the history
  • Loading branch information
donn committed Jan 8, 2025
1 parent 3b35e95 commit 5edd843
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 26 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "volare"
version = "0.20.1"
version = "0.20.2"
description = "An PDK builder/version manager for PDKs in the open_pdks format"
authors = ["Efabless Corporation and Contributors <[email protected]>"]
readme = "Readme.md"
Expand Down
30 changes: 7 additions & 23 deletions volare/build/git_multi_clone.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import re
import shutil
import subprocess
from typing import Optional

from rich.progress import Progress

Expand Down Expand Up @@ -86,10 +87,6 @@ def clone(self, callback=None):

process.wait()

subprocess.check_output(
["git", "submodule", "init"], stderr=subprocess.PIPE, cwd=self.path
)

def pristine(self):
subprocess.check_output(
["git", "clean", "-fdX"], cwd=self.path, stderr=subprocess.PIPE
Expand Down Expand Up @@ -135,9 +132,6 @@ def pull(self, callback=None):
process.wait()
if callback is not None:
callback(100)
subprocess.check_output(
["git", "submodule", "init"], stderr=subprocess.PIPE, cwd=self.path
)

def checkout_commit(self, commit: str):
subprocess.check_output(
Expand All @@ -159,22 +153,12 @@ def checkout_commit(self, commit: str):
stderr=subprocess.PIPE,
)

def init_submodule_if_not_exist(self, submodule: str, callback=None):
submodule_git_path = os.path.join(self.path, submodule, ".git")
if os.path.exists(submodule_git_path):
subprocess.check_output(
["git", "submodule", "update", "--remote", submodule],
cwd=self.path,
stderr=subprocess.PIPE,
)
if callback is not None:
callback(100)
else:
self.init_submodule(submodule, callback)

def init_submodule(self, submodule: str, callback=None):
def init_submodule(self, submodule: Optional[str] = None, callback=None):
cmd = ["git", "submodule", "update", "--init", "--progress"]
if submodule is not None:
cmd.append(submodule)
process = subprocess.Popen(
["git", "submodule", "update", "--progress", submodule, submodule],
cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
cwd=self.path,
Expand Down Expand Up @@ -231,6 +215,6 @@ def clone_submodule(self, repo: Repository, submodule: str):
current_task = self.progress.add_task(
f"Updating submodule {submodule}…", total=100
)
repo.init_submodule_if_not_exist(
repo.init_submodule(
submodule, lambda x: self.progress.update(current_task, completed=x)
)
8 changes: 6 additions & 2 deletions volare/build/ihp-sg13g2.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,12 @@ def get_ihp(
ihp_repo.link,
version,
)
repo_path = ihp_future.result().path

repo = ihp_future.result()
current_task = progress.add_task(
"Updating submodules…", total=100
)
repo.init_submodule(callback=lambda x: progress.update(current_task, completed=x))
repo_path = repo.path
console.log(f"Done fetching {ihp_repo.name}.")
else:
console.log(f"Using IHP-Open-PDK at {repo_path} unaltered.")
Expand Down

0 comments on commit 5edd843

Please sign in to comment.