db-remove.bats 2.78 KB
Newer Older
1
2
load ../lib/common

3
@test "remove single packages" {
4
	local arches=('i686' 'x86_64')
5
	local pkgs=('pkg-simple-a' 'pkg-simple-b' 'pkg-split-a' 'pkg-split-b' 'pkg-simple-epoch')
6
7
8
9
	local pkgbase
	local arch

	for pkgbase in ${pkgs[@]}; do
10
		releasePackage extra ${pkgbase}
11
12
	done

13
	db-update
14
15
16

	for pkgbase in ${pkgs[@]}; do
		for arch in ${arches[@]}; do
17
			db-remove extra ${arch} ${pkgbase}
18
19
20
21
		done
	done

	for pkgbase in ${pkgs[@]}; do
22
		checkRemovedPackage extra ${pkgbase}
23
24
25
	done
}

26
27
@test "remove debug package" {
	local arches=('i686' 'x86_64')
Morten Linderud's avatar
fixups    
Morten Linderud committed
28
29
	local pkgs=('pkg-simple-a' 'pkg-simple-b' 'pkg-split-a' 'pkg-split-b' 'pkg-simple-epoch' 'pkg-debuginfo' 'pkg-split-debuginfo')
	local debug_pkgs=('pkg-debuginfo' 'pkg-split-debuginfo')
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
	local pkgbase
	local arch

	for pkgbase in ${pkgs[@]}; do
		releasePackage extra ${pkgbase}
	done

	db-update

	for pkgbase in ${pkgs[@]}; do
		for arch in ${arches[@]}; do
			db-remove extra ${arch} ${pkgbase}
		done
	done

    checkRemovedPackage extra pkg-debuginfo
	for pkgbase in ${debug_pkgs[@]}; do
		checkRemovedPackage extra-debug ${pkgbase}
	done
}

Morten Linderud's avatar
fixups    
Morten Linderud committed
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
@test "remove specific debug package" {
	local arches=('i686' 'x86_64')
	local pkgs=('pkg-split-debuginfo')
	local debug_pkgs=('pkg-split-debuginfo')
	local pkgbase
	local arch

	for pkgbase in ${pkgs[@]}; do
		releasePackage extra ${pkgbase}
	done

	db-update

    # We might want to remove the specific debug package
    # without removing the repo packages
	for pkgbase in ${debug_pkgs[@]}; do
		for arch in ${arches[@]}; do
			db-remove extra-debug ${arch} ${pkgbase}-debug
		done
	done

	for pkgbase in ${debug_pkgs[@]}; do
		checkRemovedPackageDB extra-debug ${pkgbase}
	done
}

77
@test "remove multiple packages" {
78
79
80
81
82
83
	local arches=('i686' 'x86_64')
	local pkgs=('pkg-simple-a' 'pkg-simple-b' 'pkg-split-a' 'pkg-split-b' 'pkg-simple-epoch')
	local pkgbase
	local arch

	for pkgbase in ${pkgs[@]}; do
84
		releasePackage extra ${pkgbase}
85
86
	done

87
	db-update
88
89

	for arch in ${arches[@]}; do
90
		db-remove extra ${arch} ${pkgs[@]}
91
92
93
	done

	for pkgbase in ${pkgs[@]}; do
94
		checkRemovedPackage extra ${pkgbase}
95
96
97
	done
}

98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
@test "remove partial split package" {
	local arches=('i686' 'x86_64')
	local arch db

	releasePackage extra pkg-split-a
	db-update

	for arch in ${arches[@]}; do
		db-remove extra "${arch}" pkg-split-a1

		for db in db files; do
			if bsdtar -xf "$FTP_BASE/extra/os/${arch}/extra.${db}" -O | grep pkg-split-a1; then
				return 1
			fi
			bsdtar -xf "$FTP_BASE/extra/os/${arch}/extra.${db}" -O | grep pkg-split-a2
		done
	done
}

117
@test "remove any packages" {
118
119
120
121
	local pkgs=('pkg-any-a' 'pkg-any-b')
	local pkgbase

	for pkgbase in ${pkgs[@]}; do
122
		releasePackage extra ${pkgbase}
123
124
	done

125
	db-update
126
127

	for pkgbase in ${pkgs[@]}; do
128
		db-remove extra any ${pkgbase}
129
130
131
	done

	for pkgbase in ${pkgs[@]}; do
132
		checkRemovedPackage extra ${pkgbase}
133
134
	done
}