Added recipes for some Linux system libraries.
This commit is contained in:
@@ -21,19 +21,26 @@ def _clone(env: Environment, repo_name: str, remote_url: str):
|
||||
def _git_branch(env: Environment, repo_name: str, remote_url: str, git_ref: str = 'main') -> dict:
|
||||
repo, origin = _clone(env, repo_name, remote_url)
|
||||
worktree_dir = os.path.join(env['CLONE_DIR'], 'git', repo_name, hashlib.shake_128(git_ref.encode('utf-8')).hexdigest(6)) # TODO: commit hash would be better, right? -> not if it's a branch!
|
||||
update_submodules = False
|
||||
if not os.path.exists(worktree_dir):
|
||||
print(f'Checking out into {worktree_dir}.')
|
||||
origin.fetch(tags=True, force=True)
|
||||
os.makedirs(worktree_dir)
|
||||
repo.git.worktree('add', worktree_dir, git_ref)
|
||||
worktree_repo = Repo(worktree_dir)
|
||||
update_submodules = True
|
||||
elif env['UPDATE_REPOSITORIES']:
|
||||
worktree_repo = Repo(worktree_dir)
|
||||
if not worktree_repo.head.is_detached:
|
||||
print(f'Updating git repository at {worktree_dir}')
|
||||
worktree_origin = worktree_repo.remotes['origin']
|
||||
worktree_origin.pull()
|
||||
update_submodules = True
|
||||
else:
|
||||
print(f'Not updating git repository {worktree_dir} as it is not on a branch.')
|
||||
if update_submodules:
|
||||
for submodule in worktree_repo.submodules:
|
||||
submodule.update(init=True)
|
||||
return {
|
||||
'checkout_root': worktree_dir,
|
||||
'repo': repo,
|
||||
|
||||
Reference in New Issue
Block a user