-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile.wget.cgnac1
125 lines (125 loc) · 8.29 KB
/
Jenkinsfile.wget.cgnac1
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
pipeline {
agent any
stages {
stage('unpack') {
steps {
withEnv(['WGET_VERSION=1.20.3',
'DOWNLOADS=/home/ituglib/randall/downloads']){
cleanWs()
sh 'tar xzf ${DOWNLOADS}/wget-${WGET_VERSION}.tar.gz'
sh 'mv wget-${WGET_VERSION}/* .'
}
}
}
stage('config') {
steps {
withEnv(['PATH=/usr/coreutils/bin:/usr/local/bin:/usr/bin:/bin:/usr/ucb',
'_RLD_LIB_PATH=:/usr/local/lib']) {
sh 'CFLAGS="-c99" OPENSSL_CFLAGS="-I/usr/local/include -L/usr/local/lib" OPENSSL_LIBS="-lssl -lcrypto" conf_script_floss_cc --with-ssl=openssl'
}
}
}
stage('patch') {
steps {
sh 'sed "/# error/s/.*/ return \\\"wget\\\";/" -i lib/getprogname.c'
sh 'sed "/string.h/a#include <strings.h>" -i src/cookies.c'
sh 'sed "/string.h/a#include <strings.h>" -i src/css-url.c'
sh 'sed "/string.h/a#include <strings.h>" -i src/ftp-basic.c'
sh 'sed "/string.h/a#include <strings.h>" -i src/hash.c'
sh 'sed "/string.h/a#include <strings.h>" -i src/html-parse.c'
sh 'sed "/string.h/a#include <strings.h>" -i src/html-url.c'
sh 'sed "/string.h/a#include <strings.h>" -i src/http.c'
sh 'sed "/string.h/a#include <strings.h>" -i src/netrc.c'
sh 'sed "/string.h/a#include <strings.h>" -i src/recur.c'
sh 'sed "/string.h/a#include <strings.h>" -i src/utils.c'
sh 'printf "/#ifndef _/\ni\n#undef fprintf\n#define rpl_fprintf fprintf\n#undef vfprintf\n#define rpl_vfprintf vfprintf\n.\nw\n" | ed lib/error.c'
sh 'printf "/static void/\ni\n#undef fprintf\n#define rpl_fprintf fprintf\n.\nw\n" | ed lib/getopt.c'
sh 'printf "/static void/\ni\n#undef fputs\n#define rpl_fputs fputs\n.\nw\n" | ed lib/getpass.c'
sh 'printf "/sock_write/\n.-2\na\n#undef write\n#define rpl_write write\n.\nw\n" | ed src/connect.c'
sh 'printf "/convert_links/\ni\n#undef putc\n#define rpl_fputc putc\n#undef fputs\n#define rpl_fputs fputs\n#undef fwrite\n#define rpl_fwrite fwrite\n.\nw\n" | ed src/convert.c'
sh 'printf "/cookie_jar_save/\n.-1\ni\n#undef fputc\n#define rpl_fputc fputc\n#undef fputs\n#define rpl_fputs fputs\n#undef fprintf\n#define rpl_fprintf fprintf\n.\nw\n" | ed src/cookies.c'
sh 'printf "/yy_init_globals/\ni\n#undef fwrite\n#define rpl_fwrite fwrite\n#undef fprintf\n#define rpl_fprintf fprintf\n.\nw\n" | ed src/css_.c'
sh 'printf "/Converts symbolic permissions/\ni\n#undef fputc\n#define rpl_fputc fputc\n#undef fprintf\n#define rpl_fprintf fprintf\n.\nw\n" | ed src/ftp-ls.c'
sh 'printf "/struct hsts_store/\ni\n#undef fputs\n#define rpl_fputs fputs\n#undef fprintf\n#define rpl_fprintf fprintf\n.\nw\n" | ed src/hsts.c'
sh 'printf "/Forward decls./\ni\n#undef fwrite\n#define rpl_fwrite fwrite\n.\nw\n" | ed src/http.c'
sh 'printf "/CMD_DECLARE/\ni\n#undef fprintf\n#define rpl_fprintf fprintf\n.\nw\n" | ed src/init.c'
sh 'printf "/static struct log_ln/\ni\n#undef fputs\n#define rpl_fputs fputs\n#undef fwrite\n#define rpl_fwrite fwrite\n#undef fprintf\n#define rpl_fprintf fprintf\n#undef vfprintf\n#define rpl_vfprintf vfprintf\n.\nw\n" | ed src/log.c'
sh 'printf "/const char.*exec_name/\ni\n#undef printf\n#define rpl_printf printf\n#undef fprintf\n#define rpl_fprintf fprintf\n#undef fputs\n#define rpl_fputs fputs\n.\nw\n" | ed src/main.c'
sh 'printf "/parse_netrc/\ni\n#undef fprintf\n#define rpl_fprintf fprintf\n.\nw\n" | ed src/netrc.c'
sh 'printf "/progress_implementation/\ni\n#undef fprintf\n#define rpl_fprintf fprintf\n.\nw\n" | ed src/progress.c'
sh 'printf "/queue_element/\ni\n#undef fprintf\n#define rpl_fprintf fprintf\n.\nw\n" | ed src/recur.c'
sh 'printf "/total_downloaded_bytes/\n.-1\ni\n#undef fwrite\n#define rpl_fwrite fwrite\n.\nw\n" | ed src/retr.c'
sh 'printf "/struct scheme_data/\ni\n#undef printf\n#define rpl_printf printf\n.\nw\n" | ed src/url.c'
sh 'printf "/memfatal/\n.-1\ni\n#undef fprintf\n#define rpl_fprintf fprintf\n#undef printf\n#define rpl_printf printf\n.\nw\n" | ed src/utils.c'
sh 'printf "/The log file/\ni\n#undef fprintf\n#define rpl_fprintf fprintf\n#undef fwrite\n#define rpl_fwrite fwrite\n.\nw\n" | ed src/warc.c'
sh 'printf "/test_all_from/\ni\n#undef printf\n#define rpl_printf printf\n#undef fprintf\n#define rpl_fprintf fprintf\n.\nw\n" | ed fuzz/main.c'
sh 'sed "/dlsym (RTLD_NEXT/s/dlsym (RTLD_NEXT/dlsym ((dlHandle)RTLD_NEXT/" -i fuzz/wget_css_fuzzer.c'
sh 'sed "/dlsym (RTLD_NEXT/s/dlsym (RTLD_NEXT/dlsym ((dlHandle)RTLD_NEXT/" -i fuzz/wget_ftpls_fuzzer.c'
sh 'sed "/dlsym (RTLD_NEXT/s/dlsym (RTLD_NEXT/dlsym ((dlHandle)RTLD_NEXT/" -i fuzz/wget_netrc_fuzzer.c'
sh 'sed "/dlsym (RTLD_NEXT/s/dlsym (RTLD_NEXT/dlsym ((dlHandle)RTLD_NEXT/" -i fuzz/wget_options_fuzzer.c'
}
}
stage('build') {
steps {
withEnv(['PATH=/usr/coreutils/bin:/usr/local/bin:/usr/bin:/bin:/usr/ucb',
'_RLD_LIB_PATH=:/usr/local/lib']) {
sh 'make'
}
}
}
stage('findcall_floss') {
steps {
withEnv(['PATH=/usr/coreutils/bin:/usr/local/bin:/usr/bin:/bin:/usr/ucb',
'_RLD_LIB_PATH=:/usr/local/lib']) {
sh 'findcall_floss || echo "Definitely fails but that is unavoidable"'
}
}
}
stage('test') {
steps {
withEnv(['PATH=/usr/coreutils/bin:/usr/local/bin:/usr/bin:/bin:/usr/ucb',
'_RLD_LIB_PATH=:/usr/local/lib']) {
sh 'make check || echo "Tests failed but expected"'
}
}
}
stage('install') {
steps {
withEnv(['PATH=/usr/coreutils/bin:/usr/local/bin:/usr/bin:/bin:/usr/ucb',
'_RLD_LIB_PATH=:/usr/local/lib',
'BASENAME=wget',
'DEST=install']) {
sh 'make install DESTDIR=${WORKSPACE}/install'
}
}
}
stage('deploy') {
steps {
withEnv(['PATH=/usr/coreutils/bin:/usr/local/bin:/usr/bin:/bin:/usr/ucb',
'_RLD_LIB_PATH=:/usr/local/lib',
'BASENAME=wget',
'DEST=/home/ituglib/randall/stage']) {
sh 'export INSTALL_LOCATION="${WORKSPACE}/install/usr/local" && export VERSION_PATH="${INSTALL_LOCATION}/bin/wget" && . ${WORKSPACE}/../Ituglib_Build/dist.info.nsx && bash ${WORKSPACE}/../Ituglib_Build/package.bin.nomanifest'
}
}
}
stage('remote') {
steps {
withEnv(['PATH=/usr/coreutils/bin:/usr/local/bin:/usr/bin:/bin:/usr/ucb',
'_RLD_LIB_PATH=:/usr/local/lib',
'BASENAME=wget',
'DEST=/home/ituglib/randall/stage',
'REMOTE_DEST=/web/stage']) {
sh 'export INSTALL_LOCATION="${WORKSPACE}/install/usr/local" && export VERSION_PATH="${INSTALL_LOCATION}/bin/wget" && . ${WORKSPACE}/../Ituglib_Build/dist.info.nsx && echo "put $DEST/${BASENAME}-* $REMOTE_DEST" | /G/system/zssh/sftposs $REMOTE'
sh 'rm ${DEST}/${BASENAME}-*'
}
}
}
}
post {
always {
mail bcc: '', body: "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}\nDuration: ${currentBuild.durationString}\nChange: ${currentBuild.changeSets}\n More info at: ${env.BUILD_URL}", cc: '', from: '[email protected]', replyTo: '', subject: "[Jenkins CGNAC1] ${currentBuild.currentResult}: job ${env.JOB_NAME}", to: '[email protected]'
}
}
}