diff --git a/pkgs/by-name/go/gopeed/gitHashes.json b/pkgs/by-name/go/gopeed/gitHashes.json new file mode 100644 index 000000000000..1e971195c634 --- /dev/null +++ b/pkgs/by-name/go/gopeed/gitHashes.json @@ -0,0 +1,5 @@ +{ + "install_plugin": "sha256-3FM08D2pbtWmitf8R4pAylVqum7IfbWh6pOIEhJdySk=", + "permission_handler_windows": "sha256-MRTmuH0MfhGaMEb9bRotimAPRlFyl3ovtJUJ2WK7+DA=", + "tray_manager": "sha256-rsvykRadbCRNwJUEAcoFTywwqvx4qvzdUmz7TQFDYP4=" +} diff --git a/pkgs/by-name/go/gopeed/package.nix b/pkgs/by-name/go/gopeed/package.nix index c37850098e6e..248d5a200767 100644 --- a/pkgs/by-name/go/gopeed/package.nix +++ b/pkgs/by-name/go/gopeed/package.nix @@ -1,24 +1,24 @@ { lib, fetchFromGitHub, - flutter327, + flutter332, autoPatchelfHook, buildGoModule, libayatana-appindicator, }: let - version = "1.8.0"; + version = "1.8.2"; src = fetchFromGitHub { owner = "GopeedLab"; repo = "gopeed"; tag = "v${version}"; - hash = "sha256-GUCc6GK1yhVbk3Ss1XnT23wtz22uTgdSSDfEdr4mMpA="; + hash = "sha256-KezASQIqyu4GsKaGAhge7gEYMe57GMgzjXlAbmyDI3Y="; }; metaCommon = { - description = "Modern download manager that supports all platforms"; + description = "Modern download manager"; homepage = "https://github.com/GopeedLab/gopeed"; license = with lib.licenses; [ gpl3Plus ]; maintainers = [ ]; @@ -29,7 +29,7 @@ let inherit version src; pname = "libgopeed"; - vendorHash = "sha256-7SPTMeaHvqTZJQYPoGUGRudNRTcsEl/8AKgI6W/XCJQ="; + vendorHash = "sha256-x9M9zwS5FhsIyGGBi0szWHMfLXCFVgqv8bfSxhHZT2Y="; buildPhase = '' runHook preBuild @@ -44,7 +44,7 @@ let meta = metaCommon; }; in -flutter327.buildFlutterApplication { +flutter332.buildFlutterApplication { inherit version src; pname = "gopeed"; @@ -52,10 +52,7 @@ flutter327.buildFlutterApplication { pubspecLock = lib.importJSON ./pubspec.lock.json; - gitHashes = { - install_plugin = "sha256-3FM08D2pbtWmitf8R4pAylVqum7IfbWh6pOIEhJdySk="; - permission_handler_windows = "sha256-MRTmuH0MfhGaMEb9bRotimAPRlFyl3ovtJUJ2WK7+DA="; - }; + gitHashes = lib.importJSON ./gitHashes.json; nativeBuildInputs = [ autoPatchelfHook ]; diff --git a/pkgs/by-name/go/gopeed/pubspec.lock.json b/pkgs/by-name/go/gopeed/pubspec.lock.json index fdb2017b279b..c737f6ecfe51 100644 --- a/pkgs/by-name/go/gopeed/pubspec.lock.json +++ b/pkgs/by-name/go/gopeed/pubspec.lock.json @@ -356,6 +356,16 @@ "source": "hosted", "version": "1.0.8" }, + "dart_ipc": { + "dependency": "direct main", + "description": { + "name": "dart_ipc", + "sha256": "6cad558cda5304017c1f581df4c96fd4f8e4ee212aae7bfa4357716236faa9ba", + "url": "https://pub.dev" + }, + "source": "hosted", + "version": "1.0.1" + }, "dart_style": { "dependency": "transitive", "description": { @@ -1561,12 +1571,13 @@ "tray_manager": { "dependency": "direct main", "description": { - "name": "tray_manager", - "sha256": "bdc3ac6c36f3d12d871459e4a9822705ce5a1165a17fa837103bc842719bf3f7", - "url": "https://pub.dev" + "path": "packages/tray_manager", + "ref": "main", + "resolved-ref": "91cdbdc12517d0d832aca715542b9d0329739d5d", + "url": "https://github.com/monkeyWie/tray_manager.git" }, - "source": "hosted", - "version": "0.2.4" + "source": "git", + "version": "0.5.1" }, "typed_data": { "dependency": "transitive", @@ -1762,11 +1773,11 @@ "dependency": "transitive", "description": { "name": "web_socket_channel", - "sha256": "9f187088ed104edd8662ca07af4b124465893caf063ba29758f97af57e61da8f", + "sha256": "d645757fb0f4773d602444000a8131ff5d48c9e47adfe9772652dd1a4f2d45c8", "url": "https://pub.dev" }, "source": "hosted", - "version": "3.0.1" + "version": "3.0.3" }, "win32": { "dependency": "transitive", diff --git a/pkgs/by-name/go/gopeed/update-gitHashes.py b/pkgs/by-name/go/gopeed/update-gitHashes.py new file mode 100755 index 000000000000..ffa6feb66653 --- /dev/null +++ b/pkgs/by-name/go/gopeed/update-gitHashes.py @@ -0,0 +1,51 @@ +#! /usr/bin/env nix-shell +#! nix-shell -i python3 -p python3 nix-prefetch-git + +import json +import subprocess +import sys +from pathlib import Path + +THIS_FOLDER = Path(__file__).parent.resolve() +PUBSPEC_LOCK = THIS_FOLDER / "pubspec.lock.json" +GIT_HASHES = THIS_FOLDER / "gitHashes.json" + + +def fetch_git_hash(url: str, rev: str) -> str: + result = subprocess.run( + ["nix-prefetch-git", "--url", url, "--rev", rev], + capture_output=True, + text=True, + check=True, + ) + return json.loads(result.stdout)["hash"] + + +def main() -> None: + if not PUBSPEC_LOCK.exists(): + sys.exit(1) + try: + data = json.loads(PUBSPEC_LOCK.read_text()) + except json.JSONDecodeError: + sys.exit(1) + output: dict[str, str] = {} + for name, info in data.get("packages", {}).items(): + if info.get("source") != "git": + continue + desc = info.get("description") + if not isinstance(desc, dict): + continue + url = desc.get("url") + rev = desc.get("resolved-ref") + if not (isinstance(url, str) and isinstance(rev, str)): + continue + try: + package_hash = fetch_git_hash(url, rev) + except subprocess.CalledProcessError: + continue + output[name] = package_hash + GIT_HASHES.write_text(json.dumps(output, indent=2) + "\n") + + +if __name__ == "__main__": + main() diff --git a/pkgs/by-name/go/gopeed/update.sh b/pkgs/by-name/go/gopeed/update.sh index 1bdf16913950..3f6a47799a47 100755 --- a/pkgs/by-name/go/gopeed/update.sh +++ b/pkgs/by-name/go/gopeed/update.sh @@ -1,14 +1,14 @@ #!/usr/bin/env nix-shell -#!nix-shell -I nixpkgs=./. -i bash -p curl gnused jq yq nix bash coreutils nix-update +#!nix-shell -i bash -p curl gnused jq yq-go nix bash nix-update set -eou pipefail -ROOT="$(dirname "$(readlink -f "$0")")" +PACKAGE_DIR=$(realpath "$(dirname "$0")") -latestTag=$(curl ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} -sL https://api.github.com/repos/GopeedLab/gopeed/releases/latest | jq --raw-output .tag_name) +latestTag=$(curl ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} --fail --silent https://api.github.com/repos/GopeedLab/gopeed/releases/latest | jq --raw-output .tag_name) latestVersion=$(echo "$latestTag" | sed 's/^v//') -currentVersion=$(nix-instantiate --eval -E "with import ./. {}; gopeed.version or (lib.getVersion gopeed)" | tr -d '"') +currentVersion=$(nix eval --raw --file . gopeed.version) if [[ "$currentVersion" == "$latestVersion" ]]; then echo "package is up-to-date: $currentVersion" @@ -17,4 +17,6 @@ fi nix-update gopeed.libgopeed -curl https://raw.githubusercontent.com/GopeedLab/gopeed/${latestTag}/ui/flutter/pubspec.lock | yq . >$ROOT/pubspec.lock.json +curl --fail --silent https://raw.githubusercontent.com/GopeedLab/gopeed/${latestTag}/ui/flutter/pubspec.lock | yq eval --output-format=json --prettyPrint >$PACKAGE_DIR/pubspec.lock.json + +$PACKAGE_DIR/update-gitHashes.py