commit:     e165e102e112609de700e78b2fb6d4145ab4a6fe
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Jul  1 04:08:32 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jul  2 02:27:00 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e165e102

sys-libs/libxcrypt: switch to pre-generated autotools tarballs

There are actually *two* circular dependencies involving Perl:

1) Use self-generated (for now) `make dist` tarballs to avoid a circular
   dependency with libxcrypt->automake->perl->libxcrypt.

   (Thanks juippis and floppym! We noticed this because juippis hit an
   interesting edge case when using binpkgs.)

2) We initially tried to pre-generate the results of a Perl tool called
   during `./configure` in order to avoid unconditionally needing
   Perl.

   (I thought we could do this because the input is constant for all of the
   Gentoo build variants - for now.

   I later realised there's other Perl usage which we're stuck with
   for now without pre-generating a *lot*.)

   (Thanks mattst88! We noticed this while digging into suggestions
   for upstream.)

So, for now, we're just fixing 1), and adding a BDEPEND on Perl for 2) to
make it explicit.

(Both best explained within the comments of the ebuild.)

Bug: https://bugs.gentoo.org/699422
Closes: https://github.com/gentoo/gentoo/pull/21493
Reported-by: Joonas Niilola <juippis <AT> gentoo.org>
Reported-by: Mike Gilbert <floppym <AT> gentoo.org>
Reported-by: Matt Turner <mattst88 <AT> gentoo.org>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/libxcrypt/Manifest                |  4 +-
 sys-libs/libxcrypt/libxcrypt-4.4.20.ebuild | 80 +++++++++++++++++++++++-------
 sys-libs/libxcrypt/libxcrypt-4.4.23.ebuild | 80 +++++++++++++++++++++++-------
 3 files changed, 126 insertions(+), 38 deletions(-)

diff --git a/sys-libs/libxcrypt/Manifest b/sys-libs/libxcrypt/Manifest
index a78fbfa475e..5d96aee67a9 100644
--- a/sys-libs/libxcrypt/Manifest
+++ b/sys-libs/libxcrypt/Manifest
@@ -1,2 +1,2 @@
-DIST libxcrypt-4.4.20.tar.gz 534367 BLAKE2B 
9174bd342dc13db8fd724a13e3fbd222a0f5e2d058be2d7f511816e137fa61bd73d4b9482c85d81f27404d0e650be59c45f25d70ec3c506730d2422da4e97417
 SHA512 
66b1966003427728f96d5a83f75930a4b82d31133392bede3975cf9a1e1423d0312e73da598e40d0e3507f26fac5222cc92d7a5593f2b737d8557a5d4bf2461e
-DIST libxcrypt-4.4.23.tar.gz 536009 BLAKE2B 
b7311dec9e528abf6229f6c105e806a31a1e525e71d26252c8f30a3e1dbd61a7752b7303bd167d9ddc99b04261f02e3c7b50cc36bbc3348a337f4089f6e1c6f3
 SHA512 
4d5854a082a8c707416507611881c1407f0ea0bda0557c5f7ae6b70d8dd1c7a0828afe29d8f2e7754f5f97b824aaa03671dae6d4dad329fcd131b94b77ddb713
+DIST libxcrypt-4.4.20-autotools.tar.xz 628688 BLAKE2B 
4c23af2a765495758e52c8e95d53d1c1d911fea011375160c4f10e468939734fcc7198cc327fafa4d5c90afa6d4c56dfe6d1b56c2c17bbc015b44cffcd7bcc8b
 SHA512 
5b7504e9d83df12af7d11864e88d1034ed9ce0a837ef061044c5c7fe603d7f3e5613ddf20b30613a7943735120cd058f2117401d59879afcba34ce0e48ae62ee
+DIST libxcrypt-4.4.23-autotools.tar.xz 630204 BLAKE2B 
a1c82906f59f6d0ed8f00de8fecf2c3c20608f0e3422bc0692b290c4eefd536019395e28b380031ae16be4ef37671327aca20dc63ca0367f73c2e85dfa5e3199
 SHA512 
30acea7e643a87d2c032c97ad8ca6c8c445c2e4af66d22906e332311a5b54a6905cc7ca74af7215a2e9ca362e1af2a8a3be8b3e0f0872f42ce0e5ea3e63bad46

diff --git a/sys-libs/libxcrypt/libxcrypt-4.4.20.ebuild 
b/sys-libs/libxcrypt/libxcrypt-4.4.20.ebuild
index 5a243d6f08f..21e04f39678 100644
--- a/sys-libs/libxcrypt/libxcrypt-4.4.20.ebuild
+++ b/sys-libs/libxcrypt/libxcrypt-4.4.20.ebuild
@@ -2,34 +2,38 @@
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
-PYTHON_COMPAT=( python3_{7..9} )
-inherit autotools multibuild python-any-r1 multilib-minimal
+
+PYTHON_COMPAT=( python3_{8..9} )
+# NEED_BOOTSTRAP is for developers to quickly generate a tarball
+# for publishing to the tree.
+NEED_BOOTSTRAP="no"
+inherit multibuild python-any-r1 multilib-minimal
 
 DESCRIPTION="Extended crypt library for descrypt, md5crypt, bcrypt, and others"
-SRC_URI="https://github.com/besser82/${PN}/archive/v${PV}.tar.gz -> 
${P}.tar.gz"
 HOMEPAGE="https://github.com/besser82/libxcrypt";
+if [[ ${NEED_BOOTSTRAP} == "yes" ]] ; then
+       inherit autotools
+       SRC_URI="https://github.com/besser82/${PN}/archive/v${PV}.tar.gz -> 
${P}.tar.gz"
+else
+       
SRC_URI="https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${P}-autotools.tar.xz";
+fi
 
 LICENSE="LGPL-2.1+ public-domain BSD BSD-2"
 SLOT="0/1"
 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 ~riscv ~s390 sparc 
x86"
 IUSE="+compat split-usr +static-libs system test"
+REQUIRED_USE="split-usr? ( system )"
+RESTRICT="!test? ( test )"
 
 DEPEND="system? (
                elibc_glibc? ( sys-libs/glibc[-crypt(+)] )
                !sys-libs/musl
        )"
 RDEPEND="${DEPEND}"
-BDEPEND="sys-apps/findutils
+BDEPEND="dev-lang/perl
+       sys-apps/findutils
        test? ( $(python_gen_any_dep 'dev-python/passlib[${PYTHON_USEDEP}]') )"
 
-RESTRICT="!test? ( test )"
-
-REQUIRED_USE="split-usr? ( system )"
-
-PATCHES=(
-       "${FILESDIR}/libxcrypt-4.4.19-multibuild.patch"
-)
-
 python_check_deps() {
        has_version -b "dev-python/passlib[${PYTHON_USEDEP}]"
 }
@@ -45,7 +49,47 @@ pkg_setup() {
 
 src_prepare() {
        default
-       eautoreconf
+
+       # WARNING: Please read on bumping or applying patches!
+       #
+       # There are two circular dependencies to be aware of:
+       # 1)
+       #       if we're bootstrapping configure and makefiles:
+       #               libxcrypt -> automake -> perl -> libxcrypt
+       #
+       #   mitigation:
+       #               toolchain@ manually runs `make dist` after running 
autoconf + `./configure`
+       #               and the ebuild uses that.
+       #               (Don't include the pre-generated Perl artefacts.)
+       #
+       #       solution for future:
+       #               Upstream are working on producing `make dist` tarballs.
+       #               
https://github.com/besser82/libxcrypt/issues/134#issuecomment-871833573
+       #
+       # 2)
+       #       configure *unconditionally* needs Perl at build time to generate
+       #       a list of enabled algorithms based on the set passed to 
`configure`:
+       #               libxcrypt -> perl -> libxcrypt
+       #
+       #       mitigation:
+       #               None at the moment.
+       #
+       #       solution for future:
+       #               Not possible right now. Upstream intend on depending on 
Perl for further
+       #               configuration options.
+       #               
https://github.com/besser82/libxcrypt/issues/134#issuecomment-871833573
+       #
+       # Therefore, on changes (inc. bumps):
+       #       * You must check whether upstream have started providing 
tarballs with bootstrapped
+       #         auto{conf,make};
+       #
+       #       * diff the build system changes!
+       #
+       if [[ ${NEED_BOOTSTRAP} == "yes" ]] ; then
+               # Facilitate our split variant build for compat + non-compat
+               eapply "${FILESDIR}"/${PN}-4.4.19-multibuild.patch
+               eautoreconf
+       fi
 }
 
 src_configure() {
@@ -112,7 +156,7 @@ src_install() {
                done
        ) || die "failglob error"
 
-       # remove useless stuff from installation
+       # Remove useless stuff from installation
        find "${D}"/usr/share/doc/${PF} -type l -delete || die
        find "${D}" -name '*.la' -delete || die
 }
@@ -120,7 +164,7 @@ src_install() {
 multilib_src_install() {
        emake DESTDIR="${D}" install
 
-       # don't install the libcrypt.so symlink for the "compat" version
+       # Don't install the libcrypt.so symlink for the "compat" version
        case "${MULTIBUILD_ID}" in
                xcrypt_compat-*)
                        rm "${D}"$(get_xclibdir)/libcrypt$(get_libname) \
@@ -131,14 +175,14 @@ multilib_src_install() {
                                (
                                        if use static-libs; then
                                                # .a files are installed to 
/$(get_libdir) by default
-                                               # move static libraries to /usr 
prefix or portage will abort
+                                               # Move static libraries to /usr 
prefix or portage will abort
                                                shopt -s nullglob || die 
"failglob failed"
                                                static_libs=( 
"${ED}"/$(get_xclibdir)/*.a )
 
                                                if [[ -n ${static_libs[*]} ]]; 
then
                                                        dodir 
"/usr/$(get_xclibdir)"
                                                        mv "${static_libs[@]}" 
"${D}/usr/$(get_xclibdir)" \
-                                                               || die "moving 
static libs failed"
+                                                               || die "Moving 
static libs failed"
                                                fi
                                        fi
 
@@ -153,7 +197,7 @@ multilib_src_install() {
                                                        dosym 
"../../$(get_libdir)/${lib_file_target}" 
"/usr/$(get_xclibdir)/${lib_file_basename}"
                                                done
 
-                                               rm 
"${ED}"$(get_xclibdir)/*$(get_libname) || die "removing symlinks in incorrect 
location failed"
+                                               rm 
"${ED}"$(get_xclibdir)/*$(get_libname) || die "Removing symlinks in incorrect 
location failed"
                                        fi
                                )
                        fi

diff --git a/sys-libs/libxcrypt/libxcrypt-4.4.23.ebuild 
b/sys-libs/libxcrypt/libxcrypt-4.4.23.ebuild
index 375a789a839..d03062b4d64 100644
--- a/sys-libs/libxcrypt/libxcrypt-4.4.23.ebuild
+++ b/sys-libs/libxcrypt/libxcrypt-4.4.23.ebuild
@@ -2,34 +2,38 @@
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
-PYTHON_COMPAT=( python3_{7..10} )
-inherit autotools multibuild python-any-r1 multilib-minimal
+
+PYTHON_COMPAT=( python3_{8..10} )
+# NEED_BOOTSTRAP is for developers to quickly generate a tarball
+# for publishing to the tree.
+NEED_BOOTSTRAP="no"
+inherit multibuild python-any-r1 multilib-minimal
 
 DESCRIPTION="Extended crypt library for descrypt, md5crypt, bcrypt, and others"
-SRC_URI="https://github.com/besser82/${PN}/archive/v${PV}.tar.gz -> 
${P}.tar.gz"
 HOMEPAGE="https://github.com/besser82/libxcrypt";
+if [[ ${NEED_BOOTSTRAP} == "yes" ]] ; then
+       inherit autotools
+       SRC_URI="https://github.com/besser82/${PN}/archive/v${PV}.tar.gz -> 
${P}.tar.gz"
+else
+       
SRC_URI="https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${P}-autotools.tar.xz";
+fi
 
 LICENSE="LGPL-2.1+ public-domain BSD BSD-2"
 SLOT="0/1"
 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 
~sparc ~x86"
 IUSE="+compat split-usr +static-libs system test"
+REQUIRED_USE="split-usr? ( system )"
+RESTRICT="!test? ( test )"
 
 DEPEND="system? (
                elibc_glibc? ( sys-libs/glibc[-crypt(+)] )
                !sys-libs/musl
        )"
 RDEPEND="${DEPEND}"
-BDEPEND="sys-apps/findutils
+BDEPEND="dev-lang/perl
+       sys-apps/findutils
        test? ( $(python_gen_any_dep 'dev-python/passlib[${PYTHON_USEDEP}]') )"
 
-RESTRICT="!test? ( test )"
-
-REQUIRED_USE="split-usr? ( system )"
-
-PATCHES=(
-       "${FILESDIR}/libxcrypt-4.4.19-multibuild.patch"
-)
-
 python_check_deps() {
        has_version -b "dev-python/passlib[${PYTHON_USEDEP}]"
 }
@@ -45,7 +49,47 @@ pkg_setup() {
 
 src_prepare() {
        default
-       eautoreconf
+
+       # WARNING: Please read on bumping or applying patches!
+       #
+       # There are two circular dependencies to be aware of:
+       # 1)
+       #       if we're bootstrapping configure and makefiles:
+       #               libxcrypt -> automake -> perl -> libxcrypt
+       #
+       #   mitigation:
+       #               toolchain@ manually runs `make dist` after running 
autoconf + `./configure`
+       #               and the ebuild uses that.
+       #               (Don't include the pre-generated Perl artefacts.)
+       #
+       #       solution for future:
+       #               Upstream are working on producing `make dist` tarballs.
+       #               
https://github.com/besser82/libxcrypt/issues/134#issuecomment-871833573
+       #
+       # 2)
+       #       configure *unconditionally* needs Perl at build time to generate
+       #       a list of enabled algorithms based on the set passed to 
`configure`:
+       #               libxcrypt -> perl -> libxcrypt
+       #
+       #       mitigation:
+       #               None at the moment.
+       #
+       #       solution for future:
+       #               Not possible right now. Upstream intend on depending on 
Perl for further
+       #               configuration options.
+       #               
https://github.com/besser82/libxcrypt/issues/134#issuecomment-871833573
+       #
+       # Therefore, on changes (inc. bumps):
+       #       * You must check whether upstream have started providing 
tarballs with bootstrapped
+       #         auto{conf,make};
+       #
+       #       * diff the build system changes!
+       #
+       if [[ ${NEED_BOOTSTRAP} == "yes" ]] ; then
+               # Facilitate our split variant build for compat + non-compat
+               eapply "${FILESDIR}"/${PN}-4.4.19-multibuild.patch
+               eautoreconf
+       fi
 }
 
 src_configure() {
@@ -112,7 +156,7 @@ src_install() {
                done
        ) || die "failglob error"
 
-       # remove useless stuff from installation
+       # Remove useless stuff from installation
        find "${D}"/usr/share/doc/${PF} -type l -delete || die
        find "${D}" -name '*.la' -delete || die
 }
@@ -120,7 +164,7 @@ src_install() {
 multilib_src_install() {
        emake DESTDIR="${D}" install
 
-       # don't install the libcrypt.so symlink for the "compat" version
+       # Don't install the libcrypt.so symlink for the "compat" version
        case "${MULTIBUILD_ID}" in
                xcrypt_compat-*)
                        rm "${D}"$(get_xclibdir)/libcrypt$(get_libname) \
@@ -131,14 +175,14 @@ multilib_src_install() {
                                (
                                        if use static-libs; then
                                                # .a files are installed to 
/$(get_libdir) by default
-                                               # move static libraries to /usr 
prefix or portage will abort
+                                               # Move static libraries to /usr 
prefix or portage will abort
                                                shopt -s nullglob || die 
"failglob failed"
                                                static_libs=( 
"${ED}"/$(get_xclibdir)/*.a )
 
                                                if [[ -n ${static_libs[*]} ]]; 
then
                                                        dodir 
"/usr/$(get_xclibdir)"
                                                        mv "${static_libs[@]}" 
"${D}/usr/$(get_xclibdir)" \
-                                                               || die "moving 
static libs failed"
+                                                               || die "Moving 
static libs failed"
                                                fi
                                        fi
 
@@ -153,7 +197,7 @@ multilib_src_install() {
                                                        dosym 
"../../$(get_libdir)/${lib_file_target}" 
"/usr/$(get_xclibdir)/${lib_file_basename}"
                                                done
 
-                                               rm 
"${ED}"$(get_xclibdir)/*$(get_libname) || die "removing symlinks in incorrect 
location failed"
+                                               rm 
"${ED}"$(get_xclibdir)/*$(get_libname) || die "Removing symlinks in incorrect 
location failed"
                                        fi
                                )
                        fi

Reply via email to