Unverified Commit 388bb506 authored by @mjones's avatar @mjones Committed by GitHub
Browse files

dumpyara: init at 1.1.0 (#443108)

parents f7073b0c 2da27b8c
Loading
Loading
Loading
Loading
+83 −0
Original line number Diff line number Diff line
{
  lib,
  runCommand,
  python3Packages,
  fetchFromGitHub,
  callPackage,
  nix-update-script,
  _7zz,
  android-tools,
  cpio,
  dumpyara,
  erofs-utils,
  squashfsTools,
  zip,
}:
python3Packages.buildPythonApplication (finalAttrs: {
  pname = "dumpyara";
  version = "1.1.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "sebaubuntu-python";
    repo = "dumpyara";
    tag = "v${finalAttrs.version}";
    hash = "sha256-V7SX1XR+De3py6B3Fmqn1IehN0sGPxUKJ0YlGpBPHG4=";
  };

  build-system = with python3Packages; [ poetry-core ];

  dependencies = with python3Packages; [
    brotli
    liblp
    lz4
    protobuf5
    py7zr
    sebaubuntu-libs
    zstandard
  ];

  makeWrapperArgs = [
    "--prefix"
    "PATH"
    ":"
    (lib.makeBinPath [
      _7zz
      android-tools
      cpio
      erofs-utils
    ])
  ];

  passthru = {
    tests.requiredTools =
      runCommand "check-required-tools"
        {
          nativeBuildInputs = [
            android-tools
            dumpyara
            squashfsTools
            zip
          ];
        }
        ''
          echo foo > bar.txt
          mkbootimg --kernel bar.txt -o boot.img
          mksquashfs bar.txt system.img
          zip system.zip *.img
          dumpyara system.zip
          touch $out
        '';
    updateScript = nix-update-script { };
  };

  __structuredAttrs = true;

  meta = {
    description = "Android firmware dumper";
    homepage = "https://github.com/sebaubuntu-python/dumpyara";
    license = lib.licenses.gpl3Plus;
    maintainers = with lib.maintainers; [ ungeskriptet ];
    mainProgram = "dumpyara";
  };
})
+68 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  nix-update-script,
  android-image-kitchen,
  gitpython,
  poetry-core,
  pyelftools,
  requests,
}:

buildPythonPackage (finalAttrs: {
  pname = "sebaubuntu-libs";
  version = "2.0.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "sebaubuntu-python";
    repo = "sebaubuntu_libs";
    tag = "v${finalAttrs.version}";
    hash = "sha256-LV7Me+GmgOvDh0XGoLaftCKtP/fnB5xVqb8nArOMIys=";
  };

  build-system = [
    poetry-core
  ];

  dependencies = [
    gitpython
    pyelftools
    requests
  ];

  postPatch = ''
    # Patch libaik to use AIK from nixpkgs
    substituteInPlace sebaubuntu_libs/libaik/__init__.py \
      --replace-fail \
        "Repo.clone_from(AIK_REPO, self.path)" "" \
      --replace-fail \
        "unpackimg.sh" "${lib.getExe' android-image-kitchen "aik-unpackimg"}" \
      --replace-fail \
        "repack.sh" "${lib.getExe' android-image-kitchen "aik-repackimg"}" \
      --replace-fail \
        "cleanup.sh" "${lib.getExe' android-image-kitchen "aik-cleanup"}" \
      --replace-fail \
        'command = [self.path / script, "--nosudo", *args]' \
        'command = [script, "--nosudo", *args]' \
      --replace-fail \
        'return check_output(command, stderr=STDOUT, universal_newlines=True, encoding="utf-8")' \
        'return check_output(command, stderr=STDOUT, universal_newlines=True, encoding="utf-8",
          cwd=self.path)'
  '';

  # Module has no tests
  doCheck = false;

  pythonImportsCheck = [ "sebaubuntu_libs" ];

  passthru.updateScript = nix-update-script { };

  meta = {
    description = "SebaUbuntu's shared libs";
    homepage = "https://github.com/sebaubuntu-python/sebaubuntu_libs";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ ungeskriptet ];
  };
})
+2 −0
Original line number Diff line number Diff line
@@ -17466,6 +17466,8 @@ self: super: with self; {
  seatconnect = callPackage ../development/python-modules/seatconnect { };
  sebaubuntu-libs = callPackage ../development/python-modules/sebaubuntu-libs { };
  seccomp = callPackage ../development/python-modules/seccomp { };
  secp256k1 = callPackage ../development/python-modules/secp256k1 { inherit (pkgs) secp256k1; };