mock
mock copied to clipboard
`mock shell` should change directory to `%{_builddir}`
Currently, whenever I do mock shell --unpriv
, I endup in root directory and this is typically followed byt cd /builddir/build/BUILD/builddir_of_the_package
. Would you consider to do this step automatically? I don't think that being in the root directory is good default.
I'm not sure why login shell isn't used, I have to check later. IMO we should switch to $HOME automatically, but this doesn't happen.
I don't think it is wise to go anywhere else than /builddir
by default (non-standard behavior, something contrary to what I personally expect - so that would be about preferences). The builddir_of_the_package
is variable, hard to guess correctly ... I'd say using shell completion could be enough? Perhaps we could have some option for initial cd path
command? I don't think it is worth it...?
Maybe have a different shell command or option(s) to do this:
- su mockbuild
- cd $HOME
$ mock -r fedora-rawhide-x86_64 --shell --user
Or
$ mock -r fedora-rawhide-x86_64 --usershell
IMO we should switch to $HOME automatically
Sorry for confusion, this actually happens. But that is not useful either.
I don't think it is wise to go anywhere else than
/builddir
by default (non-standard behavior, something contrary to what I personally expect - so that would be about preferences).
You are right, that it would be non-standard, but probably more convenient. There is basically nothing useful what can one do in $HOME
in mock.
The builddir_of_the_package is variable, hard to guess correctly
The %{_builddir}
is $HOME/rpmbuild/BUILD
by default, but if there was chance to even step into the expanded sources directory, that could be nice as well.
Perhaps we could have some option for initial
cd path
command?
That starts to be more complicated then the explicit cd
. But if the default behavior could be configured, that could be helpful.
What would be useful is if mock --rebuild
(and fedpkg mockbuild
) printed a message when they fail, telling you the directory to change to.
Build failed, see /build/rpmbuild/BUILD/foo-1.2.3 in the chroot filesystem.
Alternatively, /var/lib/mock/fedora-rawhide-x86_64/build/rpmbuild/BUILD/foo-1.2.3 in the local filesystem.
Then at least you can just select that with the mouse and paste it into the shell (either mock shell or the host shell). That would be easier than remembering/rediscovering the right paths each time.
A new mock command like --usershell
or --user --shell
might be useful, but it's one more extra command to remember. I don't mind being root and I don't mind having to cd
to the build dir, the only difficulty is knowing the path of that build dir.
I created https://github.com/rpm-software-management/mock/pull/732 which allows you to use --cwd
together with --shell
. And which chdir to /builddir
if nothing is explicitly specified.
I am not sure about that %{_builddir}
because that would be hard to implement (evaluating that in bootstrap?) and hardcoding /build/rpmbuild/BUILD/
will be fragile. Or not?
The other option is to define (yet) another config option, which will allow customization. Comments?
While --cwd
might have some utility, I don't think is convenient for my use case. Once in mock shell, I can use at least bash completion to help me writ the path, while it won't work outside of mock. Also cd /some/path
is shorter the --cwd /some/path
.