aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2017-01-17 20:10:00 +0100
committerGuido Günther <agx@sigxcpu.org>2017-01-17 20:11:07 +0100
commit0fdff8e5277f3388f3879039918b126b8cf9eae0 (patch)
treea1db65908e0b31409fdd6ea1203861ca2be8f907
parent1140886c80d5ef029bfd7b37b9ff8a24f07e6a69 (diff)
buildpackage: Use commit instead of tree to create archive
This makes sure we use the timestamps of the commit when creating the tarball. Only applies when not using pristine-tar Thanks: Ximin Luo for investigating Closes: #851645
-rwxr-xr-xgbp/scripts/buildpackage.py2
-rw-r--r--tests/component/deb/test_buildpackage.py13
2 files changed, 13 insertions, 2 deletions
diff --git a/gbp/scripts/buildpackage.py b/gbp/scripts/buildpackage.py
index 8c5a8f9..5de6094 100755
--- a/gbp/scripts/buildpackage.py
+++ b/gbp/scripts/buildpackage.py
@@ -322,7 +322,7 @@ def git_archive_build_orig(repo, cp, output_dir, options):
gbp.log.debug("Building upstream tarball with compression '%s'%s" %
(options.comp_type,
"' -%s'" % comp_level if comp_level is not None else ''))
- main_tree = repo.tree_drop_dirs(upstream_tree, options.components)
+ main_tree = repo.tree_drop_dirs(upstream_tree, options.components) if options.components else upstream_tree
if not git_archive(repo, cp, output_dir, main_tree,
options.comp_type,
comp_level,
diff --git a/tests/component/deb/test_buildpackage.py b/tests/component/deb/test_buildpackage.py
index 49db96d..f5b9c41 100644
--- a/tests/component/deb/test_buildpackage.py
+++ b/tests/component/deb/test_buildpackage.py
@@ -16,6 +16,7 @@
# along with this program; if not, please see
# <http://www.gnu.org/licenses/>
+import hashlib
import os
import subprocess
@@ -178,8 +179,18 @@ class TestBuildpackage(ComponentTestBase):
'dsc-3.0',
'2.8-1',
['--git-no-pristine-tar'])
- out = subprocess.check_output(["file", "../hello-debhelper_2.8.orig.tar.gz"])
+ tarball = "../hello-debhelper_2.8.orig.tar.gz"
+ out = subprocess.check_output(["file", tarball])
ok_("max compression" not in out)
+ m1 = hashlib.md5(open(tarball, 'rb').read()).hexdigest()
+ os.unlink(tarball)
+ eq_(buildpackage(['arg0',
+ '--git-ignore-new',
+ '--git-builder=/bin/true',
+ '--git-cleaner=/bin/true',
+ '../arg with spaces']), 0)
+ m2 = hashlib.md5(open(tarball, 'rb').read()).hexdigest()
+ eq_(m1, m2, "Regenerated tarball has different checksum")
def test_tarball_max_compression(self):
"""Test that passing max compression works (#820846)"""