aboutsummaryrefslogtreecommitdiffstats
path: root/main/openvswitch/APKBUILD
blob: 06ea6b1f36652c19d9d6b66709a2d4366e6a1220 (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# Contributor: Stuart Cardall <developer@it-offshore.co.uk>
# Maintainer: Stuart Cardall <developer@it-offshore.co.uk>
pkgname=openvswitch
pkgver=2.10.1
pkgrel=2
pkgdesc="A production quality, multilayer virtual switch"
url="http://openvswitch.org/"
arch="all"
license="Apache-2.0"
depends=""
options="!check" # FIXME: no point in running tests if we ignore result
depends_dev="openssl-dev"
makedepends="$depends_dev perl linux-headers bash libcap-ng-dev
	python2 py2-six python3-dev py3-six py-twisted"
subpackages="$pkgname-doc $pkgname-dbg $pkgname-dev
	$pkgname-bash-completion:bashcomp:noarch
	$pkgname-test:_test
	py2-$pkgname:_py2:noarch
	py3-$pkgname:_py3:noarch
	$pkgname-ovn:_ovn
	"
source="http://openvswitch.org/releases/$pkgname-$pkgver.tar.gz
	ovsdb-server.initd
	ovsdb-server.confd
	ovs-vswitchd.initd
	ovs-vswitchd.confd
	ovs-modules.initd
	musl-if_packet.patch
	ifupdown-alpine.patch
	readme.debian.patch
	"

builddir="$srcdir/$pkgname-$pkgver"

build() {
	cd "$builddir"
	./configure --prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--enable-ndebug \
		--enable-libcapng \
		PYTHON=/usr/bin/python2
	make
}

check() {
	cd "$builddir"
	make check || true
}

package() {
	cd "$builddir"

	make DESTDIR="$pkgdir" install

	local _py2site=$(python2 -c "import site; print(site.getsitepackages()[0])")
	local _py3site=$(python3 -c "import site; print(site.getsitepackages()[0])")
	mkdir -p "$pkgdir/$_py2site" "$pkgdir/$_py3site"
	cp -a "$pkgdir"/usr/share/openvswitch/python/* "$pkgdir/$_py2site"/
	cp -a "$pkgdir"/usr/share/openvswitch/python/ovs "$pkgdir/$_py3site"/
	rm -rf "$pkgdir"/usr/share/openvswitch/python

	rm -f "$pkgdir"/usr/lib/*.a
	install -Dm755 "$srcdir"/ovsdb-server.initd \
		"$pkgdir"/etc/init.d/ovsdb-server
	install -Dm755 "$srcdir"/ovs-vswitchd.initd \
		"$pkgdir"/etc/init.d/ovs-vswitchd
	install -Dm755 "$srcdir"/ovs-modules.initd \
		"$pkgdir"/etc/init.d/ovs-modules
	install -Dm644 "$srcdir"/ovsdb-server.confd \
		"$pkgdir"/etc/conf.d/ovsdb-server
	install -Dm644 "$srcdir"/ovs-vswitchd.confd \
		"$pkgdir"/etc/conf.d/ovs-vswitchd

	install -d "$pkgdir"/etc/network/if-pre-up.d \
		"$pkgdir"/etc/network/if-post-down.d
	install -m755 debian/ifupdown.sh \
		"$pkgdir"/etc/network/if-pre-up.d/openvswitch
	ln -s ../if-pre-up.d/openvswitch \
		"$pkgdir"/etc/network/if-post-down.d/openvswitch
	mkdir -p "$pkgdir"/usr/share/doc/openvswitch
	install -m644 debian/openvswitch-switch.README.Debian \
		"$pkgdir"/usr/share/doc/openvswitch/README.alpine
}

_mv_files() {
	local i
	for i in "$@"; do
		case $i in
		*/*) mkdir -p "$subpkgdir"/${i%/*};;
		*) mkdir -p "$subpkgdir";;
		esac
		mv "$pkgdir"/$i "$subpkgdir"/$i
	done
}

bashcomp() {
	pkgdesc="Bash completions for $pkgname"
	depends=""
	install_if="$pkgname=$pkgver-r$pkgrel bash-completion"

	mkdir -p "$subpkgdir"/usr/share/bash-completion/completions/$pkgname
	mv "$builddir"/utilities/*-bashcomp.bash \
		"$subpkgdir"/usr/share/bash-completion/completions/$pkgname/
}

_test() {
	pkgdesc="Open vSwitch testing utilities"
	depends="py2-$pkgname=$pkgver-r$pkgrel py-twisted"
	cd "$pkgdir"
	local _py2site=$(python2 -c "import site; print(site.getsitepackages()[0])")
	_mv_files \
		usr/bin/ovs-l3ping \
		usr/bin/ovs-pcap \
		usr/bin/ovs-tcpdump \
		usr/bin/ovs-tcpundump \
		usr/bin/ovs-test \
		usr/bin/ovs-testcontroller \
		usr/bin/ovs-vlan-test \
		${_py2site#/}/ovstest
}

_py2() {
	pkgdesc="Python modules for Open vSwitch"
	depends="py2-six"
	cd "$pkgdir"
	_mv_files usr/lib/python2*
}

_py3() {
	pkgdesc="Python modules for Open vSwitch"
	depends="py3-six"
	cd "$pkgdir"
	_mv_files usr/lib/python3*
}

_ovn() {
	pkgdesc="Open Virtual Network support for openvswitch"
	cd "$pkgdir"
	_mv_files \
		usr/share/openvswitch/bugtool-plugins/network-status/ovn.xml \
		usr/share/openvswitch/scripts/ovn-bugtool-sbctl-show \
		usr/share/openvswitch/scripts/ovn-ctl \
		usr/share/openvswitch/scripts/ovn-bugtool-nbctl-show \
		usr/share/openvswitch/scripts/ovn-bugtool-sbctl-lflow-list \
		usr/share/openvswitch/scripts/ovndb-servers.ocf \
		usr/share/openvswitch/ovn-sb.ovsschema \
		usr/share/openvswitch/ovn-nb.ovsschema \
		usr/bin/ovn-sbctl \
		usr/bin/ovn-northd \
		usr/bin/ovn-trace \
		usr/bin/ovn-detrace \
		usr/bin/ovn-nbctl \
		usr/bin/ovn-controller-vtep \
		usr/bin/ovn-controller \
		usr/bin/ovn-docker-underlay-driver \
		usr/bin/ovn-docker-overlay-driver
}

sha512sums="3634bd3e978110cb9e11191a88e4232a7af152a6ddf46e8a32e50e07de866be782b7e753d26b81183ec107816e5af4109badf8f2067a61fd9506ccf81e748e44  openvswitch-2.10.1.tar.gz
097d4721a78fff749c534910d98543778474406bd61b469b88a0d981a2a380556444437ec44278cead6d8688c45a38b2acbf1551acb9ab38d048f413728e3b88  ovsdb-server.initd
b1588d076bbfc7ef2dd46fce8e46186f40cbbc4667697f7ac13ddc68e34568fdab315fde47838de7f6d32916853190336cfe3735f672ad7cb624ae14dbff55a5  ovsdb-server.confd
4bff37f8bed32d5327b4b0433984ab8ffdce77f618034aa6ffd1ad4a7caa00703ea2bef312876dce5aafa4c17fe06dddd75e5c05c10e13bf8f5c3805a0654a96  ovs-vswitchd.initd
346aea099f51707d2b4fc9fdc8c1502582723fb4e00c4d5d1624b0378c94dfb76674fa95e2af894f36169df52109dbe441ee6a45aa744584d9e4c74d15a46c1d  ovs-vswitchd.confd
1e08aa5ac6ce55b97256478b9243c8a4c92a42a97fc70ea0439c832b12a775af28a127224ae6c4ce01642dde65f76c610a44105912338bf443d8ea390c2d9ccf  ovs-modules.initd
c5f137bce28bf80c1e5a6ca18722dae9a5ecff03d20bf92642270951bbbb499e5fb05a08163442720e866d135fcd7426b88add0b42ed240d5f0c068aa9fcd9da  musl-if_packet.patch
eca5b19954e6df7dc17c582e22e4b27533710d077039a54a2ba291ae7d3a2706872f5bcad8795ca58e06ca7e45a9b8c4c51e99aedbabd0e87623972ebcdca230  ifupdown-alpine.patch
f006e7a849132140e1c6312810e7b897421dff0cc6661d4f0590a117c0a85da1fef2feca3339758f94b7732445d6d617b12744a23939fcb8ebe85884d3134d9e  readme.debian.patch"