Conan_Kudo / build / midipix_build

Forked from build/midipix_build 4 years ago
Clone
Blob Blame History Raw
#
# set -o errexit -o noglob are assumed.
#

pkgp_invariants_tarball_dist() {
	local _tarball_compress_cmd="${1}" _tarball_compress_args="${2}" _tarball_suffix="${3}";
	local _tarball_fname="${DEFAULT_TARBALL_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${_tarball_suffix}";
	tar -cpf - $(find . -maxdepth 1 -mindepth 1 -type d				\
			-not -path ./minipix						\
			-not -path ./minipix_dist					\
			-not -path ./rpm						\
			-not -path ./tmp | sort)					\
		midipix_shortcut.vbs midipix.sh	README SHA256SUMS			|\
	"${_tarball_compress_cmd}" ${_tarball_compress_args} -c > "${_tarball_fname}";
	ex_rtl_log_msg info "Finished building binary distribution tarball.";
	if [ -x "$(which gpg 2>/dev/null)" -a -n "${DEFAULT_TARBALL_SIGN_GPG_KEY}" ] &&	\
				gpg --list-keys "${DEFAULT_TARBALL_SIGN_GPG_KEY}" >/dev/null 2>&1; then
		gpg --armor --passphrase-file /dev/null					\
			--local-user "${DEFAULT_TARBALL_SIGN_GPG_KEY}" --sign "${_tarball_fname}";
		ex_rtl_log_msg info "Signed binary distribution tarball.";
	fi;
};

pkgp_invariants_tarball_toolchain() {
	local _tarball_compress_cmd="${1}" _tarball_compress_args="${2}" _tarball_suffix="${3}";
	local _tarball_cross_fname="${DEFAULT_TARBALL_CROSS_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${_tarball_suffix}";
	tar -cpf - bin include lib lib64 libexec share "${PKG_TARGET}"			|\
	"${_tarball_compress_cmd}" ${_tarball_compress_args} -c > "${_tarball_cross_fname}";
	ex_rtl_log_msg info "Finished building toolchain tarball.";
	if [ -x "$(which gpg 2>/dev/null)" -a -n "${DEFAULT_TARBALL_SIGN_GPG_KEY}" ] &&		\
				gpg --list-keys "${DEFAULT_TARBALL_SIGN_GPG_KEY}" >/dev/null 2>&1; then
		gpg --armor --passphrase-file /dev/null					\
			--local-user "${DEFAULT_TARBALL_SIGN_GPG_KEY}" --sign "${_tarball_cross_fname}";
		ex_rtl_log_msg info "Signed toolchain tarball.";
	fi;
};

pkgp_invariants_tarball_minipix() {
	local _tarball_compress_cmd="${1}" _tarball_compress_args="${2}" _tarball_suffix="${3}";
	local _tarball_minipix_fname="${DEFAULT_TARBALL_MINIPIX_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${_tarball_suffix}";
	tar -cpf - minipix 								\
		midipix_shortcut.vbs midipix.sh README					|\
	"${_tarball_compress_cmd}" ${_tarball_compress_args} -c > "${_tarball_minipix_fname}";
	ex_rtl_log_msg info "Finished building binary Minipix distribution tarball.";
	if [ -x "$(which gpg 2>/dev/null)" -a -n "${DEFAULT_TARBALL_SIGN_GPG_KEY}" ] &&		\
				gpg --list-keys "${DEFAULT_TARBALL_SIGN_GPG_KEY}" >/dev/null 2>&1; then
		gpg --armor --passphrase-file /dev/null					\
			--local-user "${DEFAULT_TARBALL_SIGN_GPG_KEY}" --sign "${_tarball_minipix_fname}";
		ex_rtl_log_msg info "Signed binary Minipix distribution tarball.";
	fi;
};

pkg_invariants_tarballs_all() {
	local _tarball_compress_args="" _tarball_compress_cmd="" _tarball_suffix="" _tarball_suffixes="" _tarball_type="" _tarball_types="";
	if ex_rtl_lmatch "${ARG_DIST}" , tbz2; then
		_tarball_suffixes="${_tarball_suffixes:+${_tarball_suffixes} }bz2";
	fi;
	if ex_rtl_lmatch "${ARG_DIST}" , tgz; then
		_tarball_suffixes="${_tarball_suffixes:+${_tarball_suffixes} }gz";
	fi;
	if ex_rtl_lmatch "${ARG_DIST}" , txz; then
		_tarball_suffixes="${_tarball_suffixes:+${_tarball_suffixes} }xz";
	fi;
	for _tarball_suffix in ${_tarball_suffixes}; do
		ex_rtl_log_msg info "Building ${_tarball_suffix}-compressed distribution tarballs...";
		case "${_tarball_suffix}" in
		bz2)	if [ -n "$(which pbzip2 2>/dev/null)" ]; then
				_tarball_compress_cmd="pbzip2";
			else
				_tarball_compress_cmd="bzip2";
			fi; ;;
		gz)	if [ -n "$(which pigz 2>/dev/null)" ]; then
				_tarball_compress_cmd="pigz";
			else
				_tarball_compress_cmd="gzip";
			fi; ;;
		xz)	_tarball_compress_cmd="xz";
			_tarball_compress_args="-T0"; ;;
		*)	ex_rtl_log_msg failexit "Unknown tarball suffix \`${_tarball_suffix}'.";
		esac;
		ex_rtl_fileop cd "${PREFIX}"; PREFIX_BASENAME="${PREFIX_NATIVE##*/}";
		_tarball_types="dist toolchain minipix";
		for _tarball_type in ${_tarball_types}; do
			pkgp_invariants_tarball_${_tarball_type} "${_tarball_compress_cmd}" "${_tarball_compress_args}" "${_tarball_suffix}";
		done;
	done;
};

# vim:filetype=sh