Update snap for build 85/9585/2
authorbeierlm <mark.beierl@canonical.com>
Thu, 13 Aug 2020 20:13:50 +0000 (16:13 -0400)
committerbeierlm <mark.beierl@canonical.com>
Thu, 13 Aug 2020 20:47:09 +0000 (16:47 -0400)
Updates the snap to be buildable in the snapcraft docker
build container.

Change-Id: I2e16bb2a1bdd2eacf1cc134e7412486dbc6e4c98
Signed-off-by: beierlm <mark.beierl@canonical.com>
snap/local/README.md
snap/snapcraft.yaml

index 4d9c181..756034b 100644 (file)
 The snapcraft.yaml located in this folder, allows to build a snap of the OSM client
 
 
-## Build
+# Build the Snap
 
 ```bash
-# Build the snap
-$ snapcraft --use-lxd
-...
-Staging client
-Priming client
-Determining the version from the project repo (version: git).
-The version has been set to 'v7.1.0+git4.a4af86f-dirty'
-Snapping 'osmclient' \
-Snapped 'osmclient_v7.1.0+git4.a4af86f-dirty_amd64.snap'
+docker run -v ${PWD}:/build -w /build snapcore/snapcraft:stable /bin/bash -c "apt update && snapcraft"
 ```
 
+
+## Working on build steps
+
+As the build can take upwards of 4 minutes, it might be easier to enter the docker
+container and perform iterative builds there.
+
+```bash
+docker run -v ${PWD}:/build -w /build snapcore/snapcraft:stable /bin/bash -c /bin/bash
+apt update
+snapcraft
+```
+
+
 ## Install
 
 ```bash
index 208c01c..805f1b6 100644 (file)
@@ -31,13 +31,11 @@ environment:
 
 apps:
   osm:
-    # command: usr/bin/osm.wrapper
     command: usr/bin/python3 $SNAP/usr/local/bin/osm
     plugs:
       - network
       - home
       - ssh-public-keys
-      # - charm
     environment:
       PATH: $SNAP/usr/bin:$SNAP/bin/:$PATH
       PYTHONPATH: $SNAP/usr/lib/python3/dist-packages:$PYTHONPATH
@@ -50,21 +48,26 @@ parts:
     build-environment:
       - PATH: "$PATH:$SNAPCRAFT_PART_INSTALL/usr/local/bin"
     build-packages:
+      - gcc
       - git
     stage-packages:
-      - python3-pip
-      - python3-setuptools
+      - libmagic1
       - python3
       - python3-dev
+      - python3-pip
       - python3-pycurl
-      - libmagic1
-      - zlib1g-dev
+      - python3-setuptools
     override-build: |
-      BRANCH_OR_TAG=`git symbolic-ref -q --short HEAD || git describe --tags --exact-match`
+      $SNAPCRAFT_PART_INSTALL/usr/bin/pip3 install wheel
+      $SNAPCRAFT_PART_INSTALL/usr/bin/pip3 install pyang
+      $SNAPCRAFT_PART_INSTALL/usr/bin/pip3 install pyangbind
+      PATH="$PATH:$SNAPCRAFT_PART_INSTALL/usr/local/bin"
+      BRANCH_OR_TAG=`git symbolic-ref -q --short HEAD || git describe --tags --exact-match 2>/dev/null || echo $BRANCH`
       git clone https://osm.etsi.org/gerrit/osm/IM.git
       cd IM/
       git checkout $BRANCH_OR_TAG
       $SNAPCRAFT_PART_INSTALL/usr/bin/pip3 install .
       cd ../ && rm -rf IM/
       $SNAPCRAFT_PART_INSTALL/usr/bin/pip3 install .
+      rm -rf .tox
       snapcraftctl build