Commit cd9fc14c authored by Jérome Perrin's avatar Jérome Perrin

Also set TMPDIR and TEMP environment variables

We were already setting $TMP, but many software uses $TMPDIR or $TEMP.
parent ba0e7204
...@@ -281,10 +281,10 @@ will add it to environmet variables as the following: ...@@ -281,10 +281,10 @@ will add it to environmet variables as the following:
CXXFLAGS=-I${buildout:prefix} $CXXFLAGS CXXFLAGS=-I${buildout:prefix} $CXXFLAGS
LDFLAGS=-L${buildout:prefix}/lib LDFLAGS=-L${buildout:prefix}/lib
Besides, the recipe changes environment variable ``TMP`` when building Besides, the recipe changes environment variables ``TMP``, ``TMPDIR`` and
and installing, and make a corresponding directory 'tmp' in the ``TEMP`` when building and installing, and make a corresponding directory 'tmp'
``location``. This temporary directory will be removed after in the ``location``. This temporary directory will be removed after installing
installing finished. finished.
Example usage Example usage
============= =============
...@@ -320,7 +320,9 @@ default build options. ...@@ -320,7 +320,9 @@ default build options.
>>> print(system(buildout)) >>> print(system(buildout))
Installing package. Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__ package: Extracting package to /sample_buildout/parts/package__compile__
configure --prefix=/sample_buildout/parts/package configure --prefix=/sample_buildout/parts/package
building package building package
...@@ -346,7 +348,9 @@ default build options. ...@@ -346,7 +348,9 @@ default build options.
>>> print system(buildout) >>> print system(buildout)
Uninstalling package. Uninstalling package.
Installing packagex. Installing packagex.
packagex: [ENV] TEMP = /sample_buildout/parts/packagex/tmp
packagex: [ENV] TMP = /sample_buildout/parts/packagex/tmp packagex: [ENV] TMP = /sample_buildout/parts/packagex/tmp
packagex: [ENV] TMPDIR = /sample_buildout/parts/packagex/tmp
packagex: Extracting package to /sample_buildout/parts/packagex__compile__ packagex: Extracting package to /sample_buildout/parts/packagex__compile__
configure --prefix=/sample_buildout/parts/packagex configure --prefix=/sample_buildout/parts/packagex
building package building package
...@@ -383,7 +387,9 @@ a custom location within the buildout:: ...@@ -383,7 +387,9 @@ a custom location within the buildout::
>>> print(system(buildout)) >>> print(system(buildout))
Uninstalling packagex. Uninstalling packagex.
Installing foobar. Installing foobar.
foobar: [ENV] TEMP = /sample_buildout/parts/foobar/tmp
foobar: [ENV] TMP = /sample_buildout/parts/foobar/tmp foobar: [ENV] TMP = /sample_buildout/parts/foobar/tmp
foobar: [ENV] TMPDIR = /sample_buildout/parts/foobar/tmp
foobar: Extracting package to /sample_buildout/parts/foobar__compile__ foobar: Extracting package to /sample_buildout/parts/foobar__compile__
building package building package
installing package installing package
...@@ -423,7 +429,9 @@ Makefile and using explicit ``make`` options to control the build process. ...@@ -423,7 +429,9 @@ Makefile and using explicit ``make`` options to control the build process.
>>> print(system(buildout)) >>> print(system(buildout))
Uninstalling foobar. Uninstalling foobar.
Installing haproxy. Installing haproxy.
haproxy: [ENV] TEMP = /sample_buildout/parts/haproxy/tmp
haproxy: [ENV] TMP = /sample_buildout/parts/haproxy/tmp haproxy: [ENV] TMP = /sample_buildout/parts/haproxy/tmp
haproxy: [ENV] TMPDIR = /sample_buildout/parts/haproxy/tmp
haproxy: Extracting package to /sample_buildout/parts/haproxy__compile__ haproxy: Extracting package to /sample_buildout/parts/haproxy__compile__
Building HAProxy 1.4.8 (dummy package) Building HAProxy 1.4.8 (dummy package)
TARGET: linux26 TARGET: linux26
...@@ -465,7 +473,9 @@ and building that. ...@@ -465,7 +473,9 @@ and building that.
>>> print(system(buildout)) >>> print(system(buildout))
Uninstalling haproxy. Uninstalling haproxy.
Installing package. Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Using local source directory: /checkout/package-0.0.0 package: Using local source directory: /checkout/package-0.0.0
configure --prefix=/sample_buildout/parts/package configure --prefix=/sample_buildout/parts/package
building package building package
...@@ -525,7 +535,9 @@ targets and also patches the source code before the scripts are run. ...@@ -525,7 +535,9 @@ targets and also patches the source code before the scripts are run.
Installing package. Installing package.
package: [ENV] CFLAGS = -I/sw/include package: [ENV] CFLAGS = -I/sw/include
package: [ENV] LDFLAGS = -L/sw/lib -L/some/extra/lib package: [ENV] LDFLAGS = -L/sw/lib -L/some/extra/lib
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__ package: Extracting package to /sample_buildout/parts/package__compile__
package: Applying patches package: Applying patches
patching file configure patching file configure
...@@ -609,7 +621,9 @@ and a new buildout to try it out ...@@ -609,7 +621,9 @@ and a new buildout to try it out
>>> print(system(buildout)) >>> print(system(buildout))
Uninstalling package. Uninstalling package.
Installing package. Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__ package: Extracting package to /sample_buildout/parts/package__compile__
package: Executing pre-configure-hook package: Executing pre-configure-hook
hook: This is pre-configure-hook! hook: This is pre-configure-hook!
...@@ -650,7 +664,9 @@ shell command in the corresponding stage. ...@@ -650,7 +664,9 @@ shell command in the corresponding stage.
>>> print system(buildout) >>> print system(buildout)
Uninstalling package. Uninstalling package.
Installing package. Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__ package: Extracting package to /sample_buildout/parts/package__compile__
package: Executing pre-configure package: Executing pre-configure
Configure part: package Configure part: package
...@@ -692,7 +708,9 @@ are only ``pre-configure`` and ``post-install``. the output will be ...@@ -692,7 +708,9 @@ are only ``pre-configure`` and ``post-install``. the output will be
#>>> print system(buildout) #>>> print system(buildout)
Uninstalling package. Uninstalling package.
Installing package. Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__ package: Extracting package to /sample_buildout/parts/package__compile__
package: Executing pre-configure package: Executing pre-configure
Configure part: Configure in common platform Configure part: Configure in common platform
...@@ -708,7 +726,9 @@ and 'package:cygwin'. The output will be ...@@ -708,7 +726,9 @@ and 'package:cygwin'. The output will be
>>> print system(buildout) >>> print system(buildout)
Uninstalling package. Uninstalling package.
Installing package. Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__ package: Extracting package to /sample_buildout/parts/package__compile__
package: Executing pre-configure package: Executing pre-configure
Configure in the CYGWIN platform Configure in the CYGWIN platform
...@@ -757,7 +777,9 @@ Let's see what happens when set prefix in the buildout section: ...@@ -757,7 +777,9 @@ Let's see what happens when set prefix in the buildout section:
package: [ENV] CXXFLAGS = /sample-buildout/mylocal/include package: [ENV] CXXFLAGS = /sample-buildout/mylocal/include
package: [ENV] LDFLAGS = /sample-buildout/mylocal/lib package: [ENV] LDFLAGS = /sample-buildout/mylocal/lib
package: [ENV] PATH = /sample_buildout/mylocal/bin:/usr/bin package: [ENV] PATH = /sample_buildout/mylocal/bin:/usr/bin
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__ package: Extracting package to /sample_buildout/parts/package__compile__
package: Executing pre-configure package: Executing pre-configure
configure --prefix=/sample_buildout/mylocal configure --prefix=/sample_buildout/mylocal
...@@ -789,7 +811,9 @@ example, ...@@ -789,7 +811,9 @@ example,
>>> print system(buildout) >>> print system(buildout)
Uninstalling package. Uninstalling package.
Installing package. Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__ package: Extracting package to /sample_buildout/parts/package__compile__
package: Executing pre-configure package: Executing pre-configure
configure --prefix=/sample_buildout/parts/package configure --prefix=/sample_buildout/parts/package
...@@ -829,7 +853,9 @@ prefix: ...@@ -829,7 +853,9 @@ prefix:
package: [ENV] CXXFLAGS = /sample-buildout/mylocal/include package: [ENV] CXXFLAGS = /sample-buildout/mylocal/include
package: [ENV] LDFLAGS = /sample-buildout/mylocal/lib package: [ENV] LDFLAGS = /sample-buildout/mylocal/lib
package: [ENV] PATH = /sample_buildout/mylocal/bin:/usr/bin package: [ENV] PATH = /sample_buildout/mylocal/bin:/usr/bin
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__ package: Extracting package to /sample_buildout/parts/package__compile__
configure --prefix=/sample_buildout/mylocal configure --prefix=/sample_buildout/mylocal
building package building package
...@@ -842,7 +868,9 @@ prefix: ...@@ -842,7 +868,9 @@ prefix:
package-2: [ENV] CXXFLAGS = /sample-buildout/mylocal/include package-2: [ENV] CXXFLAGS = /sample-buildout/mylocal/include
package-2: [ENV] LDFLAGS = /sample-buildout/mylocal/lib package-2: [ENV] LDFLAGS = /sample-buildout/mylocal/lib
package-2: [ENV] PATH = /sample_buildout/mylocal/bin:/usr/bin package-2: [ENV] PATH = /sample_buildout/mylocal/bin:/usr/bin
package-2: [ENV] TEMP = /sample_buildout/parts/package-2/tmp
package-2: [ENV] TMP = /sample_buildout/parts/package-2/tmp package-2: [ENV] TMP = /sample_buildout/parts/package-2/tmp
package-2: [ENV] TMPDIR = /sample_buildout/parts/package-2/tmp
package-2: Extracting package to /sample_buildout/parts/package-2__compile__ package-2: Extracting package to /sample_buildout/parts/package-2__compile__
configure --prefix=/sample_buildout/mylocal configure --prefix=/sample_buildout/mylocal
building package building package
...@@ -929,7 +957,9 @@ value in the part section. For example, ...@@ -929,7 +957,9 @@ value in the part section. For example,
package: [ENV] CXXFLAGS = -I/mytemp/include package: [ENV] CXXFLAGS = -I/mytemp/include
package: [ENV] LDFLAGS = -L/mytemp/lib package: [ENV] LDFLAGS = -L/mytemp/lib
package: [ENV] PATH = /mytemp/bin:/usr/bin package: [ENV] PATH = /mytemp/bin:/usr/bin
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__ package: Extracting package to /sample_buildout/parts/package__compile__
Installing package-2. Installing package-2.
package-2: [ENV] CFLAGS = -I/mytemp/include package-2: [ENV] CFLAGS = -I/mytemp/include
...@@ -937,7 +967,9 @@ value in the part section. For example, ...@@ -937,7 +967,9 @@ value in the part section. For example,
package-2: [ENV] CXXFLAGS = -I/mytemp/include package-2: [ENV] CXXFLAGS = -I/mytemp/include
package-2: [ENV] LDFLAGS = -L/mytemp/lib package-2: [ENV] LDFLAGS = -L/mytemp/lib
package-2: [ENV] PATH = /mytemp/bin:/usr/bin package-2: [ENV] PATH = /mytemp/bin:/usr/bin
package-2: [ENV] TEMP = /sample_buildout/parts/package-2/tmp
package-2: [ENV] TMP = /sample_buildout/parts/package-2/tmp package-2: [ENV] TMP = /sample_buildout/parts/package-2/tmp
package-2: [ENV] TMPDIR = /sample_buildout/parts/package-2/tmp
package-2: Extracting package to /sample_buildout/parts/package-2__compile__ package-2: Extracting package to /sample_buildout/parts/package-2__compile__
package-2: Executing post-install package-2: Executing post-install
package magic prefix is /mytemp package magic prefix is /mytemp
...@@ -962,7 +994,9 @@ can display "prefix" value in the stdout. ...@@ -962,7 +994,9 @@ can display "prefix" value in the stdout.
Uninstalling package-2. Uninstalling package-2.
Uninstalling package. Uninstalling package.
Installing package. Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__ package: Extracting package to /sample_buildout/parts/package__compile__
configure configure
building package building package
...@@ -989,7 +1023,9 @@ replaced with the recipe final prefix. ...@@ -989,7 +1023,9 @@ replaced with the recipe final prefix.
>>> print system(buildout) >>> print system(buildout)
Uninstalling package. Uninstalling package.
Installing package. Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__ package: Extracting package to /sample_buildout/parts/package__compile__
configure configure
building package building package
...@@ -1025,13 +1061,17 @@ of "package": ...@@ -1025,13 +1061,17 @@ of "package":
>>> print system(buildout) >>> print system(buildout)
Uninstalling package. Uninstalling package.
Installing package-2. Installing package-2.
package-2: [ENV] TEMP = /sample_buildout/parts/package-2/tmp
package-2: [ENV] TMP = /sample_buildout/parts/package-2/tmp package-2: [ENV] TMP = /sample_buildout/parts/package-2/tmp
package-2: [ENV] TMPDIR = /sample_buildout/parts/package-2/tmp
package-2: Extracting package to /sample_buildout/parts/package-2__compile__ package-2: Extracting package to /sample_buildout/parts/package-2__compile__
configure --prefix=/sample_buildout/parts/package-2 configure --prefix=/sample_buildout/parts/package-2
building package building package
installing package installing package
Installing package. Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__ package: Extracting package to /sample_buildout/parts/package__compile__
configure --prefix=/sample_buildout/parts/package configure --prefix=/sample_buildout/parts/package
building package building package
...@@ -1062,13 +1102,17 @@ Look, "package" is reinstalled either: ...@@ -1062,13 +1102,17 @@ Look, "package" is reinstalled either:
Uninstalling package. Uninstalling package.
Uninstalling package-2. Uninstalling package-2.
Installing package-2. Installing package-2.
package-2: [ENV] TEMP = /sample_buildout/parts/package-2/tmp
package-2: [ENV] TMP = /sample_buildout/parts/package-2/tmp package-2: [ENV] TMP = /sample_buildout/parts/package-2/tmp
package-2: [ENV] TMPDIR = /sample_buildout/parts/package-2/tmp
package-2: Extracting package to /sample_buildout/parts/package-2__compile__ package-2: Extracting package to /sample_buildout/parts/package-2__compile__
configure configure
building package building package
installing package installing package
Installing package. Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__ package: Extracting package to /sample_buildout/parts/package__compile__
configure --prefix=/sample_buildout/parts/package configure --prefix=/sample_buildout/parts/package
building package building package
...@@ -1097,7 +1141,9 @@ Use option ``share`` to install a share pacakge. ...@@ -1097,7 +1141,9 @@ Use option ``share`` to install a share pacakge.
Installing package. Installing package.
package: Checking whether package is installed at share path: /usr/local package: Checking whether package is installed at share path: /usr/local
package: could not find promise "/usr/local/bin/mypackage.exe" package: could not find promise "/usr/local/bin/mypackage.exe"
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Extracting package to /sample_buildout/parts/package__compile__ package: Extracting package to /sample_buildout/parts/package__compile__
configure --prefix=/usr/local configure --prefix=/usr/local
building package building package
......
...@@ -117,7 +117,10 @@ class Recipe(object): ...@@ -117,7 +117,10 @@ class Recipe(object):
# environment. # environment.
for key in self.environ: for key in self.environ:
self.environ[key] = self.environ[key] % os.environ self.environ[key] = self.environ[key] % os.environ
self.environ['TMP'] = os.path.join(options['default-location'], 'tmp')
# Always define TMPDIR, TEMP and TMP
for key in ('TMPDIR', 'TEMP', 'TMP'):
self.environ[key] = os.path.join(options['default-location'], 'tmp')
def augmented_environment(self): def augmented_environment(self):
"""Returns a dictionary containing the current environment variables """Returns a dictionary containing the current environment variables
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment