Merge ~xnox/curtin:snap-stage-aware into ~curtin-dev/curtin:master

Proposed by Dimitri John Ledkov
Status: Needs review
Proposed branch: ~xnox/curtin:snap-stage-aware
Merge into: ~curtin-dev/curtin:master
Diff against target: 19 lines (+8/-0)
1 file modified
bin/curtin (+8/-0)
Reviewer Review Type Date Requested Status
Server Team CI bot (community) continuous-integration Approve
curtin developers Pending
Review via email: mp+453314@code.launchpad.net

Commit message

bin/curtin: make it snap stage aware

if curtin is staged into any snap, and is in default path inside the snap make it possible to call curtin via `$ snap run --shell $mysnap curtin --help` and make it find staged python, staged python's modules, and be able to use them.

This has potential of simplifying snapcraft.yaml packaging changes in subiquity & ubuntu-desktop-installer.

But this also seems to be fragile, if for example multiple versions of python are ever staged in a single snap.

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)

Unmerged commits

0731f03... by Dimitri John Ledkov

bin/curtin: make it snap stage aware

if curtin is staged into any snap, and is in default path inside the
snap make it possible to call curtin via `$ snap run --shell $mysnap
curtin --help` and make it find staged python, staged python's
modules, and be able to use them.

Signed-off-by: Dimitri John Ledkov <email address hidden>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bin/curtin b/bin/curtin
2index 89cb319..ba40958 100755
3--- a/bin/curtin
4+++ b/bin/curtin
5@@ -26,6 +26,14 @@ if [ "${mydir#${updir}/}" = "bin" -a -d "$updir/${PY3OR2_MCHECK%%.*}" ]; then
6 esac
7 fi
8
9+if [ -n "$SNAP" ]; then
10+ snap_pypath=$(find $SNAP -path $SNAP/lib/python*/site-packages/curtin/deps/check.py)
11+ if [ -n "$snap_pypath" ]; then
12+ export PYTHONPATH="${snap_pypath%%/curtin/deps/check.py}${PYTHONPATH:+:$PYTHONPATH}"
13+ debug "setting PYTHONPATH to '$PYTHONPATH'"
14+ fi
15+fi
16+
17 if [ ! -n "$PYTHON" ]; then
18 first_exe=""
19 oifs="$IFS"; IFS=":"

Subscribers

People subscribed via source and target branches