midipix / build / midipix_build

Forked from build/midipix_build 4 years ago
Clone

Blame vars/invariants_tarballs.vars

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 (arab, vxp) 946146
pkgp_dist_tarball_dist() {
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	TARBALL_FNAME="${DEFAULT_TARBALL_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${DEFAULT_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 (arab, vxp) 1debf7
	"${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 (arab, vxp) 1debf7
			--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 (arab, vxp) 946146
pkgp_dist_tarball_toolchain() {
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	TARBALL_CROSS_FNAME="${DEFAULT_TARBALL_CROSS_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${DEFAULT_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 (arab, vxp) 1debf7
	"${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 (arab, vxp) 1debf7
			--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 (arab, vxp) 946146
pkgp_dist_tarball_minipix() {
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	TARBALL_MINIPIX_FNAME="${DEFAULT_TARBALL_MINIPIX_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${DEFAULT_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 (arab, vxp) 1debf7
	"${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 (arab, vxp) 1debf7
			--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) 946146
pkgp_dist_tarball_src() {
Lucio Andrés Illanes Albornoz d37735
	local _build_tgt_lc="" _build_tgt_uc="" _find_filters="" _pkg_name_lc="" _pkg_name_uc="";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	TARBALL_SRC_FNAME="${DEFAULT_TARBALL_SRC_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${DEFAULT_TARBALL_SUFFIX}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	ex_rtl_log_msg info "Building source tarball...";
Lucio Andrés Illanes Albornoz d37735
	for _build_tgt_lc in ${BUILD_TARGETS:-${TARGETS_DEFAULT}}; do
Lucio Andrés Illanes Albornoz d37735
		_build_tgt_uc="$(ex_rtl_toupper "${_build_tgt_lc}")";
Lucio Andrés Illanes Albornoz d37735
		for _pkg_name_lc in $(ex_rtl_get_var_unsafe ${_build_tgt_uc}_PACKAGES); do
Lucio Andrés Illanes Albornoz d37735
			_pkg_name_uc="$(ex_rtl_toupper "${_pkg_name_lc}")";
Lucio Andrés Illanes Albornoz d37735
			if [ "$(ex_rtl_get_var_unsafe ${_pkg_name_uc}_SRC_TARBALL_DISABLE)" = "1" ]; then
Lucio Andrés Illanes Albornoz d37735
				_find_filters="${_find_filters:+${_find_filters} }( -not -name ${_pkg_name}-\*-\* )";
Lucio Andrés Illanes Albornoz d37735
			fi;
Lucio Andrés Illanes Albornoz d37735
		done;
Lucio Andrés Illanes Albornoz d37735
	done;
Lucio Andrés Illanes Albornoz 36c4a8
	tar -C "${BUILD_WORKDIR}" -cpf - $(cd "${BUILD_WORKDIR}" && find	\
Lucio Andrés Illanes Albornoz d37735
		-maxdepth 1 -mindepth 1 -name \*-\*-\*				\
Lucio Andrés Illanes Albornoz d37735
		${_find_filters})						|\
Lucio Andrés Illanes Albornoz (arab, vxp) 1debf7
	"${TARBALL_COMPRESS_CMD}" ${TARBALL_COMPRESS_ARGS} -c > "${TARBALL_SRC_FNAME}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	ex_rtl_log_msg info "Finished building source 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) f42965
		gpg --armor --passphrase-file /dev/null				\
Lucio Andrés Illanes Albornoz (arab, vxp) 1debf7
			--local-user "${DEFAULT_TARBALL_SIGN_GPG_KEY}" --sign "${TARBALL_SRC_FNAME}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_rtl_log_msg info "Signed source tarball.";
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
};
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
Lucio Andrés Illanes Albornoz (arab, vxp) 6c6c71
pkg_invariants_tarballs_all() {
Lucio Andrés Illanes Albornoz (arab, vxp) 6c6c71
	if [ -z "${ARG_TARBALL}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 6c6c71
		exit 0;
Lucio Andrés Illanes Albornoz (arab, vxp) 6c6c71
	else
Lucio Andrés Illanes Albornoz (arab, vxp) 6c6c71
		ex_rtl_log_msg info "Building distribution tarballs...";
Lucio Andrés Illanes Albornoz (arab, vxp) 6c6c71
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	case "${DEFAULT_TARBALL_SUFFIX}" in
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	bz2)	if [ -n "$(which pbzip2 2>/dev/null)" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
			TARBALL_COMPRESS_CMD="pbzip2";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		else
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
			TARBALL_COMPRESS_CMD="bzip2";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		fi; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	gz)	if [ -n "$(which pigz 2>/dev/null)" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
			TARBALL_COMPRESS_CMD="pigz";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		else
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
			TARBALL_COMPRESS_CMD="gzip";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		fi; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	xz)	TARBALL_COMPRESS_CMD="xz";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		TARBALL_COMPRESS_ARGS="-T0"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	*)	ex_rtl_log_msg failexit "Unknown tarball suffix \`.${DEFAULT_TARBALL_SUFFIX}'.";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	esac;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	ex_rtl_fileop cd "${PREFIX}"; PREFIX_BASENAME="${PREFIX_NATIVE##*/}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	pkgp_dist_tarball_dist; pkgp_dist_tarball_toolchain; pkgp_dist_tarball_minipix;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	if [ "${BUILD}" = "debug" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		pkgp_dist_tarball_src;
Lucio Andrés Illanes Albornoz (arab, vxp) 59765f
	fi;
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