Skip to content

Commit ec822e8

Browse files
committed
Merge bitcoin/bitcoin#27813: guix: Update python-lief package to 0.13.2
529c92e guix: Update `python-lief` package to 0.13.2 (Hennadii Stepanov) Pull request description: The Guix's `python-lief` package is going to move to using external deps, rather than the bundled ones (https://lists.gnu.org/archive/html/guix-patches/2023-05/msg01302.html). We want to continue using our own package indefinitely, to keep the build simpler, and allow for easier updating. Changes in `contrib/devtools/security-check.py` are caused by lief-project/LIEF@6357c63. Also see: bitcoin/bitcoin#27507. ACKs for top commit: fanquake: ACK 529c92e Tree-SHA512: ad81111b090a39b380fe25bb27b54a339e78a158f462c7adda25d5ee55f0d654107b1486b29b9687ad0808e27b01e04f53a0e8ffc6600b79103d6bd0dfec64ef
2 parents d9c7c2f + 529c92e commit ec822e8

File tree

3 files changed

+25
-47
lines changed

3 files changed

+25
-47
lines changed

contrib/devtools/security-check.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def check_ELF_control_flow(binary) -> bool:
113113
main = binary.get_function_address('main')
114114
content = binary.get_content_from_virtual_address(main, 4, lief.Binary.VA_TYPES.AUTO)
115115

116-
if content == [243, 15, 30, 250]: # endbr64
116+
if content.tolist() == [243, 15, 30, 250]: # endbr64
117117
return True
118118
return False
119119

@@ -142,7 +142,7 @@ def check_PE_control_flow(binary) -> bool:
142142

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

145-
if content == [243, 15, 30, 250]: # endbr64
145+
if content.tolist() == [243, 15, 30, 250]: # endbr64
146146
return True
147147
return False
148148

@@ -183,7 +183,7 @@ def check_MACHO_control_flow(binary) -> bool:
183183
'''
184184
content = binary.get_content_from_virtual_address(binary.entrypoint, 4, lief.Binary.VA_TYPES.AUTO)
185185

186-
if content == [243, 15, 30, 250]: # endbr64
186+
if content.tolist() == [243, 15, 30, 250]: # endbr64
187187
return True
188188
return False
189189

contrib/guix/manifest.scm

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
(gnu packages moreutils)
2323
(gnu packages pkg-config)
2424
(gnu packages python)
25+
((gnu packages python-build) #:select (python-tomli))
2526
(gnu packages python-crypto)
2627
(gnu packages python-web)
2728
(gnu packages shells)
@@ -203,38 +204,44 @@ chain for " target " development."))
203204
(search-our-patches "nsis-gcc-10-memmove.patch"
204205
"nsis-disable-installer-reloc.patch")))
205206

206-
(define (fix-ppc64-nx-default lief)
207-
(package-with-extra-patches lief
208-
(search-our-patches "lief-fix-ppc64-nx-default.patch")))
209-
210-
;; Our python-lief package can be removed once we are using
211-
;; guix 83bfdb409787cb2737e68b093a319b247b7858e6 or later.
212-
;; Note we currently use cmake-minimal.
207+
;; While LIEF is packaged in Guix, we maintain our own package,
208+
;; to simplify building, and more easily apply updates.
209+
;; Moreover, the Guix's package uses cmake, which caused build
210+
;; failure; see https://github.com/bitcoin/bitcoin/pull/27296.
213211
(define-public python-lief
214212
(package
215213
(name "python-lief")
216-
(version "0.12.3")
214+
(version "0.13.2")
217215
(source (origin
218216
(method git-fetch)
219217
(uri (git-reference
220218
(url "https://github.com/lief-project/LIEF")
221219
(commit version)))
222220
(file-name (git-file-name name version))
221+
(modules '((guix build utils)))
222+
(snippet
223+
'(begin
224+
;; Configure build for Python bindings.
225+
(substitute* "api/python/config-default.toml"
226+
(("(ninja = )true" all m)
227+
(string-append m "false"))
228+
(("(parallel-jobs = )0" all m)
229+
(string-append m (number->string (parallel-job-count)))))))
223230
(sha256
224231
(base32
225-
"11i6hqmcjh56y554kqhl61698n9v66j2qk1c1g63mv2w07h2z661"))))
232+
"0y48x358ppig5xp97ahcphfipx7cg9chldj2q5zrmn610fmi4zll"))))
226233
(build-system python-build-system)
227-
(native-inputs (list cmake-minimal))
234+
(native-inputs (list cmake-minimal python-tomli))
228235
(arguments
229236
(list
230237
#:tests? #f ;needs network
231238
#:phases #~(modify-phases %standard-phases
239+
(add-before 'build 'change-directory
240+
(lambda _
241+
(chdir "api/python")))
232242
(replace 'build
233243
(lambda _
234-
(invoke
235-
"python" "setup.py" "--sdk" "build"
236-
(string-append
237-
"-j" (number->string (parallel-job-count)))))))))
244+
(invoke "python" "setup.py" "build"))))))
238245
(home-page "https://github.com/lief-project/LIEF")
239246
(synopsis "Library to instrument executable formats")
240247
(description
@@ -596,7 +603,7 @@ inspecting signatures in Mach-O binaries.")
596603
;; Git
597604
git-minimal
598605
;; Tests
599-
(fix-ppc64-nx-default python-lief))
606+
python-lief)
600607
(let ((target (getenv "HOST")))
601608
(cond ((string-suffix? "-mingw32" target)
602609
;; Windows

contrib/guix/patches/lief-fix-ppc64-nx-default.patch

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)