Commit c71ee2a59d1a3bb61ee23de5a009dde6be20d838

Thomas de Grivel 2023-02-18T02:53:42

wip ci

diff --git a/bin/shpkg_ci_mux b/bin/shpkg_ci_mux
index 1de6330..c568916 100755
--- a/bin/shpkg_ci_mux
+++ b/bin/shpkg_ci_mux
@@ -20,23 +20,19 @@ verbose 2 shpkg_lock shpkg_ci_mux.lock
 
 shpkg_ci_remote () {
     if [ "x$2" == "x--clean" ]; then
-        verbose 1 ssh "$1" shpkg/bin/shpkg_ci -qqq "$2"
+        verbose 1 ssh "$1" shpkg/bin/shpkg_ci "$2"
         rm -rf "${SHPKG_CI_DIR}"
     elif [ "x$2" != "x--upgrade" ]; then
-        verbose 1 ssh "$1" shpkg/bin/shpkg_ci -qqq "$2"
+        verbose 1 ssh "$1" shpkg/bin/shpkg_ci "$2"
     else
-        ( verbose 1 ssh "$1" shpkg/bin/shpkg_ci -qqq "$2" &
-          { ssh "$1" tail -n 10000 -f "${SHPKG_CI_CHANGED_FILES}" |
-                while read F; do
-                    D="${SHPKG_CI_DIR}/$(dirname "$F")"
-                    mkdir -p "$D"
-                    verbose 1 rsync "$1":shpkg/ci/"$F" "$D" &
-                done
-          } &
-          wait %1
-          sleep 10
-          kill %2
-        fi
+        verbose 1 ssh "$1" shpkg/bin/shpkg_ci "$2" |
+            grep '^shpkg_ci_changed_file ' |
+            cut -d ' ' -f 2 |
+            while read F; do
+                D="${SHPKG_CI_DIR}/$(dirname "$F")"
+                mkdir -p "$D"
+                verbose 1 rsync "$1":shpkg/ci/"$F" "$D"
+            done
     fi
 }
 
diff --git a/share/shpkg/shpkg.subr b/share/shpkg/shpkg.subr
index b35f1ad..4c7634c 100644
--- a/share/shpkg/shpkg.subr
+++ b/share/shpkg/shpkg.subr
@@ -832,7 +832,8 @@ shpkg_upgrade_shpkg () {
 
 cut_prefix () {
     LEN=$(echo -n "$1" | wc -c | tr -d ' ')
-    if [ "x$(echo "$2" | cut -c 1-${LEN})" = "$1" ]; then
+    echo $LEN >&2
+    if [ "x$(echo "$2" | cut -c 1-${LEN})" = "x$1" ]; then
         echo "$2" | cut -c $((${LEN} + 1))-
     fi
 }