-
-
Notifications
You must be signed in to change notification settings - Fork 573
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate to Python Standalone PKGBUILD (#4352)
* mobsf: version bump * lief: bump version and add python-lief Added `python-lief` package. * Update to-release * Delete packages/mobsf/mobsf.install * Update PKGBUILD * Update PKGBUILD * Create mobsf.install * quickscope: add package * Create quickscope.install * Update to-release * Update PKGBUILD * Update PKGBUILD * Update PKGBUILD * Update PKGBUILD * Update PKGBUILD * Update PKGBUILD * Fix LIEF --------- Co-authored-by: noptrix <[email protected]>
- Loading branch information
Showing
5 changed files
with
98 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,61 @@ | ||
# This file is part of BlackArch Linux ( https://www.blackarch.org/ ). | ||
# See COPYING for license details. | ||
|
||
pkgname=lief | ||
pkgbase=lief | ||
pkgname=(lief python-lief) | ||
_pkgname=LIEF | ||
pkgver=0.13.2 | ||
pkgrel=2 | ||
pkgdesc='Library to Instrument Executable Formats.' | ||
pkgver=0.15.1 | ||
pkgrel=1 | ||
pkgdesc='Library to instrument executable formats.' | ||
groups=('blackarch' 'blackarch-disassembler' 'blackarch-reversing') | ||
arch=('x86_64' 'aarch64') | ||
url='https://github.com/lief-project/LIEF/' | ||
license=('Apache') | ||
depends=('python') | ||
makedepends=('python-setuptools' 'cmake' 'python-build' 'python-installer' | ||
'python-wheel' 'ninja') | ||
source=("https://github.com/lief-project/LIEF/archive/$pkgver.tar.gz") | ||
sha512sums=('a8dce9cce9c68d93ec5d78cf9f67eb32dc11d4498c9903f61e34d48683905cdf8040630b390fdaefb66fd18213cdc81682b4acb24ce43fb7fe89202492f71660') | ||
arch=('x86_64') | ||
url='https://github.com/lief-project/lief' | ||
license=('Apache-2.0') | ||
depends=('tl-expected') | ||
makedepends=('cmake' 'python' 'nlohmann-json' 'python-build' 'python-installer' | ||
'python-wheel' 'python-tomli' 'python-scikit-build-core' 'ninja' | ||
'python-cattrs' 'python-packaging' 'python-rich' 'python-setuptools' | ||
'python-pydantic' 'python-pydantic-core' 'python-pyproject-metadata' | ||
'python-pathspec') | ||
provides=('libLIEF.so') | ||
source=("https://github.com/lief-project/lief/archive/refs/tags/$pkgver.tar.gz") | ||
sha512sums=('30f248ce5c77993ccc08a360bfd74562ff1e661233abf7e6017cd11351ee359c67848a1ac4159b82a38e971f41704a6008b8778c817e06ef558efe21b76e04ae') | ||
|
||
prepare() { | ||
cd "$_pkgname-$pkgver" | ||
|
||
# tmp dirty fix! we need to change this asap | ||
sed -i 's|version = "0.0.0"|version = "0.10.1"|' setup.py | ||
cd "$_pkgname-$pkgver/api/python" | ||
|
||
# fix for https://github.com/lief-project/LIEF/issues/918 | ||
sed -i '1 i\#include <cstdint>' include/LIEF/DEX/Field.hpp | ||
sed -i 's/==.*//' build-requirements.txt | ||
} | ||
|
||
build() { | ||
cd "$_pkgname-$pkgver" | ||
|
||
PYTHONPATH="$PWD" python -m build api/python --wheel --no-isolation | ||
|
||
cmake \ | ||
-B build \ | ||
-G Ninja \ | ||
-D CMAKE_BUILD_TYPE=Release \ | ||
-D BUILD_SHARED_LIBS=ON \ | ||
-D LIEF_EXAMPLES=OFF \ | ||
-D LIEF_PYTHON_API=ON \ | ||
-D LIEF_OPT_NLOHMANN_JSON_EXTERNAL=ON \ | ||
-D LIEF_OPT_EXTERNAL_EXPECTED=ON | ||
cmake --build build | ||
|
||
cd api/python | ||
python -m build --wheel --no-isolation | ||
} | ||
|
||
package() { | ||
package_lief() { | ||
cd "$_pkgname-$pkgver" | ||
|
||
PYTHONHASHSEED=0 python -m installer --destdir="$pkgdir" api/python/dist/*.whl | ||
DESTDIR="$pkgdir" cmake --install build | ||
} | ||
|
||
install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md AUTHORS \ | ||
CHANGELOG | ||
package_python-lief() { | ||
depends+=(python lief) | ||
|
||
cd "$_pkgname-$pkgver/api/python" | ||
|
||
for i in "$pkgdir/usr/bin/"*; do | ||
mv $i $(echo $i | sed 's|_|-|g;s|.py||g') | ||
done | ||
python -m installer --destdir="$pkgdir" dist/*.whl | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
post_install() { | ||
set -e | ||
cd /usr/share/mobsf | ||
python -m venv venv | ||
source venv/bin/activate && | ||
pip install --isolated --root="/usr/share/mobsf" --prefix='venv' . | ||
echo '==> To initialize mobsf to be run as standard user, execute the following commands:' | ||
echo '==> Clean Up' | ||
bash scripts/clean.sh y | ||
echo 'bash /usr/share/mobsf/scripts/clean.sh y' | ||
echo '==> Migrating Database if exists' | ||
python manage.py makemigrations | ||
python manage.py makemigrations StaticAnalyzer | ||
python manage.py migrate | ||
echo 'python /usr/share/mobsf/manage.py makemigrations' | ||
echo 'python /usr/share/mobsf/manage.py makemigrations StaticAnalyzer' | ||
echo 'python /usr/share/mobsf/manage.py migrate' | ||
echo '==> Installation Complete' | ||
echo '==> Remove old Database in ~/.MobSF/ if migration failed!' | ||
echo '==> Remove old Database in ~/.MobSF/ if migration fails!' | ||
} | ||
|
||
post_upgrade() { | ||
set -e | ||
cd /usr/share/mobsf | ||
echo '==> Clean Up' | ||
bash scripts/clean.sh y | ||
echo '==> Migrating Database' | ||
python manage.py makemigrations | ||
python manage.py makemigrations StaticAnalyzer | ||
python manage.py migrate | ||
echo '==> Remove old Database in ~/.MobSF/ if migration failed!' | ||
python -m venv venv | ||
source venv/bin/activate && | ||
pip install --isolated --root="/usr/share/mobsf" --prefix='venv' . | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
post_install() { | ||
set -e | ||
cd /usr/share/quickscope | ||
python -m venv venv | ||
source venv/bin/activate && | ||
pip install --isolated --root="/usr/share/quickscope" --prefix='venv' \ | ||
-r requirements.txt | ||
pip install -e . | ||
} | ||
|
||
post_upgrade() { | ||
post_install "$@" | ||
} |