Skip to content

Commit

Permalink
better curl errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
katrinafyi committed Sep 11, 2023
1 parent 9c0a3a0 commit 44eb011
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ final: prev:
bap-aslp = prev.callPackage ./bap-aslp.nix {};

bap-uq-pac = prev.ocamlPackages.bap.overrideAttrs rec {
version = "uq-pac";
version = src.rev;
src = prev.fetchFromGitHub {
owner = "UQ-PAC";
repo = "bap";
Expand Down
18 changes: 15 additions & 3 deletions update.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash --packages nix-update jq curl cacert git nix vim --pure --keep GITHUB_TOKEN --keep NIX_PATH
#! nix-shell -i bash --packages nix-update curl jq cacert git nix vim --pure --keep GITHUB_TOKEN --keep NIX_PATH

# updates the revision hash for each upstream package.
# for each updated package, this checks the derivation can be built
Expand All @@ -19,11 +19,21 @@ do-upgrade() {
PKGS=./pkgs.nix
TMP=$(mktemp)

PID=$$
curl() {
TMP=$(mktemp)
if ! [[ -z "$GITHUB_TOKEN" ]]; then
command curl -s --header "Authorization: Bearer $GITHUB_TOKEN" "$@"
command curl --fail-with-body -s --header "Authorization: Bearer $GITHUB_TOKEN" "$@" >$TMP
else
command curl -s "$@"
command curl --fail-with-body -s "$@" >$TMP
fi
EXIT=$?
if [[ $EXIT != 0 ]]; then
echo "::error title=curl failure ($EXIT)::curl $@" >&2
cat $TMP >&2
kill -ABRT $PID
else
cat $TMP
fi
}

Expand Down Expand Up @@ -80,4 +90,6 @@ test-build bap-aslp

update-github basil UQ-PAC/bil-to-boogie-translator

update-github bap-uq-pac UQ-PAC/bap aarch64-pull-request-2

rm -fv ./result

0 comments on commit 44eb011

Please sign in to comment.