From: Benjamin Diaz Date: Thu, 18 Oct 2018 20:31:05 +0000 (-0300) Subject: Modifies deb pkg building to include postinst script X-Git-Tag: v5.0.0~11 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F23%2F6723%2F4;p=osm%2Fcommon.git Modifies deb pkg building to include postinst script stage-build now uses make instead of tox, to allow adding postinst script. Postinst script adds installation of dependencies through pip. Adds missing MANIFEST and stdeb.cfg. Signed-off-by: Benjamin Diaz Change-Id: I42849e0a3457745ad00a169128554cf3574bcb23 --- diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..cbc5d1e --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,21 @@ +# Copyright 2018 Whitestack, LLC +# +# 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. +# +# For those usages not covered by the Apache License, Version 2.0 please +# contact: bdiaz@whitestack.com or glavado@whitestack.com +## + +include README.rst +recursive-include osm_common *.py *.xml *.sh +recursive-include devops-stages * \ No newline at end of file diff --git a/Makefile b/Makefile index 410db79..e3e9dac 100644 --- a/Makefile +++ b/Makefile @@ -16,13 +16,9 @@ all: clean package clean: - rm -rf dist deb_dist .build osm_common-*.tar.gz osm_common.egg-info eggs + rm -rf dist deb_dist osm_common-*.tar.gz osm_common.egg-info .eggs package: python3 setup.py --command-packages=stdeb.command sdist_dsc - cp python3-osm-common.postinst deb_dist/osm-common*/debian - cd deb_dist/osm-common*/debian && echo "pymongo python3-pymongo" > py3dist-overrides - # cd deb_dist/osm-common*/debian && echo "pip3 python3-pip" >> py3dist-overrides + cp debian/python3-osm-common.postinst deb_dist/osm-common*/debian cd deb_dist/osm-common*/ && dpkg-buildpackage -rfakeroot -uc -us - mkdir -p .build - cp deb_dist/python3-osm-common*.deb .build/ diff --git a/debian/python3-osm-common.postinst b/debian/python3-osm-common.postinst new file mode 100755 index 0000000..a877e58 --- /dev/null +++ b/debian/python3-osm-common.postinst @@ -0,0 +1,30 @@ +#!/bin/bash + +## +# 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. +# +# For those usages not covered by the Apache License, Version 2.0 please +# contact with: OSM_TECH@list.etsi.org +## + +echo "POST INSTALL OSM-COMMON" +echo "Installing python dependencies via pip..." + +pip3 install pip==9.0.3 +pip3 install --upgrade aiokafka==0.4.* +pip3 install --upgrade pymongo==3.7.* +pip3 install --upgrade pyyaml==3.* + +#Creation of log folder +mkdir -p /var/log/osm + diff --git a/devops-stages/stage-build.sh b/devops-stages/stage-build.sh index 538f24f..dfb7978 100755 --- a/devops-stages/stage-build.sh +++ b/devops-stages/stage-build.sh @@ -16,7 +16,4 @@ # moved to a Makefile in order to add post install. Needed for "pip3 install aiokafka", # that is not available with a package -#make clean package - -rm -rf deb_dist -tox -e build +make clean package diff --git a/python3-osm-common.postinst b/python3-osm-common.postinst deleted file mode 100755 index 62b04ec..0000000 --- a/python3-osm-common.postinst +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -## -# 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. -# -# For those usages not covered by the Apache License, Version 2.0 please -# contact with: OSM_TECH@list.etsi.org -## - -echo "POST INSTALL OSM-COMMON" -echo "Install aiokafka with pip" - -pip3 install pip==9.0.3 -pip3 install --upgrade aiokafka -# pip install --upgrade pyang pyangbind - -#Creation of log folder -mkdir -p /var/log/osm - diff --git a/stdeb.cfg b/stdeb.cfg new file mode 100644 index 0000000..2bc94c2 --- /dev/null +++ b/stdeb.cfg @@ -0,0 +1,3 @@ +[DEFAULT] +X-Python3-Version : >= 3.5 +Depends3 : python3-pip \ No newline at end of file