From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id D32EC158020 for ; Fri, 9 Dec 2022 16:50:30 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 09C3DE0886; Fri, 9 Dec 2022 16:50:30 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id D90B8E0886 for ; Fri, 9 Dec 2022 16:50:29 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 83360340948 for ; Fri, 9 Dec 2022 16:50:28 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id B533675 for ; Fri, 9 Dec 2022 16:50:26 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1670604520.350458ecda5f78ef834191b50029b1e48548f188.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: net-analyzer/nmap/, net-analyzer/nmap/files/ X-VCS-Repository: repo/gentoo X-VCS-Files: net-analyzer/nmap/files/nmap-9999-python3.patch net-analyzer/nmap/metadata.xml net-analyzer/nmap/nmap-9999.ebuild X-VCS-Directories: net-analyzer/nmap/ net-analyzer/nmap/files/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 350458ecda5f78ef834191b50029b1e48548f188 X-VCS-Branch: master Date: Fri, 9 Dec 2022 16:50:26 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 6e4db6d0-dea3-4339-a052-7e4c5a5658d9 X-Archives-Hash: 47d5f8be85f7dcda0f82054e56cf1935 commit: 350458ecda5f78ef834191b50029b1e48548f188 Author: Sam James gentoo org> AuthorDate: Fri Dec 9 16:04:43 2022 +0000 Commit: Sam James gentoo org> CommitDate: Fri Dec 9 16:48:40 2022 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=350458ec net-analyzer/nmap: restore ndiff, zenmap (now Python 3) to live Bug: https://bugs.gentoo.org/702288 Signed-off-by: Sam James gentoo.org> net-analyzer/nmap/files/nmap-9999-python3.patch | 103 ++++++++++++++++++++++++ net-analyzer/nmap/metadata.xml | 2 + net-analyzer/nmap/nmap-9999.ebuild | 74 ++++++++++++----- 3 files changed, 157 insertions(+), 22 deletions(-) diff --git a/net-analyzer/nmap/files/nmap-9999-python3.patch b/net-analyzer/nmap/files/nmap-9999-python3.patch new file mode 100644 index 000000000000..3d740d759b3c --- /dev/null +++ b/net-analyzer/nmap/files/nmap-9999-python3.patch @@ -0,0 +1,103 @@ +https://github.com/nmap/nmap/pull/2580 + +From 14f8e230a61748b1cde86d13a2cf2353d7ad1fa7 Mon Sep 17 00:00:00 2001 +From: Sam James +Date: Fri, 9 Dec 2022 15:58:35 +0000 +Subject: [PATCH] zenmap: further Python 3 compatibility fixes + +Without this, we get: +``` +Traceback (most recent call last): + File "/var/tmp/portage/net-analyzer/nmap-9999/work/nmap-9999/zenmap/setup.py", line 584, in + setup(**setup_args) + File "/usr/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup + return run_commands(dist) + File "/usr/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands + dist.run_commands() + File "/usr/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands + self.run_command(cmd) + File "/usr/lib/python3.10/site-packages/setuptools/dist.py", line 1208, in run_command + super().run_command(command) + File "/usr/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command + cmd_obj.run() + File "/var/tmp/portage/net-analyzer/nmap-9999/work/nmap-9999/zenmap/setup.py", line 188, in run + self.write_installed_files() + File "/var/tmp/portage/net-analyzer/nmap-9999/work/nmap-9999/zenmap/setup.py", line 419, in write_installed_files + print >> f, output +TypeError: unsupported operand type(s) for >>: 'builtin_function_or_method' and '_io.TextIOWrapper'. Did you mean "print(, file=)"? +make: *** [Makefile:372: install-zenmap] Error 1 +``` + +This is because Python 3 doesn't support Python 2-style print without +parentheses, or specifying the output file in that manner. + +Signed-off-by: Sam James +--- a/zenmap/setup.py ++++ b/zenmap/setup.py +@@ -215,13 +215,13 @@ def create_uninstaller(self): + #!/usr/bin/env python3 + import errno, os, os.path, sys + +-print 'Uninstall %(name)s %(version)s' ++print('Uninstall %(name)s %(version)s') + + answer = raw_input('Are you sure that you want to uninstall ' + '%(name)s %(version)s? (yes/no) ') + + if answer != 'yes' and answer != 'y': +- print 'Not uninstalling.' ++ print('Not uninstalling.') + sys.exit(0) + + """ % {'name': APP_DISPLAY_NAME, 'version': VERSION} +@@ -237,8 +237,8 @@ def create_uninstaller(self): + # This should never happen (everything gets installed + # inside the root), but if it does, be safe and don't + # delete anything. +- uninstaller += ("print '%s was not installed inside " +- "the root %s; skipping.'\n" % (output, self.root)) ++ uninstaller += ("print('%s was not installed inside " ++ "the root %s; skipping.')\n" % (output, self.root)) + continue + output = path_strip_prefix(output, self.root) + assert os.path.isabs(output) +@@ -262,24 +262,24 @@ def create_uninstaller(self): + dirs.append(path) + # Delete the files. + for file in files: +- print "Removing '%s'." % file ++ print("Removing '%s'." % file) + try: + os.remove(file) + except OSError as e: +- print >> sys.stderr, ' Error: %s.' % str(e) ++ print(' Error: %s.' % str(e), file=sys.stderr) + # Delete the directories. First reverse-sort the normalized paths by + # length so that child directories are deleted before their parents. + dirs = [os.path.normpath(dir) for dir in dirs] + dirs.sort(key = len, reverse = True) + for dir in dirs: + try: +- print "Removing the directory '%s'." % dir ++ print("Removing the directory '%s'." % dir) + os.rmdir(dir) + except OSError as e: + if e.errno == errno.ENOTEMPTY: +- print "Directory '%s' not empty; not removing." % dir ++ print("Directory '%s' not empty; not removing." % dir) + else: +- print >> sys.stderr, str(e) ++ print(str(e), file=sys.stderr) + """ + + uninstaller_file = open(uninstaller_filename, 'w') +@@ -419,7 +419,7 @@ def write_installed_files(self): + with open(INSTALLED_FILES_NAME, "w") as f: + for output in self.get_installed_files(): + assert "\n" not in output +- print >> f, output ++ print(output, file=f) + + + class my_uninstall(Command): + diff --git a/net-analyzer/nmap/metadata.xml b/net-analyzer/nmap/metadata.xml index 25a709611821..92acf338fc61 100644 --- a/net-analyzer/nmap/metadata.xml +++ b/net-analyzer/nmap/metadata.xml @@ -16,10 +16,12 @@ Enable SSH support through net-libs/libssh2 Install the ncat utility + Install the ndiff utility Install the nping utility Include support for the Nmap Scripting Engine (NSE) Install symlink to nc Use dev-lang/lua instead of the bundled liblua + Install the GTK+ based nmap GUI, zenmap nmap/nmap diff --git a/net-analyzer/nmap/nmap-9999.ebuild b/net-analyzer/nmap/nmap-9999.ebuild index 7fc911c6d87a..4588e1d360ac 100644 --- a/net-analyzer/nmap/nmap-9999.ebuild +++ b/net-analyzer/nmap/nmap-9999.ebuild @@ -6,7 +6,9 @@ EAPI=8 LUA_COMPAT=( lua5-3 ) LUA_REQ_USE="deprecated" PYTHON_COMPAT=( python3_{8..11} ) -inherit autotools lua-single python-any-r1 toolchain-funcs +PLOCALES="de es fr hi hr hu id it ja pl pt_BR pt_PR ro ru sk zh" +PLOCALE_BACKUP="en" +inherit autotools lua-single plocale python-single-r1 toolchain-funcs DESCRIPTION="Network exploration tool and security / port scanner" HOMEPAGE="https://nmap.org/" @@ -27,8 +29,9 @@ fi LICENSE="|| ( NPSL GPL-2 )" SLOT="0" -IUSE="ipv6 libssh2 ncat nping +nse ssl symlink +system-lua" +IUSE="ipv6 libssh2 ncat ndiff nping nls +nse ssl symlink +system-lua zenmap" REQUIRED_USE=" + ${PYTHON_REQUIRED_USE} system-lua? ( nse ${LUA_REQUIRED_USE} ) symlink? ( ncat ) " @@ -37,12 +40,14 @@ RDEPEND=" dev-libs/liblinear:= dev-libs/libpcre net-libs/libpcap + ndiff? ( ${PYTHON_DEPS} ) libssh2? ( net-libs/libssh2[zlib] sys-libs/zlib ) + nls? ( virtual/libintl ) nse? ( sys-libs/zlib ) - ssl? ( dev-libs/openssl:0= ) + ssl? ( dev-libs/openssl:= ) symlink? ( ncat? ( !net-analyzer/netcat @@ -50,11 +55,18 @@ RDEPEND=" ) ) system-lua? ( ${LUA_DEPS} ) + zenmap? ( + ${PYTHON_DEPS} + $(python_gen_cond_dep ' + dev-python/pygobject:3[${PYTHON_USEDEP}] + ') + ) " DEPEND="${RDEPEND}" BDEPEND=" ${PYTHON_DEPS} virtual/pkgconfig + nls? ( sys-devel/gettext ) " if [[ ${PV} != *9999* ]] ; then @@ -72,20 +84,30 @@ PATCHES=( "${FILESDIR}"/${PN}-7.80-ac-config-subdirs.patch "${FILESDIR}"/${PN}-7.91-no-FORTIFY_SOURCE.patch "${FILESDIR}"/${PN}-9999-netutil-else.patch + "${FILESDIR}"/${PN}-9999-python3.patch ) pkg_setup() { - python-any-r1_pkg_setup + python-single-r1_pkg_setup use system-lua && lua-single_pkg_setup } src_prepare() { + default + + # Drop bundled libraries rm -r liblinear/ libpcap/ libpcre/ libssh2/ libz/ || die cat "${FILESDIR}"/nls.m4 >> "${S}"/acinclude.m4 || die - default + delete_disabled_locale() { + # Force here as PLOCALES contains supported locales for man + # pages and zenmap doesn't have all of those + rm -rf zenmap/share/zenmap/locale/${1} || die + rm -f zenmap/share/zenmap/locale/${1}.po || die + } + plocale_for_each_disabled_locale delete_disabled_locale sed -i \ -e '/^ALL_LINGUAS =/{s|$| id|g;s|jp|ja|g}' \ @@ -105,23 +127,27 @@ src_configure() { export ac_cv_path_PYTHON="${PYTHON}" export am_cv_pathless_PYTHON="${EPYTHON}" - # The bundled libdnet is incompatible with the version available in the - # tree, so we cannot use the system library here. - econf \ - $(use_enable ipv6) \ - $(use_with libssh2) \ - $(use_with ncat) \ - $(use_with nping) \ - $(use_with ssl openssl) \ - $(usex libssh2 --with-zlib) \ - $(usex nse --with-liblua=$(usex system-lua yes included '' '') --without-liblua) \ - $(usex nse --with-zlib) \ - --cache-file="${S}"/config.cache \ - --with-libdnet=included \ - --with-pcre="${ESYSROOT}"/usr \ - --without-dpdk \ - --without-ndiff \ - --without-zenmap + local myeconfargs=( + $(use_enable ipv6) + $(use_enable nls) + $(use_with libssh2) + $(use_with ncat) + $(use_with ndiff) + $(use_with nping) + $(use_with ssl openssl) + $(use_with zenmap) + $(usex libssh2 --with-zlib) + $(usex nse --with-liblua=$(usex system-lua yes included '' '') --without-liblua) + $(usex nse --with-zlib) + --cache-file="${S}"/config.cache + # The bundled libdnet is incompatible with the version available in the + # tree, so we cannot use the system library here. + --with-libdnet=included + --with-pcre="${ESYSROOT}"/usr + --without-dpdk + ) + + econf "${myeconfargs[@]}" } src_compile() { @@ -146,5 +172,9 @@ src_install() { dodoc CHANGELOG HACKING docs/README docs/*.txt + if use ndiff || use zenmap ; then + python_optimize + fi + use symlink && dosym /usr/bin/ncat /usr/bin/nc }