Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: Re: [gentoo-portage-dev] [PATCH] INSTALL_MASK: honor install time config for binary packages (bug 651952)
Date: Sun, 01 Apr 2018 13:54:18
Message-Id: 1522590850.7711.10.camel@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] INSTALL_MASK: honor install time config for binary packages (bug 651952) by Zac Medico
1 W dniu czw, 29.03.2018 o godzinie 15∶34 -0700, użytkownik Zac Medico
2 napisał:
3 > For binary packages, honor the INSTALL_MASK configuration that
4 > exists at install time, since it might differ from the build time
5 > setting.
6 >
7 > Fixes: 3416876c0ee7 ("{,PKG_}INSTALL_MASK: python implementation")
8 > Bug: https://bugs.gentoo.org/651952
9 > ---
10 > bin/misc-functions.sh | 23 +++++++++++++++++++++++
11 > bin/phase-functions.sh | 10 +---------
12 > pym/portage/dbapi/vartree.py | 5 +++++
13 > 3 files changed, 29 insertions(+), 9 deletions(-)
14 >
15 > diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
16 > index 26f589915..a6330ee93 100755
17 > --- a/bin/misc-functions.sh
18 > +++ b/bin/misc-functions.sh
19 > @@ -323,6 +323,29 @@ postinst_qa_check() {
20 > done < <(printf "%s\0" "${qa_checks[@]}" | LC_ALL=C sort -u -z)
21 > }
22 >
23 > +preinst_mask() {
24 > + # Remove man pages, info pages, docs if requested. This is
25 > + # implemented in bash in order to respect INSTALL_MASK settings
26 > + # from bashrc.
27 > + local f x
28 > + for f in man info doc; do
29 > + if has no${f} ${FEATURES}; then
30 > + INSTALL_MASK+=" /usr/share/${f}"
31 > + fi
32 > + done
33 > +
34 > + # Store modified variables in build-info.
35 > + cd "${PORTAGE_BUILDDIR}"/build-info || die
36 > + set -f
37 > +
38 > + IFS=$' \t\n\r'
39 > + for f in INSTALL_MASK; do
40
41 This loop along with the whole indirection is entirely pointless, given
42 that you're processing exactly one variable.
43
44 > + x=$(echo -n ${!f})
45 > + [[ -n ${x} ]] && echo "${x}" > "${f}"
46
47 There's probably no point in this [[ -n ... ]], as that:
48
49 a. requires you to special-handle missing INSTALL_MASK file, while it's
50 easier to just ensure that it's there (and I think you requested
51 the same thing from me before you rewritten my commit into breakage),
52
53 b. makes it impossible to distinguish packages from before INSTALL_MASK
54 storing was added from those where it is empty.
55
56 > + done
57 > + set +f
58 > +}
59 > +
60 > preinst_sfperms() {
61 > if [ -z "${D}" ]; then
62 > eerror "${FUNCNAME}: D is unset"
63 > diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
64 > index bdae68f79..3de8d01b5 100644
65 > --- a/bin/phase-functions.sh
66 > +++ b/bin/phase-functions.sh
67 > @@ -661,14 +661,6 @@ __dyn_install() {
68 > set -f
69 > local f x
70 >
71 > - # remove man pages, info pages, docs if requested
72 > - for f in man info doc; do
73 > - if has no${f} ${FEATURES} && \
74 > - ! has "/usr/share/${f}" ${INSTALL_MASK}; then
75 > - INSTALL_MASK+=" /usr/share/${f}"
76 > - fi
77 > - done
78 > -
79 > IFS=$' \t\n\r'
80 > for f in CATEGORY DEFINED_PHASES FEATURES INHERITED IUSE \
81 > PF PKGUSE SLOT KEYWORDS HOMEPAGE DESCRIPTION \
82 > @@ -676,7 +668,7 @@ __dyn_install() {
83 > CXXFLAGS EXTRA_ECONF EXTRA_EINSTALL EXTRA_MAKE \
84 > LDFLAGS LIBCFLAGS LIBCXXFLAGS QA_CONFIGURE_OPTIONS \
85 > QA_DESKTOP_FILE QA_PREBUILT PROVIDES_EXCLUDE REQUIRES_EXCLUDE \
86 > - INSTALL_MASK PKG_INSTALL_MASK; do
87 > + PKG_INSTALL_MASK; do
88 >
89 > x=$(echo -n ${!f})
90 > [[ -n $x ]] && echo "$x" > $f
91 > diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
92 > index 378d42dc0..a136c38f1 100644
93 > --- a/pym/portage/dbapi/vartree.py
94 > +++ b/pym/portage/dbapi/vartree.py
95 > @@ -3846,6 +3846,11 @@ class dblink(object):
96 > # be useful to avoid collisions in some scenarios.
97 > # We cannot detect if this is needed or not here as INSTALL_MASK can be
98 > # modified by bashrc files.
99 > + phase = MiscFunctionsProcess(background=False,
100 > + commands=["preinst_mask"], phase="preinst",
101 > + scheduler=self._scheduler, settings=self.settings)
102 > + phase.start()
103 > + phase.wait()
104 > try:
105 > with io.open(_unicode_encode(os.path.join(inforoot, "INSTALL_MASK"),
106 > encoding=_encodings['fs'], errors='strict'),
107
108 --
109 Best regards,
110 Michał Górny

Replies