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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
|
name: pig
version: '1.2.0'
summary: Apache Pig
description: |
Apache Pig is a platform for analyzing large data sets that consists
of a high-level language (Pig Latin) for expressing data analysis programs,
coupled with infrastructure for evaluating these programs
This snap installs Pig 0.15.0 and is compatible with Apache Bigtop 1.2.0.
grade: stable
confinement: strict
apps:
pig:
command: wrappers/pig
plugs:
- 'network'
plugs:
home:
interface: home
hadoop:
interface: content
content: hadoop
target: $SNAP/hadoop
hadoop-conf:
interface: content
content: hadoop-conf
target: $SNAP_DATA/etc/hadoop
zookeeper:
interface: content
content: zookeeper
target: $SNAP/zookeeper
parts:
bigtop:
source: https://github.com/apache/bigtop.git
source-type: git
source-branch: branch-1.2
plugin: gradle
gradle-options: ['-b', 'packages.gradle', 'bom-snap']
build-packages:
- curl
- puppet-common
stage-packages:
- default-jdk-headless
prepare: |
# get bigtop buildreqs on the system
if [ `id -u` -ne 0 ]; then
PUPPET_CMD='sudo -E puppet apply'
else
PUPPET_CMD='puppet apply'
fi
${PUPPET_CMD} -d --parser future --modulepath=".:/etc/puppet/modules" \
-e "include bigtop_toolchain::protobuf"
${PUPPET_CMD} -d --parser future --modulepath=".:/etc/puppet/modules" \
-e "include bigtop_toolchain::packages"
# add a gradle task to generate a sourceable bom for use by other parts
echo 'task "bom-snap" () << {' >> packages.gradle
echo ' def bomWriter = new File("bigtop-snap.bom").newWriter()' >> packages.gradle
echo ' bomVersions.each { bomWriter << "$it\\n"}' >> packages.gradle
echo ' bomWriter.close()' >> packages.gradle
echo '}' >> packages.gradle
# there is no 'build' for bigtop-utils source, just set perms
chmod 755 bigtop-packages/src/common/bigtop-utils/bigtop-detect-*
# make sure utils point to the right default directory
for i in `ls bigtop-packages/src/common/bigtop-utils/bigtop-*`; do
sed -e 's|/etc/default|${SNAP}/etc/default|' -i $i; done
# point bigtop-utils to SNAP_DATA for additional classpath entries
echo 'export BIGTOP_CLASSPATH=${SNAP_DATA}/var/lib/bigtop' >> \
bigtop-packages/src/common/bigtop-utils/bigtop-utils.default
# set bigtop-utils java home to the jdk packed into the snap
echo 'export JAVA_HOME=${SNAP}/usr/lib/jvm/default-java' >> \
bigtop-packages/src/common/bigtop-utils/bigtop-utils.default
install: |
# adapted from bigtop/bigtop-packages/src/deb/bigtop-utils/rules
install -d -p -m 755 $SNAPCRAFT_PART_INSTALL/usr/lib/bigtop-utils/
install -p -m 755 bigtop-packages/src/common/bigtop-utils/bigtop-detect-javahome \
$SNAPCRAFT_PART_INSTALL/usr/lib/bigtop-utils/
install -p -m 755 bigtop-packages/src/common/bigtop-utils/bigtop-detect-javalibs \
$SNAPCRAFT_PART_INSTALL/usr/lib/bigtop-utils/
install -p -m 755 bigtop-packages/src/common/bigtop-utils/bigtop-detect-classpath \
$SNAPCRAFT_PART_INSTALL/usr/lib/bigtop-utils/
install -p -m 755 bigtop-packages/src/common/bigtop-utils/bigtop-monitor-service \
$SNAPCRAFT_PART_INSTALL/usr/lib/bigtop-utils/
install -d -p -m 755 $SNAPCRAFT_PART_INSTALL/bigtop-utils/etc/default
install -p -m 644 bigtop-packages/src/common/bigtop-utils/bigtop-utils.default \
$SNAPCRAFT_PART_INSTALL/etc/default/bigtop-utils
stage:
- etc/*
- usr/lib/*
bigtop-groovy:
after:
- bigtop
source: https://dl.bintray.com/groovy/maven/apache-groovy-binary-2.4.10.zip
plugin: dump
prepare: |
cp ../../bigtop/build/bigtop-snap.bom \
../../bigtop/build/bigtop-packages/src/common/bigtop-groovy/bigtop.bom
chmod 755 ../../bigtop/build/bigtop-packages/src/common/bigtop-groovy/do-component-build
chmod 755 ../../bigtop/build/bigtop-packages/src/common/bigtop-groovy/install_groovy.sh
build: |
../../bigtop/build/bigtop-packages/src/common/bigtop-groovy/do-component-build
install: |
# adapted from bigtop/bigtop-packages/src/deb/bigtop-groovy/rules
../../bigtop/build/bigtop-packages/src/common/bigtop-groovy/install_groovy.sh \
--build-dir=groovy-2.4.10 \
--prefix=$SNAPCRAFT_PART_INSTALL \
--bin-dir=usr/lib/bigtop-groovy/bin \
--version=2.4.10 \
--lib-dir=usr/lib/bigtop-groovy/lib \
--conf-dir=usr/lib/bigtop-groovy/conf
stage:
- usr/lib/*
bigtop-jsvc:
after:
- bigtop
source: https://archive.apache.org/dist/commons/daemon/source/commons-daemon-1.0.15-native-src.tar.gz
plugin: autotools
prepare: |
cp ../../bigtop/build/bigtop-snap.bom \
../../bigtop/build/bigtop-packages/src/common/bigtop-jsvc/bigtop.bom
chmod 755 ../../bigtop/build/bigtop-packages/src/common/bigtop-jsvc/do-component-build
chmod 755 ../../bigtop/build/bigtop-packages/src/common/bigtop-jsvc/install_jsvc.sh
# patch jsvc sources with bigtop-specific changes
for i in `ls ../../bigtop/build/bigtop-packages/src/common/bigtop-jsvc/patch*.diff`; do \
patch -p1 -i $i; done
build: |
# the autotools plugin ensures we get the right build tools, but we \
# still want to use the bigtop build recipe.
bash -c '. ../../bigtop/build/bigtop-packages/src/common/bigtop-utils/bigtop-detect-javahome && \
../../bigtop/build/bigtop-packages/src/common/bigtop-jsvc/do-component-build'
install: |
# adapted from bigtop/bigtop-packages/src/deb/bigtop-jsvc/rules
../../bigtop/build/bigtop-packages/src/common/bigtop-jsvc/install_jsvc.sh \
--build-dir=. \
--prefix=$SNAPCRAFT_PART_INSTALL
stage:
- usr/lib/*
- usr/share/*
pig:
after:
- bigtop-groovy
- bigtop-jsvc
source: https://github.com/apache/pig.git
source-type: git
source-branch: branch-0.15
plugin: ant
ant-build-targets:
- clean
build-packages:
- curl
- gzip
- maven
- tar
prepare: |
cp ../../bigtop/build/bigtop-snap.bom \
../../bigtop/build/bigtop-packages/src/common/pig/bigtop.bom
chmod 755 ../../bigtop/build/bigtop-packages/src/common/pig/do-component-build
chmod 755 ../../bigtop/build/bigtop-packages/src/common/pig/install_pig.sh
# patch bigtop sources with snap-specific changes for pig
for i in `ls ../../../snap/sources/patch*.diff`; do \
patch -d ../../bigtop/build -p1 -i $i; done
# patch pig sources with bigtop-specific changes
for i in `ls ../../bigtop/build/bigtop-packages/src/common/pig/patch*.diff`; do \
patch -p1 -i $i; done
# update pig sources with snap-specific changes
sed -e 's/getProperty("user.home")/getenv("SNAP_USER_DATA")/' -i src/org/apache/pig/Main.java
sed -e 's/getProperty("user.dir")/getenv("SNAP_USER_DATA")/' -i src/org/apache/pig/Main.java
# proxied builds need help when ant tries to get ivy (ANT_OPTS is not enough)
# NB: ${http.var} will be set by the ant plugin when appropriate
NEEDS_PROXY=0
if [ -n "${http_proxy}" ]; then
NEEDS_PROXY=1
sed -e '/name="ivy-download"/a \
<setproxy proxyhost="${http.proxyHost}" proxyport="${http.proxyPort}" \
proxyuser="${http.proxyUser}" proxypassword="${http.proxyPassword}"/>' \
-e '/name="ivy-resolve"/a \
<setproxy proxyhost="${http.proxyHost}" proxyport="${http.proxyPort}" \
proxyuser="${http.proxyUser}" proxypassword="${http.proxyPassword}"/>' \
-i build.xml
elif [ -n "${https_proxy}" ]; then
NEEDS_PROXY=1
sed -e '/name="ivy-download"/a \
<setproxy proxyhost="${https.proxyHost}" proxyport="${https.proxyPort}" \
proxyuser="${https.proxyUser}" proxypassword="${https.proxyPassword}"/>' \
-e '/name="ivy-resolve"/a \
<setproxy proxyhost="${https.proxyHost}" proxyport="${https.proxyPort}" \
proxyuser="${https.proxyUser}" proxypassword="${https.proxyPassword}"/>' \
-i build.xml
fi
# Prepare source for a proxied build (common to http and https)
if [ "${NEEDS_PROXY}" -eq "1" ]; then
# NB: ivy does not like lp builder proxies (perhaps because they're
# authenticated). Put an ivy cache in place that already contains deps.
sed -e 's/checkmodified="true"/checkmodified="false"/' -i ivy/ivysettings.xml
curl -O https://s3.amazonaws.com/jujubigdata/snap-resources/pig/pig-ivy-cache.tgz
tar -C ${HOME} -zxf pig-ivy-cache.tgz
# tell the resolve task to only use the local cache
sed -e 's/<ivy:resolve/<ivy:resolve useCacheOnly="true"/' -i build.xml
sed -e 's/changing="true"/changing="false"/' -i ivy.xml
# dont blow away our cache!
sed -e 's|${h}/.ivy2/cache/\*jetty||' -i \
../../bigtop/build/bigtop-packages/src/common/pig/do-component-build
fi
install: |
# Do not define build tasks because we want the ant plugin to setup any
# proxy config (otherwise, we'd have to grok the env and do it ourselves).
# We still want to use the bigtop build recipe for the actual build, so
# do it first thing during install.
# NB: exit 1 on failure since install step failures do not stop the build
../../bigtop/build/bigtop-packages/src/common/pig/do-component-build || exit 1
# adapted from bigtop/bigtop-packages/src/deb/pig/rules
../../bigtop/build/bigtop-packages/src/common/pig/install_pig.sh \
--build-dir=build \
--prefix=$SNAPCRAFT_PART_INSTALL \
--doc-dir=/usr/share/doc/pig \
--examples-dir=/usr/share/doc/pig/examples
# FIXME: hack a $SNAP_DATA symlink since we cant use $SNAP_DATA during build
rm -f $SNAPCRAFT_PART_INSTALL/usr/lib/pig/conf
ln -s /var/snap/pig/current/etc/pig/conf $SNAPCRAFT_PART_INSTALL/usr/lib/pig/conf
# create dirs for potential slot contents
# NB: must be done now as $SNAP will be read-only when installed
install -d -m 0755 $SNAPCRAFT_PART_INSTALL/hadoop
install -d -m 0755 $SNAPCRAFT_PART_INSTALL/hbase
install -d -m 0755 $SNAPCRAFT_PART_INSTALL/hive
install -d -m 0755 $SNAPCRAFT_PART_INSTALL/zookeeper
stage:
- etc/pig
- hadoop
- hbase
- hive
- usr/lib/pig
- zookeeper
wrappers:
after:
- pig
source: snap/
plugin: dump
stage:
- wrappers/*
|