@@ -19,17 +19,18 @@ setup_hosts() {
19
19
" 93.184.216.34 example.com"
20
20
)
21
21
22
- cat /etc/hosts >> /tmp/hosts
22
+ echo " Extending /etc/hosts file."
23
+ cp /etc/hosts /tmp/hosts.bak
23
24
for line in $HOSTS ; do
24
- echo $line >> /tmp /hosts
25
+ echo $line >> /etc /hosts
25
26
done
26
- mount -o bind /tmp/hosts /etc/hosts
27
27
28
28
CLEANUP_FUNCTIONS+=(cleanup_hosts)
29
29
}
30
30
31
31
cleanup_hosts () {
32
- umount /etc/hosts
32
+ echo " Restoring /etc/hosts file."
33
+ mv /tmp/hosts.bak /etc/hosts
33
34
}
34
35
35
36
setup_ssh () {
@@ -46,6 +47,7 @@ setup_ssh() {
46
47
" -p 80 github.com"
47
48
)
48
49
50
+ echo " Performing keyscan for expected hosts."
49
51
for host in $HOSTS ; do
50
52
if grep -vqF " $host " ~ /.ssh/known_hosts; then
51
53
ssh-keyscan $host >> ~ /.ssh/known_hosts
@@ -75,17 +77,20 @@ setup_conan() {
75
77
local CONAN_LOGIN_USERNAME=
76
78
local CONAN_PASSWORD=
77
79
78
- if network_available; then
79
- # Set the request timeout to 360 seconds to work-around slow servers.
80
- conan config set general.request_timeout=360
81
80
82
- if [ " ${CONAN_REMOTE} " != " " ]; then
83
- conan remote add default " ${CONAN_REMOTE} " " ${CONAN_REMOTE_VERIFY_SSL} "
84
- fi
81
+ # Set the request timeout to 360 seconds to work-around slow servers.
82
+ conan config set general.request_timeout=360
85
83
86
- if [ " ${CONAN_LOGIN_USERNAME} " != " " ]; then
87
- conan user --remote=default -p
88
- fi
84
+ if [ " ${CONAN_REMOTE} " != " " ]; then
85
+ echo " Adding Conan 'default' remote."
86
+ conan remote add default " ${CONAN_REMOTE} " " ${CONAN_REMOTE_VERIFY_SSL} "
87
+ fi
88
+
89
+ if [ " ${CONAN_LOGIN_USERNAME} " != " " ]; then
90
+ echo " Authenticating with 'default' remote."
91
+ export CONAN_LOGIN_USERNAME CONAN_PASSWORD
92
+ conan user --remote=default -p
93
+ unset CONAN_LOGIN_USERNAME CONAN_PASSWORD
89
94
fi
90
95
91
96
CLEANUP_FUNCTIONS+=(cleanup_conan)
@@ -101,6 +106,50 @@ setup_vtd() {
101
106
export VI_LIC_SERVER=" vtd-licenses.example.com"
102
107
}
103
108
109
+ indent_lines () {
110
+ sed -r -e ' s/[[:cntrl:]]//g' -e ' s/^/\t/g'
111
+ }
112
+
113
+ upload_package () {
114
+ pkgref=" $1 "
115
+ pkgname=" $( echo " $pkgref " | sed -r ' s/#.*$//' ) "
116
+ faillog=" $2 "
117
+
118
+ conan upload -r default --all --force -c " $pkgname "
119
+ if [ $? -ne 0 ]; then
120
+ echo " INFO: attempting recipe-download work-around"
121
+ conan download -r conancenter -re " $pkgref "
122
+ if [ $? -ne 0 ]; then
123
+ echo " CRITICAL: recipe download failed, skipping"
124
+ echo " $pkgref " >> " $faillog "
125
+ return
126
+ fi
127
+
128
+ echo " INFO: attempting upload for second time"
129
+ conan upload -r default --all --force -c " $pkgname "
130
+ if [ $? -ne 0 ]; then
131
+ echo " CRITICAL: package upload failed, skipping"
132
+ echo " $pkgref " >> " $faillog "
133
+ return
134
+ fi
135
+ fi
136
+ echo " INFO: upload successful"
137
+ }
138
+
139
+ release_packages () {
140
+ echo " Uploading packages..."
141
+ faillog=/tmp/conan-upload-failures.log
142
+ conan search --raw --rev | sed -r ' /^[^@]+$/ { s!#!@_/_#! }' | while read line; do
143
+ echo " Upload: $line "
144
+ upload_package " $line " $faillog 2>&1 | indent_lines
145
+ done
146
+
147
+ if [ $( cat $faillog 2> /dev/null | wc -l) -gt 0 ]; then
148
+ echo " Failure uploading:"
149
+ cat $faillog | indent_lines
150
+ fi
151
+ }
152
+
104
153
upload_conan_packages () {
105
154
# Prequisites:
106
155
# 1. You need to add a 'default' remote and authenticate with it.
0 commit comments