Gentoo Archives: gentoo-releng

From: Ben Kohler <bkohler@g.o>
To: gentoo-releng@l.g.o
Subject: [gentoo-releng] [PATCH 2/2] catalyst-auto-x86*.conf: explicitly list files to be transferred
Date: Fri, 15 May 2020 13:07:26
Message-Id: 20200515130719.3138513-2-bkohler@gentoo.org
In Reply to: [gentoo-releng] [PATCH 1/2] catalyst-auto-amd64*.conf: explicitly list files to be transferred by Ben Kohler
1 Previously when we were copying locally there was no (major) problem
2 with wildcarding a long list of files to be transferred after every
3 single spec finishes. Now that we are transferring to a remote host,
4 this results in a lot of wasted transfer time & bandwidth.
5
6 I have adjusted the post_build function to only transfer the new files
7 known to be produced by each spec (which has files meant to be
8 published).
9
10 Signed-off-by: Ben Kohler <bkohler@g.o>
11 ---
12 tools/catalyst-auto-x86-experimental.conf | 71 +++++++++++++----------
13 tools/catalyst-auto-x86.conf | 57 +++++++++---------
14 2 files changed, 67 insertions(+), 61 deletions(-)
15
16 diff --git a/tools/catalyst-auto-x86-experimental.conf b/tools/catalyst-auto-x86-experimental.conf
17 index 3fd60287..061cab92 100644
18 --- a/tools/catalyst-auto-x86-experimental.conf
19 +++ b/tools/catalyst-auto-x86-experimental.conf
20 @@ -30,17 +30,27 @@ EXTENSIONS="[.tar.xz,.tar.bz2,.tar.gz,.tar,.sfs]"
21 update_symlinks() {
22 # Symlink the latest stages3 to build from
23 for d in ${BUILD_SRCDIR_BASE}/{default,hardened} ; do
24 - pushd $d >/dev/null
25 + pushd "${d}" >/dev/null || exit
26 for f in $(ls stage3*${EXTENSIONS} | grep -v latest | give_latest_from_dates ) ; do
27 - of=${f/20[0-9][0-9].[0-9]/latest} # for 20XX.Y stuff
28 - of=${of/20[0-9][0-9][0-1][0-9][0-9][0-9]/latest} # for 20YYMMDD stuff
29 - ln -sf $f $of
30 + # 20yymmddThhmmssZ
31 + # 20yymmddhhmmss
32 + # 20yymmdd
33 + # 20yy.n
34 + of=$(perl -p \
35 + -e 's/20\d{6}T\d{6}Z/latest/g;' \
36 + -e 's/20\d{6}\d{6}/latest/g;' \
37 + -e 's/20\d{6}/latest/g;' \
38 + -e 's/20\d{2}\.\d{2}/latest/g;' \
39 + <<<"$f")
40 + ln -svf "$f" "$of"
41 done
42 - popd >/dev/null
43 + popd >/dev/null || exit
44 done
45 }
46
47 post_build() {
48 + local set=$1 spec=$2
49 +
50 cmd=(
51 rsync
52 -e 'ssh -i /root/.ssh/id_rsa -o UserKnownHostsFile=/dev/null -o VerifyHostKeyDNS=yes -o StrictHostKeyChecking=no'
53 @@ -59,34 +69,31 @@ post_build() {
54 DEST_HARDENED=${ARCH}@releng-incoming.gentoo.org:${BUILD_DESTDIR_BASE}/hardened
55 ;;
56 esac
57 - pushd ${BUILD_SRCDIR_BASE}/default >/dev/null
58 - mkdir -p ${TMPDIR}/empty
59 - "${cmd[@]}" ${TMPDIR}/empty ${DEST_DEFAULT}
60 - for file in $(ls stage{3,4}*{${DATESTAMP},${TIMESTAMP}}*${EXTENSIONS} ); do
61 - if [ -f $file ]; then
62 - "${cmd[@]}" ${file}* ${DEST_DEFAULT}
63 - fi
64 - done
65 - if [ -f *${DATESTAMP}*.iso ]; then
66 - "${cmd[@]}" *${DATESTAMP}*.iso* ${DEST_DEFAULT}
67 - elif [ -f *${TIMESTAMP}*.iso ]; then
68 - "${cmd[@]}" *${TIMESTAMP}*.iso* ${DEST_DEFAULT}
69 - fi
70 - popd >/dev/null
71
72 - pushd ${BUILD_SRCDIR_BASE}/hardened >/dev/null
73 - "${cmd[@]}" ${TMPDIR}/empty ${DEST_HARDENED}
74 - for file in $(ls stage{3,4}*{${DATESTAMP},${TIMESTAMP}}*${EXTENSIONS} ); do
75 - if [ -f $file ]; then
76 - "${cmd[@]}" $file* ${DEST_HARDENED}
77 - fi
78 - done
79 - if [ -f *${DATESTAMP}*.iso ]; then
80 - "${cmd[@]}" *${DATESTAMP}*.iso* ${DEST_HARDENED}
81 - elif [ -f *${TIMESTAMP}*.iso ]; then
82 - "${cmd[@]}" *${TIMESTAMP}*.iso* ${DEST_HARDENED}
83 - fi
84 - popd >/dev/null
85 + pushd "${BUILD_SRCDIR_BASE}"/default >/dev/null || exit
86 + case ${spec} in
87 + stage3.spec)
88 + "${cmd[@]}" stage3-i486-${TIMESTAMP}.tar.xz* "${DEST_DEFAULT}"
89 + ;;
90 + installcd-stage2-minimal.spec)
91 + "${cmd[@]}" install-x86-minimal-${TIMESTAMP}.iso* "${DEST_DEFAULT}"
92 + ;;
93 + i686/stage3.spec)
94 + "${cmd[@]}" stage3-i686-${TIMESTAMP}.tar.xz* "${DEST_DEFAULT}"
95 + ;;
96 + esac
97 + popd >/dev/null || exit
98 +
99 + pushd "${BUILD_SRCDIR_BASE}"/hardened >/dev/null || exit
100 + case ${spec} in
101 + hardened/stage3.spec)
102 + "${cmd[@]}" stage3-i686-hardened-${TIMESTAMP}.tar.xz* "${DEST_HARDENED}"
103 + ;;
104 + hardened/admincd-stage2.spec)
105 + "${cmd[@]}" admincd-x86-${TIMESTAMP}.iso* "${DEST_HARDENED}"
106 + ;;
107 + esac
108 + popd >/dev/null || exit
109 }
110
111 # vim:ft=sh:
112 diff --git a/tools/catalyst-auto-x86.conf b/tools/catalyst-auto-x86.conf
113 index 27637e59..e778ce8e 100644
114 --- a/tools/catalyst-auto-x86.conf
115 +++ b/tools/catalyst-auto-x86.conf
116 @@ -30,7 +30,7 @@ EXTENSIONS="[.tar.xz,.tar.bz2,.tar.gz,.tar,.sfs]"
117 update_symlinks() {
118 # Symlink the latest stages3 to build from
119 for d in ${BUILD_SRCDIR_BASE}/{default,hardened} ; do
120 - pushd $d >/dev/null
121 + pushd "${d}" >/dev/null || exit
122 for f in $(ls stage3*${EXTENSIONS} | grep -v latest | give_latest_from_dates ) ; do
123 # 20yymmddThhmmssZ
124 # 20yymmddhhmmss
125 @@ -44,11 +44,13 @@ update_symlinks() {
126 <<<"$f")
127 ln -svf "$f" "$of"
128 done
129 - popd >/dev/null
130 + popd >/dev/null || exit
131 done
132 }
133
134 post_build() {
135 + local set=$1 spec=$2
136 +
137 cmd=(
138 rsync
139 -e 'ssh -i /root/.ssh/id_rsa -o UserKnownHostsFile=/dev/null -o VerifyHostKeyDNS=yes -o StrictHostKeyChecking=no'
140 @@ -67,34 +69,31 @@ post_build() {
141 DEST_HARDENED=${ARCH}@releng-incoming.gentoo.org:${BUILD_DESTDIR_BASE}/hardened
142 ;;
143 esac
144 - pushd ${BUILD_SRCDIR_BASE}/default >/dev/null
145 - mkdir -p ${TMPDIR}/empty
146 - "${cmd[@]}" ${TMPDIR}/empty ${DEST_DEFAULT}
147 - for file in $(ls stage{3,4}*${DATESTAMP}*${EXTENSIONS} stage{3,4}*${TIMESTAMP}*${EXTENSIONS} ); do
148 - if [ -f $file ]; then
149 - "${cmd[@]}" ${file}* ${DEST_DEFAULT}
150 - fi
151 - done
152 - if [ -f *${DATESTAMP}*.iso ]; then
153 - "${cmd[@]}" *${DATESTAMP}*.iso* ${DEST_DEFAULT}
154 - elif [ -f *${TIMESTAMP}*.iso ]; then
155 - "${cmd[@]}" *${TIMESTAMP}*.iso* ${DEST_DEFAULT}
156 - fi
157 - popd >/dev/null
158
159 - pushd ${BUILD_SRCDIR_BASE}/hardened >/dev/null
160 - "${cmd[@]}" ${TMPDIR}/empty ${DEST_HARDENED}
161 - for file in $(ls stage{3,4}*${DATESTAMP}*${EXTENSIONS} stage{3,4}*${TIMESTAMP}*${EXTENSIONS} ); do
162 - if [ -f $file ]; then
163 - "${cmd[@]}" $file* ${DEST_HARDENED}
164 - fi
165 - done
166 - if [ -f *${DATESTAMP}*.iso ]; then
167 - "${cmd[@]}" *${DATESTAMP}*.iso* ${DEST_HARDENED}
168 - elif [ -f *${TIMESTAMP}*.iso ]; then
169 - "${cmd[@]}" *${TIMESTAMP}*.iso* ${DEST_HARDENED}
170 - fi
171 - popd >/dev/null
172 + pushd "${BUILD_SRCDIR_BASE}"/default >/dev/null || exit
173 + case ${spec} in
174 + stage3.spec)
175 + "${cmd[@]}" stage3-i486-${TIMESTAMP}.tar.xz* "${DEST_DEFAULT}"
176 + ;;
177 + installcd-stage2-minimal.spec)
178 + "${cmd[@]}" install-x86-minimal-${TIMESTAMP}.iso* "${DEST_DEFAULT}"
179 + ;;
180 + i686/stage3.spec)
181 + "${cmd[@]}" stage3-i686-${TIMESTAMP}.tar.xz* "${DEST_DEFAULT}"
182 + ;;
183 + esac
184 + popd >/dev/null || exit
185 +
186 + pushd "${BUILD_SRCDIR_BASE}"/hardened >/dev/null || exit
187 + case ${spec} in
188 + hardened/stage3.spec)
189 + "${cmd[@]}" stage3-i686-hardened-${TIMESTAMP}.tar.xz* "${DEST_HARDENED}"
190 + ;;
191 + hardened/admincd-stage2.spec)
192 + "${cmd[@]}" admincd-x86-${TIMESTAMP}.iso* "${DEST_HARDENED}"
193 + ;;
194 + esac
195 + popd >/dev/null || exit
196 }
197
198 # vim:ft=sh:
199 --
200 2.26.2