Fix Bug 1493 repo generation from osm-packages
[osm/osmclient.git] / snap / snapcraft.yaml
index 208c01c..d950852 100644 (file)
@@ -16,7 +16,7 @@
 ##
 name: osmclient
 base: core18
-version: git
+adopt-info: client
 summary: A python client for orchestrating OSM
 description: |
   A python client for orchestrating Open Source Mano (OSM).
@@ -31,15 +31,13 @@ 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
+      PATH: $SNAP/usr/bin:$SNAP/bin/:$PATH:$SNAP/usr/local/bin/
       PYTHONPATH: $SNAP/usr/lib/python3/dist-packages:$PYTHONPATH
       MAGIC: $SNAP/usr/share/file/magic.mgc
 
@@ -50,21 +48,32 @@ parts:
     build-environment:
       - PATH: "$PATH:$SNAPCRAFT_PART_INSTALL/usr/local/bin"
     build-packages:
+      - gcc
       - git
+      - make
+      - wget
+      - libcurl4-openssl-dev
+      - libssl-dev
     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 -r requirements.txt
       $SNAPCRAFT_PART_INSTALL/usr/bin/pip3 install .
+      rm -rf .tox
+      snapcraftctl set-version $(git describe --match v* --tags --long --dirty)
       snapcraftctl build