-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsnapcraft.yaml
142 lines (123 loc) · 4.86 KB
/
snapcraft.yaml
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
name: sonic-lool
version: 2017-01+git
summary: Software for Open Networking in the Cloud (SONiC)
description: |
SONiC is an open source project for network routers and switches.
grade: devel
confinement: devmode
apps:
id-switch:
command: id-switch
redis-server:
command: redis-launcher
daemon: simple
redis-cli:
command: redis-cli-launcher
swss:
command: swss-launcher
daemon: forking
swssconfig:
command: swssconfig-launcher
p4-switch:
command: p4-switch-launcher
hooks:
configure:
# doesn't actually need network, but the store rejects plugs: [] and
# snapcraft wont take anything else
plugs: [network]
parts:
common-debs:
plugin: nil
# deps of get-debs helper
build-packages: [httpie, jq, wget]
# dep of redis
stage-packages: [libjemalloc1]
install: |
# TODO this should be a plugin; currently doesn't fail on missing debs
# and doesn't resolve dependencies
# download debs from SONiC's jenkins
wget `./get-debs "common/job/hiredis-build" "libhiredis0\\.13"`
wget `./get-debs "common/job/sonic-swss-common-build" "libswsscommon"`
wget `./get-debs \
"common/job/libnl3" "libnl(|-genl|-cli|-route|-nf)-3-200"`
wget `./get-debs "common/job/redis-build" "(redis-server|redis-tools)"`
# unpack all debs
for d in *.deb; do dpkg -x $d $SNAPCRAFT_PART_INSTALL; done
# comment out redis config entries we want to override
sed -ri -e '/^(daemonize|dir|logfile|port|unixsocket) /s/^/#/' \
$SNAPCRAFT_PART_INSTALL/etc/redis/redis.conf
stage:
- etc/redis/redis.conf
- lib/*/*.so.*
- usr/bin/*
- usr/bin/redis-*
- usr/lib/*.so.*
- usr/lib/*/*.so.*
# common code, wrappers, configure hook etc.
common:
plugin: dump
source: common
broadcom-backend:
plugin: nil
# deps of get-debs helper
build-packages: [httpie, jq, wget]
install: |
# TODO this should be a plugin; currently doesn't fail on missing debs
# and doesn't resolve dependencies
job="broadcom/job/buildimage-brcm-all"
debs_re="(swss|syncd|libsaibcm|libsaimetadata|libsairedis|libteam5|libopennsl|python-sonic-config-engine)"
wget `./get-debs "$job" "$debs_re"`
for d in *.deb; do dpkg -x $d $SNAPCRAFT_PART_INSTALL/broadcom; done
# see https://github.com/Azure/SONiC/issues/52
ln -s libsai.so.1.0 $SNAPCRAFT_PART_INSTALL/broadcom/usr/lib/libsai.so.1
# see https://github.com/Azure/SONiC/issues/51
sed -i 's#/var/run/redis/redis\.sock#link-to-redis-socket.sock#g' \
$SNAPCRAFT_PART_INSTALL/broadcom/usr/bin/* \
$SNAPCRAFT_PART_INSTALL/broadcom/usr/lib/*/*.so.*
# replace absolute /etc/bcm/foo pathnames with relative ones e.g.
# bcm-configs/foo
sed -i '/^SAI_INIT_CONFIG_FILE=/s#=/etc/bcm/#=bcm-configs/#' \
$SNAPCRAFT_PART_INSTALL/broadcom/etc/syncd.d/*
stage:
- broadcom/etc/bcm/*
- broadcom/etc/syncd.d/*
- broadcom/etc/swss/*
- broadcom/lib/*/*.so.*
- broadcom/usr/lib/*.so.*
- broadcom/usr/lib/*/*.so.*
- broadcom/usr/bin/*
- broadcom/usr/share/sonic
p4-backend:
plugin: nil
# deps of get-debs helper
build-packages: [httpie, jq, wget]
# deps of syncd
stage-packages: [libjudydebian1, libnanomsg0]
install: |
# TODO this should be a plugin; currently doesn't fail on missing debs
# and doesn't resolve dependencies
wget `./get-debs "p4/job/p4c-bm" "python-p4c-bm"`
wget `./get-debs "p4/job/p4-bmv2" "p4-bmv2"`
wget `./get-debs "p4/job/p4-hlir" "python-p4-hlir"`
wget `./get-debs "p4/job/tenjin" "python-tenjin"`
wget `./get-debs "p4/job/sonic-sairedis-build" "(libsaimetadata|libsairedis|libsaivs|syncd)"`
wget `./get-debs "p4/job/p4-switch" "p4-switch"`
wget `./get-debs "p4/job/sonic-swss-build" "swss"`
# this comes from a common job, so might have to go into common-debs
wget `./get-debs "common/job/thrift-build" "libthrift-0.9.3"`
# Ubuntu doesn't have the same SONAMEs for libboost
for deb in main/b/boost1.55/libboost-program-options1.55.0_1.55.0+dfsg-3_amd64.deb main/b/boost1.55/libboost-thread1.55.0_1.55.0+dfsg-3_amd64.deb main/b/boost1.55/libboost-system1.55.0_1.55.0+dfsg-3_amd64.deb; do
wget "http://ftp.debian.org/debian/pool/$deb"
done
for d in *.deb; do dpkg -x $d $SNAPCRAFT_PART_INSTALL/p4; done
# see https://github.com/Azure/SONiC/issues/51
sed -i 's#/var/run/redis/redis\.sock#link-to-redis-socket.sock#g' \
$SNAPCRAFT_PART_INSTALL/p4/usr/bin/* \
$SNAPCRAFT_PART_INSTALL/p4/usr/lib/*/*.so.*
organize:
p4/usr/lib/*/bmpd/switch/*.so.*: p4/usr/lib
# TODO stage a subset of all files; drop headers, *.a etc.
# this is needed by the P4 backend
python2:
plugin: python
python-version: python2