From 99838ee7d41d23042a4c758157e9361817cb0ec0 Mon Sep 17 00:00:00 2001 From: Runar Borge Date: Tue, 15 Jan 2019 07:42:44 +0100 Subject: Added support for building only selected packages --- scripts/build-submodules | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/scripts/build-submodules b/scripts/build-submodules index 747b02d2..bd8889eb 100755 --- a/scripts/build-submodules +++ b/scripts/build-submodules @@ -22,6 +22,8 @@ print_help() { echo " --verbose - Enable verbose output" } +BUILDLIST="" + while test $# -gt 0 do case "$1" in @@ -35,6 +37,10 @@ do --verbose) VERBOSE=1 ;; + --build-*) + VAL=$(sed s/^--build-//g <<< $1) + BUILDLIST="$BUILDLIST $VAL" + ;; *) (>&2 echo "Error: Argument $1 is not valid") echo "" @@ -67,8 +73,26 @@ ROOTDIR="$(pwd)" PKGDIR="$ROOTDIR/packages" SCRIPTDIR="$ROOTDIR/scripts" +package_in_buildlist() { + # Return true if buildlist is not set + if [ -z "$BUILDLIST" ]; then + return 0 + fi + + if [[ $BUILDLIST =~ (^|[[:space:]])$1($|[[:space:]]) ]]; then + return 0 + fi + + return 1 + + +} + build_package() { PKG=$1 + if ! package_in_buildlist $1; then + return 0 + fi status_start "Building package: $PKG" if [ ! -d "$PKGDIR/$PKG/debian" ]; then status_skip "No source for: $PKG" @@ -119,6 +143,10 @@ build_frr() { # FRR upstream version is specified here FRR_VER="debian/frr-6.0.2-1" PKG=frr + if ! package_in_buildlist "frr"; then + return 0 + fi + status_start "Building package: $PKG (Git commit/tag: $FRR_VER)" if [ ! -f "$PKGDIR/$PKG/README.md" ]; then status_skip "No source for: $PKG" @@ -190,6 +218,9 @@ done # KERNEL build_kernel() { + if ! package_in_buildlist "vyos-kernel"; then + return 0 + fi status_start "Building-package: vyos-kernel" if [ ! -f "$PKGDIR/vyos-kernel/Makefile" ]; then status_skip "No source for: vyos-kernel" @@ -225,6 +256,9 @@ fi # WIREGUARD build_wireguard() { + if ! package_in_buildlist "vyos-wireguard"; then + return 0 + fi status_start "Building package: vyos-wireguard" if [ ! -d "$PKGDIR/vyos-wireguard/debian" ]; then @@ -272,6 +306,9 @@ fi # ACCEL-PPP build_accel-ppp() { + if ! package_in_buildlist "accel-ppp"; then + return 0 + fi status_start "Building package: vyos-accel-ppp" if [ ! -d "$PKGDIR/vyos-accel-ppp/debian" ]; then status_skip "No source for: vyos-accel-ppp" -- cgit v1.2.3 From fc61294dd0c7edef9fab3a6e96ddf287df25c3fa Mon Sep 17 00:00:00 2001 From: Runar Borge Date: Tue, 15 Jan 2019 07:43:48 +0100 Subject: Adding help for --build- --- scripts/build-submodules | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/build-submodules b/scripts/build-submodules index bd8889eb..d349327d 100755 --- a/scripts/build-submodules +++ b/scripts/build-submodules @@ -20,6 +20,7 @@ print_help() { echo "Parameters:" echo " --init-packages - Initiate all subpackages before building" echo " --verbose - Enable verbose output" + echo " --build-[packagename] - build only selected packages" } BUILDLIST="" -- cgit v1.2.3 From ecf6f88e137c1e8d1be90b237e85d23a81a7af0b Mon Sep 17 00:00:00 2001 From: Runar Borge Date: Wed, 16 Jan 2019 23:19:30 +0100 Subject: Added sisplay of the current commit id on all packages --- scripts/build-submodules | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/scripts/build-submodules b/scripts/build-submodules index 9bbc7ed5..960b37ea 100755 --- a/scripts/build-submodules +++ b/scripts/build-submodules @@ -91,10 +91,11 @@ package_in_buildlist() { build_package() { PKG=$1 + COMMITID=$(git log --pretty=format:'%h' -n 1--git-dir $PKGDIR/$PKG) if ! package_in_buildlist $1; then return 0 fi - status_start "Building package: $PKG" + status_start "Building package: $PKG Commit id: $COMMITID" if [ ! -d "$PKGDIR/$PKG/debian" ]; then status_skip "No source for: $PKG" return 1 @@ -115,9 +116,10 @@ echo "Cleaning up buildfiles..." rm -rf $PKGDIR/*.deb rm -rf $PKGDIR/*.changes rm -rf $PKGDIR/*.buildlog +COMMITID=$(git log --pretty=format:'%h' -n 1--git-dir $PKGDIR) echo "-----------------------------------------------------" echo "Starting build process for all packages" -echo "" +echo "vyos-build Commit ID: $COMMITID" initialize_packages() { status_start "Initializing packages" @@ -145,7 +147,6 @@ build_frr() { if ! package_in_buildlist "frr"; then return 0 fi - status_start "Building package: $PKG (Git commit/tag: $FRR_VER)" if [ ! -f "$PKGDIR/$PKG/README.md" ]; then status_skip "No source for: $PKG" @@ -251,10 +252,12 @@ done # KERNEL build_kernel() { + PKG="vyos-kernel" if ! package_in_buildlist "vyos-kernel"; then return 0 fi - status_start "Building-package: vyos-kernel" + COMMITID=$(git log --pretty=format:'%h' -n 1--git-dir $PKGDIR/$PKG) + status_start "Building-package: vyos-kernel Commit ID:$COMMITID" if [ ! -f "$PKGDIR/vyos-kernel/Makefile" ]; then status_skip "No source for: vyos-kernel" return 0 @@ -289,10 +292,12 @@ fi # WIREGUARD build_wireguard() { + PKG="vyos-wireguard" if ! package_in_buildlist "vyos-wireguard"; then return 0 fi - status_start "Building package: vyos-wireguard" + COMMITID=$(git log --pretty=format:'%h' -n 1--git-dir $PKGDIR/$PKG) + status_start "Building package: vyos-wireguard Commit ID:$COMMITID" if [ ! -d "$PKGDIR/vyos-wireguard/debian" ]; then status_skip "No source for: vyos-wireguard" @@ -339,10 +344,12 @@ fi # ACCEL-PPP build_accel-ppp() { + PKG="vyos-accel-ppp" if ! package_in_buildlist "accel-ppp"; then return 0 fi - status_start "Building package: vyos-accel-ppp" + COMMITID=$(git log --pretty=format:'%h' -n 1--git-dir $PKGDIR/$PKG) + status_start "Building package: vyos-accel-ppp Commit ID: $COMMITID" if [ ! -d "$PKGDIR/vyos-accel-ppp/debian" ]; then status_skip "No source for: vyos-accel-ppp" return 0 -- cgit v1.2.3 From 872097c8339da9e5f17066ac2a7abfc3524589c7 Mon Sep 17 00:00:00 2001 From: Runar Borge Date: Wed, 16 Jan 2019 23:30:59 +0100 Subject: Fixed print error when using SKIP message, all text was not overwritten --- scripts/build-submodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-submodules b/scripts/build-submodules index 960b37ea..51b18c24 100755 --- a/scripts/build-submodules +++ b/scripts/build-submodules @@ -64,7 +64,7 @@ status_fail() { } status_skip() { - echo -ne "\r[SKIP] $1\n" + echo -ne "\r[SKIP] $1\033[K\n" } error_msg() { -- cgit v1.2.3 From f2358fc9262cfde1f711374b4be28b0532a269aa Mon Sep 17 00:00:00 2001 From: Runar Borge Date: Wed, 16 Jan 2019 23:19:30 +0100 Subject: Added display of the current commit id on built packages --- scripts/build-submodules | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/scripts/build-submodules b/scripts/build-submodules index 9bbc7ed5..960b37ea 100755 --- a/scripts/build-submodules +++ b/scripts/build-submodules @@ -91,10 +91,11 @@ package_in_buildlist() { build_package() { PKG=$1 + COMMITID=$(git log --pretty=format:'%h' -n 1--git-dir $PKGDIR/$PKG) if ! package_in_buildlist $1; then return 0 fi - status_start "Building package: $PKG" + status_start "Building package: $PKG Commit id: $COMMITID" if [ ! -d "$PKGDIR/$PKG/debian" ]; then status_skip "No source for: $PKG" return 1 @@ -115,9 +116,10 @@ echo "Cleaning up buildfiles..." rm -rf $PKGDIR/*.deb rm -rf $PKGDIR/*.changes rm -rf $PKGDIR/*.buildlog +COMMITID=$(git log --pretty=format:'%h' -n 1--git-dir $PKGDIR) echo "-----------------------------------------------------" echo "Starting build process for all packages" -echo "" +echo "vyos-build Commit ID: $COMMITID" initialize_packages() { status_start "Initializing packages" @@ -145,7 +147,6 @@ build_frr() { if ! package_in_buildlist "frr"; then return 0 fi - status_start "Building package: $PKG (Git commit/tag: $FRR_VER)" if [ ! -f "$PKGDIR/$PKG/README.md" ]; then status_skip "No source for: $PKG" @@ -251,10 +252,12 @@ done # KERNEL build_kernel() { + PKG="vyos-kernel" if ! package_in_buildlist "vyos-kernel"; then return 0 fi - status_start "Building-package: vyos-kernel" + COMMITID=$(git log --pretty=format:'%h' -n 1--git-dir $PKGDIR/$PKG) + status_start "Building-package: vyos-kernel Commit ID:$COMMITID" if [ ! -f "$PKGDIR/vyos-kernel/Makefile" ]; then status_skip "No source for: vyos-kernel" return 0 @@ -289,10 +292,12 @@ fi # WIREGUARD build_wireguard() { + PKG="vyos-wireguard" if ! package_in_buildlist "vyos-wireguard"; then return 0 fi - status_start "Building package: vyos-wireguard" + COMMITID=$(git log --pretty=format:'%h' -n 1--git-dir $PKGDIR/$PKG) + status_start "Building package: vyos-wireguard Commit ID:$COMMITID" if [ ! -d "$PKGDIR/vyos-wireguard/debian" ]; then status_skip "No source for: vyos-wireguard" @@ -339,10 +344,12 @@ fi # ACCEL-PPP build_accel-ppp() { + PKG="vyos-accel-ppp" if ! package_in_buildlist "accel-ppp"; then return 0 fi - status_start "Building package: vyos-accel-ppp" + COMMITID=$(git log --pretty=format:'%h' -n 1--git-dir $PKGDIR/$PKG) + status_start "Building package: vyos-accel-ppp Commit ID: $COMMITID" if [ ! -d "$PKGDIR/vyos-accel-ppp/debian" ]; then status_skip "No source for: vyos-accel-ppp" return 0 -- cgit v1.2.3 From 5b7c04ca8d5ed03d9ee5bdf2dc61dd7c4fb0b427 Mon Sep 17 00:00:00 2001 From: Runar Borge Date: Wed, 16 Jan 2019 23:30:59 +0100 Subject: Fixed print error when using SKIP message, all text was not overwritten --- scripts/build-submodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-submodules b/scripts/build-submodules index 960b37ea..51b18c24 100755 --- a/scripts/build-submodules +++ b/scripts/build-submodules @@ -64,7 +64,7 @@ status_fail() { } status_skip() { - echo -ne "\r[SKIP] $1\n" + echo -ne "\r[SKIP] $1\033[K\n" } error_msg() { -- cgit v1.2.3 From be0c850e75be125f99f31a1229b3cc0212c00db6 Mon Sep 17 00:00:00 2001 From: Runar Borge Date: Thu, 17 Jan 2019 10:08:21 +0100 Subject: Changed command to get commit id --- scripts/build-submodules | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/build-submodules b/scripts/build-submodules index 51b18c24..50814b00 100755 --- a/scripts/build-submodules +++ b/scripts/build-submodules @@ -91,7 +91,7 @@ package_in_buildlist() { build_package() { PKG=$1 - COMMITID=$(git log --pretty=format:'%h' -n 1--git-dir $PKGDIR/$PKG) + COMMITID=$(cd $PKGDIR/$PKG; git rev-parse --short=10 HEAD) if ! package_in_buildlist $1; then return 0 fi @@ -116,7 +116,7 @@ echo "Cleaning up buildfiles..." rm -rf $PKGDIR/*.deb rm -rf $PKGDIR/*.changes rm -rf $PKGDIR/*.buildlog -COMMITID=$(git log --pretty=format:'%h' -n 1--git-dir $PKGDIR) +COMMITID=$(cd $PKGDIR; git rev-parse --short=10 HEAD) echo "-----------------------------------------------------" echo "Starting build process for all packages" echo "vyos-build Commit ID: $COMMITID" @@ -256,7 +256,7 @@ build_kernel() { if ! package_in_buildlist "vyos-kernel"; then return 0 fi - COMMITID=$(git log --pretty=format:'%h' -n 1--git-dir $PKGDIR/$PKG) + COMMITID=$(cd $PKGDIR/$PKG; git rev-parse --short=10 HEAD) status_start "Building-package: vyos-kernel Commit ID:$COMMITID" if [ ! -f "$PKGDIR/vyos-kernel/Makefile" ]; then status_skip "No source for: vyos-kernel" @@ -296,7 +296,7 @@ build_wireguard() { if ! package_in_buildlist "vyos-wireguard"; then return 0 fi - COMMITID=$(git log --pretty=format:'%h' -n 1--git-dir $PKGDIR/$PKG) + COMMITID=$(cd $PKGDIR/$PKG; git rev-parse --short=10 HEAD) status_start "Building package: vyos-wireguard Commit ID:$COMMITID" if [ ! -d "$PKGDIR/vyos-wireguard/debian" ]; then @@ -348,7 +348,7 @@ build_accel-ppp() { if ! package_in_buildlist "accel-ppp"; then return 0 fi - COMMITID=$(git log --pretty=format:'%h' -n 1--git-dir $PKGDIR/$PKG) + COMMITID=$(cd $PKGDIR/$PKG; git rev-parse --short=10 HEAD) status_start "Building package: vyos-accel-ppp Commit ID: $COMMITID" if [ ! -d "$PKGDIR/vyos-accel-ppp/debian" ]; then status_skip "No source for: vyos-accel-ppp" -- cgit v1.2.3