* [gentoo-dev] [PATCH v2] distutils-r1.eclass: Add assertions for bindir correctness
@ 2022-06-10 12:17 Michał Górny
2022-06-10 13:59 ` Maxwell Seefeld
0 siblings, 1 reply; 3+ messages in thread
From: Michał Górny @ 2022-06-10 12:17 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
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 <mgorny@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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [gentoo-dev] [PATCH v2] distutils-r1.eclass: Add assertions for bindir correctness
2022-06-10 12:17 [gentoo-dev] [PATCH v2] distutils-r1.eclass: Add assertions for bindir correctness Michał Górny
@ 2022-06-10 13:59 ` Maxwell Seefeld
2022-06-20 0:15 ` Sam James
0 siblings, 1 reply; 3+ messages in thread
From: Maxwell Seefeld @ 2022-06-10 13:59 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 3400 bytes --]
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 <mgorny@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 <mgorny@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
>
>
>
[-- Attachment #2: Type: text/html, Size: 4404 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [gentoo-dev] [PATCH v2] distutils-r1.eclass: Add assertions for bindir correctness
2022-06-10 13:59 ` Maxwell Seefeld
@ 2022-06-20 0:15 ` Sam James
0 siblings, 0 replies; 3+ messages in thread
From: Sam James @ 2022-06-20 0:15 UTC (permalink / raw
To: gentoo-dev; +Cc: cyberalamo
[-- Attachment #1: Type: text/plain, Size: 833 bytes --]
> On 10 Jun 2022, at 14:59, Maxwell Seefeld <cyberalamo@gmail.com> wrote:
>
> Hey, I'm new to the project is anyone maintaining Gentoo + BSD anymore or the SELINUX package?
> [snip]
You seem to have replied to a random ML post rather than making a new thread.
Yes, people are maintaining SELinux in Gentoo:
- https://wiki.gentoo.org/wiki/SELinux (the news thing on the right is a bit out of date)
- https://wiki.gentoo.org/wiki/Project:SELinux
We do a lot of coordination on IRC in general in Gentoo. You should join the #gentoo-hardened
channel on libera if you have questions about SELinux.
As for Gentoo/{Open,FreeBSD}, no, they are not maintained and all remnants of them
were removed a while ago. Any work to restore them should probably start with making
Prefix work as that's far more sustainable.
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 358 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-20 0:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-10 12:17 [gentoo-dev] [PATCH v2] distutils-r1.eclass: Add assertions for bindir correctness Michał Górny
2022-06-10 13:59 ` Maxwell Seefeld
2022-06-20 0:15 ` Sam James
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox