Unverified Commit 2e4ad1ff authored by Vladimír Čunát's avatar Vladimír Čunát
Browse files

ente-auth: 4.2.8 -> 4.3.2 (#377430)

parents e8e3ded6 0a423938
Loading
Loading
Loading
Loading
+46 −0
Original line number Diff line number Diff line
#!/usr/bin/env nix-shell
#!nix-shell -i python3 -p nix-prefetch-git

from dataclasses import dataclass
import json
import subprocess


@dataclass
class GitDependency:
    name: str
    url: str
    revision: str


def get_git_deps(lock_data):
    for name, data in lock_data["packages"].items():
        if data["source"] == "git":
            desc = data["description"]
            yield GitDependency(
                name=name,
                url=desc["url"],
                revision=desc["resolved-ref"],
            )


def nix_prefetch_git(url: str, rev: str):
    result = subprocess.run(
        ["nix-prefetch-git", url, rev],
        check=True,
        text=True,
        stdout=subprocess.PIPE,
    )
    return json.loads(result.stdout)


if __name__ == "__main__":
    with open("pubspec.lock.json") as lock_file:
        lock_data = json.load(lock_file)
    git_hashes = {}
    for dep in get_git_deps(lock_data):
        data = nix_prefetch_git(dep.url, dep.revision)
        git_hashes[dep.name] = data["hash"]
    with open("git-hashes.json", "w") as output_file:
        json.dump(git_hashes, output_file, indent=2)
        output_file.write("\n")
+6 −0
Original line number Diff line number Diff line
{
  "ente_crypto_dart": "sha256-xBBK9BdXh4+OTj+Jkf3zh5sMZjXtvhyuE1R5LFE8iTY=",
  "flutter_local_authentication": "sha256-r50jr+81ho+7q2PWHLf4VnvNJmhiARZ3s4HUpThCgc0=",
  "flutter_secure_storage_linux": "sha256-Rp+b6ZRH7F5AnM5UvYzfVjprXkpeeA7V6Ep/oYqDeiM=",
  "sqflite": "sha256-+XTVtkFJ94VifwnutvUuAqqiyWwrcEiZ3Uz0H4D9zWA="
}
+3 −10
Original line number Diff line number Diff line
@@ -17,19 +17,20 @@ let
in
flutter324.buildFlutterApplication rec {
  pname = "ente-auth";
  version = "4.2.8";
  version = "4.3.2";

  src = fetchFromGitHub {
    owner = "ente-io";
    repo = "ente";
    sparseCheckout = [ "auth" ];
    tag = "auth-v${version}";
    hash = "sha256-1vIM2MrQF0DO+5SEzIAUeZxOks6PKs3kkTdc09aCk2A=";
    hash = "sha256-/WWodQcMibwXVexI+XbTZYRkIMtfNHk3bJVBPJHcoqI=";
  };

  sourceRoot = "${src.name}/auth";

  pubspecLock = lib.importJSON ./pubspec.lock.json;
  gitHashes = lib.importJSON ./git-hashes.json;

  patches = [
    # Disable update notifications and auto-update functionality
@@ -41,14 +42,6 @@ flutter324.buildFlutterApplication rec {
    ln -s ${simple-icons} assets/simple-icons
  '';

  gitHashes = {
    desktop_webview_window = "sha256-jdNMpzFBgw53asWlGzWUS+hoPdzcL6kcJt2KzjxXf2E=";
    ente_crypto_dart = "sha256-XBzQ268E0cYljJH6gDS5O0Pmie/GwuhMDlQPfopSqJM=";
    flutter_local_authentication = "sha256-r50jr+81ho+7q2PWHLf4VnvNJmhiARZ3s4HUpThCgc0=";
    flutter_secure_storage_linux = "sha256-x45jrJ7pvVyhZlpqRSy3CbwT4Lna6yi/b2IyAilWckg=";
    sqflite = "sha256-+XTVtkFJ94VifwnutvUuAqqiyWwrcEiZ3Uz0H4D9zWA=";
  };

  nativeBuildInputs = [
    copyDesktopItems
    makeWrapper
+1 −11
Original line number Diff line number Diff line
@@ -481,7 +481,7 @@
      "description": {
        "path": ".",
        "ref": "HEAD",
        "resolved-ref": "e2e66ffd03f23bef5e0bb138b5f01b32d8e9b7bb",
        "resolved-ref": "f91e1545f8263df127762240c4da54a0c42835b2",
        "url": "https://github.com/ente-io/ente_crypto_dart.git"
      },
      "source": "git",
@@ -1623,16 +1623,6 @@
      "source": "hosted",
      "version": "4.1.0"
    },
    "scan": {
      "dependency": "direct main",
      "description": {
        "name": "scan",
        "sha256": "b343ec36f863a88d41eb4c174b810c055c6bd1f1822b2188ab31aab684fb7cdb",
        "url": "https://pub.dev"
      },
      "source": "hosted",
      "version": "1.6.0"
    },
    "screen_retriever": {
      "dependency": "transitive",
      "description": {
+9 −2
Original line number Diff line number Diff line
@@ -19,16 +19,23 @@ echo "Updating to $short_version"
# Subtree needed for lockfile and icons
auth_tree="$(gh-curl "https://api.github.com/repos/ente-io/ente/git/trees/$version" | gojq '.tree[] | select(.path == "auth") | .url' --raw-output)"

pushd "$pkg_dir"

# Get lockfile, filter out incompatible sqlite dependency and convert to JSON
echo "Updating lockfile"
pubspec_lock="$(gh-curl "$auth_tree" | gojq '.tree[] | select(.path == "pubspec.lock") | .url' --raw-output)"
gh-curl "$pubspec_lock" | gojq '.content | @base64d' --raw-output | gojq --yaml-input 'del(.packages.sqlite3_flutter_libs)' > "$pkg_dir/pubspec.lock.json"
gh-curl "$pubspec_lock" | gojq '.content | @base64d' --raw-output | gojq --yaml-input 'del(.packages.sqlite3_flutter_libs)' > pubspec.lock.json

echo "Updating git hashes"
./fetch-git-hashes.py

# Get rev and hash of simple-icons submodule
echo "Updating icons"
assets_tree="$(gh-curl "$auth_tree" | gojq '.tree[] | select(.path == "assets") | .url' --raw-output)"
simple_icons_rev="$(gh-curl "$assets_tree" | gojq '.tree[] | select(.path == "simple-icons") | .sha' --raw-output)"
nix-prefetch-github --rev "$simple_icons_rev" simple-icons simple-icons > "$pkg_dir/simple-icons.json"
nix-prefetch-github --rev "$simple_icons_rev" simple-icons simple-icons > simple-icons.json

popd

# Update package version and hash
echo "Updating package source"