diff --git a/dist/main/index.js b/dist/main/index.js index 74c76a00..1cd742ff 100644 --- a/dist/main/index.js +++ b/dist/main/index.js @@ -7964,8 +7964,17 @@ async function registerPostBuildHook(cachixBin, daemonDir) { PUSH_FILTER="${pushFilter}" - if [ -n "$PUSH_FILTER" ]; then - OUT_PATHS=$(echo "$OUT_PATHS" | grep -vEe "$PUSH_FILTER") + function filterPaths { + local regex=$1 + local paths=$2 + + for path in $paths; do + echo $path | grep -vEe $regex + done | xargs + } + + if [[ -n $PUSH_FILTER ]]; then + OUT_PATHS=$(filterPaths $PUSH_FILTER "$OUT_PATHS") fi exec ${cachixBin} daemon push \ diff --git a/dist/main/push-paths.sh b/dist/main/push-paths.sh index 35ab55ff..977c8087 100755 --- a/dist/main/push-paths.sh +++ b/dist/main/push-paths.sh @@ -3,11 +3,20 @@ set -euo pipefail cachix=$1 cachixArgs=${2:--j8} cache=$3 pathsToPush=$4 pushFilter=$5 -if [[ $pathsToPush == "" ]]; then +function filterPaths { + local regex=$1 + local paths=$2 + + for path in $paths; do + echo $path | grep -vEe $regex + done | xargs +} + +if [[ -z $pathsToPush ]]; then pathsToPush=$(comm -13 <(sort /tmp/store-path-pre-build) <("$(dirname "$0")"/list-nix-store.sh)) - if [[ $pushFilter != "" ]]; then - pathsToPush=$(echo "$pathsToPush" | grep -vEe "$pushFilter") + if [[ -n $pushFilter ]]; then + pathsToPush=$(filterPaths $pushFilter "$pathsToPush") fi fi diff --git a/src/main.ts b/src/main.ts index 8ddc835a..0d216377 100644 --- a/src/main.ts +++ b/src/main.ts @@ -283,8 +283,17 @@ async function registerPostBuildHook(cachixBin: string, daemonDir: string) { PUSH_FILTER="${pushFilter}" - if [ -n "$PUSH_FILTER" ]; then - OUT_PATHS=$(echo "$OUT_PATHS" | grep -vEe "$PUSH_FILTER") + function filterPaths { + local regex=$1 + local paths=$2 + + for path in $paths; do + echo $path | grep -vEe $regex + done | xargs + } + + if [[ -n $PUSH_FILTER ]]; then + OUT_PATHS=$(filterPaths $PUSH_FILTER "$OUT_PATHS") fi exec ${cachixBin} daemon push \