Skip to content

Commit 34a6d74

Browse files
committed
build CHANGE update package scripts
1 parent afb1088 commit 34a6d74

10 files changed

Lines changed: 69 additions & 31 deletions

CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,25 @@ if ($ENV{TRAVIS_BRANCH} STREQUAL "master")
8181
set(BRANCH "master")
8282
set(BUILD_TYPE "Package")
8383
set(CONFLICT_PACKAGE_NAME "libnetconf2-experimental")
84-
set(COMPAT_PACKAGES "")
84+
set(PACKAGE_PART_NAME "")
8585
else ()
8686
set(PACKAGE_NAME "libnetconf2-experimental")
8787
set(BRANCH "devel")
8888
set(BUILD_TYPE "debug")
8989
set(CONFLICT_PACKAGE_NAME "libnetconf2")
90-
set(COMPAT_PACKAGES "-experimental")
90+
set(PACKAGE_PART_NAME "-experimental")
9191
endif()
9292
# change version in config files
9393
configure_file(${PROJECT_SOURCE_DIR}/packages/libnetconf2.spec.in ${PROJECT_BINARY_DIR}/build-packages/libnetconf2.spec)
9494
configure_file(${PROJECT_SOURCE_DIR}/packages/libnetconf2.dsc.in ${PROJECT_BINARY_DIR}/build-packages/libnetconf2.dsc)
9595
configure_file(${PROJECT_SOURCE_DIR}/packages/debian.control.in ${PROJECT_BINARY_DIR}/build-packages/debian.control @ONLY)
9696
configure_file(${PROJECT_SOURCE_DIR}/packages/debian.rules.in ${PROJECT_BINARY_DIR}/build-packages/debian.rules)
97+
configure_file(${PROJECT_SOURCE_DIR}/packages/debian.libnetconf2-dev.install
98+
${PROJECT_BINARY_DIR}/build-packages/debian.libnetconf2${PACKAGE_PART_NAME}-dev.install COPYONLY)
99+
configure_file(${PROJECT_SOURCE_DIR}/packages/debian.libnetconf2.install
100+
${PROJECT_BINARY_DIR}/build-packages/debian.libnetconf2${PACKAGE_PART_NAME}.install COPYONLY)
101+
configure_file(${PROJECT_SOURCE_DIR}/packages/debian.python3-netconf2.install
102+
${PROJECT_BINARY_DIR}/build-packages/debian.python3-netconf2${PACKAGE_PART_NAME}.install COPYONLY)
97103

98104
if (NOT DEB_BUILDER)
99105
message(WARNING "Missing tools (devscripts, debhelper package) for building deb package.\nYou won't be able to generate deb package from source code.\nCompiling libnetconf2 should still works fine.")

packages/create-package.sh

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fi
1010

1111
# fill username and password for opensuse build and downlaod last package information
1212
echo -e "[general]\napiurl = https://api.opensuse.org\n\n[https://api.opensuse.org]\nuser = ${osb_user}\npass = ${osb_pass}" >~/.oscrc
13-
cd ./build_all
13+
cd ./build
1414
if [ $TRAVIS_BRANCH == "devel" ]; then
1515
package="home:liberouter/libnetconf2-experimental"
1616
name="libnetconf2-experimental"
@@ -26,21 +26,26 @@ cd $package
2626
# check versions
2727
VERSION=$(cat libnetconf2.spec | grep "Version: " | awk '{print $NF}')
2828
OLDVERSION=$(cat ../libnetconf2.spec | grep "Version: " | awk '{print $NF}')
29-
if [ "$VERSION" == "$OLDVERSION" ]; then
29+
if [ -z "$FORCEVERSION" -a "$VERSION" == "$OLDVERSION" ]; then
3030
exit 0
3131
fi
3232

3333
# create new changelog and paste old changelog
34-
logtime=$(git log -i --grep="VERSION .* $OLDVERSION" | grep "Date: " | sed 's/Date:[ ]*//')
35-
echo -e "$name ($VERSION) stable; urgency=low\n" >debian.changelog
36-
git log --since="$logtime" --pretty=format:" * %s (%aN)%n" | grep "BUGFIX\|CHANGE\|FEATURE" >>debian.changelog
37-
git log -1 --pretty=format:"%n -- %aN <%aE> %aD%n" >>debian.changelog
38-
echo -e "\n" >>debian.changelog
39-
cat ../debian.changelog >>debian.changelog
40-
git log -1 --date=format:'%a %b %d %Y' --pretty=format:"* %ad %aN <%aE>" | tr -d "\n" >>libnetconf2.spec
41-
echo " $VERSION" >>libnetconf2.spec
42-
git log --since="$logtime" --pretty=format:"- %s (%aN)" | grep "BUGFIX\|CHANGE\|FEATURE" >>libnetconf2.spec
43-
echo -e "\n" >>libnetconf2.spec
34+
if [ "$VERSION" != "$OLDVERSION" ]; then
35+
logtime=$(git log -i --grep="VERSION .* $OLDVERSION" | grep "Date: " | sed 's/Date:[ ]*//')
36+
echo -e "$name ($VERSION) stable; urgency=low\n" >debian.changelog
37+
git log --since="$logtime" --pretty=format:" * %s (%aN)%n" | grep "BUGFIX\|CHANGE\|FEATURE" >>debian.changelog
38+
git log -1 --pretty=format:"%n -- %aN <%aE> %aD%n" >>debian.changelog
39+
echo -e "\n" >>debian.changelog
40+
cat ../debian.changelog >>debian.changelog
41+
fi
42+
43+
if [ "$VERSION" != "$OLDVERSION" ]; then
44+
git log -1 --date=format:'%a %b %d %Y' --pretty=format:"* %ad %aN <%aE>" | tr -d "\n" >>libnetconf2.spec
45+
echo " $VERSION" >>libnetconf2.spec
46+
git log --since="$logtime" --pretty=format:"- %s (%aN)" | grep "BUGFIX\|CHANGE\|FEATURE" >>libnetconf2.spec
47+
echo -e "\n" >>libnetconf2.spec
48+
fi
4449
cat ../libnetconf2.spec | sed -e '1,/%changelog/d' >>libnetconf2.spec
4550

4651
# download source and update to opensuse build

packages/debian.control.in

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ Build-Depends: debhelper (>= 9), gcc
66
Homepage: https://github.com/CESNET/libnetconf2
77

88
Package: @PACKAGE_NAME@
9-
Depends: libyang@COMPAT_PACKAGES@, libssh-4 (>= 0.7.1), ${shlibs:Depends}
9+
Depends: libyang@PACKAGE_PART_NAME@, libssh-4 (>= 0.7.1), ${shlibs:Depends}
1010
Conflicts: @CONFLICT_PACKAGE_NAME@
1111
Section: libs
1212
Architecture: any
1313
Description: Libnetconf2 is a NETCONF library in C intended for building NETCONF clients and servers.
1414

1515
Package: @PACKAGE_NAME@-dev
16-
Depends: libyang@COMPAT_PACKAGES@-dev
16+
Depends: libyang@PACKAGE_PART_NAME@-dev
1717
Section: libdevel
1818
Architecture: any
1919
Description: Headers for libnetconf2 library.
@@ -24,14 +24,14 @@ Section: debug
2424
Architecture: any
2525
Description: Debug symbols for libnetconf2 library.
2626

27-
Package: python3-netconf2@COMPAT_PACKAGES@
27+
Package: python3-netconf2@PACKAGE_PART_NAME@
2828
Depends: @PACKAGE_NAME@ (= @LIBNETCONF2_VERSION@)
2929
Section: libs
3030
Architecture: any
3131
Description: Bindings of libyang library to python3 language.
3232

33-
Package: python3-netconf2@COMPAT_PACKAGES@-dbg
34-
Depends: python3-netconf2@COMPAT_PACKAGES@ (= @LIBNETCONF2_VERSION@)
33+
Package: python3-netconf2@PACKAGE_PART_NAME@-dbg
34+
Depends: python3-netconf2@PACKAGE_PART_NAME@ (= @LIBNETCONF2_VERSION@)
3535
Section: debug
3636
Architecture: any
3737
Description: Debug symbols of python3 bidings of libnetconf2 library.
File renamed without changes.
File renamed without changes.
File renamed without changes.

packages/debian.rules.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ export DH_VERBOSE=1
88

99
override_dh_strip:
1010
dh_strip -p@PACKAGE_NAME@ --dbg-package=@PACKAGE_NAME@-dbg
11-
dh_strip -ppython3-netconf2@COMPAT_PACKAGES@ --dbg-package=python3-netconf2@COMPAT_PACKAGES@-dbg
11+
dh_strip -ppython3-netconf2@PACKAGE_PART_NAME@ --dbg-package=python3-netconf2@PACKAGE_PART_NAME@-dbg
1212

1313
override_dh_auto_configure:
14-
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DENABLE_PYTHON=ON -DCMAKE_BUILD_TYPE:String="@BUILD_TYPE@" .
14+
cmake -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_PYTHON=ON -DCMAKE_BUILD_TYPE="@BUILD_TYPE@" .
1515

1616
override_dh_auto_test:
1717
ctest --output-on-failure

packages/libnetconf2.dsc.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
Format: 3.0 (quilt)
22
Source: @PACKAGE_NAME@
3-
Binary: @PACKAGE_NAME@, @PACKAGE_NAME@-dbg, @PACKAGE_NAME@-dev, python3-netconf2@COMPAT_PACKAGES@, python3-netconf2@COMPAT_PACKAGES@-dbg
3+
Binary: @PACKAGE_NAME@, @PACKAGE_NAME@-dbg, @PACKAGE_NAME@-dev, python3-netconf2@PACKAGE_PART_NAME@, python3-netconf2@PACKAGE_PART_NAME@-dbg
44
Maintainer: CESNET <rkrejci@cesnet.cz>
55
Version: @LIBNETCONF2_VERSION@
66
Architecture: any
77
Standards-Version: 3.8.2
88
Homepage: https://github.com/CESNET/libnetconf2
99
Vcs-Git: https://github.com/CESNET/libnetconf2
10-
Build-Depends: debhelper (>= 9), make, gcc, cmake, pkg-config, libcmocka-dev, libyang@COMPAT_PACKAGES@-dev, libssh-dev (>= 0.7.1), openssl, python3-dev (>= 3.4)
10+
Build-Depends: debhelper (>= 9), make, gcc, cmake, pkg-config, libcmocka-dev, libyang@PACKAGE_PART_NAME@-dev, libssh-dev (>= 0.7.1), openssl, python3-dev (>= 3.4)

packages/libnetconf2.spec.in

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ Source: %{url}/archive/@BRANCH@.tar.gz
77
License: BSD-3-Clause
88
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
99

10-
Requires: libyang@COMPAT_PACKAGES@
11-
BuildRequires: libyang@COMPAT_PACKAGES@-devel
10+
Requires: libyang@PACKAGE_PART_NAME@
11+
BuildRequires: libyang@PACKAGE_PART_NAME@-devel
1212
BuildRequires: libssh-devel >= 0.7.1
1313
BuildRequires: openssl-devel
14-
BuildRequires: valgrind
1514
BuildRequires: cmake
1615
BuildRequires: libcmocka-devel
1716
BuildRequires: gcc
@@ -22,7 +21,7 @@ BuildRequires: timezone
2221
%if 0%{?suse_version} + 0%{?fedora} > 0
2322
BuildRequires: python3-devel
2423
%else
25-
BuildRequires: python34-devel
24+
BuildRequires: python36-devel
2625
%endif
2726
Conflicts: @CONFLICT_PACKAGE_NAME@
2827

@@ -31,14 +30,14 @@ Summary: Headers of libnetconf2 library
3130
Requires: %{name} = %{version}-%{release}
3231
Requires: libssh-devel
3332

34-
%package -n python3-netconf2@COMPAT_PACKAGES@
33+
%package -n python3-netconf2@PACKAGE_PART_NAME@
3534
Summary: Bindings to python3
3635
Requires: %{name} = %{version}-%{release}
3736

3837
%description devel
3938
Headers of libnetconf2 library.
4039

41-
%description -n python3-netconf2@COMPAT_PACKAGES@
40+
%description -n python3-netconf2@PACKAGE_PART_NAME@
4241
Bindings of libnetconf2 library to python3 language.
4342

4443
%description
@@ -48,7 +47,7 @@ Libnetconf2 is a NETCONF library in C intended for building NETCONF clients and
4847
%setup -n libnetconf2-@BRANCH@
4948

5049
%build
51-
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_BUILD_TYPE:String="@BUILD_TYPE@" -DENABLE_PYTHON=ON -DENABLE_VALGRIND_TESTS:BOOL=FALSE .
50+
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE="@BUILD_TYPE@" -DENABLE_PYTHON=ON -DENABLE_VALGRIND_TESTS=OFF .
5251
make
5352

5453
%check
@@ -76,7 +75,7 @@ make DESTDIR=%{buildroot} install
7675
%{_includedir}/nc_server.h
7776
%dir %{_includedir}/libnetconf2/
7877

79-
%files -n python3-netconf2@COMPAT_PACKAGES@
78+
%files -n python3-netconf2@PACKAGE_PART_NAME@
8079
%defattr(-,root,root)
8180
/usr/lib*/python*/*-packages/*
8281

packages/upload-package.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
3+
GIT_PATH=`git rev-parse --show-cdup`
4+
if [ "$GIT_PATH" != "" ]; then
5+
echo "Must be run from repository root"
6+
exit
7+
fi
8+
9+
if [ $# -ne 2 ]; then
10+
echo "Usage $0 <osb-user> <osb-pass>"
11+
exit
12+
fi
13+
14+
# for correct git log command output used in changelog
15+
LC_TIME=en_US.UTF-8
16+
# upload package even if the version is not newer
17+
FORCEVERSION=1
18+
# needed so that the package is even created
19+
TRAVIS_EVENT_TYPE=cron
20+
# what package to upload (devel = libnetconf2-experimental, master = libnetconf2)
21+
TRAVIS_BRANCH=`git branch --show-current`
22+
23+
# OSB login
24+
osb_user=$1
25+
osb_pass=$2
26+
27+
# create and upload the package
28+
. ./packages/create-package.sh

0 commit comments

Comments
 (0)