aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--docs/manpages/gbp-import-orig.sgml30
-rw-r--r--gbp/scripts/import_orig.py9
-rw-r--r--tests/component/deb/test_import_orig.py12
3 files changed, 46 insertions, 5 deletions
diff --git a/docs/manpages/gbp-import-orig.sgml b/docs/manpages/gbp-import-orig.sgml
index 2220d128..e1bcace4 100644
--- a/docs/manpages/gbp-import-orig.sgml
+++ b/docs/manpages/gbp-import-orig.sgml
@@ -251,7 +251,35 @@
<term><option>--postimport=<replaceable>cmd</replaceable></option></term>
<listitem>
<para>
- run <replaceable>cmd</replaceable> after the import.
+ Run <replaceable>cmd</replaceable> after the import. The
+ hook gets the following environment variables passed:
+ <variablelist>
+ <varlistentry>
+ <term><envar>GBP_BRANCH</envar></term>
+ <listitem><para>
+ The name of the Debian packaging branch
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><envar>GBP_TAG</envar></term>
+ <listitem><para>
+ The name of the just created upstream tag
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><envar>GBP_UPSTREAM_VERSION</envar></term>
+ <listitem><para>
+ The just imported upstream version
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><envar>GBP_DEBIAN_VERSION</envar></term>
+ <listitem><para>
+ The Debian version of the package with a Debian
+ revision of '-1'
+ </para></listitem>
+ </varlistentry>
+ </variablelist>
</para>
</listitem>
</varlistentry>
diff --git a/gbp/scripts/import_orig.py b/gbp/scripts/import_orig.py
index e344926d..cbe5986d 100644
--- a/gbp/scripts/import_orig.py
+++ b/gbp/scripts/import_orig.py
@@ -298,8 +298,13 @@ def debian_branch_merge(repo, tag, version, options):
cp = ChangeLog(filename='debian/changelog')
if cp.has_epoch():
epoch = '%s:' % cp.epoch
- info = {'version': "%s%s-1" % (epoch, version)}
- env = {'GBP_BRANCH': options.debian_branch}
+ debian_version = "%s%s-1" % (epoch, version)
+ info = {'version': debian_version}
+ env = {'GBP_BRANCH': options.debian_branch,
+ 'GBP_TAG': tag,
+ 'GBP_UPSTREAM_VERSION': version,
+ 'GBP_DEBIAN_VERSION': debian_version,
+ }
gbpc.Command(format_str(options.postimport, info), extra_env=env, shell=True)()
diff --git a/tests/component/deb/test_import_orig.py b/tests/component/deb/test_import_orig.py
index 0df65877..cb68e3e0 100644
--- a/tests/component/deb/test_import_orig.py
+++ b/tests/component/deb/test_import_orig.py
@@ -63,7 +63,6 @@ class TestImportOrig(ComponentTestBase):
os.chdir(self.pkg)
orig = self._orig('2.6')
ok_(import_orig(['arg0', '--no-interactive', '--pristine-tar', orig]) == 0)
-
self._check_repo_state(repo, 'master', self.def_branches,
tags=['upstream/2.6'])
@@ -78,9 +77,18 @@ class TestImportOrig(ComponentTestBase):
self._check_repo_state(repo, 'master', ['master', 'upstream', 'pristine-tar'])
orig = self._orig('2.8')
- ok_(import_orig(['arg0', '--no-interactive', '--pristine-tar', orig]) == 0)
+ ok_(import_orig(['arg0',
+ '--postimport=printenv > postimport.out',
+ '--no-interactive', '--pristine-tar', orig]) == 0)
self._check_repo_state(repo, 'master', ['master', 'upstream', 'pristine-tar'],
tags=['debian/2.6-2', 'upstream/2.6', 'upstream/2.8'])
+ eq_(os.path.exists('postimport.out'), True)
+ self.check_hook_vars('postimport', ["GBP_BRANCH",
+ "GBP_TAG",
+ "GBP_UPSTREAM_VERSION",
+ "GBP_DEBIAN_VERSION"])
+
+
def test_update_component_tarballs(self):
"""