aw-index-cli 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ __version__ = "0.1.0"
@@ -0,0 +1,3 @@
1
+ from .cli import main
2
+
3
+ raise SystemExit(main())
aw_index_cli/cli.py ADDED
@@ -0,0 +1,166 @@
1
+ """Command-line interface for aw-index-cli."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import sys
7
+ from datetime import datetime, timezone
8
+ from pathlib import Path
9
+
10
+ from . import __version__
11
+ from .compose import (
12
+ ComposeError,
13
+ provenance_header,
14
+ render_repos,
15
+ select_repositories,
16
+ )
17
+ from .registry import RegistryError, describe_source, load_distribution
18
+ from .workspace import find_repo_root, output_path
19
+
20
+ STUB_COMMANDS = ("import", "sync", "check", "refresh")
21
+
22
+
23
+ def _build_parser() -> argparse.ArgumentParser:
24
+ parser = argparse.ArgumentParser(
25
+ prog="aw-index-cli",
26
+ description="Consumer CLI for the autoware-index registry.",
27
+ )
28
+ parser.add_argument(
29
+ "--version",
30
+ action="version",
31
+ version=f"aw-index-cli {__version__}",
32
+ )
33
+ sub = parser.add_subparsers(dest="command")
34
+
35
+ compose = sub.add_parser(
36
+ "compose",
37
+ help="Render a .repos file from a distribution.",
38
+ )
39
+ compose.add_argument("--rosdistro", required=True)
40
+ compose.add_argument(
41
+ "--packages",
42
+ nargs="*",
43
+ help="select only these registered package names (ANDed with other filters)",
44
+ )
45
+ compose.add_argument(
46
+ "--repository",
47
+ nargs="*",
48
+ help="select only these repository entries by registry key",
49
+ )
50
+ compose.add_argument("--tags", nargs="*")
51
+ compose.add_argument(
52
+ "--autoware",
53
+ help=(
54
+ "informational only — recorded in the header; the registry tracks "
55
+ "one ref per repository and does not resolve by Autoware version"
56
+ ),
57
+ )
58
+ compose.add_argument("--registry-path")
59
+ compose.add_argument("--registry-repo", default="autowarefoundation/autoware-index")
60
+ compose.add_argument("--registry-ref", default="main")
61
+ compose.add_argument("--repo-root")
62
+ compose.add_argument("--name", default="autoware-index")
63
+ compose.add_argument("--output", help="explicit output file path")
64
+ compose.add_argument("--stdout", action="store_true")
65
+ compose.add_argument("--no-timestamp", action="store_true")
66
+ compose.set_defaults(func=_cmd_compose)
67
+
68
+ for name in STUB_COMMANDS:
69
+ stub = sub.add_parser(name, help=f"(not implemented) {name}")
70
+ stub.set_defaults(func=_make_stub(name))
71
+
72
+ return parser
73
+
74
+
75
+ def _make_stub(name: str):
76
+ def _run(_args: argparse.Namespace) -> int:
77
+ print(f"aw-index-cli {name} is not implemented yet", file=sys.stderr)
78
+ return 2
79
+
80
+ return _run
81
+
82
+
83
+ def _cmd_compose(args: argparse.Namespace) -> int:
84
+ try:
85
+ distribution = load_distribution(
86
+ args.rosdistro,
87
+ path=args.registry_path,
88
+ repo=args.registry_repo,
89
+ ref=args.registry_ref,
90
+ )
91
+ source = describe_source(
92
+ path=args.registry_path,
93
+ repo=args.registry_repo,
94
+ ref=args.registry_ref,
95
+ )
96
+ if args.no_timestamp:
97
+ generated_at = None
98
+ else:
99
+ generated_at = datetime.now(timezone.utc).isoformat(timespec="seconds")
100
+ selection = [
101
+ (key, names)
102
+ for key, _spec, names in select_repositories(
103
+ distribution,
104
+ tags=args.tags,
105
+ packages=args.packages,
106
+ repository=args.repository,
107
+ )
108
+ ]
109
+ header_lines = provenance_header(
110
+ tool_version=__version__,
111
+ ros_distro=args.rosdistro,
112
+ source=source,
113
+ tags=args.tags,
114
+ packages=args.packages,
115
+ repository=args.repository,
116
+ autoware=args.autoware,
117
+ generated_at=generated_at,
118
+ selection=selection,
119
+ )
120
+ text = render_repos(
121
+ distribution,
122
+ tags=args.tags,
123
+ packages=args.packages,
124
+ repository=args.repository,
125
+ header_lines=header_lines,
126
+ )
127
+ except (RegistryError, ComposeError) as exc:
128
+ print(f"error: {exc}", file=sys.stderr)
129
+ return 1
130
+
131
+ if args.stdout:
132
+ print(text)
133
+ return 0
134
+
135
+ if args.output:
136
+ path = Path(args.output)
137
+ else:
138
+ repo_root = find_repo_root(args.repo_root or Path.cwd())
139
+ path = output_path(repo_root, args.name)
140
+
141
+ path.parent.mkdir(parents=True, exist_ok=True)
142
+ path.write_text(text, encoding="utf-8")
143
+
144
+ repo_count = len(selection)
145
+ package_count = sum(len(names) for _, names in selection)
146
+ noun = "entry" if repo_count == 1 else "entries"
147
+ listing = ", ".join(
148
+ f"{key} ({', '.join(names)})" for key, names in selection
149
+ )
150
+ summary = (
151
+ f"Wrote {repo_count} repository {noun} covering "
152
+ f"{package_count} registered package(s) to {path}"
153
+ )
154
+ if listing:
155
+ summary += f": {listing}"
156
+ print(summary, file=sys.stderr)
157
+ return 0
158
+
159
+
160
+ def main(argv: list[str] | None = None) -> int:
161
+ parser = _build_parser()
162
+ args = parser.parse_args(argv)
163
+ if not getattr(args, "command", None):
164
+ parser.print_help()
165
+ return 2
166
+ return args.func(args)
@@ -0,0 +1,182 @@
1
+ """Select repositories from a distribution and render a vcs ``.repos`` file."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import yaml
6
+
7
+
8
+ class ComposeError(Exception):
9
+ """Raised when a distribution cannot be composed into ``.repos`` entries."""
10
+
11
+
12
+ def _reject_unknown(singular: str, plural: str, missing: set[str]) -> None:
13
+ """Raise :class:`ComposeError` naming any explicitly-requested unknowns."""
14
+ if missing:
15
+ names = ", ".join(repr(name) for name in sorted(missing))
16
+ label = singular if len(missing) == 1 else plural
17
+ raise ComposeError(f"no such {label} in the distribution: {names}")
18
+
19
+
20
+ def select_repositories(
21
+ distribution: dict,
22
+ tags: list[str] | None = None,
23
+ *,
24
+ packages: list[str] | None = None,
25
+ repository: list[str] | None = None,
26
+ ) -> list[tuple[str, dict, list[str]]]:
27
+ """Return ``(key, spec, selected_packages)`` triples sorted by repo key.
28
+
29
+ Three optional filters narrow the selection and are ANDed together; omit
30
+ all of them to select the whole distribution:
31
+
32
+ * ``tags`` — keep packages whose own ``tags`` intersect these.
33
+ * ``packages`` — keep packages whose name is in this list.
34
+ * ``repository`` — keep only these repository entries (by registry key).
35
+
36
+ A repository is selected when at least one of its packages survives every
37
+ given filter; its ``selected_packages`` names are sorted. An explicit
38
+ ``repository`` key or ``packages`` name that is absent from the *whole*
39
+ distribution (independent of the other filters, so a typo never hides
40
+ behind an empty result) raises :class:`ComposeError`, as does a selected
41
+ repository whose ``packages`` is not a mapping.
42
+ """
43
+ all_repos = distribution.get("repositories") or {}
44
+ wanted_tags = set(tags or [])
45
+ wanted_pkgs = set(packages or [])
46
+ wanted_repos = set(repository or [])
47
+
48
+ # Validate explicit names against the entire distribution before filtering,
49
+ # so an unknown name errors loudly rather than yielding silent-empty output.
50
+ known_pkgs: set[str] = set()
51
+ for spec in all_repos.values():
52
+ spec_pkgs = (spec or {}).get("packages")
53
+ if isinstance(spec_pkgs, dict):
54
+ known_pkgs.update(spec_pkgs)
55
+ _reject_unknown(
56
+ "repository entry", "repository entries", wanted_repos - set(all_repos)
57
+ )
58
+ _reject_unknown("package", "packages", wanted_pkgs - known_pkgs)
59
+
60
+ selected = []
61
+ for key, spec in sorted(all_repos.items()):
62
+ if wanted_repos and key not in wanted_repos:
63
+ continue
64
+ spec_pkgs = (spec or {}).get("packages") or {}
65
+ if not isinstance(spec_pkgs, dict):
66
+ raise ComposeError(
67
+ f"repository {key!r} has 'packages' that is not a mapping "
68
+ f"of package name to spec (got {type(spec_pkgs).__name__})"
69
+ )
70
+ names = sorted(
71
+ name
72
+ for name, pkg in spec_pkgs.items()
73
+ if (not wanted_tags or set((pkg or {}).get("tags") or []) & wanted_tags)
74
+ and (not wanted_pkgs or name in wanted_pkgs)
75
+ )
76
+ if names:
77
+ selected.append((key, spec, names))
78
+ return selected
79
+
80
+
81
+ def to_repos_entries(repositories: list[tuple[str, dict, list[str]]]) -> dict:
82
+ """Map selected repositories to an ordered ``key -> entry`` dict.
83
+
84
+ The entry key is the registry repository key, so packages from one
85
+ monorepo collapse into a single clone. Each entry carries exactly
86
+ vcstool's ``type``/``url``/``version`` and nothing else — the format
87
+ defines no other per-entry fields. The selected registered package names
88
+ are recorded in the provenance header comments (see
89
+ :func:`provenance_header`), not in the YAML body. Raises
90
+ :class:`ComposeError` when a repository is missing ``url`` or
91
+ ``ref.value``, or when its ``ref`` is not a mapping.
92
+ """
93
+ entries: dict = {}
94
+ for key, spec, _names in repositories:
95
+ spec = spec or {}
96
+ url = spec.get("url")
97
+ if not url:
98
+ raise ComposeError(f"repository {key!r} is missing 'url'")
99
+ ref = spec.get("ref") or {}
100
+ if not isinstance(ref, dict):
101
+ raise ComposeError(
102
+ f"repository {key!r} has 'ref' that is not a mapping "
103
+ f"with 'kind' and 'value' (got {type(ref).__name__})"
104
+ )
105
+ version = ref.get("value")
106
+ if not version:
107
+ raise ComposeError(f"repository {key!r} is missing 'ref.value'")
108
+ entries[key] = {
109
+ "type": "git",
110
+ "url": url,
111
+ "version": version,
112
+ }
113
+ return entries
114
+
115
+
116
+ def provenance_header(
117
+ *,
118
+ tool_version: str,
119
+ ros_distro: str,
120
+ source: str,
121
+ tags: list[str] | None = None,
122
+ packages: list[str] | None = None,
123
+ repository: list[str] | None = None,
124
+ autoware: str | None = None,
125
+ generated_at: str | None = None,
126
+ selection: list[tuple[str, list[str]]] | None = None,
127
+ ) -> list[str]:
128
+ """Build the ``# …`` comment lines that precede the rendered ``.repos``.
129
+
130
+ The ``packages`` and ``repository`` selection filters, when given, are
131
+ recorded so the file documents how it was produced. ``selection`` is the
132
+ ``(repo_key, selected_package_names)`` listing; when given, every entry is
133
+ named in the header with its selected packages.
134
+ """
135
+ lines = [
136
+ f"# aw-index-cli {tool_version}",
137
+ f"# source: {source}",
138
+ f"# rosdistro: {ros_distro}",
139
+ f"# tags: {', '.join(tags) if tags else 'all'}",
140
+ ]
141
+ if packages:
142
+ lines.append(f"# packages: {', '.join(packages)}")
143
+ if repository:
144
+ lines.append(f"# repository: {', '.join(repository)}")
145
+ if autoware is not None:
146
+ lines.append(
147
+ f"# autoware: {autoware} "
148
+ "(informational only — not a ref selector; the registry tracks "
149
+ "one ref per repository)"
150
+ )
151
+ if generated_at is not None:
152
+ lines.append(f"# generated_at: {generated_at}")
153
+ if selection:
154
+ lines.append("# selected packages by repository:")
155
+ for key, package_names in selection:
156
+ lines.append(f"# {key}: {', '.join(package_names)}")
157
+ lines.append(
158
+ "# Generated file — re-run 'aw-index-cli compose …' to update; "
159
+ "do not edit by hand."
160
+ )
161
+ return lines
162
+
163
+
164
+ def render_repos(
165
+ distribution: dict,
166
+ *,
167
+ tags: list[str] | None = None,
168
+ packages: list[str] | None = None,
169
+ repository: list[str] | None = None,
170
+ header_lines: list[str],
171
+ ) -> str:
172
+ """Render the full ``.repos`` document (header comments + YAML body)."""
173
+ repositories = select_repositories(
174
+ distribution, tags=tags, packages=packages, repository=repository
175
+ )
176
+ entries = to_repos_entries(repositories)
177
+ body = yaml.safe_dump(
178
+ {"repositories": entries},
179
+ sort_keys=False,
180
+ default_flow_style=False,
181
+ )
182
+ return "\n".join(header_lines) + "\n" + body
@@ -0,0 +1,120 @@
1
+ """Load Autoware Index distribution YAML from a local path or the registry."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import urllib.error
6
+ from pathlib import Path
7
+ from urllib.request import urlopen
8
+
9
+ import yaml
10
+
11
+ DEFAULT_REPO = "autowarefoundation/autoware-index"
12
+ DEFAULT_REF = "main"
13
+ RAW_URL = "https://raw.githubusercontent.com/{repo}/{ref}/distributions/{ros_distro}.yaml"
14
+ SUPPORTED_SCHEMA_VERSION = "2"
15
+
16
+
17
+ class RegistryError(Exception):
18
+ """Raised when a distribution cannot be located, fetched, or parsed."""
19
+
20
+
21
+ def _distribution_file(path: Path, ros_distro: str) -> Path:
22
+ """Resolve the YAML file for ``ros_distro`` given a file or directory path."""
23
+ if path.is_file():
24
+ return path
25
+ if path.is_dir():
26
+ return path / "distributions" / f"{ros_distro}.yaml"
27
+ # Path may be a file that does not exist; surface a clear error.
28
+ raise RegistryError(f"registry path does not exist: {path}")
29
+
30
+
31
+ def load_distribution(
32
+ ros_distro: str,
33
+ *,
34
+ path: str | Path | None = None,
35
+ repo: str = DEFAULT_REPO,
36
+ ref: str = DEFAULT_REF,
37
+ timeout: float = 30,
38
+ ) -> dict:
39
+ """Load and validate the distribution YAML for ``ros_distro``.
40
+
41
+ If ``path`` is given it is read locally (a file directly, or a directory in
42
+ which ``distributions/<ros_distro>.yaml`` is expected). Otherwise the file is
43
+ fetched from raw.githubusercontent.com for ``repo`` at ``ref``.
44
+
45
+ Only documents with ``schema_version`` equal to
46
+ :data:`SUPPORTED_SCHEMA_VERSION` are accepted; anything else raises
47
+ :class:`RegistryError` rather than ever producing silent empty output.
48
+ """
49
+ if path is not None:
50
+ target = _distribution_file(Path(path), ros_distro)
51
+ if not target.is_file():
52
+ raise RegistryError(f"distribution file not found: {target}")
53
+ try:
54
+ raw = target.read_text(encoding="utf-8")
55
+ except (OSError, UnicodeDecodeError) as exc:
56
+ raise RegistryError(f"could not read {target}: {exc}") from exc
57
+ else:
58
+ url = RAW_URL.format(repo=repo, ref=ref, ros_distro=ros_distro)
59
+ try:
60
+ with urlopen(url, timeout=timeout) as response:
61
+ raw = response.read().decode("utf-8")
62
+ except urllib.error.HTTPError as exc:
63
+ raise RegistryError(
64
+ f"could not fetch {url}: HTTP {exc.code} {exc.reason}"
65
+ ) from exc
66
+ except TimeoutError as exc:
67
+ raise RegistryError(f"timed out fetching {url} after {timeout}s") from exc
68
+ except urllib.error.URLError as exc:
69
+ raise RegistryError(f"could not fetch {url}: {exc.reason}") from exc
70
+ except UnicodeDecodeError as exc:
71
+ raise RegistryError(
72
+ f"response from {url} was not valid UTF-8: {exc}"
73
+ ) from exc
74
+
75
+ try:
76
+ parsed = yaml.safe_load(raw)
77
+ except yaml.YAMLError as exc:
78
+ raise RegistryError(f"invalid YAML for {ros_distro}: {exc}") from exc
79
+
80
+ if not isinstance(parsed, dict):
81
+ raise RegistryError(
82
+ f"distribution for {ros_distro} is not a mapping"
83
+ )
84
+ schema_version = parsed.get("schema_version")
85
+ if schema_version != SUPPORTED_SCHEMA_VERSION:
86
+ raise RegistryError(
87
+ f"distribution for {ros_distro} has schema_version "
88
+ f"{schema_version!r}, which is not supported by this aw-index-cli "
89
+ f"(supports: {SUPPORTED_SCHEMA_VERSION!r})"
90
+ )
91
+ if parsed.get("ros_distro") != ros_distro:
92
+ raise RegistryError(
93
+ f"ros_distro mismatch: expected {ros_distro!r}, "
94
+ f"got {parsed.get('ros_distro')!r}"
95
+ )
96
+ repositories = parsed.get("repositories")
97
+ if repositories is not None and not isinstance(repositories, dict):
98
+ raise RegistryError(
99
+ f"distribution for {ros_distro}: 'repositories' must be a mapping "
100
+ f"of repository key to spec, got {type(repositories).__name__}"
101
+ )
102
+ for key, spec in (repositories or {}).items():
103
+ if not isinstance(spec, dict):
104
+ raise RegistryError(
105
+ f"distribution for {ros_distro}: repository {key!r} must be "
106
+ f"a mapping, got {type(spec).__name__}"
107
+ )
108
+ return parsed
109
+
110
+
111
+ def describe_source(
112
+ *,
113
+ path: str | Path | None = None,
114
+ repo: str | None = None,
115
+ ref: str | None = None,
116
+ ) -> str:
117
+ """Return a human-readable provenance string for the distribution source."""
118
+ if path is not None:
119
+ return f"local path {path}"
120
+ return f"{repo or DEFAULT_REPO}@{ref or DEFAULT_REF}"
@@ -0,0 +1,23 @@
1
+ """Discover the workspace repo root and the output ``.repos`` path."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pathlib import Path
6
+
7
+
8
+ def find_repo_root(start: str | Path) -> Path:
9
+ """Walk up from ``start`` to the first ancestor containing ``repositories/``.
10
+
11
+ The search includes ``start`` itself. If no such directory is found, the
12
+ resolved ``start`` is returned unchanged.
13
+ """
14
+ start_path = Path(start).resolve()
15
+ for candidate in [start_path, *start_path.parents]:
16
+ if (candidate / "repositories").is_dir():
17
+ return candidate
18
+ return start_path
19
+
20
+
21
+ def output_path(repo_root: str | Path, name: str = "autoware-index") -> Path:
22
+ """Return ``<repo_root>/repositories/<name>.repos``."""
23
+ return Path(repo_root) / "repositories" / f"{name}.repos"
@@ -0,0 +1,199 @@
1
+ Metadata-Version: 2.4
2
+ Name: aw-index-cli
3
+ Version: 0.1.0
4
+ Summary: Consumer CLI for the autoware-index registry
5
+ Project-URL: Homepage, https://github.com/autowarefoundation/aw-index-cli
6
+ Project-URL: Repository, https://github.com/autowarefoundation/aw-index-cli
7
+ Project-URL: Issues, https://github.com/autowarefoundation/aw-index-cli/issues
8
+ Author-email: Mete Fatih Cırıt <mfc@autoware.org>
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Keywords: autoware,registry,ros,ros2,vcstool
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Software Development :: Build Tools
22
+ Requires-Python: >=3.10
23
+ Requires-Dist: pyyaml>=6
24
+ Provides-Extra: dev
25
+ Requires-Dist: pytest>=7; extra == 'dev'
26
+ Description-Content-Type: text/markdown
27
+
28
+ # aw-index-cli
29
+
30
+ `aw-index-cli` is the consumer CLI for the [autoware-index][index] registry. It
31
+ reads a distribution manifest (`distributions/<rosdistro>.yaml`,
32
+ `schema_version: "2"`) and composes a [vcstool][vcstool] `.repos` file that you
33
+ can `vcs import` into a workspace.
34
+
35
+ The registry is **repository-keyed**: each entry is a repository (identified by
36
+ a registry-unique key) carrying **exactly one `ref`** and one or more
37
+ registered packages. Ref skew between packages of the same repository is
38
+ unrepresentable by construction. The registry does *not* track Autoware
39
+ versions — those are resolved at sweep time, not stored. `compose` therefore
40
+ never selects a ref by Autoware version; the `--autoware` flag is recorded in
41
+ the header for provenance only.
42
+
43
+ [index]: https://github.com/autowarefoundation/autoware-index
44
+ [vcstool]: https://github.com/dirk-thomas/vcstool
45
+
46
+ ## Install
47
+
48
+ With [pipx][pipx] (recommended for an isolated CLI):
49
+
50
+ ```bash
51
+ pipx install aw-index-cli
52
+ ```
53
+
54
+ Editable, from a checkout:
55
+
56
+ ```bash
57
+ python3 -m pip install -e ".[dev]"
58
+ ```
59
+
60
+ [pipx]: https://pipx.pypa.io/
61
+
62
+ ## `compose`
63
+
64
+ Render a `.repos` file from a distribution.
65
+
66
+ Select what you need — by package name or by repository entry. The
67
+ distribution is fetched from GitHub by default, so no registry checkout is
68
+ required.
69
+
70
+ ```bash
71
+ # Recommended: compose just the packages you want.
72
+ aw-index-cli compose --rosdistro jazzy \
73
+ --packages autoware_livox_tag_filter
74
+
75
+ # …or pull in whole repository entries by their registry key.
76
+ aw-index-cli compose --rosdistro jazzy \
77
+ --repository autoware_livox_tag_filter
78
+
79
+ # Narrow by tag (filters can be combined; they are ANDed).
80
+ aw-index-cli compose --rosdistro jazzy --tags sensing perception
81
+
82
+ # Print to stdout instead of writing a file.
83
+ aw-index-cli compose --rosdistro jazzy \
84
+ --packages autoware_livox_tag_filter --stdout
85
+ ```
86
+
87
+ > Omitting all of `--packages`, `--repository`, and `--tags` composes the
88
+ > **entire** distribution into one `.repos`. That is supported but rarely what
89
+ > you want — prefer naming the packages or repositories you actually consume.
90
+
91
+ Less common sources — a local registry checkout, or a fork / specific git ref:
92
+
93
+ ```bash
94
+ # Read from a local registry checkout instead of GitHub.
95
+ aw-index-cli compose --rosdistro jazzy \
96
+ --packages autoware_livox_tag_filter \
97
+ --registry-path /path/to/autoware-index
98
+
99
+ # Fetch the distribution from a fork at a specific branch/tag/sha.
100
+ aw-index-cli compose --rosdistro jazzy \
101
+ --packages autoware_livox_tag_filter \
102
+ --registry-repo me/autoware-index-fork --registry-ref dev
103
+ ```
104
+
105
+ Example output for `compose --rosdistro jazzy --repository livox-tools`
106
+ (a monorepo entry hosting two registered packages):
107
+
108
+ ```yaml
109
+ # aw-index-cli 0.1.0
110
+ # source: autowarefoundation/autoware-index@main
111
+ # rosdistro: jazzy
112
+ # tags: all
113
+ # repository: livox-tools
114
+ # generated_at: 2026-06-11T12:00:00+00:00
115
+ # selected packages by repository:
116
+ # livox-tools: autoware_livox_decoder, autoware_livox_tag_filter
117
+ # Generated file — re-run 'aw-index-cli compose …' to update; do not edit by hand.
118
+ repositories:
119
+ livox-tools:
120
+ type: git
121
+ url: https://github.com/autowarefoundation/autoware_livox_tag_filter
122
+ version: main
123
+ ```
124
+
125
+ Each entry is a pure vcstool entry — only `type`, `url`, and `version`. The
126
+ selected registered package names live in the `# selected packages by
127
+ repository:` header comment, not in the YAML body.
128
+
129
+ ### How entries are composed
130
+
131
+ - **Entry keys are registry repository keys** (the keys under `repositories:`
132
+ in the distribution YAML), not URL basenames. The key is also the checkout
133
+ directory `vcs import` clones into.
134
+ - **Selection is by package, repository, or tag — ANDed.** A package survives
135
+ when it passes every filter you give: `--packages` (name in the list),
136
+ `--repository` (its entry's key in the list), and `--tags` (its tags
137
+ intersect the list). Omit a filter to not constrain on it; omit all three to
138
+ take the whole distribution. A `--packages` name or `--repository` key that
139
+ does not exist anywhere in the distribution is a hard error, never a silent
140
+ empty result.
141
+ - **A monorepo collapses to one clone.** A repository is selected when at least
142
+ one of its packages survives the filters. However many of its packages match,
143
+ it yields exactly one `.repos` entry at the repository's single `ref`.
144
+ - **Entries are pure vcstool — `type`/`url`/`version` only.** The `.repos`
145
+ format defines no other per-entry fields, so the selected registered package
146
+ names are recorded in the `# selected packages by repository:` header comment
147
+ (sorted by name), not in the YAML body. With a tag filter, that comment may
148
+ name only a subset of a monorepo's registered packages. vcstool ignores
149
+ comments, so `vcs import` works unchanged.
150
+ - **The clone may contain unregistered sibling packages** the index makes no
151
+ claims about — registration is per package, but cloning is per repository.
152
+ For a build scoped to what you actually asked for, pass the names from the
153
+ header comment (or the registry) to colcon:
154
+
155
+ ```bash
156
+ colcon build --packages-up-to autoware_livox_tag_filter # names from the header comment
157
+ ```
158
+
159
+ - `version:` is the registry ref's `value` as-is; vcstool checks out tags,
160
+ shas, and branches alike without needing to know the kind.
161
+
162
+ ### schema_version gate
163
+
164
+ `compose` only accepts distribution documents with `schema_version: "2"`.
165
+ Anything else — older `"1"` documents, a missing field, or a future version —
166
+ aborts with a non-zero exit and a clear error naming the found version
167
+ ("… not supported by this aw-index-cli (supports: '2')"). It never emits
168
+ silently empty output for a document it does not understand.
169
+
170
+ ### Key options
171
+
172
+ - `--rosdistro` (required): ROS distribution, e.g. `jazzy`.
173
+ - `--packages ...`: keep only these registered package names. Unknown names error.
174
+ - `--repository ...`: keep only these repository entries, by registry key.
175
+ Unknown keys error.
176
+ - `--tags ...`: keep only packages whose tags intersect these; omit for all.
177
+ Combined with `--packages`/`--repository`, the filters are ANDed.
178
+ - `--autoware`: informational only — recorded in the header, not a ref selector.
179
+ - `--registry-path`: local file or registry directory; omit to fetch from GitHub.
180
+ - `--registry-repo` / `--registry-ref`: GitHub source — the repository
181
+ (default `autowarefoundation/autoware-index`) and the git ref (branch, tag,
182
+ or sha; default `main`) of the registry to fetch the distribution from.
183
+ - `--repo-root`: where to discover `repositories/`; defaults to the current dir.
184
+ - `--name`: output basename (default `autoware-index`).
185
+ - `--output`: explicit output file path (overrides repo-root discovery).
186
+ - `--stdout`: print the rendered `.repos` instead of writing a file.
187
+ - `--no-timestamp`: omit `generated_at` for byte-identical, diffable output.
188
+
189
+ ## Commands
190
+
191
+ - `compose` — render a `.repos` file from a distribution (implemented).
192
+ - `import` — *(not implemented yet)*
193
+ - `sync` — *(not implemented yet)*
194
+ - `check` — *(not implemented yet)*
195
+ - `refresh` — *(not implemented yet)*
196
+
197
+ ## License
198
+
199
+ Apache-2.0. See [LICENSE](LICENSE).
@@ -0,0 +1,11 @@
1
+ aw_index_cli/__init__.py,sha256=kUR5RAFc7HCeiqdlX36dZOHkUI5wI6V_43RpEcD8b-0,22
2
+ aw_index_cli/__main__.py,sha256=k1ocEWawweo1qCJWNFAAvyxz3tcY13dzvCenHszij30,48
3
+ aw_index_cli/cli.py,sha256=iDTGJz8iXHlQ-iHp31aGeZBbqhFsQEXkEoaVLvecsNI,5076
4
+ aw_index_cli/compose.py,sha256=W4EPs_QWGAaWNeT4KskewwzT9zl7i-1zH_dDlaeRefM,6934
5
+ aw_index_cli/registry.py,sha256=6IA90RrZF8APSxAQYvADYwbOiY4_x5qvclmSx6xMoH8,4561
6
+ aw_index_cli/workspace.py,sha256=37IAmb9j8EQ1wJpZdlnXA8970x6KjmJIAniwNDxNrNY,794
7
+ aw_index_cli-0.1.0.dist-info/METADATA,sha256=A9ezZPzswAOrSVroErax0TKssN_O6Mqq0Rrv_ohE2Q4,8238
8
+ aw_index_cli-0.1.0.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
9
+ aw_index_cli-0.1.0.dist-info/entry_points.txt,sha256=5A30OYZqx53UQmCRV9kJZ-4U8SP9JXfjh8gMry2UEcY,55
10
+ aw_index_cli-0.1.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
11
+ aw_index_cli-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.30.1
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ aw-index-cli = aw_index_cli.cli:main
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.