summaryrefslogtreecommitdiff
path: root/tests/tests/quilt-include-binaries
blob: 56c72f8aef5ecf0aa08ae85e86ee7150db9082a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash
set -e
. tests/lib
t-tstunt-parsechangelog

p=example

mkdir example
cd example
git init

r=1
v0=1.0-$r
t-dgit import-dsc $troot/pkg-srcs/${p}_${v0}.dsc +import

git reset --hard import

cat >debian/source/include-binaries <<END
# comment

enoent/file
bins/file
debian/binfile

../bin-in-parent
$tmp/bin-with-abs
debian/../../bin-tricky-in-parent
bins/bin-via-link
$tmp/
..
debian/../..
END

for f in bin-in-parent bin-with-abs bin-tricky-in-parent bin-via-link; do
	echo SHOULD-NOT-APPEAR-$f >../$f
done

git add debian/source/include-binaries
git commit -m 'specify include binaries'

t-prep () {
	local m=$1
	git checkout -B work master
	t-git-next-date
	r=$(( $r + 1 ))
	v=1.0-$r
	t-dch-commit -v$v -m "$1"
}

t-make-some-bin () {
	local file="$1"
	perl -e '
		use autodie;
		print pack "H*", "d41d8cd98f00b204e9800998ecf8427e";
		print "\n'"$file $r"'\n";
	' >"$file"
}

t-roundtrips () {
	t-dgit --quilt=nofix --since-version=$v0 build-source
	t-dgit import-dsc ../${p}_${v}.dsc +reimport
	set +e
	git --no-pager grep SHOULD-NOT-APPEAR reimport --
	rc=$?
	set -e
	test $rc = 1
	git diff --exit-code work reimport --
}

t-prep 'straightforward'

mkdir bins
t-make-some-bin bins/file
git add bins/file
git commit -m 'add bin'

t-roundtrips

t-prep 'bin via link'

linktarget="$tmp"
: 'make a new orig, gnagh'
mkdir ../repack
cd ../repack
tar axf $troot/pkg-srcs/${p}_1.0.orig.tar.gz
ln -s "$linktarget" example/bins
tar zcf ../${p}_1.1.orig.tar.gz example
cd ../example
cp ../${p}_1.{0,1}.orig-docs.tar.gz

v=1.1-$r
t-dch-commit -v$v -m 'update upstream'

ln -s "$linktarget" bins
git add bins
git commit -m 'add bins'

t-roundtrips

t-ok