packages BUGFIX spec files and shell script
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2a66b59..37a25e0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -49,24 +49,27 @@
)
endif()
-if ($ENV{TRAVIS_EVENT_TYPE} STREQUAL "cron")
- if ($ENV{TRAVIS_BRANCH} STREQUAL "master")
- set(PACKAGE_NAME "libyang")
- set(BRANCH "master")
- set(BUILD_TYPE "Package")
- else ()
- set(PACKAGE_NAME "libyang-experimental")
- set(BRANCH "devel")
- set(BUILD_TYPE "debug")
+if (DEFINED ENV{TRAVIS_EVENT_TYPE})
+ if ($ENV{TRAVIS_EVENT_TYPE} STREQUAL "cron")
+ if ($ENV{TRAVIS_BRANCH} STREQUAL "master")
+ set(PACKAGE_NAME "libyang")
+ set(BRANCH "master")
+ set(BUILD_TYPE "Package")
+ set(CONFLICT_PACKAGE_NAME "libyang-experimental")
+ else ()
+ set(PACKAGE_NAME "libyang-experimental")
+ set(BRANCH "devel")
+ set(BUILD_TYPE "debug")
+ set(CONFLICT_PACKAGE_NAME "libyang")
+ endif()
+ # change version in config files
+ configure_file(${PROJECT_SOURCE_DIR}/packages/libyang.spec.in ${PROJECT_BINARY_DIR}/packages/libyang.spec)
+ configure_file(${PROJECT_SOURCE_DIR}/packages/libyang.dsc.in ${PROJECT_BINARY_DIR}/packages/libyang.dsc)
+ configure_file(${PROJECT_SOURCE_DIR}/packages/debian.control.in ${PROJECT_BINARY_DIR}/packages/debian.control)
+ configure_file(${PROJECT_SOURCE_DIR}/packages/debian.rules.in ${PROJECT_BINARY_DIR}/packages/debian.rules)
endif()
- # change version in config files
- configure_file(${PROJECT_SOURCE_DIR}/packages/libyang.spec.in ${PROJECT_BINARY_DIR}/packages/libyang.spec)
- configure_file(${PROJECT_SOURCE_DIR}/packages/libyang.dsc.in ${PROJECT_BINARY_DIR}/packages/libyang.dsc)
- configure_file(${PROJECT_SOURCE_DIR}/packages/debian.control.in ${PROJECT_BINARY_DIR}/packages/debian.control)
- configure_file(${PROJECT_SOURCE_DIR}/packages/debian.rules.in ${PROJECT_BINARY_DIR}/packages/debian.rules)
endif()
-
# check the supported platform
if(NOT UNIX)
message(FATAL_ERROR "Only *nix like systems are supported.")
diff --git a/packages/create-package.sh b/packages/create-package.sh
index fbe0812..696bb2a 100755
--- a/packages/create-package.sh
+++ b/packages/create-package.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-if [ "$TRAVIS_PULL_REQUEST" == "true" -o "$TRAVIS_EVENT_TYPE" != "cron"] ; then
+if [ "$TRAVIS_PULL_REQUEST" == "true" -o "$TRAVIS_EVENT_TYPE" != "cron" ] ; then
exit 0
fi
# check osb_user and osb_pass
@@ -10,7 +10,6 @@
echo -e "[general]\napiurl = https://api.opensuse.org\n\n[https://api.opensuse.org]\nuser = ${osb_user}\npass = ${osb_pass}" >~/.oscrc
cd $HOME/build/$TRAVIS_REPO_SLUG/build
-osc checkout home:liberouter
if [ $TRAVIS_BRANCH == "devel" ]; then
package="home:liberouter/libyang-experimental"
name="libyang-experimental"
@@ -18,12 +17,26 @@
package="home:liberouter/libyang"
name="libyang"
fi
+osc checkout home:liberouter
+cp $package/libyang.spec $package/debian.changelog home:liberouter
cp packages/* $package
VERSION=$(cat CMakeCache.txt | grep "LIBYANG_VERSION:STRING=" | sed 's/LIBYANG_VERSION:STRING=//')
cd $package
+OLDVERSION=$(cat ../libyang.spec | grep "Version: " | awk '{print $NF}')
+# check different version
+if [ "$VERSION" == "$OLDVERSION" ]; then
+ exit 0
+fi
+logtime=$(git log -i --grep="VERSION .* $OLDVERSION" | grep "Date: " | sed 's/Date:[ ]*//')
echo -e "$name ($VERSION) stable; urgency=low\n" >debian.changelog
-HASHES=(`git log -2 --grep="VERSION .* [0-9]+\.[0-9]+\.[0-9]+" -i -E | grep "commit " | sed 's/commit //' | tr '\n' ' '`)
-git log "${HASHES[1]}..${HASHES[0]}" --pretty=format:" * %s%n" >>debian.changelog
+git log --since="$logtime" --pretty=format:" * %s (%aN)%n" | grep "BUGFIX\|CHANGE\|FEATURE" >>debian.changelog
git log -1 --pretty=format:"%n -- %aN <%aE> %aD%n" >>debian.changelog
-wget "https://github.com/CESNET/libyang/archive/$TRAVIS_BRANCH.tar.gz"
+echo -e "\n" >>debian.changelog
+cat ../debian.changelog >>debian.changelog
+git log -1 --date=format:'%a %b %d %Y' --pretty=format:"* %ad %aN <%aE>" | tr -d "\n" >>libyang.spec
+echo " $VERSION" >>libyang.spec
+git log --since="$logtime" --pretty=format:"- %s (%aN)" | grep "BUGFIX\|CHANGE\|FEATURE" >>libyang.spec
+echo -e "\n" >>libyang.spec
+cat ../libyang.spec | sed -e '1,/%changelog/d' >>libyang.spec
+wget "https://github.com/CESNET/libyang/archive/$TRAVIS_BRANCH.tar.gz" -O $TRAVIS_BRANCH.tar.gz
osc commit -m travis-update
diff --git a/packages/debian.changelog b/packages/debian.changelog
index 6bf4749..171945a 100644
--- a/packages/debian.changelog
+++ b/packages/debian.changelog
@@ -6,4 +6,4 @@
* schema tree BUGFIX missing include
--- Michal Vasko <mvasko@cesnet.cz> Fri, 24 Mar 2017 11:24:21 +0100
+ -- Michal Vasko <mvasko@cesnet.cz> Fri, 24 Mar 2017 11:24:21 +0100
diff --git a/packages/debian.control.in b/packages/debian.control.in
index e5ef835..afbaba2 100644
--- a/packages/debian.control.in
+++ b/packages/debian.control.in
@@ -5,22 +5,20 @@
Homepage: https://github.com/CESNET/libyang
Package: @PACKAGE_NAME@
-Depends: libpcre3-dev
+Depends: libpcre3
+Conflicts: @CONFLICT_PACKAGE_NAME@ (= @LIBYANG_MAJOR_VERSION@.@LIBYANG_MINOR_VERSION@)
Section: libs
-Version: @LIBYANG_VERSION@
Architecture: any
Description: Libyang is YANG data modelling language parser and toolkit written (and providing API) in C.
Package: @PACKAGE_NAME@-dev
-Depends: libpcre3-dev, libyang
+Depends: libpcre3-dev, libyang (=@LIBYANG_VERSION@)
Section: libs
-Version: @LIBYANG_VERSION@
Architecture: any
Description: Headers of libyang library.
Package: @PACKAGE_NAME@-dbg
-Depends: libpcre3-dev, libyang
-Section: libs
-Version: @LIBYANG_VERSION@
+Depends: libyang (=@LIBYANG_VERSION@)
+Section: debug
Architecture: any
-Description: Debug info of libyang library.
+Description: Debug symbols of libyang library.
diff --git a/packages/debian.libyang.install b/packages/debian.libyang.install
index 29d265f..95ad788 100644
--- a/packages/debian.libyang.install
+++ b/packages/debian.libyang.install
@@ -3,4 +3,3 @@
usr/lib/*/libyang/metadata.so
usr/bin/yanglint
usr/share/man/man1/yanglint.1
-
diff --git a/packages/debian.rules.in b/packages/debian.rules.in
index 246ec6b..4d81c1e 100644
--- a/packages/debian.rules.in
+++ b/packages/debian.rules.in
@@ -2,51 +2,15 @@
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
-SHELL = /bin/bash
-build:
- dh_testdir
- cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -D CMAKE_BUILD_TYPE:String="@BUILD_TYPE@" .
- dh_auto_build
+%:
+ dh $@
-check:
- dh_testdir
- dh_testroot
- make test
+override_dh_strip:
+ dh_strip --dbg-package=@PACKAGE_NAME@-dbg
-clean:
- dh_testdir
- dh_testroot
- rm -f configure-stamp build-stamp
- dh_clean
+override_dh_auto_configure:
+ cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -D CMAKE_BUILD_TYPE:String="Package" .
-install: build check
- dh_testdir
- dh_testroot
- dh_prep
- dh_installdirs
- dh_auto_install
- dh_strip -k --dbg-package=@PACKAGE_NAME@-dbg
- dh_install --list-missing -s --sourcedir=debian/tmp
-
-# Build architecture-dependent files here.
-binary-arch: build install
- dh_testdir
- dh_testroot
- dh_installdocs
- dh_installexamples
- dh_installman
- dh_link
- dh_strip
- dh_compress
- dh_fixperms
- dh_makeshlibs -V
- dh_installdeb
- dh_shlibdeps
- dh_gencontrol
- dh_md5sums
- dh_builddeb
-
-
-binary: binary-arch
-.PHONY: build clean check binary-arch binary install
+override_dh_auto_test:
+ ctest -V
diff --git a/packages/libyang.dsc.in b/packages/libyang.dsc.in
index 0fb3f9f..f11490d 100644
--- a/packages/libyang.dsc.in
+++ b/packages/libyang.dsc.in
@@ -7,5 +7,4 @@
Standards-Version: 3.8.2
Homepage: https://github.com/CESNET/libyang
Vcs-Git: https://github.com/CESNET/libyang
-Build-Depends: debhelper (>= 8), make, gcc, valgrind, doxygen, cmake, pkg-config, libpcre3-dev, libcmocka-dev
-# DEBTRANSFORM-RELEASE: 0
+Build-Depends: debhelper (>= 9), make, gcc, doxygen, cmake, pkg-config, libpcre3-dev, libcmocka-dev
diff --git a/packages/libyang.spec.in b/packages/libyang.spec.in
index 40700ad..7cd2f7d 100644
--- a/packages/libyang.spec.in
+++ b/packages/libyang.spec.in
@@ -5,28 +5,21 @@
Url: https://github.com/CESNET/libyang
Source: %{url}/archive/@BRANCH@.tar.gz
License: BSD-3-Clause
-BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
-%define debug_package %{nil}
-
-Requires: pcre-devel
+Requires: pcre
BuildRequires: cmake
BuildRequires: doxygen
-BuildRequires: glibc-devel
-BuildRequires: pcre-devel
+BuildRequires: pcre-devel
BuildRequires: valgrind
-BuildRequires: libcmocka-devel
+BuildRequires: libcmocka-devel
-%package debuginfo
-Summary: Debug info of libyang library
-Requires: %{name} = %{version}-%{release}
+Conflicts: @CONFLICT_PACKAGE_NAME@ = @LIBYANG_MAJOR_VERSION@.@LIBYANG_MINOR_VERSION@
%package devel
Summary: Headers of libyang library
Requires: %{name} = %{version}-%{release}
-
-%description debuginfo
-Debug info of libyang library.
+Requires: pcre-devel
%description devel
Headers of libyang library.
@@ -37,35 +30,34 @@
%prep
%setup -n libyang-@BRANCH@
-
%build
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -D CMAKE_BUILD_TYPE:String="@BUILD_TYPE@" .
make
%check
-make test
+ctest -V
%install
make DESTDIR=%{buildroot} install
-%{_rpmconfigdir}/find-debuginfo.sh
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
+%defattr(-,root,root)
+%{_bindir}/yanglint
+%{_datadir}/man/man1/yanglint.1.gz
%{_libdir}/libyang.so.*
%{_libdir}/libyang/nacm.so
-%{_bindir}/yanglint
%{_libdir}/libyang/metadata.so
-%{_datadir}/man/man1/yanglint.1.gz
-
-%files debuginfo
-%{_usr}/lib/debug/*
-%{_usr}/lib/debug/.b*
-%{_usrsrc}/debug/*
+%dir %{_libdir}/libyang/
%files devel
+%defattr(-,root,root)
%{_libdir}/libyang.so
%{_libdir}/pkgconfig/libyang.pc
%{_includedir}/libyang/*
+%dir %{_includedir}/libyang/
+
+%changelog