summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas Werkmeister2020-12-09 00:13:37 +0100
committerLucas Werkmeister2020-12-09 00:13:37 +0100
commit458fe7c64bf9010c68feacff17f89e2ca1197f73 (patch)
tree7ea419372d378256f32b5795386693a369a6166e
parent4287620003d3f2d7c76616ba7f86bb9de6bf9ce5 (diff)
downloadaur-458fe7c64bf9010c68feacff17f89e2ca1197f73.tar.gz
Tolerate missing pandoc
Pandoc is a heavy package to require – written in Haskell, it can pull in a lot of packages that wouldn’t otherwise be needed: when I uninstalled it locally, over 200 MiB were removed. We can’t mark the dependency as optional (there’s no optmakedepends/makeoptdepends), but we can make the build script tolerate a missing pandoc a bit better, and users who really want to avoid pandoc can then run makepkg with -d to ignore the dependency at their own risk.
-rw-r--r--PKGBUILD17
1 files changed, 14 insertions, 3 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 2afd2a6379ad..0db1b81b4c17 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -10,7 +10,10 @@ arch=('any')
url='https://github.com/systemd/mkosi'
license=('LGPL2.1')
depends=('python')
-makedepends=('python-setuptools' 'git' 'pandoc')
+makedepends=('python-setuptools'
+ 'git'
+ # pandoc is optional-ish – if missing, the package still builds
+ 'pandoc')
optdepends=('dnf: build Fedora or Mageia images'
'debootstrap: build Debian or Ubuntu images'
'debian-archive-keyring: build Debian images'
@@ -54,13 +57,21 @@ pkgver() {
build() {
cd 'mkosi'
- pandoc -s -f markdown -t man mkosi.md -o mkosi.1
python setup.py build
+
+ # try to build the manpage but tolerate “command not found” (but not other errors)
+ pandoc -s -f markdown -t man mkosi.md -o mkosi.1 || error=$?
+ if ((error != 0 && error != 127)); then
+ return $error
+ fi
}
package() {
cd 'mkosi'
python setup.py install --skip-build --optimize=1 --root="$pkgdir"
- install -Dm 644 mkosi.1 "$pkgdir/usr/share/man/man1/mkosi.1"
+
+ # as in build(), try to install the manpage but tolerate “file not found”
+ # (but in this case there’s no specific error code to check)
+ install -Dm 644 mkosi.1 "$pkgdir/usr/share/man/man1/mkosi.1" || true
}