Skip to content

Commit 30fb475

Browse files
authored
fix build issues discovered during and after v9.2.0 release (#2684)
* ci: downgrade Ubuntu version to accommodate older GLIBC versions * ci: upgrade Windows version to avoid deprecation * ci: exclude pkg_resources from PyInstaller build * update CHANGELOG * update spec file * ci: check if build runs without warnings or errors * update CHANGELOG * update build commands * update build commands * update build commands * update build commands * update build commands
1 parent a8eab7d commit 30fb475

File tree

4 files changed

+46
-16
lines changed

4 files changed

+46
-16
lines changed

.github/pyinstaller/pyinstaller.spec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ a = Analysis(
7474
# only be installed locally.
7575
"binaryninja",
7676
"ida",
77+
# remove once https://github.com/mandiant/capa/issues/2681 has
78+
# been addressed by PyInstaller
79+
"pkg_resources",
7780
],
7881
)
7982

.github/workflows/build.yml

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ jobs:
2222
fail-fast: true
2323
matrix:
2424
include:
25-
- os: ubuntu-24.04
25+
- os: ubuntu-22.04
2626
# use old linux so that the shared library versioning is more portable
2727
artifact_name: capa
2828
asset_name: linux
2929
python_version: '3.10'
30-
- os: ubuntu-24.04
30+
- os: ubuntu-22.04
3131
artifact_name: capa
3232
asset_name: linux-py312
3333
python_version: '3.12'
34-
- os: windows-2019
34+
- os: windows-2022
3535
artifact_name: capa.exe
3636
asset_name: windows
3737
python_version: '3.10'
@@ -49,7 +49,7 @@ jobs:
4949
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
5050
with:
5151
python-version: ${{ matrix.python_version }}
52-
- if: matrix.os == 'ubuntu-24.04'
52+
- if: matrix.os == 'ubuntu-22.04'
5353
run: sudo apt-get install -y libyaml-dev
5454
- name: Upgrade pip, setuptools
5555
run: python -m pip install --upgrade pip setuptools
@@ -59,6 +59,28 @@ jobs:
5959
pip install -e .[build]
6060
- name: Build standalone executable
6161
run: pyinstaller --log-level DEBUG .github/pyinstaller/pyinstaller.spec
62+
- name: Does it run without warnings or errors?
63+
shell: bash
64+
run: |
65+
if [[ "${{ matrix.os }}" == "windows-2022" ]]; then
66+
EXECUTABLE=".\\dist\\capa"
67+
else
68+
EXECUTABLE="./dist/capa"
69+
fi
70+
71+
output=$(${EXECUTABLE} --version 2>&1)
72+
exit_code=$?
73+
74+
echo "${output}"
75+
echo "${exit_code}"
76+
77+
if echo "${output}" | grep -iE 'error|warning'; then
78+
exit 1
79+
fi
80+
81+
if [[ "${exit_code}" -ne 0 ]]; then
82+
exit 1
83+
fi
6284
- name: Does it run (PE)?
6385
run: dist/capa -d "tests/data/Practical Malware Analysis Lab 01-01.dll_"
6486
- name: Does it run (Shellcode)?
@@ -82,10 +104,10 @@ jobs:
82104
matrix:
83105
include:
84106
# OSs not already tested above
85-
- os: ubuntu-24.04
107+
- os: ubuntu-22.04
86108
artifact_name: capa
87109
asset_name: linux
88-
- os: ubuntu-24.04
110+
- os: ubuntu-22.04
89111
artifact_name: capa
90112
asset_name: linux-py312
91113
- os: windows-2022

.github/workflows/tests.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ env:
2626

2727
jobs:
2828
changelog_format:
29-
runs-on: ubuntu-24.04
29+
runs-on: ubuntu-22.04
3030
steps:
3131
- name: Checkout capa
3232
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
@@ -37,7 +37,7 @@ jobs:
3737
if [ $number != 1 ]; then exit 1; fi
3838
3939
code_style:
40-
runs-on: ubuntu-24.04
40+
runs-on: ubuntu-22.04
4141
steps:
4242
- name: Checkout capa
4343
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
@@ -64,7 +64,7 @@ jobs:
6464
run: pre-commit run deptry --hook-stage manual
6565

6666
rule_linter:
67-
runs-on: ubuntu-24.04
67+
runs-on: ubuntu-22.04
6868
steps:
6969
- name: Checkout capa with submodules
7070
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
@@ -88,16 +88,16 @@ jobs:
8888
strategy:
8989
fail-fast: false
9090
matrix:
91-
os: [ubuntu-24.04, windows-2019, macos-13]
91+
os: [ubuntu-22.04, windows-2022, macos-13]
9292
# across all operating systems
9393
python-version: ["3.10", "3.11"]
9494
include:
9595
# on Ubuntu run these as well
96-
- os: ubuntu-24.04
96+
- os: ubuntu-22.04
9797
python-version: "3.10"
98-
- os: ubuntu-24.04
98+
- os: ubuntu-22.04
9999
python-version: "3.11"
100-
- os: ubuntu-24.04
100+
- os: ubuntu-22.04
101101
python-version: "3.12"
102102
steps:
103103
- name: Checkout capa with submodules
@@ -109,7 +109,7 @@ jobs:
109109
with:
110110
python-version: ${{ matrix.python-version }}
111111
- name: Install pyyaml
112-
if: matrix.os == 'ubuntu-24.04'
112+
if: matrix.os == 'ubuntu-22.04'
113113
run: sudo apt-get install -y libyaml-dev
114114
- name: Install capa
115115
run: |
@@ -126,7 +126,7 @@ jobs:
126126
name: Binary Ninja tests for ${{ matrix.python-version }}
127127
env:
128128
BN_SERIAL: ${{ secrets.BN_SERIAL }}
129-
runs-on: ubuntu-24.04
129+
runs-on: ubuntu-22.04
130130
needs: [tests]
131131
strategy:
132132
fail-fast: false
@@ -168,7 +168,7 @@ jobs:
168168

169169
ghidra-tests:
170170
name: Ghidra tests for ${{ matrix.python-version }}
171-
runs-on: ubuntu-24.04
171+
runs-on: ubuntu-22.04
172172
needs: [tests]
173173
strategy:
174174
fail-fast: false

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818

1919
### Development
2020

21+
- ci: exclude pkg_resources from PyInstaller build @mike-hunhoff #2684
22+
- ci: upgrade Windows version to avoid deprecation @mike-hunhoff #2684
23+
- ci: downgrade Ubuntu version to accommodate older GLIBC versions @mike-hunhoff #2684
24+
- ci: check if build runs without warnings or errors @mike-hunhoff #2684
25+
2126
### Raw diffs
2227
- [capa v9.2.0...master](https://github.com/mandiant/capa/compare/v9.2.0...master)
2328
- [capa-rules v9.2.0...master](https://github.com/mandiant/capa-rules/compare/v9.2.0...master)

0 commit comments

Comments
 (0)