Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: [gentoo-portage-dev] [PATCH] INSTALL_MASK: honor install time config for binary packages (bug 651952)
Date: Thu, 29 Mar 2018 22:35:10
Message-Id: 20180329223420.7134-1-zmedico@gentoo.org
1 For binary packages, honor the INSTALL_MASK configuration that
2 exists at install time, since it might differ from the build time
3 setting.
4
5 Fixes: 3416876c0ee7 ("{,PKG_}INSTALL_MASK: python implementation")
6 Bug: https://bugs.gentoo.org/651952
7 ---
8 bin/misc-functions.sh | 23 +++++++++++++++++++++++
9 bin/phase-functions.sh | 10 +---------
10 pym/portage/dbapi/vartree.py | 5 +++++
11 3 files changed, 29 insertions(+), 9 deletions(-)
12
13 diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
14 index 26f589915..a6330ee93 100755
15 --- a/bin/misc-functions.sh
16 +++ b/bin/misc-functions.sh
17 @@ -323,6 +323,29 @@ postinst_qa_check() {
18 done < <(printf "%s\0" "${qa_checks[@]}" | LC_ALL=C sort -u -z)
19 }
20
21 +preinst_mask() {
22 + # Remove man pages, info pages, docs if requested. This is
23 + # implemented in bash in order to respect INSTALL_MASK settings
24 + # from bashrc.
25 + local f x
26 + for f in man info doc; do
27 + if has no${f} ${FEATURES}; then
28 + INSTALL_MASK+=" /usr/share/${f}"
29 + fi
30 + done
31 +
32 + # Store modified variables in build-info.
33 + cd "${PORTAGE_BUILDDIR}"/build-info || die
34 + set -f
35 +
36 + IFS=$' \t\n\r'
37 + for f in INSTALL_MASK; do
38 + x=$(echo -n ${!f})
39 + [[ -n ${x} ]] && echo "${x}" > "${f}"
40 + done
41 + set +f
42 +}
43 +
44 preinst_sfperms() {
45 if [ -z "${D}" ]; then
46 eerror "${FUNCNAME}: D is unset"
47 diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
48 index bdae68f79..3de8d01b5 100644
49 --- a/bin/phase-functions.sh
50 +++ b/bin/phase-functions.sh
51 @@ -661,14 +661,6 @@ __dyn_install() {
52 set -f
53 local f x
54
55 - # remove man pages, info pages, docs if requested
56 - for f in man info doc; do
57 - if has no${f} ${FEATURES} && \
58 - ! has "/usr/share/${f}" ${INSTALL_MASK}; then
59 - INSTALL_MASK+=" /usr/share/${f}"
60 - fi
61 - done
62 -
63 IFS=$' \t\n\r'
64 for f in CATEGORY DEFINED_PHASES FEATURES INHERITED IUSE \
65 PF PKGUSE SLOT KEYWORDS HOMEPAGE DESCRIPTION \
66 @@ -676,7 +668,7 @@ __dyn_install() {
67 CXXFLAGS EXTRA_ECONF EXTRA_EINSTALL EXTRA_MAKE \
68 LDFLAGS LIBCFLAGS LIBCXXFLAGS QA_CONFIGURE_OPTIONS \
69 QA_DESKTOP_FILE QA_PREBUILT PROVIDES_EXCLUDE REQUIRES_EXCLUDE \
70 - INSTALL_MASK PKG_INSTALL_MASK; do
71 + PKG_INSTALL_MASK; do
72
73 x=$(echo -n ${!f})
74 [[ -n $x ]] && echo "$x" > $f
75 diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
76 index 378d42dc0..a136c38f1 100644
77 --- a/pym/portage/dbapi/vartree.py
78 +++ b/pym/portage/dbapi/vartree.py
79 @@ -3846,6 +3846,11 @@ class dblink(object):
80 # be useful to avoid collisions in some scenarios.
81 # We cannot detect if this is needed or not here as INSTALL_MASK can be
82 # modified by bashrc files.
83 + phase = MiscFunctionsProcess(background=False,
84 + commands=["preinst_mask"], phase="preinst",
85 + scheduler=self._scheduler, settings=self.settings)
86 + phase.start()
87 + phase.wait()
88 try:
89 with io.open(_unicode_encode(os.path.join(inforoot, "INSTALL_MASK"),
90 encoding=_encodings['fs'], errors='strict'),
91 --
92 2.13.6

Replies