Commit daa833ea 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 8d6f4c24
Pipeline #5529 passed with stage
......@@ -269,10 +269,10 @@ will add it to environmet variables as the following:
CXXFLAGS=-I${buildout:prefix} $CXXFLAGS
LDFLAGS=-L${buildout:prefix}/lib
Besides, the recipe changes environment variable ``TMP`` when building
and installing, and make a corresponding directory 'tmp' in the
``location``. This temporary directory will be removed after
installing finished.
Besides, the recipe changes environment variables ``TMP``, ``TMPDIR`` and
``TEMP`` when building and installing, and make a corresponding directory 'tmp'
in the ``location``. This temporary directory will be removed after installing
finished.
Example usage
=============
......@@ -308,7 +308,9 @@ default build options.
>>> print(system(buildout)) #doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
configure --prefix=/sample_buildout/parts/package
building package
installing package
......@@ -334,7 +336,9 @@ default build options.
>>> print system(buildout)
Uninstalling package.
Installing packagex.
packagex: [ENV] TEMP = /sample_buildout/parts/packagex/tmp
packagex: [ENV] TMP = /sample_buildout/parts/packagex/tmp
packagex: [ENV] TMPDIR = /sample_buildout/parts/packagex/tmp
configure --prefix=/sample_buildout/parts/packagex
building package
installing package
......@@ -371,7 +375,9 @@ a custom location within the buildout::
>>> print(system(buildout))
Uninstalling packagex.
Installing foobar.
foobar: [ENV] TEMP = /sample_buildout/parts/foobar/tmp
foobar: [ENV] TMP = /sample_buildout/parts/foobar/tmp
foobar: [ENV] TMPDIR = /sample_buildout/parts/foobar/tmp
building package
installing package
......@@ -410,7 +416,9 @@ Makefile and using explicit ``make`` options to control the build process.
>>> print(system(buildout))
Uninstalling foobar.
Installing haproxy.
haproxy: [ENV] TEMP = /sample_buildout/parts/haproxy/tmp
haproxy: [ENV] TMP = /sample_buildout/parts/haproxy/tmp
haproxy: [ENV] TMPDIR = /sample_buildout/parts/haproxy/tmp
Building HAProxy 1.4.8 (dummy package)
TARGET: linux26
CPU: i686
......@@ -451,7 +459,9 @@ and building that.
>>> print(system(buildout))
Uninstalling haproxy.
Installing package.
package: [ENV] TEMP = /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
configure --prefix=/sample_buildout/parts/package
building package
......@@ -511,7 +521,9 @@ targets and also patches the source code before the scripts are run.
Installing package.
package: [ENV] CFLAGS = -I/sw/include
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] TMPDIR = /sample_buildout/parts/package/tmp
package: Applying patches
patching file configure
patching file Makefile.dist
......@@ -594,7 +606,9 @@ and a new buildout to try it out
>>> print(system(buildout))
Uninstalling package.
Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Executing pre-configure-hook
hook: This is pre-configure-hook!
configure --prefix=/sample_buildout/parts/package
......@@ -634,7 +648,9 @@ shell command in the corresponding stage.
>>> print system(buildout)
Uninstalling package.
Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Executing pre-configure
Configure part: package
configure --prefix=/sample_buildout/parts/package
......@@ -675,7 +691,9 @@ are only ``pre-configure`` and ``post-install``. the output will be
#>>> print system(buildout)
Uninstalling package.
Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Executing pre-configure
Configure part: Configure in common platform
configure --prefix=/sample_buildout/parts/package
......@@ -719,7 +737,9 @@ Let's see what happens when set prefix in the buildout section:
>>> print system(buildout)
Uninstalling package.
Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Executing pre-configure
configure --prefix=/sample_buildout/mylocal
building package
......@@ -750,7 +770,9 @@ example,
>>> print system(buildout)
Uninstalling package.
Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
package: Executing pre-configure
configure --prefix=/sample_buildout/parts/package
building package
......@@ -784,13 +806,17 @@ prefix:
>>> print system(buildout)
Uninstalling package.
Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
configure --prefix=/sample_buildout/mylocal
building package
package: Executing pre-install
installing package
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] TMPDIR = /sample_buildout/parts/package-2/tmp
configure --prefix=/sample_buildout/mylocal
building package
package-2: Executing pre-install
......@@ -874,9 +900,13 @@ value in the part section. For example,
>>> print system(buildout)
Uninstalling package.
Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
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] TMPDIR = /sample_buildout/parts/package-2/tmp
package-2: Executing post-install
package magic prefix is /mytemp
<BLANKLINE>
......@@ -901,7 +931,9 @@ can display "prefix" value in the stdout.
Uninstalling package-2.
Uninstalling package.
Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
configure
building package
package: Executing pre-install
......@@ -927,7 +959,9 @@ replaced with the recipe final prefix.
>>> print system(buildout)
Uninstalling package.
Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
configure
building package
package: Executing pre-install
......@@ -962,12 +996,16 @@ of "package":
>>> print system(buildout)
Uninstalling package.
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] TMPDIR = /sample_buildout/parts/package-2/tmp
configure --prefix=/sample_buildout/parts/package-2
building package
installing package
Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
configure --prefix=/sample_buildout/parts/package
building package
installing package
......@@ -997,12 +1035,16 @@ Look, "package" is reinstalled either:
Uninstalling package.
Uninstalling 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] TMPDIR = /sample_buildout/parts/package-2/tmp
configure
building package
installing package
Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
configure --prefix=/sample_buildout/parts/package
building package
installing package
......@@ -1034,7 +1076,9 @@ If no shared-parts is set, and shared is True, shared feature is not used:
Uninstalling package.
Uninstalling package-2.
Installing package.
package: [ENV] TEMP = /sample_buildout/parts/package/tmp
package: [ENV] TMP = /sample_buildout/parts/package/tmp
package: [ENV] TMPDIR = /sample_buildout/parts/package/tmp
configure --prefix=/sample_buildout/parts/package
building package
installing package
......@@ -1068,7 +1112,9 @@ If shared-parts is set and shared is True, build package failed, the build direc
Uninstalling package.
Installing package.
package: Checking whether package is installed at shared path: .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/...
package: [ENV] TEMP = .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/.../tmp
package: [ENV] TMP = .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/.../tmp
package: [ENV] TMPDIR = .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/.../tmp
package: Command failed with exit code 127: ./configure --prefix=".../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/..."
package: Compilation error. The package is left as is at .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/...__compile__ where you can inspect what went wrong
/bin/sh: 1: ./configure: not found
......@@ -1082,7 +1128,9 @@ If shared-parts is set and shared is True, package will be installed in shared_p
package: shared directory .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/... set for package
Installing package.
package: Checking whether package is installed at shared path: .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/...
package: [ENV] TEMP = .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/.../tmp
package: [ENV] TMP = .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/.../tmp
package: [ENV] TMPDIR = .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/.../tmp
package: Removing already existing directory .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/...__compile__
configure --prefix=.../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/...
building package
......@@ -1128,7 +1176,9 @@ If options change, reinstall in different location:
Uninstalling package.
Installing package.
package: Checking whether package is installed at shared path: .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/...
package: [ENV] TEMP = .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/.../tmp
package: [ENV] TMP = .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/.../tmp
package: [ENV] TMPDIR = .../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/.../tmp
configure --prefix=.../slapos.recipe.cmmi/slapos/recipe/cmmi/shared/package/...
building package
installing package
......
......@@ -143,7 +143,10 @@ class Recipe(object):
# environment.
for key in self.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):
"""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