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 <
[email protected]> 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 <[email protected]>
---
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
<div dir="ltr">Hey, I'm new to the project is anyone maintaining Gentoo + BSD anymore or the SELINUX package? <br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jun 10, 2022 at 8:17 AM Michał Górny <<a href="mailto:
[email protected]">
[email protected]</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The eclass code in distutils-r1_python_install makes some assumptions<br>
specific to _distutils-r1_post_python_compile being called,<br>
and scriptdir not being modified since. Make them more explicit by:<br>
1) explicitly removing the files that we expect to have been created,<br>
2) verifying that both the copied and the original scriptdir have<br>
the same list of files.<br>
Signed-off-by: Michał Górny <<a href="mailto:
[email protected]" target="_blank">
[email protected]</a>><br>
---<br>
eclass/distutils-r1.eclass | 30 +++++++++++++++++++++++++++---<br>
1 file changed, 27 insertions(+), 3 deletions(-)<br>
Changes in v2:<br>
- use diff instead of cksum -- which makes the code both simpler<br>
and gives users clear info what's mismatched<br>
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass<br>
index f3d224a51224..3d5f0791baaf 100644<br>
--- a/eclass/distutils-r1.eclass<br>
+++ b/eclass/distutils-r1.eclass<br>
@@ -1514,13 +1514,37 @@ distutils-r1_python_install() {<br>
local merge_root=<br>
if [[ ${DISTUTILS_USE_PEP517} ]]; then<br>
local root=${BUILD_DIR}/install<br>
+ local reg_scriptdir=${root}/${scriptdir}<br>
+ local wrapped_scriptdir=${root}$(python_get_scriptdir)<br>
+<br>
+ # we are assuming that _distutils-r1_post_python_compile<br>
+ # has been called and ${root} has not been altered since<br>
+ # let's explicitly verify these assumptions<br> +<br>
+ # remove files that we've created explicitly<br> + rm "${reg_scriptdir}"/{"${EPYTHON}",python3,python,pyvenv.cfg} || die<br>
+ # verify that scriptdir & wrapped_scriptdir both contain<br>
+ # the s