app-antivirus/clamav: rev bump
authorThomas Deutschmann <whissi@gentoo.org>
Fri, 20 Mar 2020 23:14:09 +0000 (00:14 +0100)
committerThomas Deutschmann <whissi@gentoo.org>
Fri, 20 Mar 2020 23:48:58 +0000 (00:48 +0100)
- Migrate to EAPI 7.

- Fix USE=libclamav-only.

- Set proper REQUIRED_USE to indicate that USE=libclamav-only
  will really only install libs.

- Install HTML docs only when USE=doc is set.

Closes: https://bugs.gentoo.org/709616
Package-Manager: Portage-2.3.94, Repoman-2.3.21
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
app-antivirus/clamav/clamav-0.102.2-r1.ebuild [moved from app-antivirus/clamav/clamav-0.102.2.ebuild with 50% similarity]
app-antivirus/clamav/files/clamav-0.102.2-fix-curl-detection.patch [new file with mode: 0644]

similarity index 50%
rename from app-antivirus/clamav/clamav-0.102.2.ebuild
rename to app-antivirus/clamav/clamav-0.102.2-r1.ebuild
index 1aa121ef78fe8ab830293811b3701fef197e647d..1c7040145e40f5e0e3f2861906cbae88e09546dd 100644 (file)
@@ -1,9 +1,9 @@
 # Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=6
+EAPI=7
 
-inherit autotools eutils flag-o-matic ltprune systemd
+inherit autotools flag-o-matic systemd
 
 DESCRIPTION="Clam Anti-Virus Scanner"
 HOMEPAGE="https://www.clamav.net/"
@@ -13,6 +13,9 @@ LICENSE="GPL-2"
 SLOT="0"
 KEYWORDS="~alpha amd64 arm arm64 hppa ia64 ppc ppc64 ~sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~sparc-solaris ~x86-solaris"
 IUSE="bzip2 doc clamdtop clamsubmit iconv ipv6 libclamav-only libressl milter metadata-analysis-api selinux static-libs test uclibc xml"
+
+REQUIRED_USE="libclamav-only? ( !clamdtop !clamsubmit !milter !metadata-analysis-api )"
+
 RESTRICT="!test? ( test )"
 
 # Require acct-{user,group}/clamav at build time so that we can set
@@ -20,37 +23,33 @@ RESTRICT="!test? ( test )"
 # pkg_postinst; calling "chown" on the live filesystem scares me.
 CDEPEND="acct-group/clamav
        acct-user/clamav
+       dev-libs/libltdl
+       dev-libs/libmspack
+       || ( dev-libs/libpcre2 >dev-libs/libpcre-6 )
+       >=sys-libs/zlib-1.2.2:=
        bzip2? ( app-arch/bzip2 )
        clamdtop? ( sys-libs/ncurses:0 )
+       clamsubmit? ( net-misc/curl dev-libs/json-c:= )
+       elibc_musl? ( sys-libs/fts-standalone )
        iconv? ( virtual/libiconv )
-       metadata-analysis-api? ( dev-libs/json-c:= )
-       milter? ( || ( mail-filter/libmilter mail-mta/sendmail ) )
-       >=sys-libs/zlib-1.2.2:=
+       !libclamav-only? ( net-misc/curl )
        !libressl? ( dev-libs/openssl:0= )
        libressl? ( dev-libs/libressl:0= )
-       dev-libs/libltdl
-       || ( dev-libs/libpcre2 >dev-libs/libpcre-6 )
-       dev-libs/libmspack
-       xml? ( dev-libs/libxml2 )
-       elibc_musl? ( sys-libs/fts-standalone )
-       !libclamav-only? ( net-misc/curl )
-       clamsubmit? ( net-misc/curl dev-libs/json-c:= )"
-REQUIRED_USE="
-       libclamav-only? ( !clamsubmit )
-       clamsubmit? ( !libclamav-only )
-"
+       milter? ( || ( mail-filter/libmilter mail-mta/sendmail ) )
+       xml? ( dev-libs/libxml2 )"
+
+BDEPEND="virtual/pkgconfig"
 
 DEPEND="${CDEPEND}
-       virtual/pkgconfig
+       metadata-analysis-api? ( dev-libs/json-c:* )
        test? ( dev-libs/check )"
 RDEPEND="${CDEPEND}
        selinux? ( sec-policy/selinux-clamav )"
 
