From cc9244cd1baddc6f3ef96bbec5662239afc9f3c2 Mon Sep 17 00:00:00 2001 From: Rolf Badorek Date: Tue, 12 Nov 2019 18:19:37 +0200 Subject: [PATCH] Add PackageCloud.io publishing to CI scripts CI build scripts updated to publish SDL packages in PackageCloud.io RPM and Debian packages are available currently. Changed base image, because eariler one did have Boost libraries built from source. Debian package building tools will see Boost as missing dependency if not installed via apt. Signed-off-by: Rolf Badorek Change-Id: Id5409489415ec26c051366546c5355d6bdb8efcd --- ci/Dockerfile | 28 ++++++++++++++--- ci/publish.sh | 16 ++++++++++ configure.ac | 6 ++-- debian/changelog.in | 5 +++ debian/compat | 1 + debian/control | 20 ++++++++++++ debian/copyright | 15 +++++++++ debian/rules | 25 +++++++++++++++ debian/sdl-dev.dirs | 2 ++ debian/sdl-dev.install | 3 ++ debian/sdl.dirs | 2 ++ debian/sdl.install | 2 ++ debian/source/format | 1 + docs/release-notes.rst | 4 +++ package.sh | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++ rpm/sdl.spec.in | 54 ++++++++++++++++++++++++++++++++ 16 files changed, 261 insertions(+), 6 deletions(-) create mode 100755 ci/publish.sh create mode 100644 debian/changelog.in create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100755 debian/rules create mode 100644 debian/sdl-dev.dirs create mode 100644 debian/sdl-dev.install create mode 100644 debian/sdl.dirs create mode 100644 debian/sdl.install create mode 100644 debian/source/format create mode 100755 package.sh create mode 100755 rpm/sdl.spec.in diff --git a/ci/Dockerfile b/ci/Dockerfile index 737845c..4048151 100644 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -14,20 +14,40 @@ # limitations under the License. # -FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu18-c-go:2-u18.04-nng +FROM ubuntu:18.04 -# Install build tools and SDL dependencies: +# Install building tools and SDL dependencies: RUN apt-get update && \ - apt-get install -y libhiredis-dev && \ + apt-get install -y \ + build-essential \ + automake \ + libtool \ + pkg-config \ + libgtest-dev \ + rpm \ + devscripts \ + gawk \ + debhelper \ + autoconf-archive \ + libboost-all-dev \ + libhiredis-dev && \ apt-get clean # Copy sourcefiles: RUN mkdir -p /tmp/build COPY . /tmp/build +WORKDIR /tmp/build # Compile and run unit tests: -WORKDIR /tmp/build RUN ./autogen.sh && \ ./configure && \ make all && \ make test + +# Build packages: +RUN make clean && \ + make distclean && \ + ./package.sh --skip-test debian rpm + +RUN cp /tmp/build/ci/publish.sh /bin +ENTRYPOINT ["/bin/publish.sh"] diff --git a/ci/publish.sh b/ci/publish.sh new file mode 100755 index 0000000..2115e3c --- /dev/null +++ b/ci/publish.sh @@ -0,0 +1,16 @@ +#!/bin/bash +echo "$0: start copying packages" + +TARGET=/export +if [ $# -eq 1 ] +then + TARGET=$1 +fi + +if [ ! -d "$TARGET" ] +then + echo "$0: Error: target dir $TARGET does not exist" + exit 1 +fi + +cp -v /tmp/*.rpm /tmp/*.deb "$TARGET" diff --git a/configure.ac b/configure.ac index aca3abe..bcb8d3f 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ m4_define([SDL_MAJOR], [1]) m4_define([SDL_MINOR], [0]) -m4_define([SDL_MICRO], [3]) +m4_define([SDL_MICRO], [4]) # SDL ABI version with libtool # @@ -28,7 +28,7 @@ m4_define([SDL_MICRO], [3]) # Change the numbers just before release. m4_define([SDL_CURRENT], [1]) -m4_define([SDL_REVISION], [3]) +m4_define([SDL_REVISION], [4]) m4_define([SDL_AGE], [0]) AC_INIT([shareddatalayer], [SDL_MAJOR.SDL_MINOR.SDL_MICRO], [], [], [https://gerrit.o-ran-sc.org/r/admin/repos/ric-plt/sdl]) @@ -36,6 +36,8 @@ AC_CONFIG_HEADERS([include/config.h]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([Doxyfile]) +AC_CONFIG_FILES([rpm/sdl.spec]) +AC_CONFIG_FILES([debian/changelog]) AC_CONFIG_FILES([run-tests.sh], [chmod +x run-tests.sh]) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([subdir-objects foreign 1.13 tar-pax -Wall -Werror]) diff --git a/debian/changelog.in b/debian/changelog.in new file mode 100644 index 0000000..277acc8 --- /dev/null +++ b/debian/changelog.in @@ -0,0 +1,5 @@ +sdl (@PACKAGE_VERSION@-1) unstable; urgency=medium + + * Initial release + + -- Rolf Badorek Tue, 12 Nov 2019 15:35:00 +0300 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..f599e28 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +10 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..1db652e --- /dev/null +++ b/debian/control @@ -0,0 +1,20 @@ +Source: sdl +Priority: optional +Maintainer: Rolf Badorek +Build-Depends: debhelper (>= 10), pkg-config, libtool, automake, gawk, autoconf, automake, autoconf-archive, make, gcc, libboost-all-dev, libhiredis-dev +Standards-Version: 4.1.2 +Section: libs + +Package: sdl-dev +Section: libdevel +Architecture: any +Multi-Arch: same +Depends: sdl (= ${binary:Version}), ${misc:Depends} +Description: Development files for sdl + The sdl-dev package contains public headers, library and pkg-config file for developing applications that use sdl + +Package: sdl +Architecture: any +Multi-Arch: same +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: C++ API library for Shared Data Layer clients diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..5ed9187 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,15 @@ +# +# Copyright (c) 2018-2019 Nokia. +# +# 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. +# \ No newline at end of file diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..e1c367c --- /dev/null +++ b/debian/rules @@ -0,0 +1,25 @@ +#!/usr/bin/make -f +# See debhelper(7) (uncomment to enable) +# output every command that modifies files on the build system. +#export DH_VERBOSE = 1 + + +# see FEATURE AREAS in dpkg-buildflags(1) +#export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +# see ENVIRONMENT in dpkg-buildflags(1) +# package maintainers to append CFLAGS +#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic +# package maintainers to append LDFLAGS +#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed + + +%: + dh $@ + + +# dh_make generated override targets +# This is example for Cmake (See https://bugs.debian.org/641051 ) +#override_dh_auto_configure: +# dh_auto_configure -- # -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) + diff --git a/debian/sdl-dev.dirs b/debian/sdl-dev.dirs new file mode 100644 index 0000000..4418816 --- /dev/null +++ b/debian/sdl-dev.dirs @@ -0,0 +1,2 @@ +usr/lib +usr/include diff --git a/debian/sdl-dev.install b/debian/sdl-dev.install new file mode 100644 index 0000000..7df81cd --- /dev/null +++ b/debian/sdl-dev.install @@ -0,0 +1,3 @@ +usr/include/* +usr/lib/*/lib*.so +usr/lib/*/pkgconfig/* diff --git a/debian/sdl.dirs b/debian/sdl.dirs new file mode 100644 index 0000000..14f5b95 --- /dev/null +++ b/debian/sdl.dirs @@ -0,0 +1,2 @@ +usr/lib +usr/bin diff --git a/debian/sdl.install b/debian/sdl.install new file mode 100644 index 0000000..f366fe8 --- /dev/null +++ b/debian/sdl.install @@ -0,0 +1,2 @@ +usr/lib/*/lib*.so.* +usr/bin/sdltool diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/docs/release-notes.rst b/docs/release-notes.rst index 9a6ec6e..5876be2 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -31,6 +31,10 @@ ric-plt/sdl. Version history --------------- +[1.0.4] - 2019-11-13 + +* Add PackageCloud.io publishing to CI scripts. + [1.0.3] - 2019-11-08 * Add CI Dockerfile to compile SDL library and run unit tests. diff --git a/package.sh b/package.sh new file mode 100755 index 0000000..c4624c6 --- /dev/null +++ b/package.sh @@ -0,0 +1,83 @@ +#!/bin/bash +# +# Copyright (c) 2019 AT&T Intellectual Property. +# Copyright (c) 2018-2019 Nokia. +# +# 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. + +set -e + +if [ $# -eq 0 ] +then + echo "Generate a binary package" + echo "Usage: $0 [--target-dir ] [--skip-config] target..." + echo "Where possible targets are debian and rpm" + exit 1 +fi + +SKIP_CONF=0 +BUILD_RPM=0 +BUILD_DEB=0 +SKIP_TEST=0 +TARGET_DIR=/tmp + +for i in "$@" +do + case "$i" in + --target-dir) + shift + TARGET_DIR=$i + ;; + --skip-config) + SKIP_CONF=1 + ;; + --skip-test) + SKIP_TEST=1 + ;; + rpm) + BUILD_RPM=1 + shift + ;; + debian) + BUILD_DEB=1 + ;; + *) + echo "Unknown argument $1" + exit 1 + ;; + esac +done + +if [ $SKIP_CONF -eq 0 ] +then + ./autogen.sh && ./configure +fi + +if [ $BUILD_RPM -ne 0 ] +then + if [ $SKIP_TEST ] + then + TESTOPT=--nocheck + fi + rpmbuild --nodeps $TESTOPT -bb rpm/sdl.spec --define="_sourcedir $PWD" --define="_builddir $PWD" --define="_rpmdir .." + cp ../x86_64/*.rpm "$TARGET_DIR" +fi + +if [ $BUILD_DEB -ne 0 ] +then + if [ $SKIP_TEST -eq 1 ] + then + export DEB_BUILD_OPTIONS="nocheck noddebs" + fi + debuild -b -us -uc +fi diff --git a/rpm/sdl.spec.in b/rpm/sdl.spec.in new file mode 100755 index 0000000..2d2f89e --- /dev/null +++ b/rpm/sdl.spec.in @@ -0,0 +1,54 @@ +Name: sdl +Version: @PACKAGE_VERSION@ +Release: 1%{?dist} +Summary: C++ API library for Shared Data Layer clients + +License: Apache-2 +URL: https://gerrit.o-ran-sc.org/r/admin/repos/ric-plt/sdl + +BuildRequires: pkgconfig +BuildRequires: gcc +BuildRequires: autoconf +BuildRequires: autoconf-archive +BuildRequires: automake +BuildRequires: make +BuildRequires: gawk +BuildRequires: libtool +BuildRequires: boost-devel +BuildRequires: pkgconfig(hiredis) + +%description +%{name} provices a C++ API library for Shared Data Layer clients + +%package devel +Summary: Development files for %{name} +Requires: %{name}%{?isa} = %{version}-%{release} + +%description devel +The %{name}-devel package contains libraries and header files for +developing applications that use %{name}. + +%build +./autogen.sh +%configure +%make_build + +%install +%make_install +rm -f %{buildroot}%{_libdir}/lib*.*a + +%post -p /sbin/ldconfig + +%files +%{_libdir}/*.so.* +%{_bindir}/sdltool + +%files devel +%{_libdir}/pkgconfig/libsdl.pc +%{_libdir}/*.so +%{_libdir}/pkgconfig/*.pc +%{_includedir}/sdl + +%changelog +* Tue Nov 12 2019 Rolf Badorek - @PACKAGE_VERSION@-1 +- first version -- 2.16.6