blob: 1f5912475c6debf8e685af5fd119141732534b4a (
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
|
# Tests for ob-buildopk
#
# 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"
ls_outer()
{
local opk="${1}"
shift 1
${TAR} -tzf "${opk}"
}
ls_inner()
{
local opk="${1}"
local mbr="${2}"
shift 2
${TAR} -xzOf "${opk}" "${mbr}" | ${TAR} -tz
}
plan_ 9
rm -Rf *'.data/' *'.control/'
mkdir -p 'foo.data/usr/bin/' 'bar.data/' 'foo.control/' 'bar.control/' \
'baz-qux.data/' 'baz-qux.control/'
cp -p '../../src/src/foo.sh' 'foo.data/usr/bin/'
touch 'foo.control/control' 'foo.control/md5sums' \
'bar.control/control' 'bar.control/md5sums'
command_ok_ 'ob-buildopk exit status' -- "${FAKEROOT}" ob-buildopk
for opk in '../../foo:i686-linux-glibc_1.0-1_i686-linux-glibc_all.opk' \
'../../bar_1.0-1_all_all.opk'; do
command_ok_ 'opk exists' -- [ -f "${opk}" ]
cmd_is 'outer archive contents' ls_outer "${opk}" <<-EOF
debian-binary
control.tar.gz
data.tar.gz
EOF
cmd_is 'control.tar.gz contents' ls_inner "${opk}" control.tar.gz <<-EOF
./
./control
./md5sums
EOF
done
cmd_is 'data.tar.gz contents' \
ls_inner '../../foo:i686-linux-glibc_1.0-1_i686-linux-glibc_all.opk' \
data.tar.gz <<-EOF
./
./usr/
./usr/bin/
./usr/bin/foo.sh
EOF
cmd_is 'data.tar.gz contents' \
ls_inner '../../bar_1.0-1_all_all.opk' data.tar.gz <<-EOF
./
EOF
|