diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2020-01-15 15:51:32 +0000 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2020-01-15 15:51:32 +0000 |
commit | 21435953e16cda318a82334ddbadb3b5c36d9ea7 (patch) | |
tree | e1810a4b135afce04b34862ef0fab2bfaeb8aeca /net-dns/avahi | |
parent | 7bc9c63c9da678a7e6fceb095d56c634afd22c56 (diff) |
gentoo resync : 15.01.2020
Diffstat (limited to 'net-dns/avahi')
-rw-r--r-- | net-dns/avahi/Manifest | 5 | ||||
-rw-r--r-- | net-dns/avahi/avahi-0.7-r5.ebuild | 219 | ||||
-rw-r--r-- | net-dns/avahi/files/avahi-0.7-python3-gdbm.patch | 234 | ||||
-rw-r--r-- | net-dns/avahi/files/avahi-0.7-python3-unittest.patch | 151 | ||||
-rw-r--r-- | net-dns/avahi/files/avahi-0.7-python3.patch | 94 | ||||
-rw-r--r-- | net-dns/avahi/files/avahi-0.7-remove-empty-avahi_discover.patch | 77 |
6 files changed, 780 insertions, 0 deletions
diff --git a/net-dns/avahi/Manifest b/net-dns/avahi/Manifest index 40a1151633be..b6a95bef31a1 100644 --- a/net-dns/avahi/Manifest +++ b/net-dns/avahi/Manifest @@ -1,8 +1,13 @@ AUX autoipd-openrc.sh 700 BLAKE2B e71e5583db890f8ee1bbe9c03fc42285871089b2ea2d4549d553f14a20a3aa97c519b298bfaaccf02346c911f65f8e3f8bab7b2dc8270a5d35c471cc6bf31f6b SHA512 a5dbbac4d6d1959db3a07a63acb7569dbeba33d2274a1dd3253dc27687549371611cf08bad3998d89efb3ace63b5541a4d225e484274450e0c82661f5a1dbc32 AUX autoipd.sh 1271 BLAKE2B 815c5776afff71489826eb8338535df1af6fbf02f3d42eedb6ebb69e5fff181e7252060818dd2dd67141a40c097ded8b7ac4210cb9929bab4b68ea99533bcf26 SHA512 0bff9ca7e32212aef0246db5baf10ee4f7e93a987b7c591b21ed9f116a1c662a84be9d784fc919205c1fecb5cd8421b81a0eb590c3cc066c6b1b9265b98f1ea3 AUX avahi-0.7-CVE-2017-6519.patch 1578 BLAKE2B 87fce922927e1217802ce0f7b2a1a6f22649903a495817e224a37e7fc5c76d0d2a6cfbb50a1373a950a75a45a68bfbcba9f2155ed24940e3ffb994b862c00e4c SHA512 6c30c0d095f42b9bd289a1ac7b42287cd109bf0bad480d13eec70bedb65e7e1ab495600703f39f1caf73c3c0617c72940c33462586d68deb0a416d7c93964997 +AUX avahi-0.7-python3-gdbm.patch 7138 BLAKE2B 0ec244db80c4fd5eb896ce32ce78223e5cff3c8b0b7ecf690042489682423651f7f8c9b15d593088abbde56534e35dc2e5802b6d73d38c0cc0a112a234776237 SHA512 7b287062d605c0dd0c5a0a78ccc072ea31d2a4d158a804133e5ea8056a8f1eecf7f4833d2078c2349e01f0e97d269efb944c883a543f8f4fc3f5d538bc2c0cbe +AUX avahi-0.7-python3-unittest.patch 4772 BLAKE2B 2b1a7affc0bf4ad136f71af5c1bd03acff90c175a1efc18b63adfad7381471f06c187ef1bf0c702391dcc86cffe2e9041f0a0266a01f36b4810f53f2cb096159 SHA512 c598a3eb6aab93f58ee24ca77a2ae0a12b081a4c4e91f1f83c57dc1f62abf40dd3f914bff3ab17ac7032a45e9f30df6f8e7913ac5eaf5ea6c673dda47e878501 +AUX avahi-0.7-python3.patch 2810 BLAKE2B 523515d5d324e5b74d60abbdbc88469fec55ce31cb9d0803e9255f82aedb36fec4740d507c326166d73fb64316ad2490850d795aed27c9bef1249022be008656 SHA512 90ed5a68f39d135edec7264786eec6e0adba420cfcbf220bfc64b2739a7c0a72a869760cf4a1830949502660bfe324bf60918c71183cc68abfdf090bbeb10d92 AUX avahi-0.7-qt5.patch 6033 BLAKE2B 10c7879f6e28942a32497c84dcf523f742cb13112d9e9c23f74967c2d6c05e6f463406716c144edc1bd4588c8c76693473765d9d678f6517c4a57615d0364b91 SHA512 cd8b900a5a068add3b7aa9080491938d469795c26e1a1869ee581b95d877ded4d120cb4db768fb4d97535a72e66c3fabf6617cdca2c9bdb50ff54e24d17b1f51 +AUX avahi-0.7-remove-empty-avahi_discover.patch 2593 BLAKE2B 0fddfd46a3fc3e66960e7c2b6028e825e703e2e3f5b3d672dc204e37b87d101bffa285857c5dc41c69fc03bb3e7935fdec774492a31d4ce59ed9b06c4a0a20f4 SHA512 7bdd2ec5f16fb2850a78c983d35ca1d76b6e0d45eb17267213d3fb95b07d213f042bfa9ae07fd16b6334cc4459c5e87ae28942db69cb1987a074d6e787f19f70 DIST avahi-0.7.tar.gz 940047 BLAKE2B 8299577bf27ee65fad5d743dbf94202b148a6fc86825cae303f94c44482eea07cf6570d970ca286e81a787d6a64598b7123f2ac17a259ddc50ef431b9c94b530 SHA512 61f656da7614d8cca1862180038f571db3474c84f05db4d3509f614cdbf8b1a1047661b7e24d63682d5b48ed1bfa1b08b3c9e6dbe9222bcd62d99bc168a11abe EBUILD avahi-0.7-r2.ebuild 5250 BLAKE2B fb2f31ff16159ec52bdaf74a45e67b0d440ac81dd37b84cbff8596fbf931cb876b31c6631f2227fab6abf83671960ad45ed37f616ed2a8b424dea0cf6e3a9dc2 SHA512 ea3143c5834c2ed15cbaac7d8efd0dd3198c8e982b851abfad68c3dd3de9f5bad440a4af9db4ad140ef02f3cc39eb18ce53592cbed30b999ea433284898f948a EBUILD avahi-0.7-r4.ebuild 5215 BLAKE2B 0d387cb0af825bd7813bdf0f99bdfbc83dc8f7f69a4c0e374bf0ff51522074453197f659019395cb4efcc50719b56c6206eade55c7ce28e075d70c48a140e2aa SHA512 ac32afae86f2347d0961978b8189345e0bb2ff9feda118f2075be148d8dcdb02da591ed5e93d417a2d8a050e206fb2ba6729e8f22422bed7bc052791c8587556 +EBUILD avahi-0.7-r5.ebuild 5337 BLAKE2B 315366bd28af27c4b3c718dbad3fde275a141831fa42b0c6bee76338295846d5ad7ab7964b41c8fec66b2c2fd22c2fa82aaaf2413b3fbf6bcf8719c1b7fe9c57 SHA512 69da22a77a5d3da0232a03a3f8ef09d9dcfe31e3c6fc0d9fc14cbe94affe6891d41607d9ae2d42b4c818a13813ada698dcd80c1ffb4c79357f8801fae355664f MISC metadata.xml 935 BLAKE2B 890b4a3ab97241ba254dcf68b97a6a8b2ae4af914dc2348b8eb9d6c3182c1d2dfbd5eca8dac009e30f4662b88001c159ac5479a100bfc48a956ac2d603b6343e SHA512 7d2114e25574532405b5ff6db66b833aef68772d5b699d8885e9f1005a1785298e5b71288a858572a1270c6a4d9d2ad98aac7f79f4df6713dea79778280c82d8 diff --git a/net-dns/avahi/avahi-0.7-r5.ebuild b/net-dns/avahi/avahi-0.7-r5.ebuild new file mode 100644 index 000000000000..550cf31f3817 --- /dev/null +++ b/net-dns/avahi/avahi-0.7-r5.ebuild @@ -0,0 +1,219 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="7" + +PYTHON_COMPAT=( python3_{6,7} ) +PYTHON_REQ_USE="gdbm" +inherit autotools flag-o-matic multilib-minimal mono-env python-r1 systemd + +DESCRIPTION="System which facilitates service discovery on a local network" +HOMEPAGE="http://avahi.org/" +SRC_URI="https://github.com/lathiat/avahi/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="LGPL-2.1" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86" +IUSE="autoipd bookmarks dbus doc gdbm gtk gtk3 howl-compat +introspection ipv6 kernel_linux mdnsresponder-compat mono nls python qt5 selinux systemd test" + +REQUIRED_USE=" + python? ( dbus gdbm ${PYTHON_REQUIRED_USE} ) + mono? ( dbus ) + howl-compat? ( dbus ) + mdnsresponder-compat? ( dbus ) + systemd? ( dbus ) +" + +RESTRICT="!test? ( test )" + +DEPEND=" + dev-libs/libdaemon + dev-libs/expat + dev-libs/glib:2[${MULTILIB_USEDEP}] + gdbm? ( sys-libs/gdbm:=[${MULTILIB_USEDEP}] ) + qt5? ( dev-qt/qtcore:5 ) + gtk? ( x11-libs/gtk+:2[${MULTILIB_USEDEP}] ) + gtk3? ( x11-libs/gtk+:3[${MULTILIB_USEDEP}] ) + dbus? ( sys-apps/dbus[${MULTILIB_USEDEP}] ) + kernel_linux? ( sys-libs/libcap ) + introspection? ( dev-libs/gobject-introspection:= ) + mono? ( + dev-lang/mono + gtk? ( dev-dotnet/gtk-sharp:2 ) + ) + python? ( + ${PYTHON_DEPS} + dbus? ( dev-python/dbus-python[${PYTHON_USEDEP}] ) + introspection? ( dev-python/pygobject:3[${PYTHON_USEDEP}] ) + ) + bookmarks? ( + ${PYTHON_DEPS} + >=dev-python/twisted-16.0.0[${PYTHON_USEDEP}] + ) +" +RDEPEND=" + acct-user/avahi + acct-group/avahi + acct-group/netdev + autoipd? ( + acct-user/avahi-autoipd + acct-group/avahi-autoipd + ) + ${DEPEND} + howl-compat? ( !net-misc/howl ) + mdnsresponder-compat? ( !net-misc/mDNSResponder ) + selinux? ( sec-policy/selinux-avahi ) +" +BDEPEND=" + dev-util/glib-utils + doc? ( app-doc/doxygen ) + app-doc/xmltoman + dev-util/intltool + virtual/pkgconfig[${MULTILIB_USEDEP}] +" + +MULTILIB_WRAPPED_HEADERS=( /usr/include/avahi-qt5/qt-watch.h ) + +PATCHES=( + "${FILESDIR}/${P}-qt5.patch" + "${FILESDIR}/${P}-CVE-2017-6519.patch" + "${FILESDIR}/${P}-remove-empty-avahi_discover.patch" + "${FILESDIR}/${P}-python3.patch" + "${FILESDIR}/${P}-python3-unittest.patch" + "${FILESDIR}/${P}-python3-gdbm.patch" +) + +pkg_setup() { + use mono && mono-env_pkg_setup + use python || use bookmarks && python_setup +} + +src_prepare() { + default + + if ! use ipv6; then + sed -i \ + -e "s/use-ipv6=yes/use-ipv6=no/" \ + avahi-daemon/avahi-daemon.conf || die + fi + + sed -i \ + -e "s:\\.\\./\\.\\./\\.\\./doc/avahi-docs/html/:../../../doc/${PF}/html/:" \ + doxygen_to_devhelp.xsl || die + + eautoreconf + + # bundled manpages + multilib_copy_sources +} + +src_configure() { + # those steps should be done once-per-ebuild rather than per-ABI + use sh && replace-flags -O? -O0 + + multilib-minimal_src_configure +} + +multilib_src_configure() { + local myconf=( + --disable-monodoc + --disable-python-dbus + --disable-qt3 + --disable-qt4 + --disable-static + --enable-manpages + --enable-glib + --enable-gobject + --enable-xmltoman + --localstatedir="${EPREFIX}/var" + --with-distro=gentoo + --with-systemdsystemunitdir="$(systemd_get_systemunitdir)" + $(use_enable dbus) + $(use_enable gdbm) + $(use_enable gtk) + $(use_enable gtk3) + $(use_enable howl-compat compat-howl) + $(use_enable mdnsresponder-compat compat-libdns_sd) + $(use_enable nls) + $(multilib_native_use_enable autoipd) + $(multilib_native_use_enable doc doxygen-doc) + $(multilib_native_use_enable introspection) + $(multilib_native_use_enable mono) + $(multilib_native_use_enable python) + $(multilib_native_use_enable test tests) + ) + + if use python; then + myconf+=( + $(multilib_native_use_enable dbus python-dbus) + $(multilib_native_use_enable introspection pygobject) + ) + fi + + if use mono; then + myconf+=( $(multilib_native_use_enable doc monodoc) ) + fi + + if ! multilib_is_native_abi; then + myconf+=( + # used by daemons only + --disable-libdaemon + --with-xml=none + ) + fi + + myconf+=( $(multilib_native_use_enable qt5) ) + + econf "${myconf[@]}" +} + +multilib_src_compile() { + emake + + multilib_is_native_abi && use doc && emake avahi.devhelp +} + +multilib_src_install() { + emake install DESTDIR="${D}" + use bookmarks && use python && use dbus && use gtk || \ + rm -f "${ED}"/usr/bin/avahi-bookmarks + + # https://github.com/lathiat/avahi/issues/28 + use howl-compat && dosym avahi-compat-howl.pc /usr/$(get_libdir)/pkgconfig/howl.pc + use mdnsresponder-compat && dosym avahi-compat-libdns_sd/dns_sd.h /usr/include/dns_sd.h + + if multilib_is_native_abi && use doc; then + docinto html + dodoc -r doxygen/html/. + insinto /usr/share/devhelp/books/avahi + doins avahi.devhelp + fi + + # The build system creates an empty "/run" directory, so we clean it up here + rmdir "${ED}"/run || die +} + +multilib_src_install_all() { + if use autoipd; then + insinto /lib/rcscripts/net + doins "${FILESDIR}"/autoipd.sh + + insinto /lib/netifrc/net + newins "${FILESDIR}"/autoipd-openrc.sh autoipd.sh + fi + + dodoc docs/{AUTHORS,NEWS,README,TODO} + + find "${ED}" -name '*.la' -type f -delete || die +} + +pkg_postinst() { + if use autoipd; then + elog + elog "To use avahi-autoipd to configure your interfaces with IPv4LL (RFC3927)" + elog "addresses, just set config_<interface>=( autoipd ) in /etc/conf.d/net!" + elog + fi + + systemd_reenable avahi-daemon.service +} diff --git a/net-dns/avahi/files/avahi-0.7-python3-gdbm.patch b/net-dns/avahi/files/avahi-0.7-python3-gdbm.patch new file mode 100644 index 000000000000..3976b8df2e76 --- /dev/null +++ b/net-dns/avahi/files/avahi-0.7-python3-gdbm.patch @@ -0,0 +1,234 @@ +From 63750f1be96ad08c407193b08bf3b9ee74310e2d Mon Sep 17 00:00:00 2001 +From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com> +Date: Tue, 11 Jul 2017 21:52:37 +0200 +Subject: [PATCH] avahi-python: Use the agnostic DBM interface + +Also fixes configure failing if Python 3 is the build python and GDBM is +enabled, since Py3 only has anydbm under the name of 'dbm'. + +Not enough to make ServiceTypeDatabase.py compatible with Py3, but it's +a start. +--- + avahi-python/avahi/Makefile.am | 15 +-------- + avahi-python/avahi/ServiceTypeDatabase.py.in | 33 ++++++++++++++----- + configure.ac | 9 +++-- + service-type-database/.gitignore | 1 - + service-type-database/Makefile.am | 18 +++------- + .../{build-db.in => build-db} | 13 +++++--- + 6 files changed, 42 insertions(+), 47 deletions(-) + rename service-type-database/{build-db.in => build-db} (87%) + +diff --git a/avahi-python/avahi/Makefile.am b/avahi-python/avahi/Makefile.am +index 3eb67d0d..c906b9bf 100644 +--- a/avahi-python/avahi/Makefile.am ++++ b/avahi-python/avahi/Makefile.am +@@ -25,29 +25,16 @@ avahidir = $(pythondir)/avahi + + if HAVE_GDBM + nodist_avahi_SCRIPTS = ServiceTypeDatabase.py +- +-ServiceTypeDatabase.py: ServiceTypeDatabase.py.in +- $(AM_V_GEN)sed -e 's,@PYTHON\@,$(PYTHON),g' \ +- -e 's,@DBM\@,gdbm,g' \ +- -e 's,@FIRST_KEY\@,key = self.db.firstkey(),g' \ +- -e 's,@CHECK_KEY\@,while key is not None:,g' \ +- -e 's,@NEXT_KEY\@,key = self.db.nextkey(key),g' \ +- -e 's,@pkglibdatadir\@,$(pkglibdatadir),g' $< > $@ && \ +- chmod +x $@ + endif + + if HAVE_DBM + nodist_avahi_SCRIPTS = ServiceTypeDatabase.py ++endif + + ServiceTypeDatabase.py: ServiceTypeDatabase.py.in + $(AM_V_GEN)sed -e 's,@PYTHON\@,$(PYTHON),g' \ +- -e 's,@DBM\@,dbm,g' \ +- -e 's,@FIRST_KEY\@,keys = self.db.keys(),g' \ +- -e 's,@CHECK_KEY\@,for key in keys:,g' \ +- -e 's,@NEXT_KEY\@,,g' \ + -e 's,@pkglibdatadir\@,$(pkglibdatadir),g' $< > $@ && \ + chmod +x $@ +-endif + + avahi_PYTHON = $(avahi_SCRIPTS) + +diff --git a/avahi-python/avahi/ServiceTypeDatabase.py.in b/avahi-python/avahi/ServiceTypeDatabase.py.in +index 4ddd6544..d7f9969b 100644 +--- a/avahi-python/avahi/ServiceTypeDatabase.py.in ++++ b/avahi-python/avahi/ServiceTypeDatabase.py.in +@@ -17,7 +17,11 @@ + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + # USA. + +-import @DBM@ ++try: ++ import anydbm as dbm ++except ImportError: ++ import dbm ++ + import locale + import re + +@@ -28,7 +32,7 @@ class ServiceTypeDatabase: + + def __init__(self, filename = "@pkglibdatadir@/service-types.db"): + +- self.db = @DBM@.open(filename, "r") ++ self.db = dbm.open(filename, "r") + + l = locale.getlocale(locale.LC_MESSAGES) + +@@ -90,13 +94,24 @@ class ServiceTypeDatabase: + + def __iter__(self): + +- @FIRST_KEY@ +- @CHECK_KEY@ +- +- if re.search('_[a-zA-Z0-9-]+\._[a-zA-Z0-9-]+', key) and not re.search('_[a-zA-Z0-9-]+\._[a-zA-Z0-9-]+\[.*\]', key): +- yield key +- +- @NEXT_KEY@ ++ def want_key(key): ++ if not re.search('_[a-zA-Z0-9-]+\._[a-zA-Z0-9-]+', key): ++ return False ++ if re.search('_[a-zA-Z0-9-]+\._[a-zA-Z0-9-]+\[.*\]', key): ++ return False ++ return True ++ ++ try: ++ key = self.db.firstkey() ++ except AttributeError: ++ for key in self.db.keys(): ++ if want_key(key): ++ yield key ++ else: ++ while key is not None: ++ if want_key(key): ++ yield key ++ key = self.db.nextkey(key) + + def __len__(self): + +diff --git a/configure.ac b/configure.ac +index 66789718..fbbf7cf3 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -824,11 +824,10 @@ if test "x$HAVE_PYTHON" = "xyes" ; then + fi + + AM_CHECK_PYMOD(socket,,,[AC_MSG_ERROR(Could not find Python module socket)]) +- if test "x$HAVE_GDBM" = "xyes"; then +- AM_CHECK_PYMOD(gdbm,,,[AC_MSG_ERROR(Could not find Python module gdbm)]) +- fi +- if test "x$HAVE_DBM" = "xyes"; then +- AM_CHECK_PYMOD(dbm,,,[AC_MSG_ERROR(Could not find Python module dbm)]) ++ if test "x$HAVE_GDBM" = "xyes" || test "x$HAVE_DBM" = "xyes"; then ++ AM_CHECK_PYMOD(anydbm,,,[ ++ AM_CHECK_PYMOD(dbm,,,[AC_MSG_ERROR(Could not find Python module dbm)]) ++ ]) + fi + fi + fi +diff --git a/service-type-database/.gitignore b/service-type-database/.gitignore +index 581f1929..51b02600 100644 +--- a/service-type-database/.gitignore ++++ b/service-type-database/.gitignore +@@ -1,4 +1,3 @@ + Makefile + Makefile.in + service-types.db +-build-db +diff --git a/service-type-database/Makefile.am b/service-type-database/Makefile.am +index d184fde3..f9fa0825 100644 +--- a/service-type-database/Makefile.am ++++ b/service-type-database/Makefile.am +@@ -15,7 +15,7 @@ + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + # USA. + +-EXTRA_DIST=build-db.in service-types ++EXTRA_DIST=service-types + + pkglibdatadir=$(libdir)/avahi + +@@ -27,16 +27,11 @@ if HAVE_GDBM + noinst_SCRIPTS=build-db + pkglibdata_DATA+=service-types.db + +-build-db: build-db.in +- $(AM_V_GEN)sed -e 's,@PYTHON\@,$(PYTHON),g' \ +- -e 's,@DBM\@,gdbm,g' $< > $@ && \ +- chmod +x $@ +- +-service-types.db: service-types build-db ++service-types.db: service-types + $(AM_V_GEN)$(PYTHON) build-db $< $@.coming && \ + mv $@.coming $@ + +-CLEANFILES = service-types.db build-db ++CLEANFILES = service-types.db + + endif + if HAVE_DBM +@@ -44,11 +39,6 @@ if HAVE_DBM + noinst_SCRIPTS=build-db + pkglibdata_DATA+=service-types.db.pag service-types.db.dir + +-build-db: build-db.in +- $(AM_V_GEN)sed -e 's,@PYTHON\@,$(PYTHON),g' \ +- -e 's,@DBM\@,dbm,g' $< > $@ && \ +- chmod +x $@ +- + service-types.db.pag: service-types.db + $(AM_V_GEN)mv service-types.db.coming.pag service-types.db.pag + service-types.db.dir: service-types.db +@@ -57,7 +47,7 @@ service-types.db: service-types build-db + $(AM_V_GEN)$(PYTHON) build-db $< $@.coming && \ + if test -f "$@.coming"; then mv $@.coming $@; fi + +-CLEANFILES = service-types.db* build-db ++CLEANFILES = service-types.db* + + endif + endif +diff --git a/service-type-database/build-db.in b/service-type-database/build-db +similarity index 87% +rename from service-type-database/build-db.in +rename to service-type-database/build-db +index 4cda4253..78ee892f 100755 +--- a/service-type-database/build-db.in ++++ b/service-type-database/build-db +@@ -1,4 +1,4 @@ +-#!@PYTHON@ ++#!/usr/bin/env python + # -*-python-*- + # This file is part of avahi. + # +@@ -17,7 +17,12 @@ + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + # USA. + +-import @DBM@, sys ++try: ++ import anydbm as dbm ++except ImportError: ++ import dbm ++ ++import sys + + if len(sys.argv) > 1: + infn = sys.argv[1] +@@ -29,9 +34,9 @@ if len(sys.argv) > 2: + else: + outfn = infn + ".db" + +-db = @DBM@.open(outfn, "n") ++db = dbm.open(outfn, "n") + +-for ln in file(infn, "r"): ++for ln in open(infn, "r"): + ln = ln.strip(" \r\n\t") + + if ln == "" or ln.startswith("#"): diff --git a/net-dns/avahi/files/avahi-0.7-python3-unittest.patch b/net-dns/avahi/files/avahi-0.7-python3-unittest.patch new file mode 100644 index 000000000000..9d735a1780c2 --- /dev/null +++ b/net-dns/avahi/files/avahi-0.7-python3-unittest.patch @@ -0,0 +1,151 @@ +From 62fe263662b52a462895fd8d21cf29b2fa22fe86 Mon Sep 17 00:00:00 2001 +From: Simon McVittie <smcv@debian.org> +Date: Fri, 27 Apr 2018 11:10:57 +0100 +Subject: [PATCH] avahi-python: Add a unit test for string and bytestring + conversions + +Signed-off-by: Simon McVittie <smcv@debian.org> +--- + .gitignore | 1 + + avahi-python/avahi/.gitignore | 5 ++ + avahi-python/avahi/Makefile.am | 7 +++ + avahi-python/avahi/test.py | 85 ++++++++++++++++++++++++++++++++++ + 4 files changed, 98 insertions(+) + create mode 100755 avahi-python/avahi/test.py + +diff --git a/.gitignore b/.gitignore +index beab8d94..06565f06 100644 +--- a/.gitignore ++++ b/.gitignore +@@ -32,3 +32,4 @@ ltmain.sh + missing + py-compile + stamp-h1 ++test-driver +diff --git a/avahi-python/avahi/.gitignore b/avahi-python/avahi/.gitignore +index 118a34de..9b0f6e3c 100644 +--- a/avahi-python/avahi/.gitignore ++++ b/avahi-python/avahi/.gitignore +@@ -1 +1,6 @@ ++*.log ++*.pyc ++*.pyo ++*.trs + ServiceTypeDatabase.py ++__pycache__/ +diff --git a/avahi-python/avahi/Makefile.am b/avahi-python/avahi/Makefile.am +index 3eb67d0d..cf527aff 100644 +--- a/avahi-python/avahi/Makefile.am ++++ b/avahi-python/avahi/Makefile.am +@@ -16,6 +16,11 @@ + # USA. + + EXTRA_DIST = __init__.py ServiceTypeDatabase.py.in ++EXTRA_DIST += test.py ++ ++TESTS = ++TEST_EXTENSIONS = .py ++PY_LOG_COMPILER = $(PYTHON) + + pkglibdatadir=$(libdir)/avahi + +@@ -55,6 +60,8 @@ if HAVE_PYTHON_DBUS + + avahi_PYTHON += __init__.py + ++TESTS += test.py ++ + endif + endif + +diff --git a/avahi-python/avahi/test.py b/avahi-python/avahi/test.py +new file mode 100755 +index 00000000..7afc4809 +--- /dev/null ++++ b/avahi-python/avahi/test.py +@@ -0,0 +1,85 @@ ++#!/usr/bin/python ++# ++# Copyright 2018 Simon McVittie ++# ++# This file is part of avahi. ++# ++# avahi is free software; you can redistribute it and/or modify it ++# under the terms of the GNU Lesser General Public License as ++# published by the Free Software Foundation; either version 2 of the ++# License, or (at your option) any later version. ++# ++# avahi is distributed in the hope that it will be useful, but WITHOUT ++# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ++# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public ++# License for more details. ++# ++# You should have received a copy of the GNU Lesser General Public ++# License along with avahi; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 ++# USA. ++ ++import os ++import os.path ++import sys ++import unittest ++from collections import OrderedDict ++ ++sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir)) ++ ++import avahi ++import dbus ++ ++class TestUtilityMethods(unittest.TestCase): ++ def test_byte_array_to_string(self): ++ self.assertEqual( ++ avahi.byte_array_to_string([1, 2, 127, 128]), ++ '....') ++ self.assertEqual( ++ avahi.byte_array_to_string([ord('a'), ord(' '), ord('b')]), ++ 'a b') ++ ++ def test_txt_array_to_string_array(self): ++ self.assertEqual( ++ avahi.txt_array_to_string_array([[1, 2], [ord('a'), ord('b')]]), ++ ['..', 'ab']) ++ ++ def test_string_to_byte_array(self): ++ self.assertEqual( ++ avahi.string_to_byte_array('abc'), ++ [dbus.Byte(97), dbus.Byte(98), dbus.Byte(99)]) ++ self.assertIsInstance( ++ avahi.string_to_byte_array('abc')[0], ++ dbus.Byte) ++ self.assertEqual( ++ avahi.string_to_byte_array(b'\x01\xff'), ++ [dbus.Byte(0x01), dbus.Byte(0xff)]) ++ self.assertEqual( ++ avahi.string_to_byte_array(u'\u00e1'), ++ [dbus.Byte(0xc3), dbus.Byte(0xa1)]) ++ ++ def test_string_array_to_txt_array(self): ++ self.assertEqual( ++ avahi.string_array_to_txt_array(['abc', b'\x01', u'\u00e1']), ++ [ ++ [dbus.Byte(97), dbus.Byte(98), dbus.Byte(99)], ++ [dbus.Byte(0x01)], ++ [dbus.Byte(0xc3), dbus.Byte(0xa1)]]) ++ self.assertIsInstance( ++ avahi.string_array_to_txt_array(['abc'])[0][0], ++ dbus.Byte) ++ ++ def test_dict_to_txt_array(self): ++ self.assertEqual( ++ avahi.dict_to_txt_array( ++ OrderedDict((('a', 'abc'), ('b', b'\x01'), ('c', u'\u00e1')))), ++ [ ++ [dbus.Byte(97), dbus.Byte(ord('=')), dbus.Byte(97), dbus.Byte(98), dbus.Byte(99)], ++ [dbus.Byte(98), dbus.Byte(ord('=')), dbus.Byte(0x01)], ++ [dbus.Byte(99), dbus.Byte(ord('=')), dbus.Byte(0xc3), dbus.Byte(0xa1)]]) ++ self.assertIsInstance( ++ avahi.dict_to_txt_array({'a': 'abc'})[0][0], ++ dbus.Byte) ++ ++if __name__ == '__main__': ++ unittest.main() diff --git a/net-dns/avahi/files/avahi-0.7-python3.patch b/net-dns/avahi/files/avahi-0.7-python3.patch new file mode 100644 index 000000000000..a4bb34029964 --- /dev/null +++ b/net-dns/avahi/files/avahi-0.7-python3.patch @@ -0,0 +1,94 @@ +From 169e85dbc13dcaae8a699618883e512614f540b7 Mon Sep 17 00:00:00 2001 +From: Simon McVittie <smcv@debian.org> +Date: Fri, 27 Apr 2018 11:09:07 +0100 +Subject: [PATCH] avahi-python: Encode unicode strings as UTF-8 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Previously, we would effectively encode anything representable in +Latin-1 as Latin-1, and crash on anything not representable in Latin-1: + +>>> import avahi +>>> avahi.string_to_byte_array(u'©') +[dbus.Byte(169)] +>>> avahi.string_to_byte_array(u'\ufeff') +Traceback (most recent call last): + File "<stdin>", line 1, in <module> + File "/usr/lib/python2.7/dist-packages/avahi/__init__.py", line 94, in string_to_byte_array + r.append(dbus.Byte(ord(c))) +ValueError: Integer outside range 0-255 + +This is particularly important for Python 3, where the str type +is a Unicode string. + +The b'' syntax for bytestrings is supported since at least Python 2.7. + +These functions now accept either Unicode strings (Python 2 unicode, +Python 3 str), which are encoded in UTF-8, or bytestrings +(Python 2 str, Python 3 bytes) which are taken as-is. + +Signed-off-by: Simon McVittie <smcv@debian.org> +--- + avahi-python/avahi/__init__.py | 24 +++++++++++++++++++++--- + 1 file changed, 21 insertions(+), 3 deletions(-) + +diff --git a/avahi-python/avahi/__init__.py b/avahi-python/avahi/__init__.py +index 7b450293..02305b02 100644 +--- a/avahi-python/avahi/__init__.py ++++ b/avahi-python/avahi/__init__.py +@@ -17,6 +17,8 @@ + + # Some definitions matching those in avahi-common/defs.h + ++import sys ++ + import dbus + + SERVER_INVALID, SERVER_REGISTERING, SERVER_RUNNING, SERVER_COLLISION, SERVER_FAILURE = range(0, 5) +@@ -66,6 +68,9 @@ + DBUS_INTERFACE_SERVICE_RESOLVER = DBUS_NAME + ".ServiceResolver" + DBUS_INTERFACE_RECORD_BROWSER = DBUS_NAME + ".RecordBrowser" + ++if sys.version_info[0] >= 3: ++ unicode = str ++ + def byte_array_to_string(s): + r = "" + +@@ -86,12 +91,19 @@ def txt_array_to_string_array(t): + + return l + +- + def string_to_byte_array(s): ++ if isinstance(s, unicode): ++ s = s.encode('utf-8') ++ + r = [] + + for c in s: +- r.append(dbus.Byte(ord(c))) ++ if isinstance(c, int): ++ # Python 3: iterating over bytes yields ints ++ r.append(dbus.Byte(c)) ++ else: ++ # Python 2: iterating over str yields str ++ r.append(dbus.Byte(ord(c))) + + return r + +@@ -107,6 +119,12 @@ def dict_to_txt_array(txt_dict): + l = [] + + for k,v in txt_dict.items(): +- l.append(string_to_byte_array("%s=%s" % (k,v))) ++ if isinstance(k, unicode): ++ k = k.encode('utf-8') ++ ++ if isinstance(v, unicode): ++ v = v.encode('utf-8') ++ ++ l.append(string_to_byte_array(b"%s=%s" % (k,v))) + + return l diff --git a/net-dns/avahi/files/avahi-0.7-remove-empty-avahi_discover.patch b/net-dns/avahi/files/avahi-0.7-remove-empty-avahi_discover.patch new file mode 100644 index 000000000000..702499e22185 --- /dev/null +++ b/net-dns/avahi/files/avahi-0.7-remove-empty-avahi_discover.patch @@ -0,0 +1,77 @@ +From ffb19d8f3c7f1fe4f31f79f8601dd3079730401b Mon Sep 17 00:00:00 2001 +From: Simon McVittie <smcv@debian.org> +Date: Fri, 27 Apr 2018 09:01:13 +0100 +Subject: [PATCH] Remove empty avahi_discover Python module + +The avahi-discover tool no longer has any code outside its main +executable, so it does not need to install library modules. Its only +library code was avahi_discover.SimpleGladeApp, which was removed +in 2009. + +Signed-off-by: Simon McVittie <smcv@debian.org> +--- + avahi-python/avahi-discover/Makefile.am | 6 ------ + avahi-python/avahi-discover/__init__.py | 18 ------------------ + 2 files changed, 24 deletions(-) + delete mode 100755 avahi-python/avahi-discover/__init__.py + +diff --git a/avahi-python/avahi-discover/Makefile.am b/avahi-python/avahi-discover/Makefile.am +index 5fc4b25f..bb4d7172 100644 +--- a/avahi-python/avahi-discover/Makefile.am ++++ b/avahi-python/avahi-discover/Makefile.am +@@ -18,7 +18,6 @@ + AM_CFLAGS=-I$(top_srcdir) + + EXTRA_DIST = \ +- __init__.py \ + avahi-discover.py \ + avahi-discover.desktop.in.in + +@@ -31,15 +30,11 @@ pythonscripts = + desktopdir = $(datadir)/applications + desktop_DATA = + +-avahi_discoverdir = $(pythondir)/avahi_discover +-avahi_discover_PYTHON = +- + if HAVE_GDBM + pythonscripts += \ + avahi-discover + desktop_DATA += avahi-discover.desktop + @INTLTOOL_DESKTOP_RULE@ +-avahi_discover_PYTHON += __init__.py + endif + + if HAVE_DBM +@@ -47,7 +42,6 @@ pythonscripts += \ + avahi-discover + desktop_DATA += avahi-discover.desktop + @INTLTOOL_DESKTOP_RULE@ +-avahi_discover_PYTHON += __init__.py + endif + + avahi-discover.desktop.in: avahi-discover.desktop.in.in +diff --git a/avahi-python/avahi-discover/__init__.py b/avahi-python/avahi-discover/__init__.py +deleted file mode 100755 +index 6f3ec7f9..00000000 +--- a/avahi-python/avahi-discover/__init__.py ++++ /dev/null +@@ -1,18 +0,0 @@ +-#!@PYTHON@ +-# -*-python-*- +-# This file is part of avahi. +-# +-# avahi is free software; you can redistribute it and/or modify it +-# under the terms of the GNU Lesser General Public License as +-# published by the Free Software Foundation; either version 2 of the +-# License, or (at your option) any later version. +-# +-# avahi is distributed in the hope that it will be useful, but WITHOUT +-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +-# License for more details. +-# +-# You should have received a copy of the GNU Lesser General Public +-# License along with avahi; if not, write to the Free Software +-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +-# USA. |