diff --git a/addons/gitbranch.py b/addons/gitbranch.py index a30ed74..565da04 100644 --- a/addons/gitbranch.py +++ b/addons/gitbranch.py @@ -23,7 +23,7 @@ def _git_branch(env: Environment, repo_name: str, remote_url: str, git_ref: str 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! if not os.path.exists(worktree_dir): print(f'Checking out into {worktree_dir}.') - origin.fetch(tags=True) + origin.fetch(tags=True, force=True) os.makedirs(worktree_dir) repo.git.worktree('add', worktree_dir, git_ref) elif env['UPDATE_REPOSITORIES']: @@ -50,13 +50,16 @@ def _make_callable(val): if callable(val): return val else: - return lambda env: val + def _wrapped(*args, **kwargs): + return val + return _wrapped def _git_recipe(env: Environment, globals: dict, repo_name, repo_url, cook_fn, versions = None, tag_pattern = None, tag_fn = None, ref_fn = None, dependencies: dict = {}) -> None: _repo_name = _make_callable(repo_name) _repo_url = _make_callable(repo_url) _tag_pattern = _make_callable(tag_pattern) versions_cb = versions and _make_callable(versions) + dependencies_cb = _make_callable(dependencies) def _versions(env: Environment, update: bool = False, options: dict = {}): if 'ref' in options: @@ -78,7 +81,7 @@ def _git_recipe(env: Environment, globals: dict, repo_name, repo_url, cook_fn, v return [(0, 0, 0)] def _dependencies(env: Environment, version) -> 'dict': - return dependencies + return dependencies_cb(env, version) def _cook(env: Environment, version, options: dict = {}) -> dict: if 'ref' in options: diff --git a/recipes/curl/recipe.py b/recipes/curl/recipe.py index d8f38ec..0fb85fc 100644 --- a/recipes/curl/recipe.py +++ b/recipes/curl/recipe.py @@ -26,19 +26,22 @@ def _git_cook(env: Environment, repo: dict) -> dict: 'CPPDEFINES': ['CURL_STATICLIB=1'] } - -_DEPENDENCIES = { - 'posix': { - 'openssl': {}, - 'zlib': {}, - 'psl': {} - }, - 'nt': { - 'wincrypt': {}, - 'winldap': {}, - 'winsock2': {} - } -} +def _git_dependencies(env: Environment, version) -> 'dict': + deps = { + 'posix': { + 'openssl': {}, + 'zlib': {}, + 'psl': {} + }, + 'nt': { + 'wincrypt': {}, + 'winldap': {}, + 'winsock2': {} + } + }.get(os.name, {}) + if os.name == 'posix' and version >= (8, 10, 0): + deps['nghttp2'] = {} + return deps env.GitRecipe( globals = globals(), @@ -47,5 +50,5 @@ env.GitRecipe( tag_pattern = re.compile(r'^curl-([0-9]+)_([0-9]+)_([0-9]+)$'), tag_fn = lambda version: f'curl-{version[0]}_{version[1]}_{version[2]}', cook_fn = _git_cook, - dependencies = _DEPENDENCIES.get(os.name, {}) + dependencies = _git_dependencies )