summaryrefslogtreecommitdiffstats
path: root/tests/exe/ob-gencontrol.sh
blob: 87152f01728c84eb27a07aa24a3f4a4a34780d45 (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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# Tests for ob-gencontrol
#
# Copyright (C) 2019 Patrick McDermott
#
# This file is part of opkbuild.
#
# opkbuild is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# opkbuild is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with opkbuild.  If not, see <http://www.gnu.org/licenses/>.

set -eu

. "${TOP_SRCDIR}/tests/aux/tap-functions.sh"
. "${TOP_SRCDIR}/tests/aux/common.sh"

plan_ 14

OB_DO_SOURCE='true' command_ok_ 'ob-gencontrol source package exit status' -- \
	ob-gencontrol
cmd_is 'source package control file' cat 'src:foo.control/control' <<-EOF
	Package: src:foo
	Source: foo
	Binary: bar baz+qux baz-qux foo
	Version: 1.0-1
	Architecture: src
	Platform: all
	Maintainer: "J. Random Hacker" <jrandom@example.com>
	Build-Depends: build-all-runes, quiet-untuned-xylophone, $(: \
		)something-completely-different
	Installed-Size: 0
	Format: 2.0
	Description: foo source package
	EOF

rm -Rf 'src/' *'.data/'
cp -Rp '../../src/' 'src/'
../build install

for run in 'first' 'second'; do
	command_ok_ "ob-gencontrol ${run} run exit status" -- ob-gencontrol
	cmd_is 'control file' cat 'foo.control/control' <<-EOF
		Package: foo:i686-linux-glibc
		Source: foo
		Version: 1.0-1
		Architecture: i686-linux-glibc
		Platform: all
		Section: lib
		Maintainer: "J. Random Hacker" <jrandom@example.com>
		Depends: bar
		Installed-Size: 1
		Description: Frobnicator of Objects
		 This is a frobnicator of objects.  Conveniently, it also $(: \
		 )bit-bangs all
		 registers.
		 .
		 This package provides a frobnicator of objects.
		EOF
	cmd_is 'md5sums file' cat 'foo.control/md5sums' <<-EOF
		582b7bd410b9e196dfb0a706ac95bf23  /usr/bin/foo.sh
		EOF
	cmd_is 'control file' cat 'bar.control/control' <<-EOF
		Package: bar
		Source: foo
		Version: 1.0-1
		Architecture: all
		Platform: all
		Section: util
		Maintainer: "J. Random Hacker" <jrandom@example.com>
		Depends: foo:i686-linux-glibc (>= 1.0), $(: \
		 )foo:i686-linux-glibc (<= 1.0-z)
		Installed-Size: 0
		Description: Bit-bang All Registers
		 This is a frobnicator of objects.  Conveniently, it also $(: \
		 )bit-bangs all
		 registers.
		 .
		 This package assists in bit-banging all yer registers.
		EOF
	cmd_is 'control file' cat 'baz+qux.control/control' <<-EOF
		Package: baz+qux
		Source: foo
		Version: 1.0-1
		Architecture: all
		Platform: all
		Maintainer: "J. Random Hacker" <jrandom@example.com>
		Depends: foo:i686-linux-glibc (>= 1.0), $(: \
		 )foo:i686-linux-glibc (<= 1.0-z), bar
		Installed-Size: 0
		Description: Add all the things
		 This is a frobnicator of objects.  Conveniently, it also $(: \
		 )bit-bangs all
		 registers.
		 .
		 This package's name contains a plus sign, not to be $(: \
		 )confused with the one that
		 instead contains a hyphen.
		EOF
	cmd_is 'control file' cat 'baz-qux.control/control' <<-EOF
		Package: baz-qux
		Source: foo
		Version: 1.0-1
		Architecture: all
		Platform: all
		Maintainer: "J. Random Hacker" <jrandom@example.com>
		Depends: foo:i686-linux-glibc (>= 1.0), $(: \
		 )foo:i686-linux-glibc (<= 1.0-z), bar
		Installed-Size: 0
		Description: Hyphenate all the things
		 This is a frobnicator of objects.  Conveniently, it also $(: \
		 )bit-bangs all
		 registers.
		 .
		 This package's name contains a hyphen.  That is all.
		EOF
done