Nathan Skrzypczak | a2c9509 | 2021-10-08 14:05:58 +0200 | [diff] [blame] | 1 | .. _snap_doc: |
| 2 | |
| 3 | VPP Snap Build |
| 4 | ============== |
| 5 | |
| 6 | The external dependency package will not build in the snapcraft vm. The |
| 7 | path of least resistance is to copy it to the root of the (original) |
| 8 | workspace before running the prep script. |
| 9 | |
| 10 | Snapcraft has mount issues except under /home. Run the prep script and |
| 11 | copy the entire directory (including the .tgz file) under |
| 12 | /home/yourself. |
| 13 | |
| 14 | Run the prep script |
| 15 | ------------------- |
| 16 | |
| 17 | :: |
| 18 | |
| 19 | $ cd <vpp-workspace>/extras/snap |
| 20 | $ ./prep |
| 21 | |
| 22 | Copy data to /home (if necessary) |
| 23 | |
| 24 | :: |
| 25 | |
| 26 | $ mkdir /home/xxx |
| 27 | $ cd <vpp-workspace>/extras/snap |
| 28 | $ cp * /home/xxx |
| 29 | |
| 30 | Set snapcraft environment variables |
| 31 | ----------------------------------- |
| 32 | |
| 33 | Minimum requirements: |
| 34 | |
| 35 | SNAPCRAFT_BUILD_ENVIRONMENT_MEMORY=16G |
| 36 | SNAPCRAFT_BUILD_ENVIRONMENT_DISK=32G |
| 37 | |
| 38 | :: |
| 39 | |
| 40 | |
| 41 | Optional: |
| 42 | |
| 43 | SNAPCRAFT_BUILD_ENVIRONMENT_CPU=8 SNAPCRAFT_ENABLE_DEVELOPER_DEBUG=yes |
| 44 | |
| 45 | :: |
| 46 | |
| 47 | |
| 48 | Run snapcraft |
| 49 | ------------- |
| 50 | |
| 51 | With luck, simply running snapcraft will produce the snap |
| 52 | |
| 53 | $ snapcraft [–debug] |
| 54 | |
| 55 | :: |
| 56 | |
| 57 | |
| 58 | Rerunning snapcraft phases |
| 59 | -------------------------- |
| 60 | |
| 61 | Here's how to (re)run individual phases, to avoid starting from |
| 62 | scratch N times in case of errors: |
| 63 | |
| 64 | snapcraft pull [] snapcraft build [] snapcraft stage [] snapcraft prime |
| 65 | [] snapcraft snap or snapcraft |
| 66 | |
| 67 | :: |
| 68 | |
| 69 | |
| 70 | Restart without rebuilding VM |
| 71 | ----------------------------- |
| 72 | |
| 73 | To restart from scratch without rebuilding the VM: |
| 74 | |
| 75 | snapcraft clean vpp |
| 76 | |
| 77 | :: |
| 78 | |
| 79 | |
| 80 | Delete (all) snapcraft VMs |
| 81 | -------------------------- |
| 82 | |
| 83 | for vm in $(multipass list \| awk ‘{print $1}’ \| grep ^snapcraft-); do |
| 84 | multipass delete $vm –purge done \``\` |