gnu: Add enjarify.
authorVagrant Cascadian <vagrant@reproducible-builds.org>
Thu, 19 Sep 2019 23:43:47 +0000 (16:43 -0700)
committerVagrant Cascadian <vagrant@debian.org>
Thu, 19 Sep 2019 23:45:34 +0000 (16:45 -0700)
* gnu/packages/android (enjarify): New variable.
* gnu/packages/diffoscope (diffoscope)[native-inputs]: Add enjarify.
  [arguments]: add enjarify to add-known-tools phase.
* gnu/packages/patches/enjarify-setup-py.patch: New file.
* gnu/local.mk: Add enjarify-setup-py.patch.

gnu/local.mk
gnu/packages/android.scm
gnu/packages/diffoscope.scm
gnu/packages/patches/enjarify-setup-py.patch [new file with mode: 0644]

index 1062bdc..ad85894 100644 (file)
@@ -796,6 +796,7 @@ dist_patch_DATA =                                           \
   %D%/packages/patches/emacs-undohist-ignored.patch    \
   %D%/packages/patches/emacs-wordnut-require-adaptive-wrap.patch       \
   %D%/packages/patches/emacs-zones-called-interactively.patch  \
+  %D%/packages/patches/enjarify-setup-py.patch                 \
   %D%/packages/patches/enlightenment-fix-setuid-path.patch     \
   %D%/packages/patches/erlang-man-path.patch                   \
   %D%/packages/patches/eudev-rules-directory.patch             \
index 56d5eda..8eb5182 100644 (file)
@@ -39,6 +39,7 @@
   #:use-module (gnu packages compression)
   #:use-module (gnu packages docker)
   #:use-module (gnu packages gnupg)
+  #:use-module (gnu packages java)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages pcre)
   #:use-module (gnu packages python)
@@ -934,3 +935,60 @@ these same tools to create your own additional or alternative repository for
 publishing, or to assist in creating, testing and submitting metadata to the
 main repository.")
     (license license:agpl3+)))
+
+(define-public enjarify
+  (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)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'enjarify-wrapper-inherit-pythonpath
+           ;; enjarify sets PYTHONPATH from a shell script, overwriting
+           ;; PYTHONPATH set from guix. Comment out this line.
+           (lambda _
+             (substitute* "enjarify.sh"
+               (("export PYTHONPATH") "# export PYTHONPATH"))
+             #t))
+         (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 `(("openjdk:jdk" ,openjdk12 "jdk")))
+    (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.")
+    (license license:asl2.0)))
index fff331a..8df5a9c 100644 (file)
@@ -92,6 +92,9 @@
                     ;; Patch in support for known tools
                     (add-after 'unpack 'add-known-tools
                       (lambda _
+                        (substitute* "diffoscope/external_tools.py"
+                          (("'arch': 'enjarify'},")
+                           "'arch': 'enjarify', 'guix': 'enjarify'},"))
                         (substitute* "diffoscope/external_tools.py"
                           (("'arch': 'python-jsbeautifier'},")
                            "'arch': 'python-jsbeautifier', 'guix': 'python-jsbeautifier'},"))
                        ("docx2txt" ,docx2txt)
                        ("dtc" ,dtc)
                        ("e2fsprogs" ,e2fsprogs)
+                       ("enjarify" ,enjarify)
                        ("ffmpeg" ,ffmpeg)
                        ("gettext" ,gettext-minimal)
                        ("ghc" ,ghc)
diff --git a/gnu/packages/patches/enjarify-setup-py.patch b/gnu/packages/patches/enjarify-setup-py.patch
new file mode 100644 (file)
index 0000000..4b382ca
--- /dev/null
@@ -0,0 +1,19 @@
+Author: Reiner Herrmann <reiner@reiner-h.de>
+Origin: https://salsa.debian.org/android-tools-team/enjarify/blob/master/debian/patches/setup_py.patch
+Description: provides a minimal setup.py to build/install the package
+
+Index: enjarify/setup.py
+===================================================================
+--- /dev/null
++++ enjarify/setup.py
+@@ -0,0 +1,10 @@
++#!/usr/bin/env python3
++
++from setuptools import setup, find_packages
++
++setup(name='enjarify',
++      version='1.0.3',
++      url='https://github.com/google/enjarify',
++      packages=find_packages(),
++      )
++