Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
#
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
# set -o errexit -o noglob are assumed.
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
#
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
Lucio Andrés Illanes Albornoz 0eaee4
pkgp_invariants_tarball_dist() {
Lucio Andrés Illanes Albornoz 0eaee4
	local _tarball_compress_cmd="${1}" _tarball_compress_args="${2}" _tarball_suffix="${3}";
Lucio Andrés Illanes Albornoz 0eaee4
	local _tarball_fname="${DEFAULT_TARBALL_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${_tarball_suffix}";
Lucio Andrés Illanes Albornoz (arab, vxp) 6b5e80
	tar -cpf - $(find . -maxdepth 1 -mindepth 1 -type d				\
Lucio Andrés Illanes Albornoz (arab, vxp) c48068
			-not -path ./minipix						\
Lucio Andrés Illanes Albornoz (arab, vxp) c48068
			-not -path ./minipix_dist					\
Lucio Andrés Illanes Albornoz (arab, vxp) 8d9a43
			-not -path ./rpm						\
Lucio Andrés Illanes Albornoz (arab, vxp) 6b5e80
			-not -path ./tmp | sort)					\
Lucio Andrés Illanes Albornoz (arab, vxp) 75cf53
		midipix_shortcut.vbs midipix.sh	README SHA256SUMS			|\
Lucio Andrés Illanes Albornoz 0eaee4
	"${_tarball_compress_cmd}" ${_tarball_compress_args} -c > "${_tarball_fname}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	ex_rtl_log_msg info "Finished building binary distribution tarball.";
Lucio Andrés Illanes Albornoz (arab, vxp) 6b5e80
	if [ -x "$(which gpg 2>/dev/null)" -a -n "${DEFAULT_TARBALL_SIGN_GPG_KEY}" ] &&	\
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
				gpg --list-keys "${DEFAULT_TARBALL_SIGN_GPG_KEY}" >/dev/null 2>&1; then
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
		gpg --armor --passphrase-file /dev/null					\
Lucio Andrés Illanes Albornoz 0eaee4
			--local-user "${DEFAULT_TARBALL_SIGN_GPG_KEY}" --sign "${_tarball_fname}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_rtl_log_msg info "Signed binary distribution tarball.";
Lucio Andrés Illanes Albornoz (arab, vxp) afe7b9
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
};
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
Lucio Andrés Illanes Albornoz 0eaee4
pkgp_invariants_tarball_toolchain() {
Lucio Andrés Illanes Albornoz 0eaee4
	local _tarball_compress_cmd="${1}" _tarball_compress_args="${2}" _tarball_suffix="${3}";
Lucio Andrés Illanes Albornoz 0eaee4
	local _tarball_cross_fname="${DEFAULT_TARBALL_CROSS_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${_tarball_suffix}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	tar -cpf - bin include lib lib64 libexec share "${PKG_TARGET}"			|\
Lucio Andrés Illanes Albornoz 0eaee4
	"${_tarball_compress_cmd}" ${_tarball_compress_args} -c > "${_tarball_cross_fname}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	ex_rtl_log_msg info "Finished building toolchain tarball.";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	if [ -x "$(which gpg 2>/dev/null)" -a -n "${DEFAULT_TARBALL_SIGN_GPG_KEY}" ] &&		\
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
				gpg --list-keys "${DEFAULT_TARBALL_SIGN_GPG_KEY}" >/dev/null 2>&1; then
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
		gpg --armor --passphrase-file /dev/null					\
Lucio Andrés Illanes Albornoz 0eaee4
			--local-user "${DEFAULT_TARBALL_SIGN_GPG_KEY}" --sign "${_tarball_cross_fname}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_rtl_log_msg info "Signed toolchain tarball.";
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
};
Lucio Andrés Illanes Albornoz (arab, vxp) 9499b0
Lucio Andrés Illanes Albornoz 0eaee4
pkgp_invariants_tarball_minipix() {
Lucio Andrés Illanes Albornoz 0eaee4
	local _tarball_compress_cmd="${1}" _tarball_compress_args="${2}" _tarball_suffix="${3}";
Lucio Andrés Illanes Albornoz 0eaee4
	local _tarball_minipix_fname="${DEFAULT_TARBALL_MINIPIX_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${_tarball_suffix}";
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
	tar -cpf - minipix 								\
Lucio Andrés Illanes Albornoz (arab, vxp) 5ee71e
		midipix_shortcut.vbs midipix.sh README					|\
Lucio Andrés Illanes Albornoz 0eaee4
	"${_tarball_compress_cmd}" ${_tarball_compress_args} -c > "${_tarball_minipix_fname}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	ex_rtl_log_msg info "Finished building binary Minipix distribution tarball.";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	if [ -x "$(which gpg 2>/dev/null)" -a -n "${DEFAULT_TARBALL_SIGN_GPG_KEY}" ] &&		\
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
				gpg --list-keys "${DEFAULT_TARBALL_SIGN_GPG_KEY}" >/dev/null 2>&1; then
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
		gpg --armor --passphrase-file /dev/null					\
Lucio Andrés Illanes Albornoz 0eaee4
			--local-user "${DEFAULT_TARBALL_SIGN_GPG_KEY}" --sign "${_tarball_minipix_fname}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_rtl_log_msg info "Signed binary Minipix distribution tarball.";
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
};
Lucio Andrés Illanes Albornoz (arab, vxp) f42965
Lucio Andrés Illanes Albornoz (arab, vxp) 6c6c71
pkg_invariants_tarballs_all() {
Lucio Andrés Illanes Albornoz 0eaee4
	local _tarball_compress_args="" _tarball_compress_cmd="" _tarball_suffix="" _tarball_suffixes="" _tarball_type="" _tarball_types="";
Lucio Andrés Illanes Albornoz 0eaee4
	if ex_rtl_lmatch "${ARG_DIST}" , tbz2; then
Lucio Andrés Illanes Albornoz 0eaee4
		_tarball_suffixes="${_tarball_suffixes:+${_tarball_suffixes} }bz2";
Lucio Andrés Illanes Albornoz 0eaee4
	fi;
Lucio Andrés Illanes Albornoz 0eaee4
	if ex_rtl_lmatch "${ARG_DIST}" , tgz; then
Lucio Andrés Illanes Albornoz 0eaee4
		_tarball_suffixes="${_tarball_suffixes:+${_tarball_suffixes} }gz";
Lucio Andrés Illanes Albornoz (arab, vxp) 6c6c71
	fi;
Lucio Andrés Illanes Albornoz 0eaee4
	if ex_rtl_lmatch "${ARG_DIST}" , txz; then
Lucio Andrés Illanes Albornoz 0eaee4
		_tarball_suffixes="${_tarball_suffixes:+${_tarball_suffixes} }xz";
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
	fi;
Lucio Andrés Illanes Albornoz 0eaee4
	for _tarball_suffix in ${_tarball_suffixes}; do
Lucio Andrés Illanes Albornoz 0eaee4
		ex_rtl_log_msg info "Building ${_tarball_suffix}-compressed distribution tarballs...";
Lucio Andrés Illanes Albornoz 0eaee4
		case "${_tarball_suffix}" in
Lucio Andrés Illanes Albornoz 0eaee4
		bz2)	if [ -n "$(which pbzip2 2>/dev/null)" ]; then
