diff options
-rw-r--r-- | print-exclusion-list | 45 | ||||
-rwxr-xr-x | snapshots-create.sh | 24 |
2 files changed, 48 insertions, 21 deletions
diff --git a/print-exclusion-list b/print-exclusion-list new file mode 100644 index 0000000..583a492 --- /dev/null +++ b/print-exclusion-list @@ -0,0 +1,45 @@ +#!/bin/bash +# Copyright 2017 Gentoo Foundation; Distributed under the GPL v2 +# +# This prints an exclusion list of content that should not be included in +# snapshot tarballs or similar output. +# +# app-bar/ChangeLog is a valid package name, so we have to be careful about it! +# +# This should exclude: +# - ChangeLogs (not not packages named ChangeLog) +# - .checksum-test-marker + +SRCDIR="$1" +if [ -z "${SRCDIR}" ]; then + echo "Usage: $(basename $0) DIR" 1>&2 + exit 2 +fi +if [ ! -d "${SRCDIR}" ]; then + echo "${SRCDIR} is not a directory" 1>&2 + exit 1 +fi +if [ ! -e "${SRCDIR}/profiles/repo_name" ]; then + echo "${SRCDIR} is probably not a portdir or overlay, missing profiles/repo_name" 1>&2 + exit 1 +fi + +find "${SRCDIR}" \ + \( \ + -type f \ + -regextype posix-egrep \ + \( \ + -path "${SRCDIR}/eclass/ChangeLog*" -o \ + -path "${SRCDIR}/profiles/ChangeLog*" -o \ + -path "${SRCDIR}/profiles/*/ChangeLog*" -o \ + -regex "${SRCDIR}/[^/]+/[^/]+/ChangeLog(-[0-9]+)?$" \ + \) \ + \) \ + -o \ + -name '.checksum-test-marker' \ + \ + | sed "s,${SRCDIR}/*,,g" \ + \ + | sort + +# vim:ft=sh noet ts=2 sts=2: diff --git a/snapshots-create.sh b/snapshots-create.sh index 44efdf4..1344da6 100755 --- a/snapshots-create.sh +++ b/snapshots-create.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2011-2015 Gentoo Foundation; Distributed under the GPL v2 +# Copyright 2011-2017 Gentoo Foundation; Distributed under the GPL v2 # might be earlier copyright, no history available # 1) Create the tarball @@ -86,27 +86,8 @@ cd ${TEMP} write_time_log "START TARBALL $(date -u)" if [ ! -f "${FILENAME%.bz2}" ]; then # Build exclusion list - # app-bar/ChangeLog is a valid package name, so we have to be careful about it! EXCLUSION_LIST="$(mktemp -p ${TEMP} snapshot-exclude.XXXXXXXXXX)" - find "${MASTER}" \ - \( \ - -type f \ - -regextype posix-egrep \ - \( \ - -path "${MASTER}/eclass/ChangeLog*" -o \ - -path "${MASTER}/profiles/ChangeLog*" -o \ - -path "${MASTER}/profiles/*/ChangeLog*" -o \ - -regex "${MASTER}/[^/]+/[^/]+/ChangeLog(-[0-9]+)?$" \ - \) \ - \) \ - -o \ - -name '.checksum-test-marker' \ - \ - | sed "s,${MASTER}/*,,g" \ - \ - | sort \ - \ - >"${EXCLUSION_LIST}" + "$(dirname $0)"/print-exclusion-list "${MASTER}" >"${EXCLUSION_LIST}" TAR_OPTIONS=( # Force a small block size @@ -150,6 +131,7 @@ if [ ! -f "${FILENAME%.bz2}" ]; then echo "Tar run failed!" exit 1 fi + rm -f "${EXCLUSION_LIST}" fi [ ! -f " ${FILENAME}.umd5sum" ] && md5sum ${FILENAME%.bz2} > ${FILENAME}.umd5sum [ ! -f "${FILENAME%.bz2}.bz2" ] && ${NICE} $BZIP2_PROG -k9 ${FILENAME%.bz2} |