Skip to content

save and restore environment when running recipe functions #320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 17, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions distribute.sh
Original file line number Diff line number Diff line change
Expand Up @@ -666,13 +666,23 @@ function run_get_packages() {
done
}

function envfn() {
envsave=$(mktemp)
envrestore=$(mktemp)
set > $envsave
$1
set > $envrestore
eval $(grep -v -F -f$envrestore $envsave)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't there be a space between:

-f $envrestore

rm -f $envsave $envrestore
}

function run_prebuild() {
info "Run prebuild"
cd $BUILD_PATH
for module in $MODULES; do
fn=$(echo prebuild_$module)
debug "Call $fn"
$fn
envfn $fn
done
}

Expand Down Expand Up @@ -707,7 +717,7 @@ function run_build() {
if [ "X$DO_BUILD" == "X1" ] || [ ! -f "$MARKER_FN" ]; then
debug "Call $fn"
rm -f "$MARKER_FN"
$fn
envfn $fn
touch "$MARKER_FN"
else
debug "Skipped $fn"
Expand All @@ -721,7 +731,7 @@ function run_postbuild() {
for module in $MODULES; do
fn=$(echo postbuild_$module)
debug "Call $fn"
$fn
envfn $fn
done
}

Expand Down