diff options
author | Christian Poessinger <christian@poessinger.com> | 2019-01-30 06:05:12 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2019-01-30 06:05:12 +0100 |
commit | c85cda7b402099c37a9d978d3f664ffbaf631132 (patch) | |
tree | 962c0ba5262b02d965cd0aa31312e0920cf1f78c | |
parent | 9df5e15e9939dea7e5ecc944661d0ecb8eb0ccf4 (diff) | |
parent | 026db7258233182ae1f04a553e184b0484a62df6 (diff) | |
download | vyos-build-c85cda7b402099c37a9d978d3f664ffbaf631132.tar.gz vyos-build-c85cda7b402099c37a9d978d3f664ffbaf631132.zip |
Merge branch 'source-build' of github.com:c-po/vyos-build into current
* source-build:
Docker: update to latest libvyosconfig revision
build-submodules: source OPAM environemnt if not present
build-submodules: change VERBOSE logic
build-submodules: report back package error when build with --verbose
build-submodules: add libyang
-rw-r--r-- | .gitmodules | 4 | ||||
-rw-r--r-- | docker/Dockerfile | 2 | ||||
m--------- | packages/libyang | 0 | ||||
-rwxr-xr-x | scripts/build-submodules | 78 |
4 files changed, 71 insertions, 13 deletions
diff --git a/.gitmodules b/.gitmodules index 8be1f363..2257b9f1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -241,3 +241,7 @@ path = packages/hvinfo url = https://github.com/dmbaturin/hvinfo.git branch = master +[submodule "packages/libyang"] + path = packages/libyang + url = https://github.com/opensourcerouting/libyang.git + branch = debian diff --git a/docker/Dockerfile b/docker/Dockerfile index 889652f3..13919ede 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -230,7 +230,7 @@ RUN eval $(opam env --root=/opt/opam --set-root) && \ RUN eval $(opam env --root=/opt/opam --set-root) && \ git clone https://github.com/vyos/libvyosconfig && \ cd libvyosconfig && \ - git checkout v0.0.4 && \ + git checkout a9817fa26c1be1 && \ dpkg-buildpackage -uc -us -tc -b && \ dpkg -i ../libvyosconfig0_*_amd64.deb diff --git a/packages/libyang b/packages/libyang new file mode 160000 +Subproject 179da47f2e8def1907372408a9df97a0dcbc134 diff --git a/scripts/build-submodules b/scripts/build-submodules index 11d386fd..a167b6e0 100755 --- a/scripts/build-submodules +++ b/scripts/build-submodules @@ -24,6 +24,7 @@ print_help() { } BUILDLIST="" +VERBOSE=0 while test $# -gt 0 do @@ -70,10 +71,32 @@ status_skip() { error_msg() { echo -ne " $1\n" } + +verbose_msg() { + if [ $VERBOSE -ne 0 ]; then + echo "Current Environment:" + env + + if [ ! -z "$1" ]; then + echo "Logfile:" + cat $1 + fi + fi +} + ROOTDIR="$(pwd)" PKGDIR="$ROOTDIR/packages" SCRIPTDIR="$ROOTDIR/scripts" +# Source OPAM environment if not already set +if [ -z "$OPAMROOT" ]; then + if [ -x "$(command -v opam)" ]; then + eval $(opam env --root=/opt/opam --set-root) + else + echo "WARNING: 'opam' not installed, can't build VyConf and libvyosconfig" + fi +fi + package_in_buildlist() { # Return true if buildlist is not set if [ -z "$BUILDLIST" ]; then @@ -104,6 +127,7 @@ build_package() { ) >>$PKGDIR/$PKG.buildlog 2>&1 if [ $? -ne 0 ]; then status_fail + verbose_msg "$PKGDIR/$PKG.buildlog" error_msg "Failed to build package $PKG, look in $PKG.buildlog to examine the fault\n" return 2 fi @@ -128,9 +152,7 @@ initialize_packages() { ) >>$PKGDIR/init-packages.buildlog 2>&1 if [ $? -ne 0 ]; then status_fail - if [ $VERBOSE -eq 1 ]; then - cat $PKGDIR/init-packages.buildlog - fi + verbose_msg "$PKGDIR/init-packages.buildlog" error_msg "Failed to update all package, look in init-packages.buildlog to examine the fault\n" return 1 fi @@ -140,6 +162,44 @@ if [ $INIT_PACKAGES ]; then initialize_packages fi +build_libyang() { + PKG=libyang + COMMITID=$(cd $PKGDIR/$PKG; git rev-parse --short=10 HEAD) + if ! package_in_buildlist $1; then + return 0 + fi + status_start "Building package: $PKG Commit id: $COMMITID" + if [ ! -f "$PKGDIR/$PKG/README.md" ]; then + status_skip "No source for: $PKG" + return 1 + fi + + ( set -e; set -x + cd $PKGDIR/$PKG + git checkout 179da47f2e8de + + git clean -dxf + git reset --hard + + mkdir build + cd build + + cmake .. + make build-deb + + cp debs/* $PKGDIR + + ) >>$PKGDIR/$PKG.buildlog 2>&1 + + if [ $? -ne 0 ]; then + status_fail + error_msg "Failed to build package $PKG, look in $PKG.buildlog to examine the fault\n" + return 2 + fi + status_ok +} +build_libyang + build_frr() { PKG=frr COMMITID=$(cd $PKGDIR/$PKG; git rev-parse --short=10 HEAD) @@ -271,9 +331,7 @@ build_kernel() { ) >>$PKGDIR/vyos-kernel.buildlog 2>&1 if [ $? -ne 0 ]; then status_fail - if [ $VERBOSE -eq 1 ]; then - cat $PKGDIR/vyos-kernel.buildlog - fi + verbose_msg "$PKGDIR/vyos-kernel.buildlog" error_msg "Failed to build package vyos-kernel, look in vyos-kernel.buildlog to examine the fault\n" return 1 fi @@ -330,9 +388,7 @@ build_wireguard() { ) >>$PKGDIR/vyos-wireguard.buildlog 2>&1 if [ $? -ne 0 ]; then status_fail - if [ $VERBOSE -eq 1 ]; then - cat $PKGDIR/vyos-wireguard.buildlog - fi + verbose_msg "$PKGDIR/vyos-wireguard.buildlog" error_msg "Failed to build package vyos-wireguard, look in vyos-wireguard.buildlog to examine the fault\n" return 2 fi @@ -381,9 +437,7 @@ build_accel-ppp() { ) >>$PKGDIR/vyos-accel-ppp.buildlog 2>&1 if [ $? -ne 0 ]; then status_fail - if [ $VERBOSE -eq 1 ]; then - cat $PKGDIR/vyos-accel-ppp.buildlog - fi + verbose_msg "$PKGDIR/vyos-accel-ppp.buildlog" error_msg "Failed to build package vyos-accel-ppp, look in vyos-accel-ppp.buildlog to examine the fault\n" return 1 fi |