Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion kt/commands/setup/impl.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import logging

from kt.ktlib.config import Config
from kt.ktlib.kernels import KernelsInfo
from kt.ktlib.repo import RepoInfoException


def main():
Expand All @@ -10,4 +13,7 @@ def main():

repos = KernelsInfo.from_yaml(config=config).repos
for repo in repos.values():
repo.setup_repo()
try:
repo.setup_repo()
except RepoInfoException as e:
logging.error(e, exc_info=True)
1 change: 1 addition & 0 deletions kt/data/kernels.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
common_repos:
dist-git-tree-fips: git@gitlab.com:ctrl-iq-public/fips/src/kernel.git
kernel-src-tree: https://github.com/ctrliq/kernel-src-tree.git
kernel-src-tree-tools: https://github.com/ctrliq/kernel-src-tree-tools.git

kernels:
cbr-7.9:
Expand Down
19 changes: 15 additions & 4 deletions kt/ktlib/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
from pathlib3x import Path


class RepoInfoException(Exception):
pass


@dataclass
class RepoInfo:
"""
Expand Down Expand Up @@ -33,12 +37,19 @@ def _update(self):
def setup_repo(self):
"""
Set up a git repository at the destination.
If destination already exists and override == True,
nothing is done
If destination already exists, update it.
"""

if not self.folder.exists():
self._clone_repo()
try:
self._clone_repo()
except git.GitCommandError as e:
raise RepoInfoException(f"{self.folder.name} could not be cloned") from e
Comment thread
roxanan1996 marked this conversation as resolved.

return

logging.info(f"{self.folder} already exists, updating it")
self._update()
try:
self._update()
except git.GitCommandError as e:
Comment thread
roxanan1996 marked this conversation as resolved.
raise RepoInfoException(f"{self.folder.name} could not be updated") from e
Comment thread
roxanan1996 marked this conversation as resolved.
Loading