-
Notifications
You must be signed in to change notification settings - Fork 2
/
perl-dependencies
executable file
·376 lines (355 loc) · 15.8 KB
/
perl-dependencies
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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
#!/bin/bash
#
# This needs to go away and use local::lib instead
#
################################################################################
# Getting this to run on CentOS 5 proved to be impossible without overwriting
# perl modules provided by RPMs, thus breaking all package management principles
# so I decided to install them locally as needed. This script will pull them down
# from CPAN and install them in a local directory to which we can point jarvis' @INC
#
# Why not just use CPAN? I needed something that didn't play 40 questions with me
# every time I use it. I want to background this process and let jarvis just get
# what he needs without the water-boarding interrogation that's provided by -MCPAN -eshell
################################################################################
# Get some packages we need to build some of the modules
CPANLIB="$(cd $(dirname $0);pwd)/cpan";
PREFIX="${CPANLIB}"
CANHAS="gcc git openssl-devel expat-devel"
NEED=''
for pkg in $(echo "${CANHAS}"); do
echo "$(rpm -q ${pkg})"|grep -q "not installed" && NEED="${NEED} ${pkg}"
done
if [ ! -z "${NEED}" ]; then
echo "-=[$NEED]=-"
exit 0;
if [ "${UID}" == "0" ];then
yum install -y ${NEED}
else
echo "please: yum install -y ${NEED}"
exit;
fi
fi
if [ "$(stat -c %a /usr/local/share)" != "755" ] ;then
if [ "${UID}" == "0" ];then
chmod 755 /usr/local/share
else
echo "/usr/local/share needs to be 0755"
exit 2;
fi
fi
################################################################################
# gist bullshit:
if [ ! -f /usr/local/bin/gist ];then
if [ "${UID}" == "0" ];then
wget --no-check-certificate -O /usr/local/bin/gist https://github.com/fapestniegd/gist/raw/3a4d20ef432beb8e7541bdc594e54ab132a4e59b/gist
chmod 755 /usr/local/bin/gist
else
echo "you'll want to install gist in /usr/local/bin..."
fi
fi
################################################################################
################################################################################
[ ! -d "$(cd $(dirname $0);pwd)/tmp" ] && mkdir -p "$(cd $(dirname $0);pwd)/tmp"
LOGFILE=$(mktemp $(cd $(dirname $0);pwd)/tmp/cpan.install.log.XXXX)
################################################################################
spin(){
while [ 1 ]; do
echo -ne '/\x08' ; sleep 0.05
echo -ne '-\x08' ; sleep 0.05
echo -ne '\\\x08' ; sleep 0.05
echo -ne '|\x08' ; sleep 0.05
done
}
spinner(){
PROC=$1
spin &
disown
SPINNER=$!
wait $PROC
RETURN=$?
kill -9 ${SPINNER}
echo -ne "\x08 [${RETURN}] "
return $RETURN
}
################################################################################
try(){
if [ -d "$(cd $(dirname $0);pwd)/tmp" ];then
cd "$(cd $(dirname $0);pwd)/tmp"
fi
URI=$1
if [ -z "${URI}" ]; then exit 1;fi
FILE=$(echo "${URI}"|sed -e 's/.*\///')
first=$(echo ${URI}|cut -b 1)
firsttwo=$(echo ${URI}|cut -b 1-2)
INCLUDES=" -I ${PREFIX}/lib/perl5/5.8.8"
INCLUDES="${INCLUDES} -I ${PREFIX}/lib/perl5/site_perl/5.8.8/"
INCLUDES="${INCLUDES} -I ${PREFIX}/lib/perl5/i386-linux-thread-multi"
INCLUDES="${INCLUDES} -I ${PREFIX}/lib/perl5/5.8.8/i386-linux-thread-multi/"
INCLUDES="${INCLUDES} -I ${PREFIX}/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi"
export INCLUDES
MODULEANDVER=$(echo "${FILE}"|sed -e 's/\.tar.gz//')
MODULE=$(echo "${MODULEANDVER}"|sed -e 's/-[^\-]*$//') # strip the version
VERSION=$(echo "${MODULEANDVER}"|sed -e "s/^${MODULE}-//") # strip everything but the version
VERSION=$(echo "${VERSION}"|sed -e 's/0*$//') # 0.3800 -> 0.38
MODULE=$(echo ${MODULE} | sed -e 's/-/::/g') # put :: where the dashes are
ACTUAL_VERSION=$(perl ${INCLUDES} -M${MODULE} -le "print qq(\$${MODULE}::VERSION);")
ACTUAL_VERSION=$(echo "${ACTUAL_VERSION}"|sed -e 's/0*$//') # 0.3800 -> 0.38
if [ -z ${ACTUAL_VERSION} ]; then
echo "NO VERSION INFO FOR ${MODULE}"
#If it won't return a version, go with any version
perl ${INCLUDES} -M${MODULE} -le 'print;'
if [ $? -eq 0 ]; then return 0; fi
else
echo "Got: [ ${MODULE} ${ACTUAL_VERSION}/${VERSION} ]"
if [ "${ACTUAL_VERSION}" == "${VERSION}" ];then return 0; fi
fi
# fetch the file if we don't have it.
if [ ! -f "${FILE}" ];then
if [ -z "${FILE}" ]; then exit 2;fi
echo "Fetching ${FILE} from http://backpan.perl.org/authors/id/${first}/${firsttwo}/${URI}"
wget -qO "${FILE}" "http://backpan.perl.org/authors/id/${first}/${firsttwo}/${URI}"
if [ ! -f "${FILE}" ]; then exit 3;fi
fi
# yeah, seriously, the author of Net::Ping::External uses a .zip file. #someonesalwaysgottabedifferent
echo ${FILE} | grep -q "\.zip$"
if [ $? -eq 0 ]; then
unzip -o "${FILE}"
DIR=$(unzip -l Net-Ping-External-0.13.zip | awk '{if($1==0){print $NF;}}' |head -1|sed -e 's/\/.*//')
else
DIR=$(tar tzf "${FILE}"|sed -e 's/\/.*//'|sort -u|head -1)
tar xzf "${FILE}"
fi
if [ ! -d "${DIR}" ]; then exit 4;fi
echo "${DIR} $FILE"
PERL5LIB="${PREFIX}/lib/perl5/5.8.8"
PERL5LIB="${PERL5LIB}:${PREFIX}/lib/perl5/site_perl/5.8.8/"
PERL5LIB="${PERL5LIB}:${PREFIX}/lib/perl5/i386-linux-thread-multi"
PERL5LIB="${PERL5LIB}:${PREFIX}/lib/perl5/5.8.8/i386-linux-thread-multi"
PERL5LIB="${PERL5LIB}:${PREFIX}/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi"
export PERL5LIB
# Build
if [ -f "${DIR}/Build.PL" ]; then
export PERL5LIB
echo
echo "BUILD COMMANDS:"
echo "export PERL5LIB=\"$PERL5LIB\""
echo "export INCLUDES=\"$INCLUDES\""
echo "perl Build.PL --install_base "${PREFIX}" && ./Build && ./Build test && ./Build install"
echo
(cd "${DIR}" ; perl Build.PL --install_base "${PREFIX}" && ./Build && ./Build test && ./Build install) || exit 8
# maybe roll back the version if fails?
fi
# Make
# interactive by default options are gay
if [ "$DIR" == "XML-Twig-3.38" ];then GAYOPTIONS='-y'; fi
if [ -f "${DIR}/Makefile.PL" ]; then
echo
echo "BUILD COMMAND: perl ${INCLUDES} Makefile.PL ${GAYOPTIONS} PREFIX="${PREFIX}" 2>&1"
echo
(cd "${DIR}";yes "y"|perl ${INCLUDES} Makefile.PL ${GAYOPTIONS} PREFIX="${PREFIX}" 2>&1)|grep prerequisite
if [ $? == 0 ]; then
(cd "${DIR}";yes "y"|perl ${INCLUDES} Makefile.PL ${GAYOPTIONS} PREFIX="${PREFIX}" 2>&1)|grep prerequisite | while read line;do
echo "${line}" | sed -e 's/Warning: prerequisite //' -e 's/ .*$//'
done
exit 7 # could we try somwe fetching here?
else
export PERL5LIB
(cd "${DIR}";make && make test && make install) || exit 9 # maybe roll back the version if fails?
fi
fi
# clean up
rm -fr "${DIR}" "${FILE}"
}
################################################################################
################################################################################
the_needful(){
uri=$1;
pkg=$(echo $uri|sed -e 's/.*\///' -e's/.tar.gz.*$//')
echo -n "${pkg}: "
echo "################################################################################" >> ${LOGFILE} 2>&1
echo "# ${pkg}: ">> ${LOGFILE} 2>&1
echo "################################################################################" >> ${LOGFILE} 2>&1
try $line >> ${LOGFILE} 2>&1 &
spinner $!
if [ $? -eq 0 ];then
echo OK
return 0;
else
echo FAIL
return 1;
fi
}
################################################################################
# bare host kickstarted with:
# %packages
# @Base, dhcp, autodir, sendmail-cf, perl-Net-DNS, perl-Sys-Hostname-Long,
# perl-LDAP xorg-x11-xauth, xterm, openldap-clients, -java-1.5.0-ibm,
# -java-1.5.0-ibm-devel, -gpm cfengine-community
################################################################################
################################################################################
# add vmware with:
#
# wget VMware-vSphere-Perl-SDK-4.1.0-254719.i386.tar.gz from vmware
# tar xvzf VMware-vSphere-Perl-SDK-4.1.0-254719.i386.tar.gz
# (cd vmware-vsphere-cli-distrib;./vmware-install.pl default)
# (accept the license)
################################################################################
################################################################################
cat<<EOF |sed -e's/#.*//' -e 's/^ *try //' -e 's/^ *$//'| grep .|while read line;do the_needful $line||exit $?;done
#try RCAPUTO/POE-1.310.tar.gz # fails with deps, indented below
try GBARR/IO-1.25.tar.gz
try TODDR/IO-Tty-1.10.tar.gz
#try RCAPUTO/POE-Test-Loops-1.312.tar.gz
try MSCHWERN/Test-Simple-0.98.tar.gz
try RCAPUTO/POE-Test-Loops-1.312.tar.gz
try AMS/Storable-2.25.tar.gz
try RCAPUTO/POE-1.311.tar.gz
#try DOY/Moose-2.0010.tar.gz
#try RJBS/Data-OptList-0.107.tar.gz
#try ADAMK/Params-Util-1.04.tar.gz
try MSCHWERN/ExtUtils-MakeMaker-6.56.tar.gz
try ADAMK/Params-Util-1.04.tar.gz
try RJBS/Sub-Install-0.925.tar.gz
try RJBS/Data-OptList-0.107.tar.gz
#try FLORA/Devel-GlobalDestruction-0.03.tar.gz
try CHOCOLATE/Scope-Guard-0.20.tar.gz
try RJBS/Sub-Exporter-0.982.tar.gz
try FLORA/Devel-GlobalDestruction-0.03.tar.gz
#try DOY/Eval-Closure-0.06.tar.gz
#try RJBS/Test-Fatal-0.006.tar.gz
try DOY/Try-Tiny-0.09.tar.gz
try RJBS/Test-Fatal-0.006.tar.gz
#try TOKUHIROM/Test-Requires-0.06.tar.gz
try MSCHWERN/ExtUtils-MakeMaker-6.56.tar.gz
try TOKUHIROM/Test-Requires-0.06.tar.gz
try DOY/Eval-Closure-0.06.tar.gz
try ADAMK/List-MoreUtils-0.32.tar.gz
#try DROLSKY/Package-DeprecationManager-0.11.tar.gz
#try DROLSKY/Params-Validate-1.00.tar.gz
try SMUELLER/Attribute-Handlers-0.91.tar.gz
try DROLSKY/Params-Validate-1.00.tar.gz
try DROLSKY/Package-DeprecationManager-0.11.tar.gz
#try DOY/Package-Stash-0.29.tar.gz
try DOY/Package-Stash-XS-0.22.tar.gz
try DOY/Package-Stash-0.29.tar.gz
try RJBS/Sub-Exporter-0.982.tar.gz
try FLORA/Sub-Name-0.05.tar.gz
try ADAMK/Task-Weaken-1.04.tar.gz
#try FLORA/MRO-Compat-0.11.tar.gz
#try FLORA/Class-C3-0.23.tar.gz
#try FLORA/Algorithm-C3-0.08.tar.gz
#try DAGOLDEN/Module-Build-0.3800.tar.gz
#try DAGOLDEN/ExtUtils-ParseXS-2.2206.tar.gz
#try DAGOLDEN/ExtUtils-CBuilder-0.280202.tar.gz
try SMUELLER/PathTools-3.33.tar.gz
#try BINGOS/IPC-Cmd-0.70.tar.gz
try JESSE/Locale-Maketext-Simple-0.21.tar.gz
#try BINGOS/Module-Load-Conditional-0.44.tar.gz
try JPEACOCK/version-0.88.tar.gz
try BINGOS/Module-CoreList-2.46.tar.gz
try BINGOS/Module-Load-0.18.tar.gz
try BINGOS/Params-Check-0.28.tar.gz
try BINGOS/Module-Load-Conditional-0.44.tar.gz
try BINGOS/IPC-Cmd-0.70.tar.gz
# try DAGOLDEN/ExtUtils-CBuilder-0.280205.tar.gz
try DAGOLDEN/ExtUtils-ParseXS-2.2206.tar.gz
try DAGOLDEN/Module-Metadata-1.000004.tar.gz
#try DAGOLDEN/CPAN-Meta-2.110930.tar.gz
try DAGOLDEN/CPAN-Meta-YAML-0.003.tar.gz
try TJENNESS/File-Temp-0.22.tar.gz
try MAKAMAKA/JSON-PP-2.27105.tar.gz
try DAGOLDEN/Parse-CPAN-Meta-1.4401.tar.gz
try RJBS/Version-Requirements-0.101020.tar.gz
try DAGOLDEN/CPAN-Meta-2.110930.tar.gz
try DAGOLDEN/Parse-CPAN-Meta-1.4401.tar.gz
try DAGOLDEN/Perl-OSType-1.002.tar.gz
try ANDYA/Test-Harness-3.23.tar.gz
#try BIGPRESH/Pod-Readme-0.11.tar.gz
#try RRA/podlators-2.4.0.tar.gz
#try DWHEELER/Pod-Simple-3.16.tar.gz
try SBURKE/Pod-Escapes-1.04.tar.gz
try DWHEELER/Pod-Simple-3.16.tar.gz
try RRA/podlators-2.4.0.tar.gz
try ABIGAIL/Regexp-Common-2011041701.tar.gz
try BIGPRESH/Pod-Readme-0.11.tar.gz
#try BINGOS/Archive-Tar-1.76.tar.gz
#try PMQS/IO-Compress-2.033.tar.gz
try PMQS/Compress-Raw-Bzip2-2.033.tar.gz
#try PMQS/IO-Compress-2.033.tar.gz
try PMQS/Compress-Raw-Zlib-2.033.tar.gz
try PMQS/IO-Compress-2.033.tar.gz
try TOMHUGHES/IO-Zlib-1.10.tar.gz
try KANE/Package-Constants-0.02.tar.gz
#try OVID/Text-Diff-1.41.tar.gz
try NEDKONZ/Algorithm-Diff-1.15.tar.gz
try RBS/Text-Diff-0.35.tar.gz # <- newer versions require nonexistant Algorithm-Diff-1.19
try BINGOS/Archive-Tar-1.76.tar.gz
try DAGOLDEN/Module-Build-0.3800.tar.gz
#try FLORA/Algorithm-C3-0.06.tar.gz
try BLBLACK/Algorithm-C3-0.06.tar.gz
try FLORA/Class-C3-0.23.tar.gz
try FLORA/MRO-Compat-0.11.tar.gz
try DOY/Moose-2.0010.tar.gz
#try JKIM/Net-Amazon-EC2-0.14.tar.gz
# try GRANTM/XML-Simple-2.18.tar.gz
try GRANTM/XML-SAX-0.96.tar.gz
try GRANTM/XML-Simple-2.18.tar.gz
try DROLSKY/Params-Validate-1.00.tar.gz
try JKIM/Net-Amazon-EC2-0.14.tar.gz
#try PMQS/IO-Compress-2.033.tar.gz
try PMQS/Compress-Raw-Zlib-2.033.tar.gz
try PMQS/Compress-Raw-Bzip2-2.037.tar.gz
try PMQS/IO-Compress-2.033.tar.gz
#try PETDANCE/WWW-Mechanize-1.66.tar.gz # (1.68 fails tests)
#try JFEARN/HTML-Tree-4.2.tar.gz
#try ADIE/Test-Exception-0.31.tar.gz
#try DAGOLDEN/Sub-Uplevel-0.22.tar.gz
try DAGOLDEN/Sub-Uplevel-0.22.tar.gz
try ADIE/Test-Exception-0.31.tar.gz
try JFEARN/HTML-Tree-4.2.tar.gz
try JESSE/HTTP-Server-Simple-0.44.tar.gz
#try GAAS/libwww-perl-6.02.tar.gz
try GAAS/Encode-Locale-1.02.tar.gz
#try GAAS/File-Listing-6.02.tar.gz
try GAAS/HTTP-Date-6.00.tar.gz
try GAAS/File-Listing-6.02.tar.gz
#try GAAS/HTTP-Cookies-6.00.tar.gz
#try GAAS/HTTP-Message-6.02.tar.gz
try GAAS/LWP-MediaTypes-6.01.tar.gz
try GAAS/HTTP-Message-6.02.tar.gz
try GAAS/HTTP-Cookies-6.00.tar.gz
try GAAS/HTTP-Daemon-6.00.tar.gz
try GAAS/HTTP-Date-6.00.tar.gz
try GAAS/HTTP-Negotiate-6.00.tar.gz
try GAAS/HTTP-Message-6.02.tar.gz
try GAAS/LWP-MediaTypes-6.01.tar.gz
try GAAS/Net-HTTP-6.01.tar.gz
try GAAS/WWW-RobotRules-6.01.tar.gz
try GAAS/libwww-perl-6.02.tar.gz
# try CHORNY/Test-Warn-0.23.tar.gz
try COGENT/Tree-DAG_Node-1.06.tar.gz
try CHORNY/Test-Warn-0.23.tar.gz
try GAAS/URI-1.58.tar.gz
# try PETDANCE/Test-Memory-Cycle-1.04.tar.gz
try LDS/Devel-Cycle-1.11.tar.gz
try ROBIN/PadWalker-1.92.tar.gz
try PETDANCE/Test-Memory-Cycle-1.04.tar.gz
try PETDANCE/WWW-Mechanize-1.66.tar.gz # (1.68 fails )
try MAKAMAKA/JSON-2.53.tar.gz
try INGY/YAML-0.73.tar.gz
try CHORNY/Net-Ping-External-0.13.zip
#try GBARR/Net-TFTP-0.19.tar.gz
try SIMONFLK/Test-MockModule-0.05.tar.gz
try GBARR/Net-TFTP-0.19.tar.gz
EOF
################################################################################
# un-do the crap we did just to make this stuff build/test/install
if [ ! -z "${NEED}" ]; then
if [ "${UID}" == "0" ];then
rpm -e ${NEED}
else
echo "you may: rpm -e ${NEED} now."
exit;
fi
fi