Skip to content

feat(component query): bulk spec querying with --arch enforcement#204

Open
liunan-ms wants to merge 2 commits into
microsoft:mainfrom
liunan-ms:liunan/specquery
Open

feat(component query): bulk spec querying with --arch enforcement#204
liunan-ms wants to merge 2 commits into
microsoft:mainfrom
liunan-ms:liunan/specquery

Conversation

@liunan-ms
Copy link
Copy Markdown
Contributor

Introduces azldev component query for bulk-querying rendered RPM specs inside a single shared mock chroot, with arch-aware policy enforcement.

CLI

  • New azldev component query command — selects components via the standard component filter, renders results as a table / CSV / Markdown / JSON.
  • New --arch flag (default x86_64, also accepts aarch64) driving rpmspec --target=<arch> and ExclusiveArch/ExcludeArch policy.

Docs

CLI reference under docs/user/reference/cli/ regenerated.

Copilot AI review requested due to automatic review settings May 21, 2026 21:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR updates azldev component query to operate on locally rendered specs and to batch rpmspec execution in a shared mock chroot, including reporting binary subpackages.

Changes:

  • Added batched spec querying via an embedded Python helper and shared Go scaffolding for running batch scripts in mock.
  • Extended spec query results to include binary subpackages and updated tests to validate subpackage extraction.
  • Updated CLI help/docs and adjusted component query to require and validate rendered-specs-dir.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
scenario/internal/projecttest/testspec.go Adds subpackage rendering support in test spec generation.
scenario/component_query_test.go Updates scenario test to render first and validate subpackages in query output.
internal/rpm/specquery.go Exposes rpmspec queryformat constants and adds subpackage parsing helper.
internal/rpm/specquery_test.go Adds unit tests for subpackage-output parsing and SRPM parsing behavior.
internal/app/azldev/core/sources/specquery.go Introduces batch spec query orchestration and input validation.
internal/app/azldev/core/sources/specquery_test.go Adds tests for batched query JSON parsing and validation.
internal/app/azldev/core/sources/query_process.py Implements parallel per-spec rpmspec execution inside mock chroot.
internal/app/azldev/core/sources/mockprocessor.go Refactors shared batch-script runner and adds configurable required package install.
internal/app/azldev/command.go Emits partial results even when a command returns an error, with typed-nil guarding.
internal/app/azldev/cmds/component/query.go Reworks component query to read rendered specs and use batched rpmspec querying.
internal/app/azldev/cmds/component/mockproc.go Centralizes mock required-package presets and mock processor creation.
internal/app/azldev/cmds/component/query_test.go Updates query command tests for rendered-specs-dir validation behavior.
internal/app/azldev/cmds/component/query_internal_test.go Adds internal tests for building batch query inputs and skip behavior.
docs/user/reference/cli/azldev_component_query.md Updates CLI reference to match rendered-spec-based query and new --arch flag.
docs/user/reference/cli/azldev_component.md Updates command list description for component query.

Comment thread internal/app/azldev/command.go
Comment thread internal/app/azldev/core/sources/specquery.go
Comment thread internal/app/azldev/cmds/component/mockproc.go Outdated
Comment thread scenario/internal/projecttest/testspec.go
… enforcement

Add an --arch flag to 'component query' (default x86_64) that drives
rpmspec's --target and enforces ExclusiveArch/ExcludeArch policy via a
probe queryformat wrapped around the srpm query. Specs excluded by the
selected arch surface as ExcludedFromArch entries and are summarized in
a per-run log line.

Harden the per-spec query subprocess:
- 180s rpmspec timeout with a dedicated _RpmspecTimeout exception
- UTF-8 decoding with errors=replace on file IO and subprocess output

Plumb the arch parameter through BatchQuerySpecs and add
ExcludedFromArch to SpecQueryResult / its JSON mapping.

Teach runFuncInternal to render partial results when the inner func
returns both a value and an error, so per-component query failures
still print the successful rows while exiting non-zero.

Add javapackages-common to the mock package list so %javadoc_package
(from macros.fjava) doesn't silently disappear.
Bump scenario AZL 4.0 upstream + mock releasever to Fedora 43;
  java-srpm-macros is missing from f42-build koji.
Regenerate CLI docs.

[distros.azurelinux.versions.'4.0'.default-component-config]
spec = { type = "upstream", upstream-distro = { name = "fedora", version = "42" } }
spec = { type = "upstream", upstream-distro = { name = "fedora", version = "43" } }
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

java-srpm-macros is not available in f42 as a standalone binary RPM. Bumping the test mock to releasever=43 (and the matching f43-build URL) to unblock the scenario tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants