[pacman-dev] [PATCH v2 1/1] Open up a place for BUILDENV extensions
Dave Reisner
d at falconindy.com
Fri Apr 1 19:37:24 UTC 2016
On Sat, Apr 02, 2016 at 03:52:07AM +0900, quequotion at gmail.com wrote:
> From: Que Quotion <quequotion at gmail.com>
>
> ---
How exactly is this related to BUILDENV? This seems to be allowing
arbitrary code to run before executing the build() function. What about
allowing for cleanup after build()? Otherwise, you leak side effects
into check() and package() as well.
> scripts/libmakepkg/buildenv_ext.sh.in | 42 +++++++++++++++++++++++++++++++++++
> scripts/Makefile.am | 2 ++
> scripts/makepkg.sh.in | 3 +++
> 3 files changed, 47 insertions(+)
> create mode 100644 scripts/libmakepkg/buildenv_ext.sh.in
>
> diff --git a/scripts/libmakepkg/buildenv_ext.sh.in b/scripts/libmakepkg/buildenv_ext.sh.in
> new file mode 100644
> index 0000000..a877b87
> --- /dev/null
> +++ b/scripts/libmakepkg/buildenv_ext.sh.in
> @@ -0,0 +1,42 @@
> +#!/usr/bin/bash
> +#
> +# buildenv_ext.sh - addional functions for altering the build environment
> +# before compiliation
> +#
> +# Copyright (c) 2015-2016 Pacman Development Team <pacman-dev at archlinux.org>
> +#
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 2 of the License, or
> +# (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program. If not, see <http://www.gnu.org/licenses/>.
> +#
> +
> +[[ -n "$LIBMAKEPKG_BUILDENV_EXT_SH" ]] && return
> +LIBMAKEPKG_BUILDENV_EXT_SH=1
> +
> +LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
> +
> +declare -a exta_buildopts
This line does nothing, even if correctly spelled.
> +
> +for lib in "$LIBRARY/buildenv_ext/"*.sh; do
Since nullglob isn't set, an empty directory will cause this to throw
an error about a missing file (as the glob will turn into a literal). As
there's no "buildenv_ext" files provided by makepkg, this means we error
by default.
> + source "$lib"
> +done
> +
> +readonly -a extra_buildopts
> +
> +buildenv_ext() {
> +
> + # options that alter compilation parameters
> + for func in ${extra_buildopts[@]}; do
> + $func
quoting...
for func in "${extra_buildopts[@]}"; do
"$func"
done
> + done
> +
> +}
> diff --git a/scripts/Makefile.am b/scripts/Makefile.am
> index 6f9abb8..a633827 100644
> --- a/scripts/Makefile.am
> +++ b/scripts/Makefile.am
> @@ -45,6 +45,7 @@ LIBMAKEPKGDIRS = \
> lint_pkgbuild \
> source \
> tidy \
> + buildenv_ext \
> util
>
> LIBMAKEPKG = \
> @@ -82,6 +83,7 @@ LIBMAKEPKG_IN = \
> libmakepkg/source/local.sh \
> libmakepkg/source/svn.sh \
> libmakepkg/tidy.sh \
> + libmakepkg/buildenv_ext.sh \
> libmakepkg/tidy/docs.sh \
> libmakepkg/tidy/emptydirs.sh \
> libmakepkg/tidy/libtool.sh \
> --
> 2.7.4
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index 2efcc98..aafec5d 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -866,6 +866,9 @@ run_build() {
> export DISTCC_HOSTS
> fi
>
> + # Check for BUILDENV extensions, use any that are requested (check buildenv and PKGBUILD opts)
> + buildenv_ext
> +
> run_function_safe "build"
> }
>
> --
> 2.7.4
More information about the pacman-dev
mailing list