# 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 .
set -eu
. "${TOP_SRCDIR}/tests/aux/tap-functions.sh"
. "${TOP_SRCDIR}/tests/aux/common.sh"
plan_ 12
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 foo
Version: 1.0-1
Architecture: src
Platform: all
Maintainer: "J. Random Hacker"
Build-Depends: build-all-runes
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"
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: utils
Maintainer: "J. Random Hacker"
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"
Depends: 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