Skip to content

_internal/tuf: restructure TUF cache dir layout #373

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 28, 2022
Merged
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
10 changes: 5 additions & 5 deletions sigstore/_internal/tuf.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ def _get_dirs(url: str) -> tuple[Path, Path]:
"""

builder = appdirs.AppDirs("sigstore-python", "sigstore")
tuf_base = parse.quote(url, safe="")
repo_base = parse.quote(url, safe="")

data_dir = Path(builder.user_data_dir)
cache_dir = Path(builder.user_cache_dir)
tuf_data_dir = Path(builder.user_data_dir) / "tuf"
tuf_cache_dir = Path(builder.user_cache_dir) / "tuf"

return (data_dir / tuf_base), (cache_dir / tuf_base)
return (tuf_data_dir / repo_base), (tuf_cache_dir / repo_base)


class TrustUpdater:
Expand All @@ -75,7 +75,7 @@ def __init__(self, url: str) -> None:

self._metadata_dir, self._targets_dir = _get_dirs(url)

# intialize metadata dir
# Initialize metadata dir
tuf_root = self._metadata_dir / "root.json"
if not tuf_root.exists():
if self._repo_url == DEFAULT_TUF_URL:
Expand Down