Skip to content

Commit

Permalink
merge bitcoin#27813: Update python-lief package to 0.13.2
Browse files Browse the repository at this point in the history
  • Loading branch information
kwvg committed Nov 6, 2024
1 parent 70e6283 commit d439e46
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 48 deletions.
2 changes: 1 addition & 1 deletion contrib/containers/ci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ RUN pip3 install \
codespell==1.17.1 \
flake8==3.8.3 \
jinja2 \
lief==0.12.3 \
lief==0.13.2 \
pyzmq \
vulture==2.3 \
mypy==0.781 \
Expand Down
6 changes: 3 additions & 3 deletions contrib/devtools/security-check.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def check_ELF_control_flow(binary) -> bool:
main = binary.get_function_address('main')
content = binary.get_content_from_virtual_address(main, 4, lief.Binary.VA_TYPES.AUTO)

if content == [243, 15, 30, 250]: # endbr64
if content.tolist() == [243, 15, 30, 250]: # endbr64
return True
return False

Expand Down Expand Up @@ -142,7 +142,7 @@ def check_PE_control_flow(binary) -> bool:

content = binary.get_content_from_virtual_address(virtual_address, 4, lief.Binary.VA_TYPES.VA)

if content == [243, 15, 30, 250]: # endbr64
if content.tolist() == [243, 15, 30, 250]: # endbr64
return True
return False

Expand Down Expand Up @@ -190,7 +190,7 @@ def check_MACHO_control_flow(binary) -> bool:
'''
content = binary.get_content_from_virtual_address(binary.entrypoint, 4, lief.Binary.VA_TYPES.AUTO)

if content == [243, 15, 30, 250]: # endbr64
if content.tolist() == [243, 15, 30, 250]: # endbr64
return True
return False

Expand Down
37 changes: 22 additions & 15 deletions contrib/guix/manifest.scm
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
(gnu packages moreutils)
(gnu packages pkg-config)
(gnu packages python)
((gnu packages python-build) #:select (python-tomli))
(gnu packages python-crypto)
(gnu packages python-web)
(gnu packages shells)
Expand Down Expand Up @@ -204,38 +205,44 @@ chain for " target " development."))
(search-our-patches "nsis-gcc-10-memmove.patch"
"nsis-disable-installer-reloc.patch")))

(define (fix-ppc64-nx-default lief)
(package-with-extra-patches lief
(search-our-patches "lief-fix-ppc64-nx-default.patch")))

;; Our python-lief package can be removed once we are using
;; guix 83bfdb409787cb2737e68b093a319b247b7858e6 or later.
;; Note we currently use cmake-minimal.
;; While LIEF is packaged in Guix, we maintain our own package,
;; to simplify building, and more easily apply updates.
;; Moreover, the Guix's package uses cmake, which caused build
;; failure; see https://github.com/bitcoin/bitcoin/pull/27296.
(define-public python-lief
(package
(name "python-lief")
(version "0.12.3")
(version "0.13.2")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/lief-project/LIEF")
(commit version)))
(file-name (git-file-name name version))
(modules '((guix build utils)))
(snippet
'(begin
;; Configure build for Python bindings.
(substitute* "api/python/config-default.toml"
(("(ninja = )true" all m)
(string-append m "false"))
(("(parallel-jobs = )0" all m)
(string-append m (number->string (parallel-job-count)))))))
(sha256
(base32
"11i6hqmcjh56y554kqhl61698n9v66j2qk1c1g63mv2w07h2z661"))))
"0y48x358ppig5xp97ahcphfipx7cg9chldj2q5zrmn610fmi4zll"))))
(build-system python-build-system)
(native-inputs (list cmake-minimal))
(native-inputs (list cmake-minimal python-tomli))
(arguments
(list
#:tests? #f ;needs network
#:phases #~(modify-phases %standard-phases
(add-before 'build 'change-directory
(lambda _
(chdir "api/python")))
(replace 'build
(lambda _
(invoke
"python" "setup.py" "--sdk" "build"
(string-append
"-j" (number->string (parallel-job-count)))))))))
(invoke "python" "setup.py" "build"))))))
(home-page "https://github.com/lief-project/LIEF")
(synopsis "Library to instrument executable formats")
(description
Expand Down Expand Up @@ -600,7 +607,7 @@ inspecting signatures in Mach-O binaries.")
;; Git
git-minimal
;; Tests
(fix-ppc64-nx-default python-lief))
python-lief)
(let ((target (getenv "HOST")))
(cond ((string-suffix? "-mingw32" target)
;; Windows
Expand Down
29 changes: 0 additions & 29 deletions contrib/guix/patches/lief-fix-ppc64-nx-default.patch

This file was deleted.

0 comments on commit d439e46

Please sign in to comment.