From b10711d42e65c1ae604891d33cfd83628ca7aa64 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 27 Jan 2019 13:04:11 +0100 Subject: build-submodules: add libyang --- scripts/build-submodules | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'scripts/build-submodules') diff --git a/scripts/build-submodules b/scripts/build-submodules index 0d11c059..b3ea2c1a 100755 --- a/scripts/build-submodules +++ b/scripts/build-submodules @@ -140,6 +140,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) -- cgit v1.2.3 From 9210522425e2cd6ed5d9f83ad594e5588671863e Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 27 Jan 2019 13:06:16 +0100 Subject: build-submodules: report back package error when build with --verbose --- scripts/build-submodules | 3 +++ 1 file changed, 3 insertions(+) (limited to 'scripts/build-submodules') diff --git a/scripts/build-submodules b/scripts/build-submodules index b3ea2c1a..6fd945d1 100755 --- a/scripts/build-submodules +++ b/scripts/build-submodules @@ -104,6 +104,9 @@ build_package() { ) >>$PKGDIR/$PKG.buildlog 2>&1 if [ $? -ne 0 ]; then status_fail + if [ $VERBOSE -eq 1 ]; then + cat $PKGDIR/$PKG.buildlog + fi error_msg "Failed to build package $PKG, look in $PKG.buildlog to examine the fault\n" return 2 fi -- cgit v1.2.3 From 000cd8b2d962989e26c847a6337bc1b3a3f1c6a9 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 27 Jan 2019 16:19:19 +0100 Subject: build-submodules: change VERBOSE logic --- scripts/build-submodules | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'scripts/build-submodules') diff --git a/scripts/build-submodules b/scripts/build-submodules index 6fd945d1..79abf59f 100755 --- a/scripts/build-submodules +++ b/scripts/build-submodules @@ -24,6 +24,7 @@ print_help() { } BUILDLIST="" +VERBOSE=0 while test $# -gt 0 do @@ -70,6 +71,19 @@ 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" @@ -104,9 +118,7 @@ build_package() { ) >>$PKGDIR/$PKG.buildlog 2>&1 if [ $? -ne 0 ]; then status_fail - if [ $VERBOSE -eq 1 ]; then - cat $PKGDIR/$PKG.buildlog - fi + verbose_msg "$PKGDIR/$PKG.buildlog" error_msg "Failed to build package $PKG, look in $PKG.buildlog to examine the fault\n" return 2 fi @@ -131,9 +143,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 @@ -311,9 +321,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 @@ -370,9 +378,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 @@ -421,9 +427,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 -- cgit v1.2.3 From 9170ead86561b0d494df5ac464a04d703a61e036 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 27 Jan 2019 18:08:53 +0100 Subject: build-submodules: source OPAM environemnt if not present --- scripts/build-submodules | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'scripts/build-submodules') diff --git a/scripts/build-submodules b/scripts/build-submodules index 79abf59f..6423a14a 100755 --- a/scripts/build-submodules +++ b/scripts/build-submodules @@ -88,6 +88,15 @@ 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 -- cgit v1.2.3