From 6997024ea9bb9e8ce83f225ef7fb1bdbfd1b2b35 Mon Sep 17 00:00:00 2001 From: Sharlatan Hellseher Date: Fri, 19 Dec 2025 09:31:10 +0000 Subject: [PATCH] gnu: enjarify: Improve package, fix tests. * gnu/packages/android.scm (enjarify): Use G-Expressions, improve style, and fix tests. [source]: Use direct URL string instead of [home-page] [build-system]: Switch to pyproject-build-system. [arguments]: Remove trailing #t from lambdas. : Merge 'fixup-expected-test-results with 'drop-java-xss-argument into 'fix-tests phase and fix module path in "runtests.py"; rework 'install-enjarify-wrapper phase. [native-inputs]: Add python-setuptools. [home-page]: Move above [synopsis] [description]: Start from a new line, mention original source of the project. Fixes: guix/guix#4954 Reported-by: nomike Change-Id: I22e3e613ca5d0352fdd5d6d397183a4cde1a067f --- gnu/packages/android.scm | 88 ++++++++++++++++++++++------------------ 1 file changed, 48 insertions(+), 40 deletions(-) diff --git a/gnu/packages/android.scm b/gnu/packages/android.scm index 1333af19ed4473cde7690ff252d46c99b64793e0..50a5daab1dd6975cedc254f9a96e6bf55b4f3fcc 100644 --- a/gnu/packages/android.scm +++ b/gnu/packages/android.scm @@ -1306,50 +1306,58 @@ emulator inside the comfort of Emacs.") (package (name "enjarify") (version "1.0.3") - (home-page "https://github.com/Storyyeller/enjarify") (source (origin - (method git-fetch) - (uri (git-reference - (url home-page) - (commit version))) - (file-name (git-file-name name version)) - (patches - (search-patches "enjarify-setup-py.patch")) - (sha256 - (base32 - "1nam7h1g4f1h6jla4qcjjagnyvd24dv6d5445w04q8hx07nxdapk")))) - (build-system python-build-system) + (method git-fetch) + (uri (git-reference + (url "https://github.com/Storyyeller/enjarify") + (commit version))) + (file-name (git-file-name name version)) + (patches + (search-patches "enjarify-setup-py.patch")) + (sha256 + (base32 "1nam7h1g4f1h6jla4qcjjagnyvd24dv6d5445w04q8hx07nxdapk")))) + (build-system pyproject-build-system) (arguments - `(#:phases - (modify-phases %standard-phases - (add-before 'check 'fixup-expected-test-results - ;; Upstream adjusted this test in commit: - ;; 3ae884a6485af82d300515813f537685b08dd800 - (lambda _ - (substitute* "tests/test2/expected.txt" - (("^20") "0")) - #t)) - (add-before 'check 'drop-java-xss-argument - ;; Upstream removed this argument in order to support 32-bit - ;; architectures. commit: 4be0111d879aa95fdc0d9f24fe529f8c664d4093 - (lambda _ - (substitute* "enjarify/runtests.py" - (("java -Xss515m") "java ")) - #t)) - (add-after 'install 'install-enjarify-wrapper - (lambda* (#:key outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out"))) - (mkdir-p (string-append out "/bin/")) - (copy-file "enjarify.sh" (string-append out "/bin/enjarify")) - #t)))))) - (native-inputs (list openjdk12)) + (list + #:phases + #~(modify-phases %standard-phases + (add-before 'check 'fix-tests + (lambda _ + (substitute* "enjarify/runtests.py" + (("from \\.main") "from enjarify.main") + (("from \\.jvm") "from enjarify.jvm")) + ;; Upstream adjusted this test in commit: + ;; 3ae884a6485af82d300515813f537685b08dd800 + (substitute* "tests/test2/expected.txt" + (("^20") "0")) + ;; Upstream removed this argument in order to support 32-bit + ;; architectures. commit: + ;; 4be0111d879aa95fdc0d9f24fe529f8c664d4093 + (substitute* "enjarify/runtests.py" + (("java -Xss515m") "java ")))) + (add-after 'install 'install-enjarify-wrapper + (lambda _ + (let ((bin (string-append #$output "/bin"))) + (install-file "enjarify.sh" bin) + (symlink (string-append bin "/enjarify.sh") + (string-append bin "/enjarify"))))) + (replace 'check + (lambda* (#:key tests? test-flags #:allow-other-keys) + (when tests? + (invoke "python" "-m" "enjarify.runtests"))))))) + (native-inputs + (list openjdk12 + python-setuptools)) + (home-page "https://github.com/Storyyeller/enjarify") (synopsis "Translate Dalvik bytecode to equivalent Java bytecode") - (description "Android applications are Java programs that run on a -customized virtual machine, which is part of the Android operating system, the -Dalvik VM. Their bytecode differs from the bytecode of normal Java -applications. Enjarify can translate the Dalvik bytecode back to equivalent -Java bytecode, which simplifies the analysis of Android applications.") + (description + "Android applications are Java programs that run on a customized virtual +machine, which is part of the Android operating system, the Dalvik VM. Their +bytecode differs from the bytecode of normal Java applications. Enjarify can +translate the Dalvik bytecode back to equivalent Java bytecode, which +simplifies the analysis of Android applications. It's an alternative fork of +not maintained Goole's project https://github.com/google/enjarify.") (license license:asl2.0))) (define-public android-file-transfer