[Skill] Test and inspect packages in Azure Linux mock chroots. Use when testing built RPMs, inspecting dependencies, debugging runtime issues, or verifying package contents. Triggers: test package, mock shell, inspect rpm, smoke test, chroot, verify build output.
75
92%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Never install built RPMs on the host. They target Azure Linux, not your dev machine. Use the methods below instead.
azldev has no built-in mock reset. Use mock directly when you need to clear stale state:
# Clean just the chroot (fast, keeps bootstrap)
mock --quiet -r distro/mock/azurelinux-4.0-x86_64.cfg --configdir distro/mock --scrub=chroot
# Nuclear — clean everything including bootstrap
mock --quiet -r distro/mock/azurelinux-4.0-x86_64.cfg --configdir distro/mock --scrub=allPipe commands via heredoc — fully autonomous, no user interaction needed:
azldev adv mock shell --add-package /path/to/package.rpm <<'CMDS'
<command> --version
echo "exit code: $?"
exit
CMDSUse this for automated checks: running binaries, querying installed packages, inspecting paths.
When --add-package fails, or you just want to inspect without installing, use mock --copyin to copy the RPM into the chroot and inspect it there:
# Copy the RPM into the chroot (does NOT install it)
mock -r distro/mock/azurelinux-4.0-x86_64.cfg --configdir distro/mock \
--copyin base/out/<name>*.rpm /tmp/
# Enter the chroot and inspect
azldev adv mock shell <<'CMDS'
rpm -qip /tmp/<name>*.rpm # package info
rpm -qlp /tmp/<name>*.rpm # file list
rpm -qRp /tmp/<name>*.rpm # dependencies
dnf install /tmp/<name>*.rpm # retry install to see error details
exit
CMDSThis avoids installing on the host and gives you the full Azure Linux environment for debugging dependency issues, file conflicts, etc.
Use when you need to explore interactively or run multiple diagnostic commands:
azldev adv mock shell --add-package /path/to/package.rpm --enable-networkecho "ready") in a non-background terminal to establish the shared shell.azldev adv mock shell command above in that same terminal.isBackground=true) — you cannot send commands to them.exit when done to leave the chroot.Prefer the non-interactive heredoc approach when possible. Use interactive only when you need to react to output between commands.
| Flag | Purpose |
|---|---|
-p, --add-package <path> | Install a package into the chroot before entering. Accepts RPM file paths or package names. Can be repeated. |
--enable-network | Allow network access (dependency resolution, downloads) |
⚠️
-pmeans--add-package, not component name. Unlikecomp build -p <name>,mock shellhas no component selector. The-pshorthand is--add-package. Passing-p <name>installs a package by name from configured repos — it does NOT set up a chroot with that component's build dependencies.
-p <name> with --add-package /path/to/name.rpm for the same package. Since -p IS --add-package, passing both -p cowsay --add-package ./cowsay.rpm tells dnf to install the repo version AND your local RPM — two different builds of the same package, which conflicts. Use one or the other:
--add-package /path/to/rpm to install your locally built RPM-p <name> to install a package by name from configured reposazldev adv mock shell sessions — installed packages, created files, etc. all persist. This is useful (install once, re-enter later) but can cause confusion from stale state. Use mock --scrub=chroot to reset when needed (see "Resetting the Mock Chroot" above).prep-sources output. Use --force to overwrite an existing output dir. Note that prep-sources -o <dir> writes to a user-specified dir, NOT base/out/ (that's for comp build output).azldev adv mock shell again will fail. Run exit first.advanced is hidden. azldev adv (alias for advanced) doesn't appear in azldev --help but contains mock shell, mock build-rpms, mcp, and wget.9e308ff
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.