mirror of
https://gitlab.alpinelinux.org/alpine/abuild.git
synced 2025-03-10 06:07:33 +00:00
tests: verify subpkg dependencies don't influence main package
Subpackages can declare their own dependencies, but these should not affect the main package. Add a test that verifies this behaviour.
This commit is contained in:
parent
2ffb1294b1
commit
cf6cd0231f
@ -1,17 +1,25 @@
|
||||
load helpers
|
||||
|
||||
setup() {
|
||||
export ABUILD="$PWD/../abuild"
|
||||
export ABUILD_SHAREDIR="$PWD/.."
|
||||
export ABUILD_CONF=/dev/null
|
||||
tmpdir="$BATS_TMPDIR"/abuild
|
||||
export REPODEST="$tmpdir"/packages
|
||||
mkdir -p $tmpdir
|
||||
export CLEANUP="srcdir bldroot pkgdir deps"
|
||||
export WORKDIR="$tmpdir"/work
|
||||
|
||||
mkdir -p "$tmpdir" "$WORKDIR"
|
||||
}
|
||||
|
||||
teardown() {
|
||||
rm -rf "$tmpdir"
|
||||
}
|
||||
|
||||
build_repo() {
|
||||
:
|
||||
}
|
||||
|
||||
@test "abuild: help text" {
|
||||
$ABUILD -h
|
||||
}
|
||||
@ -128,3 +136,16 @@ teardown() {
|
||||
run $ABUILD sanitycheck
|
||||
[[ $output[1] == *WARNING*dbg* ]]
|
||||
}
|
||||
|
||||
@test "abuild: verify main package does not inherit subpackage dependencies" {
|
||||
cd testrepo/subpkg-dep-leak/
|
||||
|
||||
$ABUILD
|
||||
|
||||
pkg_field subpkg-dep-leak-1.0-r0 depend >"$WORKDIR"/actual_main_dependencies
|
||||
pkg_field subpkg-dep-leak-subpkg-1.0-r0 depend >"$WORKDIR"/actual_subpkg_dependencies
|
||||
|
||||
diff main_dependencies "$WORKDIR"/actual_main_dependencies
|
||||
diff subpkg_dependencies "$WORKDIR"/actual_subpkg_dependencies
|
||||
false
|
||||
}
|
||||
|
15
tests/helpers.bash
Normal file
15
tests/helpers.bash
Normal file
@ -0,0 +1,15 @@
|
||||
pkg_field() {
|
||||
local pkg=$1
|
||||
local field=$2
|
||||
|
||||
tar xzf "$REPODEST"/testrepo/"$(arch)"/"$pkg".apk -O .PKGINFO |
|
||||
awk "/^$field =/ { print \$3 }" |
|
||||
sort
|
||||
}
|
||||
|
||||
has_dependency() {
|
||||
local pkg=$1
|
||||
local dependency=$2
|
||||
|
||||
pkg_field "$pkg" depend | grep -qx "$dependency"
|
||||
}
|
29
tests/testrepo/subpkg-dep-leak/APKBUILD
Normal file
29
tests/testrepo/subpkg-dep-leak/APKBUILD
Normal file
@ -0,0 +1,29 @@
|
||||
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
|
||||
|
||||
# test package
|
||||
pkgname="subpkg-dep-leak"
|
||||
pkgver="1.0"
|
||||
pkgrel=0
|
||||
pkgdesc="Dummy test package with subpackages and dependencies"
|
||||
url="https://gitlab.alpinelinux.org/alpine/aports"
|
||||
arch="noarch"
|
||||
depends="tar scanelf"
|
||||
license="MIT"
|
||||
subpackages="$pkgname-subpkg"
|
||||
|
||||
prepare() {
|
||||
mkdir -p "$builddir"
|
||||
}
|
||||
|
||||
check() {
|
||||
true
|
||||
}
|
||||
|
||||
package() {
|
||||
mkdir -p "$pkgdir"
|
||||
}
|
||||
|
||||
subpkg() {
|
||||
depends="sed"
|
||||
mkdir -p "$subpkgdir"
|
||||
}
|
2
tests/testrepo/subpkg-dep-leak/main_dependencies
Normal file
2
tests/testrepo/subpkg-dep-leak/main_dependencies
Normal file
@ -0,0 +1,2 @@
|
||||
scanelf
|
||||
tar
|
1
tests/testrepo/subpkg-dep-leak/subpkg_dependencies
Normal file
1
tests/testrepo/subpkg-dep-leak/subpkg_dependencies
Normal file
@ -0,0 +1 @@
|
||||
sed
|
Loading…
Reference in New Issue
Block a user