diff options
author | 2019-12-21 12:49:27 -0800 | |
---|---|---|
committer | 2019-12-21 12:49:27 -0800 | |
commit | 32352ad5d45276c00ca05472d4bddda4b96c4c22 (patch) | |
tree | 4003b4bed8290ff5d75a683854a834283161d67f /snapshots-create.sh | |
parent | snapshots-create.sh: refactor tar options and include full tarformat rationale (diff) | |
download | mastermirror-scripts-32352ad5d45276c00ca05472d4bddda4b96c4c22.tar.gz mastermirror-scripts-32352ad5d45276c00ca05472d4bddda4b96c4c22.tar.bz2 mastermirror-scripts-32352ad5d45276c00ca05472d4bddda4b96c4c22.zip |
snapshots-create.sh: change back to manual creation of new tarball
Perl Archive::Tar::Stream does not handle gnutar archives correctly if
the file names are long.
Fixes: https://bugs.gentoo.org/703460
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Diffstat (limited to 'snapshots-create.sh')
-rwxr-xr-x | snapshots-create.sh | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/snapshots-create.sh b/snapshots-create.sh index 5ea56ec..3ab7e28 100755 --- a/snapshots-create.sh +++ b/snapshots-create.sh @@ -183,21 +183,39 @@ write_time_log "END TARBALL(umd5,old) $(date -u)" write_time_log "START TARBALL(transform,new) $(date -u)" if [ ! -f "${FILENAME_NEW%.xz}" ]; then + # The newer tarball differs in the following ways: # Filename 'portage-YYYYMMDD' -> 'gentoo-YYYYMMDD' # Path prefex 'portage' -> 'gentoo-YYYYMMDD' # - # Instead of rebuilding the entire tarball, it's MUCH faster to consider it - # a single IO stream and process it as such. - # tar-transform-names.pl is a small wrapper around Perl Archive::Tar::Stream - # that just changes filenames - /usr/local/bin/mastermirror//tar-transform-names.pl \ - --input-file "${FILENAME%.bz2}" \ - --output-file "${FILENAME_NEW%.xz}" \ - --regex "s/^portage/${FILENAME_NEW%%.*}/" + # Earlier code used tar-transform-names.pl as a wrapper around Perl + # Archive::Tar::Stream, but it was found that the Archive::Tar::Stream + # codebase did not handle gnutar format correctly. + # https://bugs.gentoo.org/703460 + # + # While the stream processing was MUCH faster (because it didn't traverse + # the filesystem at all), it broke on very long filenames that ARE present + # in the Gentoo repo: + #/usr/local/bin/mastermirror//tar-transform-names.pl \ + # --input-file "${FILENAME%.bz2}" \ + # --output-file "${FILENAME_NEW%.xz}" \ + # --regex "s/^portage/${FILENAME_NEW%%.*}/" + + NEW_TARBALL_OPTIONS=( + # The . needs to match the file argument + --transform="s,^\.,${FILENAME_NEW%%.*},g" + # The operation, destination, source arguments + --create + --file ${FILENAME_NEW%.xz} + . + ) + tar \ + "${COMMON_TAR_OPTIONS[@]}" \ + "${NEW_TARBALL_OPTIONS[@]}" rc=$? if [ $rc -ne 0 ]; then - echo "Tar transform run!" + echo "TARBALL(tar,new) failed!" + echo "TARBALL(tar,new) failed!" 1>&2 exit 1 fi fi |