depot/third_party/nixpkgs/pkgs/applications/science/misc/openrefine/update.sh
Default email 60f07311b9 Project import generated by Copybara.
GitOrigin-RevId: f8e2ebd66d097614d51a56a755450d4ae1632df1
2024-02-06 17:22:34 -08:00

20 lines
861 B
Bash
Executable file

#!/usr/bin/env nix-shell
#!nix-shell -i bash -p nix nix-update
set -euxo pipefail
nix-update "${UPDATE_NIX_ATTR_PATH}"
nix-update "${UPDATE_NIX_ATTR_PATH}.npmPkg" --version=skip
FILE="$(nix-instantiate --eval -E 'with import ./. {}; (builtins.unsafeGetAttrPos "version" '"${UPDATE_NIX_ATTR_PATH}"').file' | tr -d '"')"
MVNHASH_OLD=$(nix-instantiate --eval . -A "${UPDATE_NIX_ATTR_PATH}.mvnHash" | tr -d '"')
MVNHASH_OLD_ESCAPED=$(echo "${MVNHASH_OLD}" | sed -re 's|[+]|\\&|g')
FAKEHASH=$(nix-instantiate --eval . -A "lib.fakeHash" | tr -d '"')
FAKEHASH_ESCAPED=$(echo "${FAKEHASH}" | sed -re 's|[+]|\\&|g')
sed -E -i "s|${MVNHASH_OLD_ESCAPED}|${FAKEHASH}|g" "${FILE}"
MVNHASH_NEW="$(nix-build . -A "${UPDATE_NIX_ATTR_PATH}" 2>&1 | tail -n10 | grep 'got:' | cut -d: -f2- | xargs echo || true)"
sed -E -i "s|${FAKEHASH_ESCAPED}|${MVNHASH_NEW}|g" "${FILE}"