From d4e09ed881a65ad2ebeac9c5b500622fd9112107 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Tue, 5 Sep 2023 17:30:06 +0100 Subject: [PATCH 1/9] Add an initial pkgbuild It uses `pyinstaller`, as otherwise it installs lots of dependencies, and `venv`s aren't portable --- .gitignore | 22 ++++++++++++++++++---- PKGBUILD | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 PKGBUILD diff --git a/.gitignore b/.gitignore index ad4a1f1..4f0700f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,20 @@ -# Created by https://www.toptal.com/developers/gitignore/api/python -# Edit at https://www.toptal.com/developers/gitignore?templates=python +# Created by https://www.toptal.com/developers/gitignore/api/archlinuxpackages,python +# Edit at https://www.toptal.com/developers/gitignore?templates=archlinuxpackages,python + +### ArchLinuxPackages ### +*.tar +*.tar.* +*.jar +*.exe +*.msi +*.zip +*.tgz +*.log +*.log.* +*.sig + +pkg/ +src/ ### Python ### # Byte-compiled / optimized / DLL files @@ -60,7 +75,6 @@ cover/ *.pot # Django stuff: -*.log local_settings.py db.sqlite3 db.sqlite3-journal @@ -173,4 +187,4 @@ poetry.toml # LSP config files pyrightconfig.json -# End of https://www.toptal.com/developers/gitignore/api/python +# End of https://www.toptal.com/developers/gitignore/api/archlinuxpackages,python diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..48a0fd2 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,32 @@ +# Maintainer: Jake Howard +pkgname=heroku-audit +pkgver=0.0.1 +pkgrel=1 +pkgdesc="Command-line tool for reporting on specific attributes of a Heroku environment." +url="https://github.com/torchbox/heroku-audit" +license=('BSD') +arch=('any') +depends=() +source=("https://github.com/torchbox/heroku-audit/archive/${pkgver}.tar.gz") +makedepends=(python-build python-wheel pyinstaller) +sha256sums=('c840041c7027b1cf902de0ae27887285fdb122baeaa349c0d18dbe9226b5eea8') + +build() { + cd "${srcdir}"/${pkgname}-${pkgver} + + python -m venv venv + source venv/bin/activate + + pip install -e . + + pyinstaller -F --strip heroku_audit/__main__.py --name heroku-audit --clean +} + +package() { + cd "${srcdir}"/${pkgname}-${pkgver} + + install -Dm755 dist/heroku-audit "${pkgdir}"/usr/bin/heroku-audit + + install -Dm644 README.md "${pkgdir}"/usr/share/doc/${pkgname}/README.md + install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE +} From 6e44255055398d9bbda41464be78efa303a33ebc Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 14 Sep 2023 11:53:06 +0100 Subject: [PATCH 2/9] Update version, add checks and install entirely in venv --- PKGBUILD | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index 48a0fd2..c5732ef 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,25 +1,33 @@ # Maintainer: Jake Howard pkgname=heroku-audit -pkgver=0.0.1 +pkgver=0.0.2 pkgrel=1 pkgdesc="Command-line tool for reporting on specific attributes of a Heroku environment." url="https://github.com/torchbox/heroku-audit" license=('BSD') arch=('any') -depends=() +depends=(python) source=("https://github.com/torchbox/heroku-audit/archive/${pkgver}.tar.gz") -makedepends=(python-build python-wheel pyinstaller) -sha256sums=('c840041c7027b1cf902de0ae27887285fdb122baeaa349c0d18dbe9226b5eea8') +makedepends=(python-build python-wheel) +sha256sums=('0c539746c4b5dfb1ff8504e1a96394c3456666c866e0f0c1f7f54ef6f1242279') build() { cd "${srcdir}"/${pkgname}-${pkgver} + # Create a temporary virtualenv to install the build dependencies in python -m venv venv source venv/bin/activate - pip install -e . + pip install -e . pyinstaller - pyinstaller -F --strip heroku_audit/__main__.py --name heroku-audit --clean + venv/bin/pyinstaller -F --strip heroku_audit/__main__.py --name heroku-audit --clean +} + +check() { + cd "${srcdir}"/${pkgname}-${pkgver} + + ./dist/heroku-audit --version > /dev/null + ./dist/heroku-audit --list > /dev/null } package() { From 3fd9b32e4748c492fcaaaad46a97b3fd8dfa4183 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 14 Sep 2023 11:55:11 +0100 Subject: [PATCH 3/9] Check PKGBUILD on CI --- .github/workflows/ci.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a2ba4c5..8cfbb6f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,3 +92,12 @@ jobs: uses: pypa/gh-action-pypi-publish@release/v1 with: print_hash: true + + makepkg: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Makepkg Build and Check + uses: edlanglois/pkgbuild-action@v1 From 68a0af4849f215ab29a0b0b071a314f7b287269a Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 14 Sep 2023 12:00:20 +0100 Subject: [PATCH 4/9] Add missing runtime deps --- PKGBUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PKGBUILD b/PKGBUILD index c5732ef..3740a36 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -6,7 +6,7 @@ pkgdesc="Command-line tool for reporting on specific attributes of a Heroku envi url="https://github.com/torchbox/heroku-audit" license=('BSD') arch=('any') -depends=(python) +depends=(python glibc zlib) source=("https://github.com/torchbox/heroku-audit/archive/${pkgver}.tar.gz") makedepends=(python-build python-wheel) sha256sums=('0c539746c4b5dfb1ff8504e1a96394c3456666c866e0f0c1f7f54ef6f1242279') From aa713f09dc3e06ef7b686edf6ec45705c223c10b Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 14 Sep 2023 12:00:36 +0100 Subject: [PATCH 5/9] Only support x86 for now --- PKGBUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PKGBUILD b/PKGBUILD index 3740a36..c86839a 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -5,7 +5,7 @@ pkgrel=1 pkgdesc="Command-line tool for reporting on specific attributes of a Heroku environment." url="https://github.com/torchbox/heroku-audit" license=('BSD') -arch=('any') +arch=('x86_64') depends=(python glibc zlib) source=("https://github.com/torchbox/heroku-audit/archive/${pkgver}.tar.gz") makedepends=(python-build python-wheel) From 2296aa4f2efae193ac08b025e73eb25a31ceca02 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 14 Sep 2023 12:07:12 +0100 Subject: [PATCH 6/9] `pyinstaller` doesn't depend on Python at runtime --- PKGBUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PKGBUILD b/PKGBUILD index c86839a..befe687 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -6,7 +6,7 @@ pkgdesc="Command-line tool for reporting on specific attributes of a Heroku envi url="https://github.com/torchbox/heroku-audit" license=('BSD') arch=('x86_64') -depends=(python glibc zlib) +depends=(glibc zlib) source=("https://github.com/torchbox/heroku-audit/archive/${pkgver}.tar.gz") makedepends=(python-build python-wheel) sha256sums=('0c539746c4b5dfb1ff8504e1a96394c3456666c866e0f0c1f7f54ef6f1242279') From 139bfe659181b7c7aa6285fa4de7eaac2018dba1 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 14 Sep 2023 12:32:01 +0100 Subject: [PATCH 7/9] Don't package to single file Using an opt directory makes the launch quicker, packaging quicker and simpler and generally a single file isn't necessary --- PKGBUILD | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index befe687..ef31628 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -20,20 +20,24 @@ build() { pip install -e . pyinstaller - venv/bin/pyinstaller -F --strip heroku_audit/__main__.py --name heroku-audit --clean + venv/bin/pyinstaller -D --strip heroku_audit/__main__.py --name heroku-audit --clean } check() { cd "${srcdir}"/${pkgname}-${pkgver} - ./dist/heroku-audit --version > /dev/null - ./dist/heroku-audit --list > /dev/null + ./dist/heroku-audit/heroku-audit --version > /dev/null + ./dist/heroku-audit/heroku-audit --list > /dev/null } package() { cd "${srcdir}"/${pkgname}-${pkgver} - install -Dm755 dist/heroku-audit "${pkgdir}"/usr/bin/heroku-audit + mkdir -p "${pkgdir}"/opt + cp -r dist/heroku-audit "${pkgdir}"/opt/heroku-audit + + mkdir -p "${pkgdir}"/usr/bin/ + ln -s /opt/heroku-audit/heroku-audit "${pkgdir}"/usr/bin/ install -Dm644 README.md "${pkgdir}"/usr/share/doc/${pkgname}/README.md install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE From cb072d8f7b7e9531ae1c144652d258a9e36ed2ec Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 14 Sep 2023 12:33:56 +0100 Subject: [PATCH 8/9] Don't prompt to replace output dir --- PKGBUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PKGBUILD b/PKGBUILD index ef31628..494e28c 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -20,7 +20,7 @@ build() { pip install -e . pyinstaller - venv/bin/pyinstaller -D --strip heroku_audit/__main__.py --name heroku-audit --clean + venv/bin/pyinstaller -D --strip heroku_audit/__main__.py --name heroku-audit --clean --noconfirm } check() { From dfb554d898be06f71399925ca6c95ee2849543c0 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 14 Sep 2023 12:56:15 +0100 Subject: [PATCH 9/9] Expand dependencies to everything `namcap` complains about --- PKGBUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PKGBUILD b/PKGBUILD index 494e28c..7b0610f 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -6,7 +6,7 @@ pkgdesc="Command-line tool for reporting on specific attributes of a Heroku envi url="https://github.com/torchbox/heroku-audit" license=('BSD') arch=('x86_64') -depends=(glibc zlib) +depends=(zlib readline xz openssl glibc expat bzip2 libffi util-linux-libs ncurses mpdecimal) source=("https://github.com/torchbox/heroku-audit/archive/${pkgver}.tar.gz") makedepends=(python-build python-wheel) sha256sums=('0c539746c4b5dfb1ff8504e1a96394c3456666c866e0f0c1f7f54ef6f1242279')