From 09a2710efddf61e302d30dc2438105a3a155ce15 Mon Sep 17 00:00:00 2001 From: Mike Marchetti Date: Mon, 24 Sep 2018 15:05:51 -0400 Subject: [PATCH] Build IM docs package Signed-off-by: Mike Marchetti Change-Id: I612ba00dd2ba6b15cdac88d1c30681168d078693 --- Dockerfile | 5 +++- Makefile | 2 ++ build-docs.sh | 55 ++++++++++++++++++++++++++++++++++ debian/control | 12 ++++++++ devops-stages/stage-archive.sh | 1 + setup.py | 2 +- 6 files changed, 75 insertions(+), 2 deletions(-) create mode 100755 build-docs.sh create mode 100644 debian/control diff --git a/Dockerfile b/Dockerfile index 064baad..1e89c8f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,10 @@ FROM ubuntu:16.04 RUN apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get -y install git make wget python python3 python3-all python3-pip python-pip debhelper tox python-setuptools python3-setuptools && \ + DEBIAN_FRONTEND=noninteractive apt-get -y install git make wget python \ + python3 python3-all python3-pip python-pip \ + debhelper tox python-setuptools \ + python3-setuptools build-essential dh-make && \ DEBIAN_FRONTEND=noninteractive pip3 install pip==9.0.3 && \ DEBIAN_FRONTEND=noninteractive pip3 install -U pyang pyangbind && \ DEBIAN_FRONTEND=noninteractive pip3 install -U stdeb && \ diff --git a/Makefile b/Makefile index 26e3843..4faeb5f 100644 --- a/Makefile +++ b/Makefile @@ -85,6 +85,8 @@ $(RW_PB_EXT): package: tox -e build tox -e build3 + ./build-docs.sh + pyangbind: pyang git clone https://github.com/alf-tierno/pyangbind diff --git a/build-docs.sh b/build-docs.sh new file mode 100755 index 0000000..3bb29b1 --- /dev/null +++ b/build-docs.sh @@ -0,0 +1,55 @@ +#!/bin/bash +# Copyright 2018 Sandvine +# All Rights Reserved. +# +# 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. + +PKG_DIRECTORIES="osm_im_trees models" +MDG_NAME=im +PKG_NAME=osm-${MDG_NAME}docs +DEB_INSTALL=debian/${PKG_NAME}.install +export DEBEMAIL="mmarchetti@sandvine.com" +export DEBFULLNAME="Michael Marchetti" + +PKG_VERSION=$(git describe --match "v*" --tags --abbrev=0) +PKG_VERSION_FULL=$(git describe --match "v*" --tags --long) +PKG_VERSION_PREFIX=$(echo $PKG_VERSION | sed -e 's/v//g') +PKG_VERSION_POST=$(git rev-list $PKG_VERSION..HEAD | wc -l) + +IFS='-' read -ra PKG_VERSION_FIELDS <<< "$PKG_VERSION_FULL" + +if [ "$PKG_VERSION_POST" -eq 0 ]; then + PKG_DIR="${PKG_NAME}-${PKG_VERSION_PREFIX}" + POST_UPDATE= +else + PKG_DIR="${PKG_NAME}-$PKG_VERSION_PREFIX.post${PKG_VERSION_POST}" + POST_UPDATE=".post${PKG_VERSION_FIELDS[1]}" +fi + +rm -rf $PKG_DIR +rm -f *.orig.tar.xz +rm -f *.deb +rm -f $DEB_INSTALL +mkdir -p $PKG_DIR + +for dir in $PKG_DIRECTORIES; do + ln -s $PWD/$dir $PKG_DIR/. + echo "$dir/* usr/share/osm-$MDG_NAME/$dir" >> $DEB_INSTALL +done +cp -R debian $PKG_DIR/. + +cd $PKG_DIR +dh_make -y --indep --createorig --a -c apache +sed -i -e "s/${PKG_VERSION_PREFIX}${POST_UPDATE}-1/$PKG_VERSION_PREFIX${POST_UPDATE}-${PKG_VERSION_FIELDS[2]}/g" debian/changelog +dpkg-buildpackage -uc -us -tc -rfakeroot +cd - diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..5e9a67f --- /dev/null +++ b/debian/control @@ -0,0 +1,12 @@ +Source: osm-im +Section: devel +Priority: optional +Maintainer: Michael Marchetti +Build-Depends: debhelper (>=9) +Standards-Version: 3.9.6 +Homepage: http://osm.etsi.org + +Package: osm-im +Architecture: all +Depends: ${misc:Depends} +Description: osm-im is the Information Model package for OSM, providing base classes derived from YANG models to be used by other modules. diff --git a/devops-stages/stage-archive.sh b/devops-stages/stage-archive.sh index c696ce6..98b44a3 100755 --- a/devops-stages/stage-archive.sh +++ b/devops-stages/stage-archive.sh @@ -5,6 +5,7 @@ rm -rf pool rm -rf dists mkdir -p pool/$MDG mv deb_dist/*.deb pool/$MDG/ +mv *.deb pool/$MDG/ mv pyangbind/deb_dist/*.deb pool/$MDG/ mv pyang/deb_dist/*.deb pool/$MDG/ diff --git a/setup.py b/setup.py index cdccff9..b08ea17 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ setup( name='osm_im', description='OSM Information Model', long_description = open('README.rst').read(), - version_command=('git describe --tags --long --dirty --match v*', 'pep440-git'), + version_command=('git describe --tags --long --dirty --match v*', 'pep440-git-full'), author='Mike Marchetti', author_email='mmarchetti@sandvine.com', packages=find_packages(), -- 2.25.1