Skip to content
This repository was archived by the owner on Dec 16, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dbuild/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def docker_build(build_dir, build_type, source_dir='source', force_rm=False,
&& apt-get -y dist-upgrade && '

if build_type == 'source':
command += 'dpkg-buildpackage -S -nc -uc -us'
command += 'dpkg-buildpackage -S -I -nc -uc -us'
cwd = '/build/' + source_dir
elif build_type == 'binary':
command += "dpkg-source -x /build/*.dsc /build/pkgbuild/ && \
Expand Down
6 changes: 6 additions & 0 deletions dbuild/test_data/pkg4/debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pkg4 (1.0-1) stable; urgency=low

* New upstream release

-- Peter Jensen <[email protected]> Tue, 29 Dec 2015 19:41:34 +0000

1 change: 1 addition & 0 deletions dbuild/test_data/pkg4/debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6
12 changes: 12 additions & 0 deletions dbuild/test_data/pkg4/debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Source: pkg4
Section: admin
Priority: optional
Maintainer: Peter Jensen <[email protected]>
Build-Depends: debhelper
Standards-Version: 3.9.3

Package: pkg4
Architecture: all
Depends: ${shlibs:depends}
Description: pkg4
Pkg4
1 change: 1 addition & 0 deletions dbuild/test_data/pkg4/debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
N/A
4 changes: 4 additions & 0 deletions dbuild/test_data/pkg4/debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/make -f

%:
dh $*
1 change: 1 addition & 0 deletions dbuild/test_data/pkg4/debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0
20 changes: 20 additions & 0 deletions dbuild/tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import os.path
import shutil
import tarfile
import tempfile
import types
from unittest import TestCase
Expand Down Expand Up @@ -132,6 +133,25 @@ def test_build(self):
finally:
shutil.rmtree(tmpdir)

def test_discards_dot_git_dir(self):
tmpdir = tempfile.mkdtemp()
try:
shutil.copytree(os.path.join(os.path.dirname(__file__), 'test_data', 'pkg4'),
os.path.join(tmpdir, 'source'))

os.mkdir(os.path.join(tmpdir, 'source', '.git'))

with open(os.path.join(tmpdir, 'source', '.git', 'somefile'), 'w') as fp:
fp.write('this should be discarded')

dbuild.docker_build(tmpdir, build_type='source', build_owner=os.getuid())

tf = tarfile.open(os.path.join(tmpdir, 'pkg4_1.0-1.tar.gz'), 'r:*')
self.assertFalse(list(filter(lambda ti: '/.git/' in ti.name, tf.getmembers())),
'Tarball contained .git dir' + repr(tf.getmembers()))
finally:
shutil.rmtree(tmpdir)

def test_build_failed_source_build(self):
tmpdir = tempfile.mkdtemp()
try:
Expand Down