diff --git a/pkgs/by-name/ap/apkeditor/arsclib/default.nix b/pkgs/by-name/ap/apkeditor/arsclib/default.nix index 37e9d0d9ec59..56625eb1af31 100644 --- a/pkgs/by-name/ap/apkeditor/arsclib/default.nix +++ b/pkgs/by-name/ap/apkeditor/arsclib/default.nix @@ -8,8 +8,8 @@ let self = REAndroidLibrary { pname = "arsclib"; - # 1.3.5 is not new enough for APKEditor because of API changes - version = "1.3.5-unstable-2024-10-21"; + # 1.3.8 is not new enough for APKEditor because of API changes + version = "1.3.8-unstable-2025-09-23"; projectName = "ARSCLib"; src = fetchFromGitHub { @@ -18,8 +18,8 @@ let # This is the latest commit at the time of packaging. # It can be changed to a stable release ("V${version}") # if it is compatible with APKEditor. - rev = "ed6ccf00e56d7cce13e8648ad46a2678a6093248"; - hash = "sha256-jzd7xkc4O+P9hlGsFGGl2P3pqVvV5+mDyKTRUuGfFSA="; + rev = "7238433395dea6f7d0fce3139f1659063ac31f42"; + hash = "sha256-93eskC/qdkkNAZFYqSzoFxhmWgzTvDyZmZxOvwELGCs="; }; mitmCache = gradle.fetchDeps { diff --git a/pkgs/by-name/ap/apkeditor/jcommand/default.nix b/pkgs/by-name/ap/apkeditor/jcommand/default.nix index 43b6ce8cae4c..b2e5a0c021ba 100644 --- a/pkgs/by-name/ap/apkeditor/jcommand/default.nix +++ b/pkgs/by-name/ap/apkeditor/jcommand/default.nix @@ -8,7 +8,7 @@ let self = REAndroidLibrary { pname = "jcommand"; - version = "0-unstable-2024-09-20"; + version = "0-unstable-2025-01-21"; projectName = "JCommand"; src = fetchFromGitHub { @@ -18,8 +18,8 @@ let # it is hard to determine the actual commit that APKEditor is intended to use, # so I think we should use the latest commit that doesn't break compilation or basic functionality. # Currently this is the latest commit at the time of packaging. - rev = "714b6263c28dabb34adc858951cf4bc60d6c3fed"; - hash = "sha256-6Em+1ddUkZBCYWs88qtfeGnxISZchFrHgDL8fsgZoQg="; + rev = "27d5fd21dc7da268182ea81e59007af890adb06e"; + hash = "sha256-sbblGrp16rMGGGt7xAFd9F3ACeadYYEymBEL+s5BZ1E="; }; mitmCache = gradle.fetchDeps { diff --git a/pkgs/by-name/ap/apkeditor/package.nix b/pkgs/by-name/ap/apkeditor/package.nix index 04f1d608a952..8647e87359d1 100644 --- a/pkgs/by-name/ap/apkeditor/package.nix +++ b/pkgs/by-name/ap/apkeditor/package.nix @@ -3,6 +3,7 @@ stdenv, fetchFromGitHub, callPackage, + versionCheckHook, jre, gradle, @@ -54,7 +55,7 @@ let apkeditor = let pname = "apkeditor"; - version = "1.4.1"; + version = "1.4.5"; projectName = "APKEditor"; in REAndroidLibrary { @@ -69,8 +70,8 @@ let src = fetchFromGitHub { owner = "REAndroid"; repo = "APKEditor"; - tag = "v${version}"; - hash = "sha256-a72j9qGjJXnTFeqLez2rhBSArFVYCX+Xs7NQd8CY5Yk="; + tag = "V${version}"; + hash = "sha256-yuNMyEnxTjHPSBPWVD8b+f612hWGGayZHKHxtWtxXDg="; }; patches = [ @@ -99,8 +100,15 @@ let --add-flags "-jar $out/${apkeditor.outJar}" ''; + doInstallCheck = true; + nativeInstallCheckInputs = [ versionCheckHook ]; + + passthru.updateScript = ./update.sh; + meta = { description = "Powerful android apk resources editor"; + homepage = "https://github.com/REAndroid/APKEditor"; + changelog = "https://github.com/REAndroid/APKEditor/releases/tag/V${version}"; maintainers = with lib.maintainers; [ ulysseszhan ]; license = lib.licenses.asl20; platforms = lib.platforms.all; diff --git a/pkgs/by-name/ap/apkeditor/smali/default.nix b/pkgs/by-name/ap/apkeditor/smali/default.nix index de6b87c8e82e..ee0032ad27d0 100644 --- a/pkgs/by-name/ap/apkeditor/smali/default.nix +++ b/pkgs/by-name/ap/apkeditor/smali/default.nix @@ -8,7 +8,7 @@ let self = REAndroidLibrary { pname = "smali"; - version = "0-unstable-2024-10-15"; + version = "0-unstable-2024-11-24"; projectName = "smali"; src = fetchFromGitHub { @@ -18,8 +18,8 @@ let # it is hard to determine the actual commit that APKEditor is intended to use, # so I think we should use the latest commit that doesn't break compilation or basic functionality. # Currently this is the latest commit at the time of packaging. - rev = "c781eafb31f526abce9fdf406ce2c925fec20d28"; - hash = "sha256-6tkvikgWMUcKwzsgbfpxlB6NZBAlZtTE34M3qPQw7Y4="; + rev = "76b35b4e0c9e8c874ca3e374bb943bba8d280770"; + hash = "sha256-PhRBjiIKA4EIiafPplZNBErXG8V84Xn0cZLWVPmJelQ="; }; patches = [ diff --git a/pkgs/by-name/ap/apkeditor/update.sh b/pkgs/by-name/ap/apkeditor/update.sh new file mode 100755 index 000000000000..45b43b916690 --- /dev/null +++ b/pkgs/by-name/ap/apkeditor/update.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p curl jq common-updater-scripts + +set -euo pipefail + +GITHUB_TOKEN="${GITHUB_TOKEN:-}" + +nixpkgs_attr() { + nix-instantiate --eval --raw --attr "$1" +} + +github_api() { + local token_opt=() + if [[ -n "$GITHUB_TOKEN" ]]; then + token_opt=(-H "Authorization: Bearer $GITHUB_TOKEN") + fi + curl -fsS "${token_opt[@]}" "https://api.github.com$1" +} + +update_mitm_cache() { + if [[ -z "$(nixpkgs_attr "$1.mitmCache.name")" ]]; then + return + fi + "$(nix-build -A "$1.mitmCache.updateScript")" +} + +update() { + echo "Updating $1..." >&2 + + local owner="$(nixpkgs_attr "$1.src.owner")" + local repo="$(nixpkgs_attr "$1.src.repo")" + + local old_version="$(nixpkgs_attr "$1.version")" + local use_last_commit=0 + if [[ "$old_version" == *unstable* ]]; then + use_last_commit=1 + fi + + if (( use_last_commit )); then + local repo_info="$(github_api "/repos/$owner/$repo/commits?per_page=1" | jq ".[0]")" + local new_rev="$(echo "$repo_info" | jq -r .sha)" + local date="$(echo "$repo_info" | jq -r .commit.author.date)" + date="$(date -u -d "$date" +%Y-%m-%d)" + local new_version="${old_version%%-unstable*}-unstable-$(date -u -d "$date" +%Y-%m-%d)" + update-source-version "$1" "$new_version" --rev="$new_rev" --ignore-same-version --ignore-same-hash + else + local tag="$(github_api "/repos/$owner/$repo/releases/latest" | jq -r .tag_name)" + local new_version="${tag#V}" + update-source-version "$1" "$new_version" --ignore-same-version --ignore-same-hash + fi + + update_mitm_cache "$1" +} + +update apkeditor.passthru.deps.arsclib +update apkeditor.passthru.deps.smali +update apkeditor.passthru.deps.jcommand +update apkeditor