Lucio Andrés Illanes Albornoz 0eaee4
				_tarball_compress_cmd="pbzip2";
Lucio Andrés Illanes Albornoz 0eaee4
			else
Lucio Andrés Illanes Albornoz 0eaee4
				_tarball_compress_cmd="bzip2";
Lucio Andrés Illanes Albornoz 0eaee4
			fi; ;;
Lucio Andrés Illanes Albornoz 0eaee4
		gz)	if [ -n "$(which pigz 2>/dev/null)" ]; then
Lucio Andrés Illanes Albornoz 0eaee4
				_tarball_compress_cmd="pigz";
Lucio Andrés Illanes Albornoz 0eaee4
			else
Lucio Andrés Illanes Albornoz 0eaee4
				_tarball_compress_cmd="gzip";
Lucio Andrés Illanes Albornoz 0eaee4
			fi; ;;
Lucio Andrés Illanes Albornoz 0eaee4
		xz)	_tarball_compress_cmd="xz";
Lucio Andrés Illanes Albornoz 0eaee4
			_tarball_compress_args="-T0"; ;;
Lucio Andrés Illanes Albornoz 0eaee4
		*)	ex_rtl_log_msg failexit "Unknown tarball suffix \`${_tarball_suffix}'.";
Lucio Andrés Illanes Albornoz 0eaee4
		esac;
Lucio Andrés Illanes Albornoz 0eaee4
		ex_rtl_fileop cd "${PREFIX}"; PREFIX_BASENAME="${PREFIX_NATIVE##*/}";
Lucio Andrés Illanes Albornoz 0eaee4
		_tarball_types="dist toolchain minipix";
Lucio Andrés Illanes Albornoz 0eaee4
		for _tarball_type in ${_tarball_types}; do
Lucio Andrés Illanes Albornoz 0eaee4
			pkgp_invariants_tarball_${_tarball_type} "${_tarball_compress_cmd}" "${_tarball_compress_args}" "${_tarball_suffix}";
Lucio Andrés Illanes Albornoz 0eaee4
		done;
Lucio Andrés Illanes Albornoz 0eaee4
	done;
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
};
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
Lucio Andrés Illanes Albornoz (arab, vxp) afcefa
# vim:filetype=sh