From 3bd1273e9cfd347c79ddfe07e6b18d3d7f34d0a7 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sat, 26 Jan 2019 09:55:33 +0100 Subject: submodules: add vyos-xe-guest-utilities --- .gitmodules | 4 ++++ packages/vyos-xe-guest-utilities | 1 + scripts/build-submodules | 1 + 3 files changed, 6 insertions(+) create mode 160000 packages/vyos-xe-guest-utilities diff --git a/.gitmodules b/.gitmodules index cf586e80..e71823a2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -233,3 +233,7 @@ path = packages/vyos-netplug url = https://github.com/vyos/vyos-netplug.git branch = current +[submodule "packages/vyos-xe-guest-utilities"] + path = packages/vyos-xe-guest-utilities + url = http://github.com/vyos/vyos-xe-guest-utilities.git + branch = current \ No newline at end of file diff --git a/packages/vyos-xe-guest-utilities b/packages/vyos-xe-guest-utilities new file mode 160000 index 00000000..a31c0926 --- /dev/null +++ b/packages/vyos-xe-guest-utilities @@ -0,0 +1 @@ +Subproject commit a31c092661c65e177967535e8c53dc5b7a04b5cd diff --git a/scripts/build-submodules b/scripts/build-submodules index 62902265..3756f6d5 100755 --- a/scripts/build-submodules +++ b/scripts/build-submodules @@ -242,6 +242,7 @@ for PKG in mdns-repeater \ vyatta-wireless \ vyatta-wirelessmodem \ vyatta-zone \ + vyos-xe-guest-utilities \ vyos-keepalived \ vyos-netplug \ vyos-nhrp \ -- cgit v1.2.3 From d1e120574de4b6cb14465ba743f6167552dd9cdb Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sat, 26 Jan 2019 09:57:04 +0100 Subject: submodules: add igmpproxy --- .gitmodules | 4 ++++ packages/igmpproxy | 1 + scripts/build-submodules | 5 ++--- 3 files changed, 7 insertions(+), 3 deletions(-) create mode 160000 packages/igmpproxy diff --git a/.gitmodules b/.gitmodules index e71823a2..ee1f8009 100644 --- a/.gitmodules +++ b/.gitmodules @@ -236,4 +236,8 @@ [submodule "packages/vyos-xe-guest-utilities"] path = packages/vyos-xe-guest-utilities url = http://github.com/vyos/vyos-xe-guest-utilities.git + branch = current +[submodule "packages/igmpproxy"] + path = packages/igmpproxy + url = https://github.com/vyos/igmpproxy.git branch = current \ No newline at end of file diff --git a/packages/igmpproxy b/packages/igmpproxy new file mode 160000 index 00000000..1f87c675 --- /dev/null +++ b/packages/igmpproxy @@ -0,0 +1 @@ +Subproject commit 1f87c675725bff8f380bf7364c3961ee5a5a9e4f diff --git a/scripts/build-submodules b/scripts/build-submodules index 3756f6d5..9090c66e 100755 --- a/scripts/build-submodules +++ b/scripts/build-submodules @@ -83,10 +83,8 @@ package_in_buildlist() { if [[ $BUILDLIST =~ (^|[[:space:]])$1($|[[:space:]]) ]]; then return 0 fi - - return 1 - + return 1 } build_package() { @@ -207,6 +205,7 @@ for PKG in mdns-repeater \ eventwatchd \ ddclient \ rtrlib \ + igmpproxy \ libvyosconfig \ vyatta-bash \ vyatta-biosdevname \ -- cgit v1.2.3 From b8dca95039982d76b647c97f50a2270d25f71fd0 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sat, 26 Jan 2019 09:58:37 +0100 Subject: Build submodules in parallel with number of host CPUs --- scripts/build-submodules | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/build-submodules b/scripts/build-submodules index 9090c66e..987a055f 100755 --- a/scripts/build-submodules +++ b/scripts/build-submodules @@ -100,7 +100,7 @@ build_package() { fi ( set -e; set -x cd $PKGDIR/$PKG - dpkg-buildpackage -uc -us -tc -b + dpkg-buildpackage -uc -us -tc -b -j$(cat /proc/cpuinfo | grep processor | wc -l) ) >>$PKGDIR/$PKG.buildlog 2>&1 if [ $? -ne 0 ]; then status_fail @@ -185,7 +185,8 @@ build_frr() { # Build Debian Package debuild --no-lintian --set-envvar=WANT_SNMP=1 --set-envvar=WANT_RPKI=1 \ - --set-envvar=WANT_CUMULUS_MODE=0 -b -uc -us + --set-envvar=WANT_CUMULUS_MODE=0 -b -uc -us \ + -j$(cat /proc/cpuinfo | grep processor | wc -l) mv ../frr_*.deb $PKGDIR ) >>$PKGDIR/$PKG.buildlog 2>&1 @@ -332,7 +333,7 @@ build_wireguard() { ( set -e; set -x cd $PKGDIR/vyos-wireguard echo "src/wireguard.ko /lib/modules/$VERSION.$PATCHLEVEL.$SUBLEVEL-$ARCH-vyos/extra" | tee debian/wireguard-modules.install - KERNELDIR=$PKGDIR/vyos-kernel dpkg-buildpackage -uc -us -tc -b + KERNELDIR=$PKGDIR/vyos-kernel dpkg-buildpackage -uc -us -tc -b -j$(cat /proc/cpuinfo | grep processor | wc -l) ) >>$PKGDIR/vyos-wireguard.buildlog 2>&1 if [ $? -ne 0 ]; then status_fail @@ -383,7 +384,7 @@ build_accel-ppp() { cd $PKGDIR/vyos-accel-ppp echo "lib/modules/$VERSION.$PATCHLEVEL.$SUBLEVEL-$ARCH-vyos/extra/*.ko" | tee debian/vyos-accel-ppp-ipoe-kmod.install sed -i "s#[0-9].[0-9][0-9].[0-9]-amd64-vyos#$VERSION.$PATCHLEVEL.$SUBLEVEL-$ARCH-vyos#g" debian/rules - KERNELDIR=$PKGDIR/vyos-kernel dpkg-buildpackage -uc -us -tc -b + KERNELDIR=$PKGDIR/vyos-kernel dpkg-buildpackage -uc -us -tc -b -j$(cat /proc/cpuinfo | grep processor | wc -l) ) >>$PKGDIR/vyos-accel-ppp.buildlog 2>&1 if [ $? -ne 0 ]; then status_fail -- cgit v1.2.3 From 8a727f71fa3d63b91938f29376f726a904fffa73 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sat, 26 Jan 2019 09:59:15 +0100 Subject: Fix --verbose option when building submodules --- scripts/build-submodules | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/build-submodules b/scripts/build-submodules index 987a055f..31bf55a3 100755 --- a/scripts/build-submodules +++ b/scripts/build-submodules @@ -128,7 +128,7 @@ initialize_packages() { ) >>$PKGDIR/init-packages.buildlog 2>&1 if [ $? -ne 0 ]; then status_fail - if [ $VERBOSE ]; then + if [ $VERBOSE -eq 1 ]; then cat $PKGDIR/init-packages.buildlog fi error_msg "Failed to update all package, look in init-packages.buildlog to examine the fault\n" @@ -278,7 +278,7 @@ build_kernel() { ) >>$PKGDIR/vyos-kernel.buildlog 2>&1 if [ $? -ne 0 ]; then status_fail - if [ $VERBOSE ]; then + if [ $VERBOSE -eq 1 ]; then cat $PKGDIR/vyos-kernel.buildlog fi error_msg "Failed to build package vyos-kernel, look in vyos-kernel.buildlog to examine the fault\n" @@ -337,7 +337,7 @@ build_wireguard() { ) >>$PKGDIR/vyos-wireguard.buildlog 2>&1 if [ $? -ne 0 ]; then status_fail - if [ $VERBOSE ]; then + if [ $VERBOSE -eq 1 ]; then cat $PKGDIR/vyos-wireguard.buildlog fi error_msg "Failed to build package vyos-wireguard, look in vyos-wireguard.buildlog to examine the fault\n" @@ -388,7 +388,7 @@ build_accel-ppp() { ) >>$PKGDIR/vyos-accel-ppp.buildlog 2>&1 if [ $? -ne 0 ]; then status_fail - if [ $VERBOSE ]; then + if [ $VERBOSE -eq 1 ]; then cat $PKGDIR/vyos-accel-ppp.buildlog fi error_msg "Failed to build package vyos-accel-ppp, look in vyos-accel-ppp.buildlog to examine the fault\n" -- cgit v1.2.3 From 0ad391b9e2b4c9693c6ea32f8e10dd8f1c52af40 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sat, 26 Jan 2019 10:00:10 +0100 Subject: When building frr clean out Git repository first --- scripts/build-submodules | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/build-submodules b/scripts/build-submodules index 31bf55a3..a84e0b93 100755 --- a/scripts/build-submodules +++ b/scripts/build-submodules @@ -153,6 +153,8 @@ build_frr() { ( set -e; set -x cd $PKGDIR/$PKG + git clean -dxf + git reset --hard # Run bootstrap.sh and make a dist tarball # http://docs.frrouting.org/projects/dev-guide/en/latest/packaging-debian.html @@ -170,7 +172,6 @@ build_frr() { tar xf ../frr_*.orig.tar.gz cd frr* source /etc/os-release - ls -al ../../frr_*${ID}${VERSION_ID}* tar xf ../../frr_*${ID}${VERSION_ID}*.debian.tar.xz # As libyang is not (yet) build and installed as native Debian package FRR -- cgit v1.2.3 From 9d52ba2003467db001d095a9ac037c29b5ef4aab Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sat, 26 Jan 2019 10:00:58 +0100 Subject: When building parse Git commit ID --- scripts/build-submodules | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/build-submodules b/scripts/build-submodules index a84e0b93..3502a7d4 100755 --- a/scripts/build-submodules +++ b/scripts/build-submodules @@ -142,10 +142,11 @@ fi build_frr() { PKG=frr - if ! package_in_buildlist "frr"; then + COMMITID=$(cd $PKGDIR/$PKG; git rev-parse --short=10 HEAD) + if ! package_in_buildlist $1; then return 0 fi - status_start "Building package: $PKG (Git commit/tag: $FRR_VER)" + status_start "Building package: $PKG Commit id: $COMMITID" if [ ! -f "$PKGDIR/$PKG/README.md" ]; then status_skip "No source for: $PKG" return 1 -- cgit v1.2.3 From 873cf3a68f318ba3a7469b0dbb5c9415787eef98 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sat, 26 Jan 2019 10:01:50 +0100 Subject: When building linux-kernel use number of host CPUs on parallel build --- scripts/build-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-kernel b/scripts/build-kernel index 80229d5d..4a23d9c7 100755 --- a/scripts/build-kernel +++ b/scripts/build-kernel @@ -27,7 +27,7 @@ case "$ARCH" in if [ ${PATCHLEVEL} -lt 14 ]; then TARGETS+=" kernel_manual kernel_doc" fi - CONCURRENCY_LEVEL=4 LOCALVERSION="" make-kpkg --rootcmd fakeroot --initrd --append_to_version -amd64-vyos --revision=$VERSION.$PATCHLEVEL.$SUBLEVEL-1+vyos1+current1 -j4 ${TARGETS} + CONCURRENCY_LEVEL=4 LOCALVERSION="" make-kpkg --rootcmd fakeroot --initrd --append_to_version -amd64-vyos --revision=$VERSION.$PATCHLEVEL.$SUBLEVEL-1+vyos1+current1 -j$(cat /proc/cpuinfo | grep processor | wc -l) ${TARGETS} ;; armhf) -- cgit v1.2.3 From b4dfb255edab84f8f1461492eed5425ff9e80df5 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sat, 26 Jan 2019 10:03:05 +0100 Subject: Docker: Make OPAM system wide available --- docker/Dockerfile | 30 +++++++++++++++++++----------- docker/entrypoint.sh | 4 ++++ 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index d951a8ff..cffa8621 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -23,6 +23,7 @@ RUN apt-get update && apt-get install -y \ curl \ make \ sudo \ + mc \ live-build \ pbuilder \ devscripts \ @@ -191,10 +192,13 @@ RUN apt-get update && apt-get install -y \ # Packages needed for libvyosconfig RUN curl https://raw.githubusercontent.com/ocaml/opam/2.0.2/shell/install.sh --output /tmp/opam_install.sh && \ sed -i 's/read BINDIR/BINDIR=""/' /tmp/opam_install.sh && sh /tmp/opam_install.sh && \ - opam init --disable-sandboxing && \ - eval $(opam env) && opam switch create 4.07.0 && \ - eval $(opam env) && opam install -y oasis && \ - eval $(opam env) && opam install -y \ + opam init --root=/opt/opam --comp=4.07.0 --disable-sandboxing + +RUN eval $(opam env --root=/opt/opam --set-root) && \ + opam install -y \ + oasis + +RUN eval $(opam env --root=/opt/opam --set-root) && opam install -y \ fileutils \ lwt \ lwt_ppx \ @@ -210,14 +214,14 @@ RUN curl https://raw.githubusercontent.com/ocaml/opam/2.0.2/shell/install.sh --o ocaml-protoc \ ctypes-foreign -RUN eval $(opam env) && opam install -y \ +RUN eval $(opam env --root=/opt/opam --set-root) && opam install -y \ ctypes # Build VyConf which is required to build libvyosconfig -RUN eval $(opam env) && \ - git clone https://github.com/vyos/vyconf.git && \ - cd vyconf && \ - git checkout 0f121c12a84200 && \ +RUN eval $(opam env --root=/opt/opam --set-root) && \ + git clone https://github.com/vyos/vyconf.git /tmp/vyconf && \ + cd /tmp/vyconf && \ + git checkout v0.1 && \ ./build-setup.sh && \ ./configure --enable-tests && \ make && \ @@ -225,10 +229,10 @@ RUN eval $(opam env) && \ make install # Build libvyosconfig -RUN eval $(opam env) && \ +RUN eval $(opam env --root=/opt/opam --set-root) && \ git clone https://github.com/vyos/libvyosconfig && \ cd libvyosconfig && \ - git checkout e75e4ae638c49e && \ + git checkout v0.0.4 && \ dpkg-buildpackage -uc -us -tc -b && \ dpkg -i ../libvyosconfig0_*_amd64.deb @@ -236,6 +240,10 @@ RUN eval $(opam env) && \ RUN apt-get update && apt-get install -y \ whois +# Packages needed for vyos-xe-guest-utilities +RUN apt-get update && apt-get install -y \ + golang + # Update live-build RUN echo 'deb http://ftp.debian.org/debian stretch main' | tee -a /etc/apt/sources.list.d/stretch.list && \ apt-get update && apt-get install -y -t stretch live-build && \ diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 8db41103..ed6ca7d9 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -23,6 +23,10 @@ if ! grep -q $NEW_GID /etc/group; then groupadd --gid $NEW_GID $USER_NAME fi +# libvyosconfig depends on OCaml/OPAM so we make sure +# we can use it +echo "eval \$(opam env --root=/opt/opam --set-root)" >> /etc/skel/.bashrc + useradd --shell /bin/bash --uid $NEW_UID --gid $NEW_GID --non-unique --create-home $USER_NAME usermod --append --groups sudo $USER_NAME sudo chown $NEW_UID:$NEW_GID /home/$USER_NAME -- cgit v1.2.3 From fdf47c42269f7adb7d5f3e60b8180e8b9bc77503 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sat, 26 Jan 2019 10:04:13 +0100 Subject: Jenkins: cleanup --- Jenkinsfile | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d1d8ad95..4bc64b26 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -30,14 +30,16 @@ pipeline { stage('Submodule Init') { steps { sh ''' - git submodule update --init --recursive - git submodule update --remote + git submodule update --init --recursive --remote ''' } } stage('Build Packages') { steps { - sh 'scripts/build-submodules --verbose' + sh ''' + #!/bin/sh + scripts/build-submodules --verbose + ''' } } @@ -68,7 +70,12 @@ pipeline { echo 'One way or another, I have finished' // the 'build' directory got elevated permissions during the build // cdjust permissions so it can be cleaned up by the regular user - sh 'sudo chmod -R 777 build/' + sh ''' + #!/bin/bash + if [ -d build ]; then + sudo chmod -R 777 build/ + fi + ''' deleteDir() /* cleanup our workspace */ } } -- cgit v1.2.3