summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@gmail.com>2025-04-18 13:53:07 +0000
committerBruce Ashfield <bruce.ashfield@gmail.com>2025-04-18 13:56:50 +0000
commitd331d16c3781f78be37ab192cdb4ab3c7b4284fb (patch)
treec58596d5f39542626e08e15798e3842c3b68079a /scripts
parentd560060e4c4208b0d2db023ed7c6a5e20af2c730 (diff)
downloadmeta-virtualization-d331d16c3781f78be37ab192cdb4ab3c7b4284fb.tar.gz
scripts: adjust relocation.inc to not copy large directories
Some of the git repositories for depedencies can be quite large. The large files never seem to be related to build (as they would be too large to be pure go modules). To make things faster, update our rsync copy to exclude any directories bigger than 500M, we can adjust the limit or make it something a recipe can specify in the future, but for now this helps long build times. Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/oe-go-mod-autogen.py33
1 files changed, 29 insertions, 4 deletions
diff --git a/scripts/oe-go-mod-autogen.py b/scripts/oe-go-mod-autogen.py
index 40c964da..7cb101d0 100755
--- a/scripts/oe-go-mod-autogen.py
+++ b/scripts/oe-go-mod-autogen.py
@@ -569,8 +569,7 @@ class GoModTool(object):
569 srcrev_name_recorded = [] 569 srcrev_name_recorded = []
570 # pre styhead releases 570 # pre styhead releases
571 # SRC_URI += "git://%s;name=%s;protocol=https;nobranch=1;destsuffix=${WORKDIR}/${BP}/src/import/vendor.fetch/%s" 571 # SRC_URI += "git://%s;name=%s;protocol=https;nobranch=1;destsuffix=${WORKDIR}/${BP}/src/import/vendor.fetch/%s"
572 template = """# %s %s 572 template = """# [%s %s] git ls-remote %s %s
573# [1] git ls-remote %s %s
574SRCREV_%s = "%s" 573SRCREV_%s = "%s"
575SRC_URI += "git://%s;name=%s;protocol=https;nobranch=1;destsuffix=${GO_SRCURI_DESTSUFFIX}/vendor.fetch/%s" 574SRC_URI += "git://%s;name=%s;protocol=https;nobranch=1;destsuffix=${GO_SRCURI_DESTSUFFIX}/vendor.fetch/%s"
576 575
@@ -622,14 +621,40 @@ do_compile:prepend() {
622 site_dest=$(echo $s | cut -d: -f1) 621 site_dest=$(echo $s | cut -d: -f1)
623 site_source=$(echo $s | cut -d: -f2) 622 site_source=$(echo $s | cut -d: -f2)
624 force_flag=$(echo $s | cut -d: -f3) 623 force_flag=$(echo $s | cut -d: -f3)
624
625 mkdir -p vendor.copy/$site_dest 625 mkdir -p vendor.copy/$site_dest
626
627 # create a temporary exclude file
628 exclude_file=$(mktemp)
629
630 find vendor.fetch/$site_source -type d -print0 | \
631 xargs -0 du -sBM 2>/dev/null | \
632 awk '{if ($1+0 > 500) print substr($0, index($0,$2))}' | \
633 sed 's|^vendor.fetch/||' > "$exclude_file"
634
626 if [ -n "$force_flag" ]; then 635 if [ -n "$force_flag" ]; then
627 echo "[INFO] $site_dest: force copying .go files" 636 echo "[INFO] $site_dest: force copying .go files"
628 rm -rf vendor.copy/$site_dest 637 rm -rf vendor.copy/$site_dest
629 rsync -a --exclude='vendor/' --exclude='.git/' vendor.fetch/$site_source/ vendor.copy/$site_dest 638 rsync -a \
639 --exclude='vendor/' \
640 --exclude='.git/' \
641 --exclude-from="$exclude_file" \
642 vendor.fetch/$site_source/ vendor.copy/$site_dest
630 else 643 else
631 [ -n "$(ls -A vendor.copy/$site_dest/*.go 2> /dev/null)" ] && { echo "[INFO] vendor.fetch/$site_source -> $site_dest: go copy skipped (files present)" ; true ; } || { echo "[INFO] $site_dest: copying .go files" ; rsync -a --exclude='vendor/' --exclude='.git/' vendor.fetch/$site_source/ vendor.copy/$site_dest ; } 644 if [ -n "$(ls -A vendor.copy/$site_dest/*.go 2> /dev/null)" ]; then
645 echo "[INFO] vendor.fetch/$site_source -> $site_dest: go copy skipped (files present)"
646 true
647 else
648 echo "[INFO] $site_dest: copying .go files"
649 rsync -a \
650 --exclude='vendor/' \
651 --exclude='.git/' \
652 --exclude-from="$exclude_file" \
653 vendor.fetch/$site_source/ vendor.copy/$site_dest
654 fi
632 fi 655 fi
656
657 rm -f "$exclude_file"
633 done 658 done
634} 659}
635""" 660"""