The temporary directory the tarballs are unapcked into.
</para></listitem>
</varlistentry>
+ <varlistentry>
+ <term><envar>GBP_SOURCES_DIR</envar></term>
+ <listitem><para>
+ The temporary directory where the unpacked sources are.
+ </para></listitem>
+ </varlistentry>
<varlistentry>
<term><envar>GBP_GIT_DIR</envar></term>
<listitem><para>
extra_env=env)()
-def postunpack_hook(repo, tmp_dir, options):
+def postunpack_hook(repo, tmp_dir, sources, options):
if options.postunpack:
Hook('Postunpack', options.postunpack,
extra_env={'GBP_GIT_DIR': repo.git_dir,
- 'GBP_TMP_DIR': tmp_dir}
+ 'GBP_TMP_DIR': tmp_dir,
+ 'GBP_SOURCES_DIR': sources[0].unpacked}
)(dir=tmp_dir)
sources, tmpdir = unpack_tarballs(name, sources, version, options)
try:
- postunpack_hook(repo, tmpdir, options)
+ postunpack_hook(repo, tmpdir, sources, options)
except gbpc.CommandExecFailed:
raise GbpError() # The hook already printed an error message
("GBP_TAG", "upstream/2.8"),
("GBP_UPSTREAM_VERSION", "2.8"),
("GBP_DEBIAN_VERSION", "2.8-1")])
+
+ def test_postunpack_env_vars(self):
+ """
+ Test that the expected environment variables are set during
+ postunpack hook.
+ """
+ repo = ComponentTestGitRepository.create(self.pkg)
+ os.chdir(self.pkg)
+ orig = self._orig('2.8')
+ ok_(import_orig(['arg0',
+ '--postunpack=printenv > ../postunpack.out',
+ '--no-interactive', '--pristine-tar', orig]) == 0)
+ self.check_hook_vars('../postunpack', ["GBP_GIT_DIR",
+ "GBP_TMP_DIR",
+ "GBP_SOURCES_DIR"])