1 |
The eclass code in distutils-r1_python_install makes some assumptions |
2 |
specific to _distutils-r1_post_python_compile being called, |
3 |
and scriptdir not being modified since. Make them more explicit by: |
4 |
|
5 |
1) explicitly removing the files that we expect to have been created, |
6 |
|
7 |
2) verifying that both the copied and the original scriptdir have |
8 |
the same list of files. |
9 |
|
10 |
Signed-off-by: Michał Górny <mgorny@g.o> |
11 |
--- |
12 |
eclass/distutils-r1.eclass | 30 +++++++++++++++++++++++++++--- |
13 |
1 file changed, 27 insertions(+), 3 deletions(-) |
14 |
|
15 |
Changes in v2: |
16 |
- use diff instead of cksum -- which makes the code both simpler |
17 |
and gives users clear info what's mismatched |
18 |
|
19 |
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass |
20 |
index f3d224a51224..3d5f0791baaf 100644 |
21 |
--- a/eclass/distutils-r1.eclass |
22 |
+++ b/eclass/distutils-r1.eclass |
23 |
@@ -1514,13 +1514,37 @@ distutils-r1_python_install() { |
24 |
local merge_root= |
25 |
if [[ ${DISTUTILS_USE_PEP517} ]]; then |
26 |
local root=${BUILD_DIR}/install |
27 |
+ local reg_scriptdir=${root}/${scriptdir} |
28 |
+ local wrapped_scriptdir=${root}$(python_get_scriptdir) |
29 |
+ |
30 |
+ # we are assuming that _distutils-r1_post_python_compile |
31 |
+ # has been called and ${root} has not been altered since |
32 |
+ # let's explicitly verify these assumptions |
33 |
+ |
34 |
+ # remove files that we've created explicitly |
35 |
+ rm "${reg_scriptdir}"/{"${EPYTHON}",python3,python,pyvenv.cfg} || die |
36 |
+ # verify that scriptdir & wrapped_scriptdir both contain |
37 |
+ # the same files |
38 |
+ ( |
39 |
+ cd "${reg_scriptdir}" && find . -mindepth 1 |
40 |
+ ) | sort > "${T}"/files-bin |
41 |
+ assert "listing ${reg_scriptdir} failed" |
42 |
+ ( |
43 |
+ if [[ -d ${wrapped_scriptdir} ]]; then |
44 |
+ cd "${wrapped_scriptdir}" && find . -mindepth 1 |
45 |
+ fi |
46 |
+ ) | sort > "${T}"/files-wrapped |
47 |
+ assert "listing ${wrapped_scriptdir} failed" |
48 |
+ if ! diff -U 0 "${T}"/files-{bin,wrapped}; then |
49 |
+ die "File lists for ${reg_scriptdir} and ${wrapped_scriptdir} differ (see diff above)" |
50 |
+ fi |
51 |
+ |
52 |
# remove the altered bindir, executables from the package |
53 |
# are already in scriptdir |
54 |
- rm -r "${root}${scriptdir}" || die |
55 |
+ rm -r "${reg_scriptdir}" || die |
56 |
if [[ ${DISTUTILS_SINGLE_IMPL} ]]; then |
57 |
- local wrapped_scriptdir=${root}$(python_get_scriptdir) |
58 |
if [[ -d ${wrapped_scriptdir} ]]; then |
59 |
- mv "${wrapped_scriptdir}" "${root}${scriptdir}" || die |
60 |
+ mv "${wrapped_scriptdir}" "${reg_scriptdir}" || die |
61 |
fi |
62 |
fi |
63 |
# prune empty directories to see if ${root} contains anything |
64 |
-- |
65 |
2.35.1 |