Blame dist/dist_zipdist.dist

Lucio Andrés Illanes Albornoz 36c4a8
#
Lucio Andrés Illanes Albornoz 2b85d0
# set +o errexit -o noglob is assumed.
Lucio Andrés Illanes Albornoz 36c4a8
#
Lucio Andrés Illanes Albornoz 36c4a8
Lucio Andrés Illanes Albornoz efeeb0
pkg_dist_zipdist_all() {
Lucio Andrés Illanes Albornoz d37735
	local _dist_fname="" _pkg_name="" _pkglist_fname="${PREFIX}/pkglist.native";
Lucio Andrés Illanes Albornoz c6d6e0
	if rtl_lmatch "${ARG_DIST}" "zipdist" ","; then
Lucio Andrés Illanes Albornoz efeeb0
		echo "msg_pkg dist dist_zipdist Building deployable distribution ZIP archive..." >&3;
Lucio Andrés Illanes Albornoz 2960a4
		rtl_log_msg info "Finished building deployable distribution ZIP archive.";
Lucio Andrés Illanes Albornoz d37735
		for _pkg_name in $(cat "${_pkglist_fname}"); do
Lucio Andrés Illanes Albornoz d37735
			if ! stat "${BUILD_WORKDIR}/${_pkg_name}-native-${DEFAULT_TARGET}" >/dev/null 2>&1; then
Lucio Andrés Illanes Albornoz c6d6e0
				rtl_log_msg failexit "Error: missing package build directory for package \`${_pkg_name}'.";
Lucio Andrés Illanes Albornoz d37735
			fi;
Lucio Andrés Illanes Albornoz d37735
		done;
Lucio Andrés Illanes Albornoz 36c4a8
		_dist_fname="${DEFAULT_ZIPDIST_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.zip";
Lucio Andrés Illanes Albornoz bf9edf
		if [ -e "${BUILD_WORKDIR}/zipdist" ]\
Lucio Andrés Illanes Albornoz bf9edf
		&& ! rtl_fileop rm "${BUILD_WORKDIR}/zipdist"; then
Lucio Andrés Illanes Albornoz bf9edf
			return 1;
Lucio Andrés Illanes Albornoz bf9edf
		elif ! rtl_fileop mkdir "${BUILD_WORKDIR}/zipdist"; then
Lucio Andrés Illanes Albornoz bf9edf
			return 1;
Lucio Andrés Illanes Albornoz bf9edf
		elif ! "${BUILD_WORKDIR}/mpackage/mpackage.sh"				\
Lucio Andrés Illanes Albornoz bf9edf
				--defroot="${DEFAULT_ZIPDIST_DEFROOT}"			\
Lucio Andrés Illanes Albornoz bf9edf
				--flysyms						\
Lucio Andrés Illanes Albornoz bf9edf
				--minroot="${PREFIX_MINIPIX}"				\
Lucio Andrés Illanes Albornoz bf9edf
				--objroot="${BUILD_WORKDIR}"				\
Lucio Andrés Illanes Albornoz bf9edf
				--pkgroot="${BUILD_WORKDIR}/zipdist/pkgroot"		\
Lucio Andrés Illanes Albornoz bf9edf
				--product=Midipix					\
Lucio Andrés Illanes Albornoz bf9edf
				--subset="${_pkglist_fname}"				\
Lucio Andrés Illanes Albornoz bf9edf
				--symbols						\
Lucio Andrés Illanes Albornoz bf9edf
				--sysroot="${BUILD_WORKDIR}/zipdist/sysroot"		\
Lucio Andrés Illanes Albornoz bf9edf
				--target="${DEFAULT_TARGET}"				\
Lucio Andrés Illanes Albornoz bf9edf
				--tmproot="${BUILD_WORKDIR}/zipdist/tmproot"		\
Lucio Andrés Illanes Albornoz bf9edf
				--zipfile="${PREFIX}/${_dist_fname}"; then
Lucio Andrés Illanes Albornoz bf9edf
			return 1;
Lucio Andrés Illanes Albornoz bf9edf
		else
Lucio Andrés Illanes Albornoz bf9edf
			echo "msg_pkg dist dist_zipdist Finished building deployable distribution ZIP archive." >&3;
Lucio Andrés Illanes Albornoz bf9edf
			rtl_log_msg info "Finished building deployable distribution ZIP archive.";
Lucio Andrés Illanes Albornoz bf9edf
			if [ -n "${DEFAULT_ZIPDIST_SIGN_GPG_KEY}" ]\
Lucio Andrés Illanes Albornoz bf9edf
			&& [ -x "$(which gpg 2>/dev/null)" ]\
Lucio Andrés Illanes Albornoz bf9edf
			&& gpg --list-keys "${DEFAULT_ZIPDIST_SIGN_GPG_KEY}" >/dev/null 2>&1; then
Lucio Andrés Illanes Albornoz bf9edf
				echo "msg_pkg dist dist_zipdist Signing deployable distribution ZIP archive..." >&3;
Lucio Andrés Illanes Albornoz bf9edf
				rtl_log_msg info "Signing deployable distribution ZIP archive...";
Lucio Andrés Illanes Albornoz bf9edf
				if ! gpg --armor --passphrase-file /dev/null		\
Lucio Andrés Illanes Albornoz bf9edf
					--local-user "${DEFAULT_ZIPDIST_SIGN_GPG_KEY}"	\
Lucio Andrés Illanes Albornoz bf9edf
					--sign "${PREFIX}/${_dist_fname}"; then
Lucio Andrés Illanes Albornoz bf9edf
					return 1;
Lucio Andrés Illanes Albornoz bf9edf
				fi;
Lucio Andrés Illanes Albornoz bf9edf
				echo "msg_pkg dist dist_zipdist Signed deployable distribution ZIP archive." >&3;
Lucio Andrés Illanes Albornoz bf9edf
				rtl_log_msg info "Signed deployable distribution ZIP archive.";
Lucio Andrés Illanes Albornoz bf9edf
			fi;
Lucio Andrés Illanes Albornoz 86373a
		fi;
Lucio Andrés Illanes Albornoz 36c4a8
	fi;
Lucio Andrés Illanes Albornoz 36c4a8
};
Lucio Andrés Illanes Albornoz 36c4a8
Lucio Andrés Illanes Albornoz 36c4a8
# vim:filetype=sh