From efeeb057a7857ee35319d129b7298274262c5c52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?= Date: Sat, 29 Feb 2020 13:28:22 +0000 Subject: Refactors dist packages into groups/999.dist.group and dist/dist_*.dist. build.sh:buildp_dispatch_pkg_state(): fix `missing_pkg' log message. subr/ex_pkg_env.subr:exp_pkg_env_set(): source from "dist/${_pkg_name}.dist" given `dist' group. --- dist/dist_digest.dist | 23 +++++++++++++++ dist/dist_gitref.dist | 9 ++++++ dist/dist_minipix.dist | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++ dist/dist_zipdist.dist | 49 +++++++++++++++++++++++++++++++ 4 files changed, 159 insertions(+) create mode 100644 dist/dist_digest.dist create mode 100644 dist/dist_gitref.dist create mode 100644 dist/dist_minipix.dist create mode 100644 dist/dist_zipdist.dist (limited to 'dist') diff --git a/dist/dist_digest.dist b/dist/dist_digest.dist new file mode 100644 index 00000000..335b63e7 --- /dev/null +++ b/dist/dist_digest.dist @@ -0,0 +1,23 @@ +# +# set +o errexit -o noglob is assumed. +# + +pkg_dist_digest_all() { + local _fname=""; + if rtl_lmatch "${ARG_DIST}" "tbz2" "," \ + || rtl_lmatch "${ARG_DIST}" "tgz" "," \ + || rtl_lmatch "${ARG_DIST}" "txz" ","; then + rtl_log_msg info "Compiling SHA256 sums..."; + if [ -e "${PREFIX}/SHA256SUMS" ]; then + rtl_fileop mv "${PREFIX}/SHA256SUMS" "${PREFIX}/SHA256SUMS.last"; + fi; + (cd "${PREFIX}"; + for _fname in $(find "${PREFIX_NATIVE#${PREFIX}/}" -type f -perm /a=x \ + \( -path "${PREFIX_NATIVE#${PREFIX}/}/bin/*" -or \ + -path "${PREFIX_NATIVE#${PREFIX}/}/lib/*" \)); do + sha256sum "${_fname}"; + done > "${PREFIX}/SHA256SUMS"); + fi; +}; + +# vim:filetype=sh diff --git a/dist/dist_gitref.dist b/dist/dist_gitref.dist new file mode 100644 index 00000000..a04b0f01 --- /dev/null +++ b/dist/dist_gitref.dist @@ -0,0 +1,9 @@ +# +# set +o errexit -o noglob is assumed. +# + +pkg_dist_gitref_all() { + (rtl_fileop cd "${MIDIPIX_BUILD_PWD}" && git rev-parse HEAD > "${PREFIX}/build.gitref"); +}; + +# vim:filetype=sh diff --git a/dist/dist_minipix.dist b/dist/dist_minipix.dist new file mode 100644 index 00000000..04267d3b --- /dev/null +++ b/dist/dist_minipix.dist @@ -0,0 +1,78 @@ +# +# set +o errexit -o noglob is assumed. +# + +pkgp_dist_minipix_is_newer() { + local _new_fname="${1}" _new_ts="" _old_dname="${2}" _old_ts=""; + if ! _old_ts="$(stat -c %Y "${_old_dname%%/}/${_new_fname##*/}" 2>/dev/null)" \ + || ! _new_ts="$(stat -c %Y "${_new_fname}" 2>/dev/null)"; then + return 0; + elif [ "${_new_ts}" -gt "${_old_ts}" ]; then + return 0; + else + return 1; + fi; +}; + +pkg_dist_minipix_all() { + local _dname="" _fname="" _pname=""; + if rtl_lmatch "${ARG_DIST}" "minipix" ","; then + for _dname in "${PREFIX_MINIPIX}/bin" "${PREFIX_MINIPIX}/share"; do + if [ ! -e "${_dname}" ]; then + rtl_fileop mkdir "${_dname}"; + fi; + done; + for _fname in clear reset tset; do + if [ -e "${PREFIX_NATIVE}/bin/${_fname}" ]\ + && pkgp_dist_minipix_is_newer "${PREFIX_NATIVE}/bin/${_fname}" "${PREFIX_MINIPIX}/bin"; then + rtl_fileop cp_follow "${PREFIX_NATIVE}/bin/${_fname}" "${PREFIX_MINIPIX}/bin"; + fi; + done; + for _pname in $([ -e "${PREFIX}/minipix_dist/bin" ] && find "${PREFIX}/minipix_dist/bin" \ + -maxdepth 1 -perm /a=x -type f -and \( -not -name "lib*" \)); do + if pkgp_dist_minipix_is_newer "${_pname}" "${PREFIX_MINIPIX}/bin"; then + rtl_fileop cp_follow "${_pname}" "${PREFIX_MINIPIX}/bin"; + fi; + done; + for _fname in libc.so libcrypto.so.45 libexpat.so.1 liblzma.so.5 libmagic.so.1 \ + libncurses.so.6 libncursesw.so.6 libpcre.so.1 libperk.so.0 \ + libpsxscl.so libpython2.7.so.1 libreadline.so.7 libssl.so.47 \ + libu16ports.so.0 libtinfo.so.6 libtinfow.so.6 libunistring.so.2 \ + libuuid.so.1; do + if [ -e "${PREFIX_NATIVE}/lib/${_fname}" ]\ + && pkgp_dist_minipix_is_newer "${PREFIX_NATIVE}/lib/${_fname}" "${PREFIX_MINIPIX}/bin"; then + rtl_fileop cp_follow \ + "${PREFIX_NATIVE}/lib/${_fname}" "${PREFIX_MINIPIX}/bin"; + fi; + done; + for _dname in lib/python2.7 share/gdb; do + if [ -d "${PREFIX}/minipix_dist/${_dname}" ]; then + tar -C "${PREFIX}/minipix_dist" -cpf - "${_dname}" | tar -C "${PREFIX_MINIPIX}" -xpf -; + fi; + done; + for _fname in nano vim; do + if [ -e "${PREFIX}/minipix_dist/share/${_fname}" ]\ + && pkgp_dist_minipix_is_newer "${PREFIX}/minipix_dist/share/${_fname}" "${PREFIX_MINIPIX}/share"; then + rtl_fileop cp_follow "${PREFIX}/minipix_dist/share/${_fname}" "${PREFIX_MINIPIX}/share"; + fi; + done; + if [ ! -L "${PREFIX_MINIPIX}/share/nanorc" ]; then + rtl_fileop ln_symbolic "nano/nanorc.nanorc" "${PREFIX_MINIPIX}/share/nanorc"; + fi; + if [ ! -L "${PREFIX_MINIPIX}/share/vimrc" ]; then + rtl_fileop ln_symbolic "vim/vim74/vimrc_example.vim" "${PREFIX_MINIPIX}/share/vimrc"; + fi; + for _fname in putty putty-256color screen screen-256color xterm xterm-256color; do + _dname="share/terminfo/${_fname%${_fname#[a-zA-Z]}}"; + if [ ! -e "${PREFIX_MINIPIX}/${_dname}" ]; then + rtl_fileop mkdir "${PREFIX_MINIPIX}/${_dname}"; + fi; + if [ -e "${PREFIX_NATIVE}/${_dname}/${_fname}" ]\ + && pkgp_dist_minipix_is_newer "${PREFIX_NATIVE}/${_dname}/${_fname}" "${PREFIX_MINIPIX}/${_dname}"; then + rtl_fileop cp_follow "${PREFIX_NATIVE}/${_dname}/${_fname}" "${PREFIX_MINIPIX}/${_dname}"; + fi; + done; + fi; +}; + +# vim:filetype=sh diff --git a/dist/dist_zipdist.dist b/dist/dist_zipdist.dist new file mode 100644 index 00000000..36c45892 --- /dev/null +++ b/dist/dist_zipdist.dist @@ -0,0 +1,49 @@ +# +# set +o errexit -o noglob is assumed. +# + +pkg_dist_zipdist_all() { + local _dist_fname="" _pkg_name="" _pkglist_fname="${PREFIX}/pkglist.native"; + if rtl_lmatch "${ARG_DIST}" "zipdist" ","; then + echo "msg_pkg dist dist_zipdist Building deployable distribution ZIP archive..." >&3; + rtl_log_msg info "Finished building deployable distribution ZIP archive."; + for _pkg_name in $(cat "${_pkglist_fname}"); do + if ! stat "${BUILD_WORKDIR}/${_pkg_name}-native-${DEFAULT_TARGET}" >/dev/null 2>&1; then + rtl_log_msg failexit "Error: missing package build directory for package \`${_pkg_name}'."; + fi; + done; + _dist_fname="${DEFAULT_ZIPDIST_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.zip"; + if [ -e "${BUILD_WORKDIR}/zipdist" ]; then + rtl_fileop rm "${BUILD_WORKDIR}/zipdist"; + fi; + rtl_fileop mkdir "${BUILD_WORKDIR}/zipdist"; + "${BUILD_WORKDIR}/mpackage/mpackage.sh" \ + --defroot="${DEFAULT_ZIPDIST_DEFROOT}" \ + --flysyms \ + --minroot="${PREFIX_MINIPIX}" \ + --objroot="${BUILD_WORKDIR}" \ + --pkgroot="${BUILD_WORKDIR}/zipdist/pkgroot" \ + --product=Midipix \ + --subset="${_pkglist_fname}" \ + --symbols \ + --sysroot="${BUILD_WORKDIR}/zipdist/sysroot" \ + --target="${DEFAULT_TARGET}" \ + --tmproot="${BUILD_WORKDIR}/zipdist/tmproot" \ + --zipfile="${PREFIX}/${_dist_fname}"; + echo "msg_pkg dist dist_zipdist Finished building deployable distribution ZIP archive." >&3; + rtl_log_msg info "Finished building deployable distribution ZIP archive."; + if [ -n "${DEFAULT_ZIPDIST_SIGN_GPG_KEY}" ]\ + && [ -x "$(which gpg 2>/dev/null)" ]\ + && gpg --list-keys "${DEFAULT_ZIPDIST_SIGN_GPG_KEY}" >/dev/null 2>&1; then + echo "msg_pkg dist dist_zipdist Signing deployable distribution ZIP archive..." >&3; + rtl_log_msg info "Signing deployable distribution ZIP archive..."; + gpg --armor --passphrase-file /dev/null \ + --local-user "${DEFAULT_ZIPDIST_SIGN_GPG_KEY}" \ + --sign "${PREFIX}/${_dist_fname}"; + echo "msg_pkg dist dist_zipdist Signed deployable distribution ZIP archive." >&3; + rtl_log_msg info "Signed deployable distribution ZIP archive."; + fi; + fi; +}; + +# vim:filetype=sh -- cgit v1.2.3