~smoser/curtin/trunk.install-kernel-fix

Viewing all changes in revision 323.

  • Committer: Scott Moser
  • Date: 2015-12-17 20:40:48 UTC
  • mfrom: (321.1.1 trunk.nodeps-help)
  • Revision ID: smoser@ubuntu.com-20151217204048-5yupk3xut7prj1qf
fix python executable selection when 'curtin --help' is called

The launcher was passing command arguments through to PY3OR2_MCHECK. If
you ran './curtin --help', then the launcher would call:
  python3 -m $PY3OR2_MCHECK --help
That program would print its help, and exit 0. The launcher would
interpret the exit status of 0 to mean all dependencies were met. If that
was not the case, then it would not look further to test python.

In an environment (trusty) where python2 had deps installed, but python3
did not, the launcher would then invoke 'curtin --help' with python3.
That would then stacktrace on missing dependencies.

The fix here is to pass '--' to separate the arguments to the checker
from the arguments that would be used.

In order to facilitate debugging, if PY3OR2_DEBUG is present, then
we will add '-v' to the invocation, calling:
  python3 -m $PY3OR2_MCHECK -v -- args...

The result is then that:
  PY3OR2_DEBUG=1 ./bin/curtin --help

Will show output like:
  python3 [94]: Fix with:
    apt-get -qy install lvm2 mdadm python3-oauthlib xfsprogs
  current best: python3
  python [94]: Fix with:
    apt-get -qy install lvm2 mdadm python-oauthlib xfsprogs
  executing: python3 -m "curtin.commands.main" --help

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: