summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorChih-Hsuan Yen2022-05-24 16:25:34 +0800
committerChih-Hsuan Yen2022-05-24 16:25:34 +0800
commitbceb3c5c47169ee9fa2142d82d2ee22f1c3c835e (patch)
tree8a7509cd305dc9489070fe0681d6a30eb4392919
parent2d1cd2cb81fcfdda955e8e20cc810c84698c3566 (diff)
downloadaur-bceb3c5c47169ee9fa2142d82d2ee22f1c3c835e.tar.gz
misc improvements/cleanups
* Remove unneeded item 'python' from makedepends/optdepends - it's already in depends * Improve unbound.service for using the python module in the chroot * Install the license to the correct place * Compile Python module to avoid a untracked file * Remove unused patches * Stop generating PKGBUILD from community/unbound with a script
-rw-r--r--.SRCINFO4
-rw-r--r--PKGBUILD21
-rw-r--r--unbound-1.13.2-fix_libpython_linking.patch68
-rw-r--r--unbound-fix-libpython-linking.patch44
4 files changed, 15 insertions, 122 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 54c6f793af9d..cdb6250c5f01 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,13 +1,12 @@
pkgbase = unbound-python
pkgdesc = Validating, recursive, and caching DNS resolver, with Python bindings
pkgver = 1.15.0
- pkgrel = 1
+ pkgrel = 2
url = https://unbound.net/
arch = x86_64
license = BSD
makedepends = expat
makedepends = protobuf-c
- makedepends = python
makedepends = swig
makedepends = systemd
depends = dnssec-anchors
@@ -21,7 +20,6 @@ pkgbase = unbound-python
depends = python
optdepends = expat: for unbound-anchor
optdepends = sh: for unbound-control-setup
- optdepends = python: for python-bindings
provides = libunbound.so
provides = unbound=1.15.0
conflicts = unbound
diff --git a/PKGBUILD b/PKGBUILD
index 069a7b690482..8a91a750593d 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -7,19 +7,19 @@
_pkgname=unbound
pkgname=unbound-python
pkgver=1.15.0
-pkgrel=1
+pkgrel=2
pkgdesc="Validating, recursive, and caching DNS resolver, with Python bindings"
arch=(x86_64)
url="https://unbound.net/"
license=(BSD)
-depends=("dnssec-anchors" "fstrm" "hiredis" "ldns" "libevent" "libnghttp2" "libsodium" "openssl" "python")
-makedepends=(expat protobuf-c python swig systemd)
+depends=(dnssec-anchors fstrm hiredis ldns libevent libnghttp2 libsodium openssl python)
+makedepends=(expat protobuf-c swig systemd)
optdepends=(
'expat: for unbound-anchor'
'sh: for unbound-control-setup'
- 'python: for python-bindings'
)
provides=("libunbound.so" "unbound=$pkgver")
+conflicts=("unbound")
backup=(etc/${_pkgname}/${_pkgname}.conf)
source=(
"https://unbound.net/downloads/${_pkgname}-${pkgver}.tar.gz"{,.asc}
@@ -43,9 +43,14 @@ b2sums=('e67756fb28aac784431484e5f834cbe3864a0ec021a8c9eb3124a6d5732fea99a073815
validpgpkeys=(EDFAA3F2CA4E6EB05681AF8E9F6F1C2D7E045F8D) # W.C.A. Wijngaards <wouter@nlnetlabs.nl>
prepare() {
+ # borrowed from community/hyperkitty
+ local python_stdlib_basepath="$(python -c "from sysconfig import get_path; print(get_path('stdlib'))")"
+
cd ${_pkgname}-${pkgver}
# enable trusted-anchor-file and set it to an unbound specific location
patch -Np1 -i ../"${_pkgname}-1.14.0-trust_anchor_file.patch"
+ # Not sure if there is a way to patch autoconf - this line should exist only when --with-pythonmodule
+ echo BindReadOnlyPaths=$python_stdlib_basepath:/etc/unbound$python_stdlib_basepath >> contrib/${_pkgname}.service.in
autoreconf -fiv
}
@@ -71,7 +76,8 @@ build() {
--with-rootkey-file=/etc/trusted-key.key \
--with-libevent \
--with-libnghttp2 \
- --with-pyunbound --with-pythonmodule
+ --with-pyunbound \
+ --with-pythonmodule
sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
make
}
@@ -87,10 +93,11 @@ package() {
cd ${_pkgname}-${pkgver}
make DESTDIR="${pkgdir}" install
install -vDm 644 contrib/${_pkgname}.service -t "${pkgdir}"/usr/lib/systemd/system/
- install -vDm 644 LICENSE -t "${pkgdir}"/usr/share/licenses/${_pkgname}/
+ install -vDm 644 LICENSE -t "${pkgdir}"/usr/share/licenses/${pkgname}/
install -vDm 644 ../${_pkgname}-sysusers.conf "${pkgdir}"/usr/lib/sysusers.d/${_pkgname}.conf
install -vDm 644 ../${_pkgname}-tmpfiles.conf "${pkgdir}"/usr/lib/tmpfiles.d/${_pkgname}.conf
# libalpm hook to copy the dnssec-anchors provided key to /etc/unbound
install -vDm 644 ../unbound-trusted-key.hook -t "${pkgdir}"/usr/share/libalpm/hooks/
+
+ python -m compileall -s "$pkgdir" -p / "$pkgdir"/usr/lib
}
-conflicts=("unbound")
diff --git a/unbound-1.13.2-fix_libpython_linking.patch b/unbound-1.13.2-fix_libpython_linking.patch
deleted file mode 100644
index 450b114b81c6..000000000000
--- a/unbound-1.13.2-fix_libpython_linking.patch
+++ /dev/null
@@ -1,68 +0,0 @@
-From 98087a051e657c4604050c3d1e6735950b9ea76f Mon Sep 17 00:00:00 2001
-From: Chih-Hsuan Yen <yan12125@gmail.com>
-Date: Fri, 23 Jul 2021 13:23:05 +0800
-Subject: [PATCH] - Reduce unnecessary linking
-
-- Link to libpython only when needed, fixes #242
-
-When pyunbound is enabled while pythonmodule is not (i.e., ./configure
---without-pythonmodule --with-pyunbound), only the Python library
-_unbound.so uses Python functions, and main programs (unbound,
-unbound-anchor, ...) and libunbound.so do not. This patch removes
-unneeded linking.
-
-- Link the Python library _unbound.so to Python only. _unbound.so does
- not directly use libraries used by libunbound. This patch removes
- unneeded linking mentioned in [1]
-
-[1] https://github.com/NLnetLabs/unbound/pull/511#issuecomment-886072003
----
- Makefile.in | 3 ++-
- configure.ac | 12 ++++++++----
- 2 files changed, 10 insertions(+), 5 deletions(-)
-
-diff --git a/Makefile.in b/Makefile.in
-index ff5dc8fae..58413d7a5 100644
---- a/Makefile.in
-+++ b/Makefile.in
-@@ -61,6 +61,7 @@ PYTHON_CPPFLAGS=-I. @PYTHON_CPPFLAGS@
- CFLAGS=-DSRCDIR=$(srcdir) @CFLAGS@
- LDFLAGS=@LDFLAGS@
- LIBS=@LIBS@
-+PYTHON_LIBS=@PYTHON_LIBS@
- LIBOBJS=@LIBOBJS@
- # filter out ctime_r from compat obj.
- LIBOBJ_WITHOUT_CTIME=@LIBOBJ_WITHOUT_CTIME@
-@@ -476,7 +477,7 @@ libunbound/python/libunbound_wrap.c: $(srcdir)/libunbound/python/libunbound.i un
-
- # Pyunbound python unbound wrapper
- _unbound.la: libunbound_wrap.lo libunbound.la
-- $(LIBTOOL) --tag=CC --mode=link $(CC) $(RUNTIME_PATH) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -module -avoid-version -no-undefined -shared -o $@ libunbound_wrap.lo -rpath $(PYTHON_SITE_PKG) -L. -L.libs libunbound.la $(LIBS)
-+ $(LIBTOOL) --tag=CC --mode=link $(CC) $(RUNTIME_PATH) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -module -avoid-version -no-undefined -shared -o $@ libunbound_wrap.lo -rpath $(PYTHON_SITE_PKG) -L. -L.libs libunbound.la $(PYTHON_LIBS)
-
- util/config_file.c: util/configparser.h
- util/configlexer.c: $(srcdir)/util/configlexer.lex util/configparser.h
-diff --git a/configure.ac b/configure.ac
-index fe911723c..0fc1e00a4 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -699,11 +699,15 @@ if test x_$ub_test_python != x_no; then
- AC_SUBST(PY_MAJOR_VERSION)
- # Have Python
- AC_DEFINE(HAVE_PYTHON,1,[Define if you have Python libraries and header files.])
-- if test -n "$LIBS"; then
-- LIBS="$PYTHON_LDFLAGS $LIBS"
-- else
-- LIBS="$PYTHON_LDFLAGS"
-+ if test x_$ub_with_pythonmod != x_no; then
-+ if test -n "$LIBS"; then
-+ LIBS="$PYTHON_LDFLAGS $LIBS"
-+ else
-+ LIBS="$PYTHON_LDFLAGS"
-+ fi
- fi
-+ PYTHON_LIBS="$PYTHON_LDFLAGS"
-+ AC_SUBST(PYTHON_LIBS)
- if test -n "$CPPFLAGS"; then
- CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS"
- else
diff --git a/unbound-fix-libpython-linking.patch b/unbound-fix-libpython-linking.patch
deleted file mode 100644
index eaac55cdfc51..000000000000
--- a/unbound-fix-libpython-linking.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-diff --git a/Makefile.in b/Makefile.in
---- a/Makefile.in
-+++ b/Makefile.in
-@@ -61,6 +61,7 @@ PYTHON_CPPFLAGS=-I. @PYTHON_CPPFLAGS@
- CFLAGS=-DSRCDIR=$(srcdir) @CFLAGS@
- LDFLAGS=@LDFLAGS@
- LIBS=@LIBS@
-+PYTHON_LIBS=@PYTHON_LIBS@
- LIBOBJS=@LIBOBJS@
- # filter out ctime_r from compat obj.
- LIBOBJ_WITHOUT_CTIME=@LIBOBJ_WITHOUT_CTIME@
-@@ -474,7 +475,7 @@ libunbound/python/libunbound_wrap.c: $(srcdir)/libunbound/python/libunbound.i un
-
- # Pyunbound python unbound wrapper
- _unbound.la: libunbound_wrap.lo libunbound.la
-- $(LIBTOOL) --tag=CC --mode=link $(CC) $(RUNTIME_PATH) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -module -avoid-version -no-undefined -shared -o $@ libunbound_wrap.lo -rpath $(PYTHON_SITE_PKG) -L. -L.libs -lunbound
-+ $(LIBTOOL) --tag=CC --mode=link $(CC) $(RUNTIME_PATH) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -module -avoid-version -no-undefined -shared -o $@ libunbound_wrap.lo -rpath $(PYTHON_SITE_PKG) -L. -L.libs -lunbound $(LIBS) $(PYTHON_LIBS)
-
- util/config_file.c: util/configparser.h
- util/configlexer.c: $(srcdir)/util/configlexer.lex util/configparser.h
-diff --git a/configure.ac b/configure.ac
---- a/configure.ac
-+++ b/configure.ac
-@@ -699,11 +699,17 @@ if test x_$ub_test_python != x_no; then
- AC_SUBST(PY_MAJOR_VERSION)
- # Have Python
- AC_DEFINE(HAVE_PYTHON,1,[Define if you have Python libraries and header files.])
-- if test -n "$LIBS"; then
-- LIBS="$PYTHON_LDFLAGS $LIBS"
-+ if test x_$ub_with_pythonmod != x_no; then
-+ if test -n "$LIBS"; then
-+ LIBS="$PYTHON_LDFLAGS $LIBS"
-+ else
-+ LIBS="$PYTHON_LDFLAGS"
-+ fi
-+ PYTHON_LIBS=""
- else
-- LIBS="$PYTHON_LDFLAGS"
-+ PYTHON_LIBS="$PYTHON_LDFLAGS"
- fi
-+ AC_SUBST(PYTHON_LIBS)
- if test -n "$CPPFLAGS"; then
- CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS"
- else