* [gentoo-portage-dev] [PATCH 0/2] Document globbing for INSTALL_MASK.
@ 2015-07-19 16:08 Michael Orlitzky
2015-07-19 16:08 ` [gentoo-portage-dev] [PATCH 1/2] bin/misc-functions.sh: Elaborate on some comments in install_mask() Michael Orlitzky
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Michael Orlitzky @ 2015-07-19 16:08 UTC (permalink / raw
To: gentoo-portage-dev
This documents shell globs in INSTALL_MASK and warns about filenames
containing spaces. I also added a few more comments to the code after
I figured out what it was going.
Michael Orlitzky (2):
bin/misc-functions.sh: Elaborate on some comments in install_mask().
man/make.conf.5: Document globbing for INSTALL_MASK.
bin/misc-functions.sh | 16 +++++++++++++---
man/make.conf.5 | 44 ++++++++++++++++++++++++++++++++++++--------
2 files changed, 49 insertions(+), 11 deletions(-)
--
2.3.6
^ permalink raw reply [flat|nested] 4+ messages in thread
* [gentoo-portage-dev] [PATCH 1/2] bin/misc-functions.sh: Elaborate on some comments in install_mask().
2015-07-19 16:08 [gentoo-portage-dev] [PATCH 0/2] Document globbing for INSTALL_MASK Michael Orlitzky
@ 2015-07-19 16:08 ` Michael Orlitzky
2015-07-19 16:08 ` [gentoo-portage-dev] [PATCH 2/2] man/make.conf.5: Document globbing for INSTALL_MASK Michael Orlitzky
2015-07-20 21:50 ` [gentoo-portage-dev] [PATCH 0/2] " Brian Dolbec
2 siblings, 0 replies; 4+ messages in thread
From: Michael Orlitzky @ 2015-07-19 16:08 UTC (permalink / raw
To: gentoo-portage-dev
---
bin/misc-functions.sh | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index 9b79351..c2ff70a 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -261,20 +261,30 @@ install_mask() {
shift
local install_mask="$*"
- # we don't want globbing for initial expansion, but afterwards, we do
+ # We think of $install_mask as a space-separated list of
+ # globs. We don't want globbing in the "for" loop; that is, we
+ # want to keep the asterisks in the indivual entries.
local shopts=$-
set -o noglob
local no_inst
for no_inst in ${install_mask}; do
+ # Here, $no_inst is a single "entry" potentially
+ # containing a glob. From now on, we *do* want to
+ # expand it.
set +o noglob
- # normal stuff
+ # The standard case where $no_inst is something that
+ # the shell could expand on its own.
if [[ -e "${root}"/${no_inst} || "${root}"/${no_inst} != $(echo "${root}"/${no_inst}) ]] ; then
__quiet_mode || einfo "Removing ${no_inst}"
rm -Rf "${root}"/${no_inst} >&/dev/null
fi
- # we also need to handle globs (*.a, *.h, etc)
+ # We also want to allow the user to specify a "bare
+ # glob." For example, $no_inst="*.a" should prevent
+ # ALL files ending in ".a" from being installed,
+ # regardless of their location/depth. We achieve this
+ # by passing the pattern to `find`.
find "${root}" \( -path "${no_inst}" -or -name "${no_inst}" \) \
-print0 2> /dev/null \
| LC_ALL=C sort -z \
--
2.3.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-portage-dev] [PATCH 2/2] man/make.conf.5: Document globbing for INSTALL_MASK.
2015-07-19 16:08 [gentoo-portage-dev] [PATCH 0/2] Document globbing for INSTALL_MASK Michael Orlitzky
2015-07-19 16:08 ` [gentoo-portage-dev] [PATCH 1/2] bin/misc-functions.sh: Elaborate on some comments in install_mask() Michael Orlitzky
@ 2015-07-19 16:08 ` Michael Orlitzky
2015-07-20 21:50 ` [gentoo-portage-dev] [PATCH 0/2] " Brian Dolbec
2 siblings, 0 replies; 4+ messages in thread
From: Michael Orlitzky @ 2015-07-19 16:08 UTC (permalink / raw
To: gentoo-portage-dev
The INSTALL_MASK variable has long supported shell glob patterns, but
these were not mentioned in the man page. In fact there are two
different behaviors -- one for globs that the shell can expand, and
one for "bare globs" like "*.pdf". Both of these are now documented in
the man page.
In addition, a warning and example have been added to the man page
regarding spaces within filenames (patterns).
---
man/make.conf.5 | 44 ++++++++++++++++++++++++++++++++++++--------
1 file changed, 36 insertions(+), 8 deletions(-)
diff --git a/man/make.conf.5 b/man/make.conf.5
index a7417f3..13b8042 100644
--- a/man/make.conf.5
+++ b/man/make.conf.5
@@ -699,14 +699,42 @@ These variables are used by network clients such as \fBwget\fR(1) and
\fBrsync\fR(1). They are only required if you use a
proxy server for internet access.
.TP
-\fBINSTALL_MASK\fR = \fI[space delimited list of file names]\fR
-Use this variable if you want to selectively prevent certain files from being
-copied into your file system tree. This does not work on symlinks, but only on
-actual files. Useful if you wish to filter out files like HACKING.gz and
-TODO.gz. The \fBINSTALL_MASK\fR is processed just before a package is merged.
-Also supported is a \fBPKG_INSTALL_MASK\fR variable that behaves exactly like
-\fBINSTALL_MASK\fR except that it is processed just before creation of a binary
-package.
+\fBINSTALL_MASK\fR = \fI[space delimited list of filename patterns (globs)]\fR
+Use this variable if you want to selectively prevent certain files
+from being copied into your file system tree. This does not work on
+symlinks, but only on actual files. Useful if you wish to filter out
+files like HACKING.gz and TODO.gz.
+
+Patterns are matched against both the absolute path and the bare
+filename of each file (or directory) to be installed.
+
+The \fBINSTALL_MASK\fR is processed just before a package is merged.
+Also supported is a \fBPKG_INSTALL_MASK\fR variable that behaves
+exactly like \fBINSTALL_MASK\fR except that it is processed just
+before creation of a binary package.
+
+\fB***warning***\fR
+.br
+This does not place nice with filenames containing spaces. If you
+supply a pattern with a space in it, that single pattern will be
+interpreted as two separate patterns.
+
+.I Examples:
+
+.nf
+# Prevent individual files from being installed.
+INSTALL_MASK="/usr/bin/zless /usr/bin/zzxorcat"
+
+# Prevent all PDF files from being installed.
+INSTALL_MASK="*.pdf"
+
+# Block PDF files one level beneath /usr/share/doc.
+INSTALL_MASK="/usr/share/doc/*/*.pdf"
+
+# Watch out! This will be interpreted as two patterns, and
+# prevent both "README" AND all PDF files from being installed.
+INSTALL_MASK="README\\ *.pdf"
+.fi
.TP
.B LDFLAGS
A list of flags to pass to the compiler when the linker will be called. See
--
2.3.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [gentoo-portage-dev] [PATCH 0/2] Document globbing for INSTALL_MASK.
2015-07-19 16:08 [gentoo-portage-dev] [PATCH 0/2] Document globbing for INSTALL_MASK Michael Orlitzky
2015-07-19 16:08 ` [gentoo-portage-dev] [PATCH 1/2] bin/misc-functions.sh: Elaborate on some comments in install_mask() Michael Orlitzky
2015-07-19 16:08 ` [gentoo-portage-dev] [PATCH 2/2] man/make.conf.5: Document globbing for INSTALL_MASK Michael Orlitzky
@ 2015-07-20 21:50 ` Brian Dolbec
2 siblings, 0 replies; 4+ messages in thread
From: Brian Dolbec @ 2015-07-20 21:50 UTC (permalink / raw
To: gentoo-portage-dev
On Sun, 19 Jul 2015 12:08:50 -0400
Michael Orlitzky <mjo@gentoo.org> wrote:
> This documents shell globs in INSTALL_MASK and warns about filenames
> containing spaces. I also added a few more comments to the code after
> I figured out what it was going.
>
> Michael Orlitzky (2):
> bin/misc-functions.sh: Elaborate on some comments in install_mask().
> man/make.conf.5: Document globbing for INSTALL_MASK.
>
> bin/misc-functions.sh | 16 +++++++++++++---
> man/make.conf.5 | 44
> ++++++++++++++++++++++++++++++++++++-------- 2 files changed, 49
> insertions(+), 11 deletions(-)
>
Merged, thanks :)
--
Brian Dolbec <dolsen>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-07-20 21:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-19 16:08 [gentoo-portage-dev] [PATCH 0/2] Document globbing for INSTALL_MASK Michael Orlitzky
2015-07-19 16:08 ` [gentoo-portage-dev] [PATCH 1/2] bin/misc-functions.sh: Elaborate on some comments in install_mask() Michael Orlitzky
2015-07-19 16:08 ` [gentoo-portage-dev] [PATCH 2/2] man/make.conf.5: Document globbing for INSTALL_MASK Michael Orlitzky
2015-07-20 21:50 ` [gentoo-portage-dev] [PATCH 0/2] " Brian Dolbec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox