Skip to content

Commit 3c58863

Browse files
authored
feat(package): Add azldev package list command (#53)
Adds a new azldev package list (alias azldev pkg list) command that resolves and displays binary package configuration across all config layers.
1 parent bf9e6f6 commit 3c58863

20 files changed

+744
-7
lines changed
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# How To: Inspect Resolved Package Configuration
2+
3+
This guide shows how to use `azldev package list` to audit the effective
4+
binary-package configuration for your project without running a build.
5+
6+
## Background
7+
8+
Binary package configuration in azldev is assembled from up to four layers
9+
(see [Package Groups](../reference/config/package-groups.md) for details):
10+
11+
1. Project `default-package-config`
12+
2. Package group `default-package-config`
13+
3. Component `default-package-config`
14+
4. Component `packages.<name>` override (highest priority)
15+
16+
`azldev package list` resolves all of these layers and prints the effective
17+
configuration for each package you ask about.
18+
19+
## List All Explicitly-Configured Packages
20+
21+
Use `-a` to enumerate every package that appears in any package-group or
22+
component `packages` map:
23+
24+
```bash
25+
azldev package list -a
26+
```
27+
28+
Example output:
29+
30+
```
31+
╭──────────────────┬────────────────┬───────────┬──────────────╮
32+
│ PACKAGE │ GROUP │ COMPONENT │ CHANNEL │
33+
├──────────────────┼────────────────┼───────────┼──────────────┤
34+
│ curl-debugsource │ debug-packages │ │ rpm-debug │
35+
│ libcurl │ base-packages │ │ rpm-base │
36+
│ libcurl-devel │ devel-packages │ curl │ rpm-base │
37+
│ wget2-wget │ │ wget2 │ rpm-base │
38+
╰──────────────────┴────────────────┴───────────┴──────────────╯
39+
```
40+
41+
### Column meanings
42+
43+
| Column | Meaning |
44+
|--------|---------|
45+
| **Package** | Binary package name (RPM `Name` tag) |
46+
| **Group** | Package-group whose `packages` list contains this package, if any |
47+
| **Component** | Component that has an explicit `packages.<name>` override for this package, if any |
48+
| **Channel** | Effective publish channel after all config layers are applied |
49+
50+
> **Note:** A non-empty **Component** column means the component has an explicit
51+
> per-package entry in its `packages` map — it does **not** mean "the component
52+
> whose spec produces this package". Packages that get their configuration only
53+
> from the project default or a package-group will show an empty Component.
54+
55+
## Look Up Specific Packages
56+
57+
Use `-p` to look up one or more packages by exact name. Packages that are not
58+
in any explicit configuration are still shown — they resolve using only the
59+
project default:
60+
61+
```bash
62+
azldev package list -p libcurl -p libcurl-devel -p curl-debugsource
63+
```
64+
65+
Positional arguments are equivalent to `-p`:
66+
67+
```bash
68+
azldev package list libcurl libcurl-devel curl-debugsource
69+
```
70+
71+
You can combine `-a` and `-p` — the results are the union of both selections.
72+
73+
## Machine-Readable Output
74+
75+
Pass `-q -O json` to get JSON output suitable for scripting:
76+
77+
```bash
78+
azldev package list -a -q -O json
79+
```
80+
81+
```json
82+
[
83+
{
84+
"packageName": "libcurl",
85+
"group": "base-packages",
86+
"component": "",
87+
"channel": "rpm-base"
88+
},
89+
...
90+
]
91+
```
92+
93+
## Alias
94+
95+
`pkg` is an alias for the `package` subcommand:
96+
97+
```bash
98+
azldev pkg list -a
99+
```

docs/user/reference/cli/azldev.md

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/user/reference/cli/azldev_package.md

Lines changed: 41 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/user/reference/cli/azldev_package_list.md

Lines changed: 69 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/user/reference/config/project.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
The `[project]` section defines metadata and directory layout for an azldev project. It is typically defined in a project-level config file (e.g., `base/project.toml`) rather than the root `azldev.toml`.
44

5-
## Field Reference
5+
## `[project]` Field Reference
6+
7+
The following fields are nested under the `[project]` TOML section:
68

79
| Field | TOML Key | Type | Required | Description |
810
|-------|----------|------|----------|-------------|
@@ -11,8 +13,8 @@ The `[project]` section defines metadata and directory layout for an azldev proj
1113
| Work directory | `work-dir` | string | No | Path to the temporary working directory for build artifacts (relative to this config file) |
1214
| Output directory | `output-dir` | string | No | Path to the directory where final build outputs (RPMs, SRPMs) are placed (relative to this config file) |
1315
| Default distro | `default-distro` | [DistroReference](distros.md#distro-references) | No | The default distro and version to use when building components |
14-
| Default package config | `default-package-config` | [PackageConfig](package-groups.md#package-config) | No | Project-wide default applied to every binary package before group and component overrides |
15-
| Package groups | `package-groups` | map of string → [PackageGroupConfig](package-groups.md) | No | Named groups of binary packages with shared configuration |
16+
17+
> **Note:** `[default-package-config]` and `[package-groups]` are **top-level** TOML sections — they are not nested under `[project]`. They are documented in the sections below.
1618
1719
## Directory Paths
1820

@@ -37,7 +39,7 @@ Components inherit their spec source and build environment from the default dist
3739

3840
## Default Package Config
3941

40-
The `[default-package-config]` section defines the lowest-priority configuration layer applied to every binary package produced by any component in the project. It is overridden by [package groups](package-groups.md), [component-level defaults](components.md#package-configuration), and explicit per-package overrides.
42+
The `[default-package-config]` section is a **top-level** TOML section (not nested under `[project]`). It defines the lowest-priority configuration layer applied to every binary package produced by any component in the project. It is overridden by [package groups](package-groups.md), [component-level defaults](components.md#package-configuration), and explicit per-package overrides.
4143

4244
The most common use is to set a project-wide default publish channel:
4345

@@ -50,7 +52,7 @@ See [Package Groups](package-groups.md#resolution-order) for the full resolution
5052

5153
## Package Groups
5254

53-
The `[package-groups.<name>]` section defines named groups of binary packages. Each group lists its members explicitly in the `packages` field and provides a `default-package-config` that is applied to all listed packages.
55+
The `[package-groups.<name>]` section is a **top-level** TOML section (not nested under `[project]`). It defines named groups of binary packages. Each group lists its members explicitly in the `packages` field and provides a `default-package-config` that is applied to all listed packages.
5456

5557
This is currently used to route different types of packages (e.g., `-devel`, `-debuginfo`) to different publish channels, though groups can also carry other future configuration.
5658

internal/app/azldev/cmds/component/build.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ func buildComponentUsingBuilder(
323323
// Enrich each RPM with its binary package name and resolved publish channel.
324324
results.RPMs, err = resolveRPMResults(env.FS(), results.RPMPaths, env.Config(), component.GetConfig())
325325
if err != nil {
326-
return results, fmt.Errorf("failed to resolve publish channels for %q:\n%w", component.GetName(), err)
326+
return results, fmt.Errorf("failed to resolve publish channels for %#q:\n%w", component.GetName(), err)
327327
}
328328

329329
// Populate the parallel Channels slice for table display.

0 commit comments

Comments
 (0)