summaryrefslogtreecommitdiff
path: root/test/test.d/db-repo-add.sh
blob: 01d53c469d1d562244f5b3bf6c60a2de8b60ea2d (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
#!/bin/bash

curdir=$(readlink -e $(dirname $0))
source "${curdir}/../lib/common.inc"

testAddSimplePackages() {
	local arches=('i686' 'x86_64')
	local pkgs=('pkg-simple-a' 'pkg-simple-b')
	local pkgbase
	local arch

	for pkgbase in ${pkgs[@]}; do
		for arch in ${arches[@]}; do
			cp "${pkgdir}/${pkgbase}/${pkgbase}-1-1-${arch}.pkg.tar.xz" "${root_dir}/${PKGPOOL}/"
			touch "${root_dir}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz.sig"
			ln -s "${root_dir}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz" "${root_dir}/extra/os/${arch}/"
			ln -s "${root_dir}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz.sig" "${root_dir}/extra/os/${arch}/"
			../db-repo-add extra ${arch} ${pkgbase}-1-1-${arch}.pkg.tar.xz
		done
	done

	for pkgbase in ${pkgs[@]}; do
		for arch in ${arches[@]}; do
			checkPackageDB extra ${pkgbase}-1-1-${arch}.pkg.tar.xz ${arch}
		done
	done
}

testAddMultiplePackages() {
	local arches=('i686' 'x86_64')
	local pkgs=('pkg-simple-a' 'pkg-simple-b')
	local pkgbase
	local arch

	for arch in ${arches[@]}; do
		add_pkgs=()
		for pkgbase in ${pkgs[@]}; do
			cp "${pkgdir}/${pkgbase}/${pkgbase}-1-1-${arch}.pkg.tar.xz" "${root_dir}/${PKGPOOL}/"
			touch "${root_dir}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz.sig"
			ln -s "${root_dir}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz" "${root_dir}/extra/os/${arch}/"
			ln -s "${root_dir}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz.sig" "${root_dir}/extra/os/${arch}/"
			add_pkgs[${#add_pkgs[*]}]=${pkgbase}-1-1-${arch}.pkg.tar.xz
		done
		../db-repo-add extra ${arch} ${add_pkgs[@]}
	done

	for pkgbase in ${pkgs[@]}; do
		for arch in ${arches[@]}; do
			checkPackageDB extra ${pkgbase}-1-1-${arch}.pkg.tar.xz ${arch}
		done
	done
}

source "${curdir}/../lib/shunit2"