-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
66 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,47 @@ | ||
function getUncachedDrvs { | ||
local -a uncached | ||
local drv | ||
drv=$1 | ||
declare action="$1" | ||
declare targetDrv | ||
|
||
mapfile -t uncached < <( | ||
command nix-store --realise --dry-run "$drv" 2>&1 1>/dev/null \ | ||
| command sed -nrf @extractor@ | ||
) | ||
eval "$(jq -r '@sh "targetDrv=\(.targetDrv)"' <<< "$action" )" | ||
|
||
test ''${#uncached[@]} -eq 0 && return; | ||
mapfile -t uncached < <( | ||
command nix-store --realise --dry-run "$targetDrv" 2>&1 1>/dev/null \ | ||
| command sed -nr ' | ||
# If the line "will be built" is matched ... | ||
/will be built/ { | ||
# Create a label to iterate over dervivations | ||
:b | ||
# Get next line from input into pattern buffer | ||
# (Overwrite the pattern buffer) | ||
n | ||
# If the line matches a nix store path ... | ||
/\/nix/ { | ||
# ... strip leading whitespaces and print it | ||
s/\s*(.*)/\1/p | ||
# and go on with the next line (step back to b) | ||
bb | ||
} | ||
} | ||
' | ||
) | ||
|
||
if ( | ||
command nix show-derivation ''${uncached[@]} 2> /dev/null \ | ||
| command jq --exit-status \ | ||
' with_entries( | ||
select(.value|.env.preferLocalBuild != "1") | ||
) | any | ||
' 1> /dev/null | ||
); then | ||
echo "$drv" | ||
fi | ||
} | ||
if [[ ${#uncached[@]} -eq 0 ]]; | ||
then | ||
exit 1 | ||
fi | ||
|
||
export -f getUncachedDrvs | ||
if ! ( | ||
command nix show-derivation ''${uncached[@]} 2> /dev/null \ | ||
| command jq --exit-status \ | ||
' with_entries( | ||
select(.value|.env.preferLocalBuild != "1") | ||
) | any | ||
' 1> /dev/null | ||
); then | ||
exit 1 | ||
fi | ||
|
||
command jq --raw-output \ | ||
--from-file @filter@ \ | ||
--arg uncachedDrvs "$( | ||
parallel -j0 getUncachedDrvs ::: "$( | ||
command jq --raw-output 'map(.targetDrv|strings)[]' <<< "$1" | ||
)" | ||
)" <<< "$1" | ||
|
||
unset -f getUncachedDrvs | ||
exit 0 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,10 @@ | ||
function scopeo_inspect() { | ||
local image | ||
image="$1" | ||
if command skopeo inspect --insecure-policy "docker://$image" &>/dev/null; then | ||
echo "$image" | ||
fi | ||
} | ||
export -f scopeo_inspect | ||
command jq --raw-output \ | ||
--from-file "@filter@" \ | ||
--arg available "$( | ||
parallel -j0 scopeo_inspect ::: "$( | ||
command jq --raw-output 'map(.meta.image|strings)[]' <<< "$1" | ||
)" | ||
)" <<< "$1" | ||
unset -f scopeo_inspect | ||
unset images | ||
declare action="$1" | ||
declare image | ||
|
||
eval "$(jq -r '@sh "image=\(.meta.image)"' <<< "$action" )" | ||
|
||
if command skopeo inspect --insecure-policy "docker://$image" &>/dev/null; then | ||
echo 1 | ||
fi | ||
|
||
echo 0 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters