Hey, I'm new to the project is anyone maintaining Gentoo + BSD anymore or
the SELINUX package?

On Fri, Jun 10, 2022 at 8:17 AM Michał Górny <mgo...@gentoo.org> wrote:

> The eclass code in distutils-r1_python_install makes some assumptions
> specific to _distutils-r1_post_python_compile being called,
> and scriptdir not being modified since.  Make them more explicit by:
>
> 1) explicitly removing the files that we expect to have been created,
>
> 2) verifying that both the copied and the original scriptdir have
>    the same list of files.
>
> Signed-off-by: Michał Górny <mgo...@gentoo.org>
> ---
>  eclass/distutils-r1.eclass | 30 +++++++++++++++++++++++++++---
>  1 file changed, 27 insertions(+), 3 deletions(-)
>
> Changes in v2:
> - use diff instead of cksum -- which makes the code both simpler
>   and gives users clear info what's mismatched
>
> diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
> index f3d224a51224..3d5f0791baaf 100644
> --- a/eclass/distutils-r1.eclass
> +++ b/eclass/distutils-r1.eclass
> @@ -1514,13 +1514,37 @@ distutils-r1_python_install() {
>         local merge_root=
>         if [[ ${DISTUTILS_USE_PEP517} ]]; then
>                 local root=${BUILD_DIR}/install
> +               local reg_scriptdir=${root}/${scriptdir}
> +               local wrapped_scriptdir=${root}$(python_get_scriptdir)
> +
> +               # we are assuming that _distutils-r1_post_python_compile
> +               # has been called and ${root} has not been altered since
> +               # let's explicitly verify these assumptions
> +
> +               # remove files that we've created explicitly
> +               rm
> "${reg_scriptdir}"/{"${EPYTHON}",python3,python,pyvenv.cfg} || die
> +               # verify that scriptdir & wrapped_scriptdir both contain
> +               # the same files
> +               (
> +                       cd "${reg_scriptdir}" && find . -mindepth 1
> +               ) | sort > "${T}"/files-bin
> +               assert "listing ${reg_scriptdir} failed"
> +               (
> +                       if [[ -d ${wrapped_scriptdir} ]]; then
> +                               cd "${wrapped_scriptdir}" && find .
> -mindepth 1
> +                       fi
> +               ) | sort > "${T}"/files-wrapped
> +               assert "listing ${wrapped_scriptdir} failed"
> +               if ! diff -U 0 "${T}"/files-{bin,wrapped}; then
> +                       die "File lists for ${reg_scriptdir} and
> ${wrapped_scriptdir} differ (see diff above)"
> +               fi
> +
>                 # remove the altered bindir, executables from the package
>                 # are already in scriptdir
> -               rm -r "${root}${scriptdir}" || die
> +               rm -r "${reg_scriptdir}" || die
>                 if [[ ${DISTUTILS_SINGLE_IMPL} ]]; then
> -                       local
> wrapped_scriptdir=${root}$(python_get_scriptdir)
>                         if [[ -d ${wrapped_scriptdir} ]]; then
> -                               mv "${wrapped_scriptdir}"
> "${root}${scriptdir}" || die
> +                               mv "${wrapped_scriptdir}"
> "${reg_scriptdir}" || die
>                         fi
>                 fi
>                 # prune empty directories to see if ${root} contains
> anything
> --
> 2.35.1
>
>
>

Reply via email to