Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 574752
Collapse All | Expand All

(-)a/snapshots-create.sh (-2 / +60 lines)
Lines 1-5 Link Here
1
#!/bin/bash
1
#!/bin/bash
2
# Copyright 2011-2017 Gentoo Foundation; Distributed under the GPL v2
2
# Copyright 2011-2019 Gentoo Authors; Distributed under the GPL v2
3
# might be earlier copyright, no history available
3
# might be earlier copyright, no history available
4
4
5
# 1) Create the tarball
5
# 1) Create the tarball
Lines 33-38 DELTA_FILENAME="portage-${DELTA_BASE}.tar.bz2" Link Here
33
YESTERDAY=`/bin/date -d yesterday +%Y%m%d`
33
YESTERDAY=`/bin/date -d yesterday +%Y%m%d`
34
FILENAME="portage-${YESTERDAY}.tar.bz2"
34
FILENAME="portage-${YESTERDAY}.tar.bz2"
35
35
36
FILENAME_NEW="gentoo-${YESTERDAY}.tar.xz"
37
36
# Parallel compressors can use a LOT of cpu, be nice about it
38
# Parallel compressors can use a LOT of cpu, be nice about it
37
NICE="nice -n 10"
39
NICE="nice -n 10"
38
40
Lines 148-153 fi Link Here
148
write_time_log "END TARBALL		$(date -u)"
150
write_time_log "END TARBALL		$(date -u)"
149
# end 1)
151
# end 1)
150
152
153
# 1b) Also create new-style tarball
154
write_time_log "START TARBALL_NEW		$(date -u)"
155
if [ ! -f "${FILENAME_NEW%.xz}" ]; then
156
	# Build exclusion list
157
	EXCLUSION_LIST="$(mktemp -p ${TEMP} snapshot-exclude.XXXXXXXXXX)"
158
	/usr/local/bin/mastermirror/print-exclusion-list.sh "${MASTER}" >"${EXCLUSION_LIST}"
159
160
	TAR_OPTIONS=(
161
	# Force a small block size
162
		--blocking-factor=1
163
		--record-size=512
164
	# GNU tar format saves approximately 1K per file in the tarball over POSIX
165
	# format. Multiply ~170k files, and the savings are large.
166
		--format=gnu
167
	# Sorting by name produces consistent ordering and helps compression of
168
	# related content. Custom ordering might further improve ordering in future
169
	# (eg all metadata.xml first)
170
		--sort=name
171
	# Force ownership of content:
172
		--owner=portage
173
		--group=portage
174
	# Excluded content:
175
		--no-wildcards
176
		--exclude-from "${EXCLUSION_LIST}"
177
	# Do not capture any xattr/acl info at all.
178
		--no-acls
179
		--no-xattrs
180
		--no-selinux
181
	# Include a volume ID for tracing
182
	# volume header is not supported by:
183
	# - Docker https://bugs.gentoo.org/631644
184
	# - tarsync https://bugs.gentoo.org/631616
185
	#	-V "${FILENAME%.bz2}"
186
	# do everything relative to the destination
187
		-C "${MASTER}"
188
		# The . needs to match the file argument
189
		--transform="s,^\.,${FILENAME_NEW%%.*},g"
190
	# The operation, destination, source arguments
191
		--create
192
		--file ${FILENAME_NEW%.xz}
193
		.
194
	)
195
196
	tar "${TAR_OPTIONS[@]}"
197
	rc=$?
198
	if [ $rc -ne 0 ]; then
199
		echo "Tar run failed!"
200
		exit 1
201
	fi
202
	rm -f "${EXCLUSION_LIST}"
203
fi
204
[ ! -f "${FILENAME_NEW}.umd5sum" ] && md5sum ${FILENAME_NEW%.xz} > ${FILENAME_NEW}.umd5sum
205
[ ! -f "${FILENAME_NEW}" ] && ${NICE} ${XZ_PROG} -9 -e <"${FILENAME_NEW%.*}" >"${FILENAME_NEW%.*}.xz"
206
write_time_log "END TARBALL_NEW		$(date -u)"
207
# end 1b)
208
151
# 2) Sanity check the tarball size and bail out if it appears abnormal.
209
# 2) Sanity check the tarball size and bail out if it appears abnormal.
152
write_time_log "START SIZE SANITY	$(date -u)"
210
write_time_log "START SIZE SANITY	$(date -u)"
153
current_size=$(stat -c '%s' "${FILENAME}")
211
current_size=$(stat -c '%s' "${FILENAME}")
Lines 187-193 write_time_log "END XZ $(date -u)" Link Here
187
245
188
# 4) sign
246
# 4) sign
189
write_time_log "START SIGN		$(date -u)"
247
write_time_log "START SIGN		$(date -u)"
190
for f in "${FILENAME}" "${FILENAME%.*}".xz ; do
248
for f in "${FILENAME}" "${FILENAME%.*}".xz "${FILENAME_NEW}"; do
191
	if [ ! -f "${UPLOAD}${f}".umd5sum ]; then
249
	if [ ! -f "${UPLOAD}${f}".umd5sum ]; then
192
		cp "${FILENAME}".umd5sum "${UPLOAD}${f}".umd5sum || exit $?
250
		cp "${FILENAME}".umd5sum "${UPLOAD}${f}".umd5sum || exit $?
193
		md5sum "$f" > "$f".md5sum || exit $?
251
		md5sum "$f" > "$f".md5sum || exit $?

Return to bug 574752