Skip to content
Permalink
Browse files

Fix extra_env.

Added a regression test for this bug.

Bug:            https://trac.macports.org/ticket/9948
Submitted by:
Reviewed by:
Approved by:
Obtained from:

git-svn-id: https://svn.macports.org/repository/macports/trunk/base@18681 d073be05-634f-4543-b044-5fe20cf6d1d6
  • Loading branch information
pguyot committed Jul 22, 2006
1 parent 5517778 commit a772f30bbdbf6a67ddc9140da03764f82b5e3463
@@ -1,5 +1,5 @@
# darwinports.tcl
# $Id: darwinports.tcl,v 1.212 2006/04/05 23:51:50 jberry Exp $
# $Id: darwinports.tcl,v 1.213 2006/07/22 05:50:40 pguyot Exp $
#
# Copyright (c) 2002 Apple Computer, Inc.
# Copyright (c) 2004 - 2005 Paul Guyot, <pguyot@kallisys.net>.
@@ -224,7 +224,7 @@ proc dportinit {up_ui_options up_options up_variations} {
set fd [open $file r]
while {[gets $fd line] >= 0} {
foreach option $bootstrap_options {
if {[regexp "^$option\[ \t\]+(\[A-Za-z0-9_:,\./-\]+$)" $line match val] == 1} {
if {[regexp "^$option\[ \t\]+(\[A-Za-z0-9_:,\./-\].+$)" $line match val] == 1} {
set darwinports::$option $val
global darwinports::$option
}
@@ -434,9 +434,9 @@ proc dportinit {up_ui_options up_options up_variations} {
http_proxy HTTPS_PROXY FTP_PROXY ALL_PROXY NO_PROXY
}
if {[info exists extra_env]} {
lappend keepenvkeys ${extra_env}
set keepenvkeys [concat ${keepenvkeys} ${extra_env}]
}

foreach envkey [array names env] {
if {[lsearch $keepenvkeys $envkey] == -1} {
array unset env $envkey
@@ -1,7 +1,6 @@
include ../Mk/dports.autoconf.mk

#SUBDIR=checksums-1 site-tags trace xcodeversion
SUBDIR=checksums-1 site-tags xcodeversion
SUBDIR=checksums-1 envvariables site-tags trace xcodeversion

.PHONY: test

@@ -42,6 +41,7 @@ test: /tmp/darwinports-tests/opt/local/etc/ports/sources.conf
fi) \
fi || exit 1; \
done
@rm -rf /tmp/darwinports-tests/

install:

@@ -0,0 +1,18 @@
include ../../Mk/dports.autoconf.mk

.PHONY: test

$(bindir)/port:
@echo "Please install DarwinPorts before running this test"
@exit 1

test:
@PORTSRC=$(PORTSRC) $(bindir)/port clean > /dev/null
@sh -c "export ENVA=A ; export ENVB=B; \
export PORTSRC=$(PORTSRC); $(bindir)/port -t test" > output 2>&1 || (cat output; exit 1)
@diff output master 2>&1 | tee difference
@if [ -s difference ]; then \
exit 1; \
else \
rm -f difference; \
fi
@@ -0,0 +1,24 @@
# $Id: Portfile,v 1.1 2006/07/22 05:50:41 pguyot Exp $

PortSystem 1.0
name envvariables
version 1
categories test
maintainers pguyot@kallisys.net
description Test port for env variables
homepage http://darwinports.opendarwin.org/
platforms darwin

long_description ${description}

fetch {}
checksum {}
extract {}
configure {}
build {}
destroot {}

test {
puts $env(ENVA)
puts $env(ENVB)
}
@@ -0,0 +1,8 @@
---> Fetching envvariables
---> Verifying checksum(s) for envvariables
---> Extracting envvariables
---> Configuring envvariables
---> Building envvariables with target all
---> Testing envvariables
A
B
@@ -48,3 +48,9 @@ rsync_dir dpupdate1/base/

# Rsync options
rsync_options "-rtzv --delete --delete-after"

# Extra environment variables to keep. Any variables listed here are added
# to the list of variables that are not removed from the environment used
# while processing ports
# extra_env KEEP_THIS THIS_TOO
extra_env ENVA ENVB

0 comments on commit a772f30

Please sign in to comment.
You can’t perform that action at this time.