Skip to content
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

Provide list of chroots (--list-chroots) in machine-readable format #1294

Open
scfc opened this issue Jan 23, 2024 · 1 comment
Open

Provide list of chroots (--list-chroots) in machine-readable format #1294

scfc opened this issue Jan 23, 2024 · 1 comment
Labels
enhancement feature request, rfe

Comments

@scfc
Copy link

scfc commented Jan 23, 2024

I'm working on polishing up an Emacs TRAMP method for editing within Mock. To provide completion of possible chroots, I need to have a list of them.

mock -q --list-chroots does not look stable in that regard (generated by mock/py/mockbuild/config.py):

$ mock -q --list-chroots
config name                        description
Global configs:
alma+epel-8-aarch64                AlmaLinux 8 + EPEL
alma+epel-8-ppc64le                AlmaLinux 8 + EPEL
alma+epel-8-x86_64                 AlmaLinux 8 + EPEL
[…]
$

It has a row with the column names (suggesting the columns may change) and interjects "Global configs:" and sometimes "Custom configs:" into the table.

Not so surprisingly, mock/etc/bash_completion.d/mock therefore duplicates the code to list the chroots (in shell script).

It would be nice if Mock provided an option to list chroots in a machine-readable format (and probably then used that in mock/etc/bash_completion.d/mock). The output should consist (only) of the list (implying -q), no headers and no interlines, with each line consisting only of the name of the chroot as it can be passed to mock -r.

@praiskup praiskup added the enhancement feature request, rfe label Jan 24, 2024
@praiskup praiskup changed the title RFE: Provide list of chroots (--list-chroots) in machine-readable format Provide list of chroots (--list-chroots) in machine-readable format Jan 24, 2024
@praiskup
Copy link
Member

Thank you for the report. Bash-completion just needs to have a list of files, while --list-chroots parses those files too, to print out additional metadata.

Said that I can imagine having a --list-chroots-config-files printing just filenames - and start using that option even in Mock's bash completion. Or using --list-chroots --only-filenames. Or something like that. Patches are welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement feature request, rfe
Projects
None yet
Development

No branches or pull requests

2 participants