+
+(define-public rpm
+ (package
+ (name "rpm")
+ (version "4.12.0.1")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "http://rpm.org/releases/rpm-4.12.x/rpm-"
+ version ".tar.bz2"))
+ (sha256
+ (base32
+ "0a82ym8phx7g0f3k6smvxnvzh7yv857l42xafk49689kzhld5pbp"))
+ (patches (search-patches "rpm-CVE-2014-8118.patch"))))
+ (build-system gnu-build-system)
+ (arguments
+ '(#:configure-flags '("--with-external-db" ;use the system's bdb
+ "--enable-python"
+ "--without-lua")
+ #:phases (modify-phases %standard-phases
+ (add-before 'configure 'set-nspr-search-path
+ (lambda* (#:key inputs #:allow-other-keys)
+ ;; nspr.pc contains the right -I flag pointing to
+ ;; 'include/nspr', but unfortunately 'configure' doesn't
+ ;; use 'pkg-config'. Thus, augment CPATH.
+ ;; Likewise for NSS.
+ (let ((nspr (assoc-ref inputs "nspr"))
+ (nss (assoc-ref inputs "nss")))
+ (setenv "CPATH"
+ (string-append (getenv "C_INCLUDE_PATH") ":"
+ nspr "/include/nspr:"
+ nss "/include/nss"))
+ (setenv "LIBRARY_PATH"
+ (string-append (getenv "LIBRARY_PATH") ":"
+ nss "/lib/nss"))
+ #t)))
+ (add-after 'install 'fix-rpm-symlinks
+ (lambda* (#:key outputs #:allow-other-keys)
+ ;; 'make install' gets these symlinks wrong. Fix them.
+ (let* ((out (assoc-ref outputs "out"))
+ (bin (string-append out "/bin")))
+ (with-directory-excursion bin
+ (for-each (lambda (file)
+ (delete-file file)
+ (symlink "rpm" file))
+ '("rpmquery" "rpmverify"))
+ #t)))))))
+ (native-inputs
+ `(("pkg-config" ,pkg-config)))
+ (inputs
+ `(("python" ,python-2)
+ ("xz" ,xz)
+ ("bdb" ,bdb)
+ ("popt" ,popt)
+ ("nss" ,nss)
+ ("nspr" ,nspr)
+ ("libarchive" ,libarchive)
+ ("nettle" ,nettle) ;XXX: actually a dependency of libarchive
+ ("file" ,file)
+ ("bzip2" ,bzip2)
+ ("zlib" ,zlib)
+ ("cpio" ,cpio)))
+ (home-page "http://www.rpm.org/")
+ (synopsis "The RPM Package Manager")
+ (description
+ "The RPM Package Manager (RPM) is a command-line driven package
+management system capable of installing, uninstalling, verifying, querying,
+and updating computer software packages. Each software package consists of an
+archive of files along with information about the package like its version, a
+description. There is also a library permitting developers to manage such
+transactions from C or Python.")
+
+ ;; The whole is GPLv2+; librpm itself is dual-licensed LGPLv2+ | GPLv2+.
+ (license gpl2+)))
+
+(define-public diffoscope
+ (package
+ (name "diffoscope")
+ (version "51")
+ (source (origin
+ (method url-fetch)
+ (uri (pypi-uri name version))
+ (sha256
+ (base32
+ "18rn6rrwh586228vnaf1nq0wayh19zbvfc0qmnbys6ln2pv2v007"))))
+ (build-system python-build-system)
+ (arguments
+ `(#:phases (modify-phases %standard-phases
+ ;; setup.py mistakenly requires python-magic from PyPi, even
+ ;; though the Python bindings of `file` are sufficient.
+ ;; https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=815844
+ (add-after 'unpack 'dependency-on-python-magic
+ (lambda _
+ (substitute* "setup.py"
+ (("'python-magic',") ""))))
+ (add-before 'build 'disable-egg-zipping
+ (lambda _
+ ;; Leave the .egg file uncompressed.
+ (let ((port (open-file "setup.cfg" "a")))
+ (display "\n[easy_install]\nzip_ok = 0\n"
+ port)
+ (close-port port)
+ #t))))))
+ (inputs `(("rpm" ,rpm) ;for rpm-python
+ ("python-file" ,python-file)
+ ("python-debian" ,python-debian)
+ ("python-libarchive-c" ,python-libarchive-c)
+ ("python-tlsh" ,python-tlsh)
+
+ ;; Below are modules used for tests.
+ ("python-pytest" ,python-pytest)
+ ("python-chardet" ,python-chardet)))
+ (home-page "http://diffoscope.org/")
+ (synopsis "Compare files, archives, and directories in depth")
+ (description
+ "Diffoscope tries to get to the bottom of what makes files or directories
+different. It recursively unpacks archives of many kinds and transforms
+various binary formats into more human readable forms to compare them. It can
+compare two tarballs, ISO images, or PDFs just as easily.")
+ (license gpl3+)))