summaryrefslogtreecommitdiff
path: root/tests/lib-baredebian
blob: 676ff21cf9d147e711cadf7981efaf9fdf6dbb84 (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
#

baredebian-test-vars () {
	quiltmode=baredebian
	v=1.0-1
	suite=sid
	uv=${v%-*}
	uvtag=v$uv
	xorigcomps=''
}

baredebian-tarball-mode () {
	git tag -d $uvtag
	uvtag=''
	quiltmode=baredebian+tarball
}

baredebian-test-core () {
	t-expect-fail 'contradicts clean mode git-ff' \
	t-dgit -wgf --dgit-view-save=split.f1 --$quiltmode quilt-fixup

	t-dgit -wn --dgit-view-save=split.f1 --$quiltmode quilt-fixup

	local orig=${p}_${uv}.orig
	tar --strip-components=1 -axf ../$orig.tar.*
	for comp in $xorigcomps; do
		mkdir $comp
		cd $comp
		tar --strip-components=1 -axf ../../$orig-$comp.tar.*
		cd ..
	done

	cd debian
	git clean -xdff
	git checkout HEAD -- .
	cd ..

	# Now we are in this insane state that people seem to expect

	export QUILT_PATCHES=debian/patches
	quilt push -a

	git add -Af .
	git reset .pc
	git diff --cached --exit-code split.f1 -- :/ :!/debian
	git diff --exit-code HEAD..split.f1 -- :/debian
	git reset

	quilt new made-with-quilt
	quilt add src.c
	echo //omg >>src.c
	quilt refresh

	git add debian/patches/.
	t-commit 'extra patch made with quilt' 1.0-2

	dpkg-buildpackage -uc -us --build=source
	# ^ Do this by hand here not because we expect users to do this
	#   (rather than dgit build), but so that we can check that our
	#   output is the same as users are used to.

	t-dgit -wn --quilt=$quiltmode --dgit-view-save=split.b quilt-fixup
	t-dgit -wn --quilt=$quiltmode --dgit-view-save=split.p --new push

	git merge-base --is-ancestor HEAD     split.p
	if [ "$uvtag" ]; then
		git merge-base --is-ancestor $uvtag split.p
		set +e; git merge-base HEAD $uvtag; rc=$?; set -e; [ $rc = 1 ]
	fi

	git clean -xdff
	# t-pushed-good-* wants a clean tree to start with, but this
	#  workflow expects a mess

	t-splitbrain-pushed-good-start
	t-splitbrain-pushed-good--unpack

	find . -mindepth 1 -maxdepth 1		\
		\! -path ./debian		\
		\! -path ./.git			\
		-print0				\
		| xargs -0r rm -rf --

	t-splitbrain-pushed-good-end-made-dep14
}

baredebian-test () {
	baredebian-test-vars
	baredebian-test-core
}