From da8f617ab34d8933dedbc64e1bc5c65acaa53f55 Mon Sep 17 00:00:00 2001 From: David Garcia Date: Thu, 18 Jun 2020 17:08:11 +0200 Subject: [PATCH] Add snapcraft.yaml to osmclient Change-Id: I97e847decd5cb99328e76f78256f0af61044f5a5 Signed-off-by: David Garcia --- snap/local/README.md | 42 ++++++++++++++++++++++++ snap/snapcraft.yaml | 76 ++++++++++++++++++++++++++++++++++++-------- 2 files changed, 105 insertions(+), 13 deletions(-) create mode 100644 snap/local/README.md diff --git a/snap/local/README.md b/snap/local/README.md new file mode 100644 index 0000000..4d9c181 --- /dev/null +++ b/snap/local/README.md @@ -0,0 +1,42 @@ +## +# Copyright 2020 ETSI +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +## + +# Snap for OSM client + +The snapcraft.yaml located in this folder, allows to build a snap of the OSM client + + +## Build + +```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' +``` + +## Install + +```bash +$ sudo snap install --devmode osmclient_v7.1.0+git4.a4af86f-dirty_amd64.snap +osmclient v7.1.0+git4.a4af86f-dirty installed +$ sudo snap alias osmclient.osm osm +``` diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index b7d0f05..208c01c 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,20 +1,70 @@ -name: osmclient # you probably want to 'snapcraft register ' -version: '0.1' # just for humans, typically '1.2+git' or '1.3.2' -summary: A python client for osm orchestration +--- +## +# Copyright 2020 ETSI +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +## +name: osmclient +base: core18 +version: git +summary: A python client for orchestrating OSM description: | - A python client for osm orchestration + A python client for orchestrating Open Source Mano (OSM). -grade: stable # must be 'stable' to release into candidate/stable channels -confinement: strict # use 'strict' once you have the right plugs and slots +grade: stable + +confinement: strict + +environment: + LC_ALL: C.UTF-8 + LANG: C.UTF-8 apps: - osmclient: - command: bin/osm + 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 + MAGIC: $SNAP/usr/share/file/magic.mgc parts: - osmclient: + client: + plugin: dump source: . - plugin: python - python-version: python2 - stage: - - -README.md + build-environment: + - PATH: "$PATH:$SNAPCRAFT_PART_INSTALL/usr/local/bin" + build-packages: + - git + stage-packages: + - python3-pip + - python3-setuptools + - python3 + - python3-dev + - python3-pycurl + - libmagic1 + - zlib1g-dev + override-build: | + BRANCH_OR_TAG=`git symbolic-ref -q --short HEAD || git describe --tags --exact-match` + 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 . + snapcraftctl build -- 2.25.1