Skip to content

Instantly share code, notes, and snippets.

@NickZ
Last active February 8, 2020 23:58
Show Gist options
  • Save NickZ/d50d56348e2be7cd26fbecabdb02cb6f to your computer and use it in GitHub Desktop.
Save NickZ/d50d56348e2be7cd26fbecabdb02cb6f to your computer and use it in GitHub Desktop.
Windows snapcraft test instructions

Current blockers:

  1. Need to wait for multipass 1.1 for this bugfix: canonical/multipass#1170
  2. Need to wait for multipass snapcraft builder images to be built for Windows (currently not bootable, according to Saviq)
  3. Need to merge this PR to fix issues with sanity checking: canonical/snapcraft#2919
  4. Need to merge this PR to fix issues with push not working: canonical/snapcraft#2922
  5. snapcraft clean does not yet work.

Requirements:

Instructions to get around the first four blockers:

  1. Install the above. For squashfs, extract to C:\bin
  2. edit your PATH variable to include the following:
%USERPROFILE%\AppData\Local\Programs\Python\Python37
%USERPROFILE%\AppData\Local\Programs\Python\Python37\Scripts
C:\bin

Make sure that they are at the top of the list or it will not work with the command line (it will just prompt you to install the windows store version, which we don't want.)

  1. Clone my fork of the snapcraft repository: https://github.com/NickZ/snapcraft
  2. Checkout the windows-testing branch (gets around blocker 1, 3, and 4)
  3. run the following in the command line at the repo:
pip install -r requirements.txt
pip install -e .
  1. Launch a multipass instance with the following command: (to get around blocker 2)
multipass launch -d10G -m2G -c4 -nsnapcraft-subtitle-edit 18.04
  1. multipass shell snapcraft-subtitle-edit

  2. sudo su and create the following files with nano: (creates files that are present on snapcraft builder)

/root/.bashrc:

export SNAPCRAFT_BUILD_ENVIRONMENT=managed-host
export PS1="\h \$(/bin/_snapcraft_prompt)# "
export PATH=/snap/bin:$PATH

/bin/_snapcraft_prompt:

#!/bin/bash
if [[ "$PWD" =~ ^$HOME.* ]]; then
    path="${PWD/#$HOME/\ ..}"
    if [[ "$path" == " .." ]]; then
        ps1=""
    else
        ps1="$path"
    fi
else
    ps1="$PWD"
fi
echo -n $ps1

Then run chmod a+x /bin/_snapcraft_prompt Then exit out

  1. Clone my subtitle-edit-snap repository to test: https://github.com/NickZ/subtitle-edit-snap.git

10: Run snapcraft in the directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment