We don't really need this, but it's easier to avoid trouble if we're
not using the package manager to uninstall itself and it's
dependencies ;). Portage will protect itself and refuse to unmerge
itself and the version of Python it's using, but it doesn't protect
other dependencies like app-admin/eselect-python (which supplies the
/usr/bin/python-wrapper linked from /usr/bin/python).
I've also added sys-apps/findutils to avoid crashing with:
Traceback (most recent call last):
File "/usr/bin/emerge", line 50, in <module>
retval = emerge_main()
File "/usr/lib64/portage/pym/_emerge/main.py", line 1031, in emerge_main
return run_action(emerge_config)
File "/usr/lib64/portage/pym/_emerge/actions.py", line 3983, in run_action
emerge_config.trees, emerge_config.target_config.mtimedb, rval)
File "/usr/lib64/portage/pym/portage/proxy/objectproxy.py", line 31, in __call__
return result(*args, **kwargs)
File "/usr/lib64/portage/pym/_emerge/post_emerge.py", line 146, in post_emerge
chk_updated_cfg_files(settings['EROOT'], config_protect)
File "/usr/lib64/portage/pym/_emerge/chk_updated_cfg_files.py", line 17, in chk_updated_cfg_files
portage.util.find_updated_config_files(target_root, config_protect))
File "/usr/lib64/portage/pym/portage/util/__init__.py", line 1735, in find_updated_config_files
stderr=subprocess.STDOUT)
File "/usr/lib64/python2.7/subprocess.py", line 709, in __init__
errread, errwrite)
File "/usr/lib64/python2.7/subprocess.py", line 1326, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
the trouble comes from portage.util.find_updated_config_files, which
is calling find with code like:
if stat.S_ISDIR(mymode):
mycommand = \
"find '%s' -name '.*' -type d -prune -o -name '._cfg????_*'" % x
else:
mycommand = "find '%s' -maxdepth 1 -name '._cfg????_%s'" % \
os.path.split(x.rstrip(os.path.sep))
-v "${PWD}/empty-system.py:/tmp/empty-system.py" \
"${IMAGE}" /bin/bash -c "
/tmp/empty-system.py &&
- emerge --noreplace app-shells/bash sys-apps/net-tools sys-apps/openrc sys-devel/gettext &&
+ emerge --noreplace app-shells/bash sys-apps/findutils sys-apps/net-tools sys-apps/openrc sys-devel/gettext virtual/package-manager &&
emerge -v --with-bdeps=n --depclean &&
rm -rf /usr/portage" ||
die "failed to create ${CONTAINER}"