From ec7491d9c514f73ef8a5a17f7d45e8993ace2295 Mon Sep 17 00:00:00 2001 From: rina Date: Tue, 12 Sep 2023 14:08:26 +1000 Subject: [PATCH] clean up share/ outputs and update README. --- README.md | 13 ++++++++----- asli.nix | 4 ++-- aslp.nix | 2 +- bap-asli-plugin.nix | 4 ++-- bap-aslp.nix | 2 +- basil.nix | 6 +++--- update.sh | 7 +++++-- 7 files changed, 22 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 3614d27..4f71540 100644 --- a/README.md +++ b/README.md @@ -21,11 +21,14 @@ the usual \ extended with those from this repo. For users of tools, the main packages are: - **[aslp][]**: the ASLp partial evaluator with ARM's MRA, -- **[bap-aslp][]**: a version of BAP with an integrated ASLp plugin, and +- **[bap-aslp][]**: a version of official BAP with a bundled ASLp plugin, +- **[bap-uq-pac][]**: PAC's fork of BAP with the [Primus Lisp PR][] but without ASLp, and - **[basil][]**: the Basil tool for analysis and transpilation to Boogie code. [aslp]: https://github.com/UQ-PAC/aslp [bap-aslp]: https://github.com/UQ-PAC/bap-asli-plugin +[bap-uq-pac]: https://github.com/UQ-PAC/bap/tree/aarch64-pull-request-2 +[Primus Lisp PR]: https://github.com/BinaryAnalysisPlatform/bap/pull/1546 [basil]: https://github.com/UQ-PAC/bil-to-boogie-translator These are each defined in a .nix file of the same name, @@ -155,13 +158,13 @@ This involves updating the src attribute with the latest commit hash from each G Most of this is automated by a script: ```bash -export GITHUB_TOKEN=github_pat_11... # not necessary but avoids rate limiting -./update.sh +export GITHUB_TOKEN=github_... # not necessary but avoids rate limiting +./update.sh upgrade --build # or `./update.sh check` to check only ``` -This will update the hash in each Nix file with the latest, then attempt to build the new packages. +This will update the hash in each Nix file with the latest then attempt to build the new packages. If successful, this will commit the changes. -The basil derivation is more unstable since it relies on SBT to fetch its dependencies. +The basil derivation is most fragile since it relies on SBT to fetch its dependencies. The depsSha256 will need to be changed manually if the script fails at that point. ## miscellany diff --git a/asli.nix b/asli.nix index fa58fc0..169bdd1 100644 --- a/asli.nix +++ b/asli.nix @@ -27,8 +27,8 @@ ocamlPackages.buildDunePackage rec { configurePhase = '' export ASLI_OTT=${pkgs.ott.out + "/share/ott"} - mkdir -p $out/asl - cp -rv prelude.asl mra_tools tests $out/asl + mkdir -p $out/share/asli + cp -rv prelude.asl mra_tools tests $out/share/asli ''; outputs = [ "out" ]; diff --git a/aslp.nix b/aslp.nix index 3d827df..5ebc95a 100644 --- a/aslp.nix +++ b/aslp.nix @@ -9,7 +9,7 @@ installPhase = '' mkdir -p $out/bin - ASL_PATH=${asli}/asl + ASL_PATH=${asli}/share/asli cd ${asli}/bin makeBinaryWrapper "$(pwd)/asli" $out/bin/aslp \ --append-flags --prelude \ diff --git a/bap-asli-plugin.nix b/bap-asli-plugin.nix index 37e11ae..ad1ed7a 100644 --- a/bap-asli-plugin.nix +++ b/bap-asli-plugin.nix @@ -22,8 +22,8 @@ stdenv.mkDerivation rec { runHook preBuild bapbuild -package asli.libASL asli.plugin - mkdir -p $out - cp asli.plugin $out/asli.plugin + mkdir -p $out/share/bap-asli-plugin + cp asli.plugin $out/share/bap-asli-plugin/asli.plugin runHook postBuild ''; diff --git a/bap-aslp.nix b/bap-aslp.nix index a4bddfd..b625b33 100644 --- a/bap-aslp.nix +++ b/bap-aslp.nix @@ -9,7 +9,7 @@ installPhase = '' mkdir -p $out/bin - ASLI_PATH=${asli}/asl + ASLI_PATH=${asli}/share/asli cd ${_bap}/bin for b in *; do makeBinaryWrapper "$(pwd)/$b" $out/bin/$b-aslp \ diff --git a/basil.nix b/basil.nix index d8b8e40..5df66c1 100644 --- a/basil.nix +++ b/basil.nix @@ -29,17 +29,17 @@ mkSbtDerivation rec { installPhase = '' mkdir -p $out/bin - mkdir -p $out/share/target + mkdir -p $out/share/basil JAR=target/scala-3.1.0/wptool-boogie*.jar # copy jar to output directory - cp -r $JAR $out/share/$(basename $JAR) + cp -r $JAR $out/share/basil/$(basename $JAR) # make wrapper to run jar with appropriate arguments makeBinaryWrapper "${jre}/bin/java" $out/bin/basil \ --add-flags -jar \ - --add-flags "$out/share/$(basename $JAR)" + --add-flags "$out/share/basil/$(basename $JAR)" ''; meta = { diff --git a/update.sh b/update.sh index 24d3dd5..dbd9801 100755 --- a/update.sh +++ b/update.sh @@ -16,11 +16,14 @@ case "$1" in ;; *) echo "$0: missing required argument" >&2 - echo "Usage: $0 [ check | upgrade ]" >&2 + echo "Usage: $0 [ check | upgrade ] [ NIX-UPDATE OPTION ]... " >&2 exit 1 ;; esac +shift +ARGS=("$@") + do-upgrade() { [[ $MODE == upgrade ]] } @@ -61,7 +64,7 @@ update-github() { latest=$(curl "$COMMITS_API" | jq -r .sha) if do-upgrade; then - nix-update -f "$PKGS" $attr --version branch=$branch --commit --build + nix-update -f "$PKGS" $attr --version branch=$branch --commit "${ARGS[@]}" else current=$(nix-instantiate --eval -E "(import ./$PKGS {}).$attr.src.rev" | jq -r) COMPARE="https://api.github.com/repos/$repo/compare/$current...$branch"