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 36c4a8
pkg_invariants_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 2960a4
		echo "msg_pkg invariants invariants_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 ec4218
		if [ -e "${BUILD_WORKDIR}/zipdist" ]; then
Lucio Andrés Illanes Albornoz c6d6e0
			rtl_fileop rm "${BUILD_WORKDIR}/zipdist";
Lucio Andrés Illanes Albornoz ec4218
		fi;
Lucio Andrés Illanes Albornoz c6d6e0
		rtl_fileop mkdir "${BUILD_WORKDIR}/zipdist";
Lucio Andrés Illanes Albornoz 86373a
		"${BUILD_WORKDIR}/mpackage/mpackage.sh"				\
Lucio Andrés Illanes Albornoz 86373a
			--defroot="${DEFAULT_ZIPDIST_DEFROOT}"			\
Lucio Andrés Illanes Albornoz 86373a
			--flysyms						\
Lucio Andrés Illanes Albornoz 86373a
			--minroot="${PREFIX_MINIPIX}"				\
Lucio Andrés Illanes Albornoz 86373a
			--objroot="${BUILD_WORKDIR}"				\
Lucio Andrés Illanes Albornoz 86373a
			--pkgroot="${BUILD_WORKDIR}/zipdist/pkgroot"		\
Lucio Andrés Illanes Albornoz 86373a
			--product=Midipix					\
Lucio Andrés Illanes Albornoz 86373a
			--subset="${_pkglist_fname}"				\
Lucio Andrés Illanes Albornoz 86373a
			--symbols						\
Lucio Andrés Illanes Albornoz 86373a
			--sysroot="${BUILD_WORKDIR}/zipdist/sysroot"		\
Lucio Andrés Illanes Albornoz 86373a
			--target="${DEFAULT_TARGET}"				\
Lucio Andrés Illanes Albornoz 86373a
			--tmproot="${BUILD_WORKDIR}/zipdist/tmproot"		\
Lucio Andrés Illanes Albornoz 36c4a8
			--zipfile="${PREFIX}/${_dist_fname}";
Lucio Andrés Illanes Albornoz 2960a4
		echo "msg_pkg invariants invariants_zipdist Finished building deployable distribution ZIP archive." >&3;
Lucio Andrés Illanes Albornoz c6d6e0
		rtl_log_msg info "Finished building deployable distribution ZIP archive.";
Lucio Andrés Illanes Albornoz 86373a
		if [ -n "${DEFAULT_ZIPDIST_SIGN_GPG_KEY}" ]\
Lucio Andrés Illanes Albornoz 86373a
		&& [ -x "$(which gpg 2>/dev/null)" ]\
Lucio Andrés Illanes Albornoz 86373a
		&& gpg --list-keys "${DEFAULT_ZIPDIST_SIGN_GPG_KEY}" >/dev/null 2>&1; then
Lucio Andrés Illanes Albornoz 2960a4
			echo "msg_pkg invariants invariants_zipdist Signing deployable distribution ZIP archive..." >&3;
Lucio Andrés Illanes Albornoz c6d6e0
			rtl_log_msg info "Signing deployable distribution ZIP archive...";
Lucio Andrés Illanes Albornoz 86373a
			gpg --armor --passphrase-file /dev/null			\
Lucio Andrés Illanes Albornoz 86373a
				--local-user "${DEFAULT_ZIPDIST_SIGN_GPG_KEY}"	\
Lucio Andrés Illanes Albornoz 86373a
				--sign "${PREFIX}/${_dist_fname}";
Lucio Andrés Illanes Albornoz 2960a4
			echo "msg_pkg invariants invariants_zipdist Signed deployable distribution ZIP archive." >&3;
Lucio Andrés Illanes Albornoz c6d6e0
			rtl_log_msg info "Signed deployable distribution ZIP archive.";
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