diff options
-rwxr-xr-x | scripts/oe-go-mod-autogen.py | 33 |
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 | ||
574 | SRCREV_%s = "%s" | 573 | SRCREV_%s = "%s" |
575 | SRC_URI += "git://%s;name=%s;protocol=https;nobranch=1;destsuffix=${GO_SRCURI_DESTSUFFIX}/vendor.fetch/%s" | 574 | SRC_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 | """ |