#!/usr/bin/env bash
+# NOTE: if the output of this backend has to change (e.g. we change what gets
+# included in the archive, or we change the format of the archive (e.g. tar
+# options, compression ratio or method)), we MUST update the format version
+# in the variable BR_FTM_VERSION_svn, in package/pkg-download.mk.
+
# We want to catch any unexpected failure, and exit immediately
set -e
# Environment:
# SVN : the svn command to call
+. "${0%/*}/helpers"
+
verbose=
while getopts "${BR_BACKEND_DL_GETOPTS}" OPT; do
case "${OPT}" in
# last line (svn outputs everything on stdout)
date="$( _svn info --show-item last-changed-date "'${uri}@${rev}'" |tail -n 1 )"
-# Generate the archive, sort with the C locale so that it is reproducible.
+# Generate the archive.
# We did a 'svn export' above, so it's not a working copy (there is no .svn
# directory or file to ignore).
-find "${basename}" -not -type d >"${output}.list"
-LC_ALL=C sort <"${output}.list" >"${output}.list.sorted"
-
-# Create GNU-format tarballs, since that's the format of the tarballs on
-# sources.buildroot.org and used in the *.hash files
-tar cf - --transform="s#^\./#${basename}/#" \
- --numeric-owner --owner=0 --group=0 --mtime="${date}" --format=gnu \
- -T "${output}.list.sorted" >"${output}.tar"
-gzip -6 -n <"${output}.tar" >"${output}"
-
-rm -f "${output}.list"
-rm -f "${output}.list.sorted"
+mk_tar_gz "${basename}" "${basename}" "${date}" "${output}"