misc: fix snap image build 37/30937/3
authorDave Barach <dave@barachs.net>
Tue, 26 Jan 2021 15:51:13 +0000 (10:51 -0500)
committerDave Barach <openvpp@barachs.net>
Tue, 26 Jan 2021 16:07:53 +0000 (16:07 +0000)
Clean up snapcraft.yaml bit rot, switch to Ubuntu 20.04, add README.md

Type: improvement

Signed-off-by: Dave Barach <dave@barachs.net>
Change-Id: I2e0d3925cf43541e70b59083f8c91af539aa34e6

extras/snap/README.md [new file with mode: 0644]
extras/snap/prep
extras/snap/snapcraft.yaml

diff --git a/extras/snap/README.md b/extras/snap/README.md
new file mode 100644 (file)
index 0000000..9387184
--- /dev/null
@@ -0,0 +1,83 @@
+General
+-------
+
+The external dependency package will not build in the snapcraft
+vm. The path of least resistance is to copy it to the root of the
+(original) workspace before running the prep script.
+
+Snapcraft has mount issues except under /home. Run the prep script and
+copy the entire directory (including the .tgz file) under
+/home/yourself.
+
+Run the prep script
+-------------------
+
+```
+  $ cd <vpp-workspace>/extras/snap
+  $ ./prep
+```
+
+Copy data to /home (if necessary)
+
+```
+  $ mkdir /home/xxx
+  $ cd <vpp-workspace>/extras/snap
+  $ cp * /home/xxx
+
+Set snapcraft environment variables
+-----------------------------------
+
+Minimum requirements:
+
+```
+  SNAPCRAFT_BUILD_ENVIRONMENT_MEMORY=16G
+  SNAPCRAFT_BUILD_ENVIRONMENT_DISK=32G
+```
+
+Optional:
+
+```
+  SNAPCRAFT_BUILD_ENVIRONMENT_CPU=8
+  SNAPCRAFT_ENABLE_DEVELOPER_DEBUG=yes
+```
+
+Run snapcraft
+-------------
+
+With luck, simply running snapcraft will produce the snap
+
+```
+  $ <environment-variable-settings> snapcraft [--debug]
+```
+
+Rerunning snapcraft phases
+--------------------------
+
+Here's how to (re)run individual phases, to avoid starting from
+scratch N times in case of errors:
+
+```
+  snapcraft pull [<part-name>]
+  snapcraft build [<part-name>]
+  snapcraft stage [<part-name>]
+  snapcraft prime [<part-name>]
+  snapcraft snap or snapcraft
+```
+
+Restart without rebuilding VM
+-----------------------------
+
+To restart from scratch without rebuilding the VM:
+
+```
+  snapcraft clean vpp
+```
+
+Delete (all) snapcraft VMs
+--------------------------
+
+```
+  for vm in $(multipass list | awk '{print $1}' | grep ^snapcraft-); do
+       multipass delete $vm --purge
+  done
+```
index caabd85..9e7e74b 100755 (executable)
@@ -5,6 +5,8 @@ set -eu
 cd ../../build-root
 echo "make distclean..."
 make distclean > /dev/null 2>&1
+# make sure we don't trip over a symbolic link later
+rm -f .ccache
 cd ../
 echo "construct source tarball..."
 tar -zcf extras/snap/vpp.tgz --exclude=extras/snap/vpp.tgz .
index 7fce0af..9a9dbd2 100644 (file)
@@ -1,6 +1,6 @@
 name: vpp
-base: core18
-version: '20.05'
+base: core20
+version: '21.01'
 summary: Vector Packet Processor
 description: |
          High performance user-mode network stack
@@ -17,14 +17,16 @@ parts:
       - gcc-8
       - make
       - libnuma-dev
+      - libpcap-dev
     stage-packages:
       # For the dpdk plugin
       - libnuma1
     override-build: |
-      UNATTENDED=y make install-dep build-release
+      dpkg -i vpp-ext-deps*.deb || true
+      UNATTENDED=y make install-dep install-ext-deps build-release
     override-prime: |
-      # Copy the build results into SNAPCRAFT_PRIME
-      cd $SNAPCRAFT_PART_BUILD/build-root/install-vpp-native
+      # Copy the build result into SNAPCRAFT_PRIME
+      cd $SNAPCRAFT_PART_SRC/../build/build-root/install-vpp-native
       tar cf - . | (cd $SNAPCRAFT_PRIME ; tar xf -)
       # Copy staged libraries into SNAPCRAFT_PRIME
       cp $SNAPCRAFT_STAGE/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/lib* $SNAPCRAFT_PRIME/vpp/lib