Merge pull request #279186 from shyim/upd-dynamodb

dynamodb-local: 2023-12-14 -> 2.2.1
This commit is contained in:
Pol Dellaiera 2024-03-02 23:43:07 +01:00 committed by GitHub
commit 43d514a57a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,6 +4,13 @@
, jdk_headless
, jre_minimal
, makeBinaryWrapper
, curl
, jq
, yq
, dynamodb-local
, testers
, common-updater-scripts
, writeShellScript
}:
let
jre = jre_minimal.override {
@ -18,11 +25,11 @@ let
in
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "dynamodb-local";
version = "2023-12-14";
version = "2.2.1";
src = fetchurl {
url = "https://d1ni2b6xgvw0s0.cloudfront.net/v2.x/dynamodb_local_${finalAttrs.version}.tar.gz";
hash = "sha256-F9xTcLNAVFVbH7l0FlMuVNoLBrJS/UcHKXTkJh1n40w=";
url = "https://d1ni2b6xgvw0s0.cloudfront.net/v2.x/dynamodb_local_2024-01-04.tar.gz";
hash = "sha256-CbZ9Z9A70JoHu4G6It+7WycaEtzuwjVJ2YrOK+37zYA=";
};
sourceRoot = ".";
@ -41,6 +48,29 @@ stdenvNoCC.mkDerivation (finalAttrs: {
runHook postInstall
'';
passthru = {
tests.version = testers.testVersion {
package = dynamodb-local;
};
updateScript = writeShellScript "update-dynamodb-local" ''
set -o errexit
export PATH="${lib.makeBinPath [ curl jq yq common-updater-scripts ]}:$PATH"
NEW_VERSION=$(curl -s https://repo1.maven.org/maven2/com/amazonaws/DynamoDBLocal/maven-metadata.xml | xq -r '.metadata.versioning.latest')
NEW_VERSION_DATE=$(curl -s https://repo1.maven.org/maven2/com/amazonaws/DynamoDBLocal/maven-metadata.xml | xq -r '.metadata.versioning.lastUpdated | "\(.[:4])-\(.[4:6])-\(.[6:8])"')
if [[ "${finalAttrs.version}" = "$NEW_VERSION" ]]; then
echo "The new version same as the old version."
exit 0
fi
DOWNLOAD_URL="https://d1ni2b6xgvw0s0.cloudfront.net/v2.x/dynamodb_local_$NEW_VERSION_DATE.tar.gz"
NIX_HASH=$(nix hash to-sri sha256:$(nix-prefetch-url $DOWNLOAD_URL))
update-source-version "dynamodb-local" "$NEW_VERSION" "$NIX_HASH" "$DOWNLOAD_URL"
'';
};
meta = with lib; {
description = "DynamoDB Local is a small client-side database and server that mimics the DynamoDB service.";
homepage = "https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html";