-HTML_DOCS=( docs/html/. )
-
 PATCHES=(
        "${FILESDIR}/${PN}-0.101.2-tinfo.patch" #670729
        "${FILESDIR}/${PN}-0.102.1-libxml2_pkgconfig.patch" #661328
+       "${FILESDIR}/${PN}-0.102.2-fix-curl-detection.patch" #709616
 )
 
 src_prepare() {
@@ -106,79 +105,94 @@ src_install() {
        default
 
        rm -rf "${ED}"/var/lib/clamav || die
-       newinitd "${FILESDIR}"/clamd.initd-r6 clamd
-       newconfd "${FILESDIR}"/clamd.conf-r1 clamd
-
-       systemd_dotmpfilesd "${FILESDIR}/tmpfiles.d/clamav.conf"
-       systemd_newunit "${FILESDIR}/clamd_at.service" "clamd@.service"
-       systemd_dounit "${FILESDIR}/clamd.service"
-       systemd_dounit "${FILESDIR}/freshclamd.service"
-
-       insinto /etc/logrotate.d
-       newins "${FILESDIR}"/clamav.logrotate clamav
-
-       # Modify /etc/{clamd,freshclam}.conf to be usable out of the box
-       sed -i -e "s:^\(Example\):\# \1:" \
-               -e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/var/run/clamav/clamd.pid:" \
-               -e "s:.*\(LocalSocket\) .*:\1 ${EPREFIX}/var/run/clamav/clamd.sock:" \
-               -e "s:.*\(User\) .*:\1 clamav:" \
-               -e "s:^\#\(LogFile\) .*:\1 ${EPREFIX}/var/log/clamav/clamd.log:" \
-               -e "s:^\#\(LogTime\).*:\1 yes:" \
-               -e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
-               -e "s:^\#\(DatabaseDirectory\).*:\1 /var/lib/clamav:" \
-               "${ED}"/etc/clamd.conf.sample || die
-       sed -i -e "s:^\(Example\):\# \1:" \
-               -e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/var/run/clamav/freshclam.pid:" \
-               -e "s:.*\(DatabaseOwner\) .*:\1 clamav:" \
-               -e "s:^\#\(UpdateLogFile\) .*:\1 ${EPREFIX}/var/log/clamav/freshclam.log:" \
-               -e "s:^\#\(NotifyClamd\).*:\1 ${EPREFIX}/etc/clamd.conf:" \
-               -e "s:^\#\(ScriptedUpdates\).*:\1 yes:" \
-               -e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
-               -e "s:^\#\(DatabaseDirectory\).*:\1 /var/lib/clamav:" \
-               "${ED}"/etc/freshclam.conf.sample || die
 
-       if use milter ; then
-               # MilterSocket one to include ' /' because there is a 2nd line for
-               # inet: which we want to leave
-               ##dodoc "${FILESDIR}"/clamav-milter.README.gentoo
+       if ! use libclamav-only ; then
+               newinitd "${FILESDIR}"/clamd.initd-r6 clamd
+               newconfd "${FILESDIR}"/clamd.conf-r1 clamd
+
+               systemd_dotmpfilesd "${FILESDIR}/tmpfiles.d/clamav.conf"
+               systemd_newunit "${FILESDIR}/clamd_at.service" "clamd@.service"
+               systemd_dounit "${FILESDIR}/clamd.service"
+               systemd_dounit "${FILESDIR}/freshclamd.service"
+
+               insinto /etc/logrotate.d
+               newins "${FILESDIR}"/clamav.logrotate clamav
+
+               # Modify /etc/{clamd,freshclam}.conf to be usable out of the box
                sed -i -e "s:^\(Example\):\# \1:" \
-                       -e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/var/run/clamav/clamav-milter.pid:" \
-                       -e "s+^\#\(ClamdSocket\) .*+\1 unix:${EPREFIX}/var/run/clamav/clamd.sock+" \
+                       -e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/var/run/clamav/clamd.pid:" \
+                       -e "s:.*\(LocalSocket\) .*:\1 ${EPREFIX}/var/run/clamav/clamd.sock:" \
                        -e "s:.*\(User\) .*:\1 clamav:" \
-                       -e "s+^\#\(MilterSocket\) /.*+\1 unix:${EPREFIX}/var/run/clamav/clamav-milter.sock+" \
+                       -e "s:^\#\(LogFile\) .*:\1 ${EPREFIX}/var/log/clamav/clamd.log:" \
+                       -e "s:^\#\(LogTime\).*:\1 yes:" \
                        -e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
-                       -e "s:^\#\(LogFile\) .*:\1 ${EPREFIX}/var/log/clamav/clamav-milter.log:" \
-                       "${ED}"/etc/clamav-milter.conf.sample || die
-               cat >> "${ED}"/etc/conf.d/clamd <<-EOF
-                       MILTER_NICELEVEL=19
-                       START_MILTER=no
-               EOF
-
-               systemd_newunit "${FILESDIR}/clamav-milter.service-r1" clamav-milter.service
-       fi
+                       -e "s:^\#\(DatabaseDirectory\).*:\1 /var/lib/clamav:" \
+                       "${ED}"/etc/clamd.conf.sample || die
 
-       if use doc; then
-          einstalldocs
-          doman docs/man/*.[1-8]
+               sed -i -e "s:^\(Example\):\# \1:" \
+                       -e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/var/run/clamav/freshclam.pid:" \
+                       -e "s:.*\(DatabaseOwner\) .*:\1 clamav:" \
+                       -e "s:^\#\(UpdateLogFile\) .*:\1 ${EPREFIX}/var/log/clamav/freshclam.log:" \
+                       -e "s:^\#\(NotifyClamd\).*:\1 ${EPREFIX}/etc/clamd.conf:" \
+                       -e "s:^\#\(ScriptedUpdates\).*:\1 yes:" \
+                       -e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
+                       -e "s:^\#\(DatabaseDirectory\).*:\1 /var/lib/clamav:" \
+                       "${ED}"/etc/freshclam.conf.sample || die
+
+               if use milter ; then
+                       # MilterSocket one to include ' /' because there is a 2nd line for
+                       # inet: which we want to leave
+                       ##dodoc "${FILESDIR}"/clamav-milter.README.gentoo
+                       sed -i -e "s:^\(Example\):\# \1:" \
+                               -e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/var/run/clamav/clamav-milter.pid:" \
+                               -e "s+^\#\(ClamdSocket\) .*+\1 unix:${EPREFIX}/var/run/clamav/clamd.sock+" \
+                               -e "s:.*\(User\) .*:\1 clamav:" \
+                               -e "s+^\#\(MilterSocket\) /.*+\1 unix:${EPREFIX}/var/run/clamav/clamav-milter.sock+" \
+                               -e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
+                               -e "s:^\#\(LogFile\) .*:\1 ${EPREFIX}/var/log/clamav/clamav-milter.log:" \
+                               "${ED}"/etc/clamav-milter.conf.sample || die
+
+                       cat >> "${ED}"/etc/conf.d/clamd <<-EOF
+                               MILTER_NICELEVEL=19
+                               START_MILTER=no
+                       EOF
+
+                       systemd_newunit "${FILESDIR}/clamav-milter.service-r1" clamav-milter.service
+               fi
+
+               local i
+               for i in clamd freshclam clamav-milter
+               do
+                       if [[ -f "${ED}"/etc/"${i}".conf.sample ]]; then
+                               mv "${ED}"/etc/"${i}".conf{.sample,} || die
+                       fi
+               done
+
+               # These both need to be writable by the clamav user.
+               # TODO: use syslog by default; that's what it's for.
+               diropts -o clamav -g clamav
+               keepdir /var/lib/clamav
+               keepdir /var/log/clamav
        fi
 
-       for i in clamd freshclam clamav-milter
-       do
-               if [[ -f "${D}"/etc/"${i}".conf.sample ]]; then
-                       mv "${D}"/etc/"${i}".conf{.sample,} || die
-               fi
-       done
+       if use doc ; then
+               local HTML_DOCS=( docs/html/. )
+               einstalldocs
 
-       prune_libtool_files --all
+               if ! use libclamav-only ; then
+                       doman docs/man/*.[1-8]
+               fi
+       fi
 
-       # These both need to be writable by the clamav user.
-       # TODO: use syslog by default; that's what it's for.
-       diropts -o clamav -g clamav
-       keepdir /var/lib/clamav
-       keepdir /var/log/clamav
+       find "${ED}" -name '*.la' -delete || die
 }
 
 src_test() {
+       if use libclamav-only ; then
+               ewarn "Test target not available when USE=libclamav-only is set, skipping tests ..."
+               return 0
+       fi
+
        emake quick-check
 }
 
@@ -187,11 +201,13 @@ pkg_postinst() {
                elog "For simple instructions how to setup the clamav-milter read the"
                elog "clamav-milter.README.gentoo in /usr/share/doc/${PF}"
        fi
-       local databases=( "${ROOT}"var/lib/clamav/main.c[lv]d )
+
+       local databases=( "${EROOT}"/var/lib/clamav/main.c[lv]d )
        if [[ ! -f "${databases}" ]] ; then
                ewarn "You must run freshclam manually to populate the virus database"
                ewarn "before starting clamav for the first time."
        fi
+
        elog "For instructions on how to use clamonacc, see"
        elog
        elog "  https://www.clamav.net/documents/on-access-scanning"
diff --git a/app-antivirus/clamav/files/clamav-0.102.2-fix-curl-detection.patch b/app-antivirus/clamav/files/clamav-0.102.2-fix-curl-detection.patch
new file mode 100644 (file)
index 0000000..f89a704
--- /dev/null
@@ -0,0 +1,26 @@
+https://bugs.gentoo.org/709616
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -197,6 +197,10 @@ AC_CONFIG_FILES([
+                  clamav-types.h
+                  clamav-version.h])
+ if test "x$enable_libclamav_only" != "xyes"; then
++    if test "$have_curl" = "no"; then
++        AC_MSG_ERROR([libcurl not found. libcurl (e.g. libcurl-devel) is required in order to build freshclam and clamsubmit.])
++    fi
++
+     AC_CONFIG_FILES([
+                      clamscan/Makefile
+                      database/Makefile
+--- a/m4/reorganization/libs/curl.m4
++++ b/m4/reorganization/libs/curl.m4
+@@ -92,8 +92,6 @@ if test "X$have_curl" = "Xyes"; then
+     )
+     LDFLAGS="$save_LDFLAGS"
+-else
+-    AC_MSG_ERROR([libcurl not found. libcurl (e.g. libcurl-devel) is required in order to build freshclam and clamsubmit.])
+ fi
+ AC_SUBST([CLAMSUBMIT_LIBS])