From 729be50de92ca2500debe688a25e53dad1587e52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz=20=28arab=2C=20vx?= =?UTF-8?q?p=29?= Date: Mon, 14 May 2018 16:52:58 +0000 Subject: subr/pkg_install_rpm.subr: split from subr/pkg_install.subr. subr/pkg_install_rpm.subr: correctly determine ${PKG_VERSION} and ${PKG_URL}. vars/env.vars:${DEFAULT_BUILD_STEPS}: adds install_rpm after install. --- subr/pkg_install.subr | 37 ---------------------------- subr/pkg_install_rpm.subr | 61 +++++++++++++++++++++++++++++++++++++++++++++++ vars/env.vars | 2 +- 3 files changed, 62 insertions(+), 38 deletions(-) create mode 100644 subr/pkg_install_rpm.subr diff --git a/subr/pkg_install.subr b/subr/pkg_install.subr index 7394fc65..dd007abe 100644 --- a/subr/pkg_install.subr +++ b/subr/pkg_install.subr @@ -3,7 +3,6 @@ # pkg_install() { - local _pkg_version_rpm=""; ex_rtl_fileop mkdir "${PKG_PREFIX}"; find "${PKG_DESTDIR}" \ -type d -exec chmod 0755 {} \;; @@ -18,42 +17,6 @@ pkg_install() { tar -C "${PKG_DESTDIR}" -cpf - . |\ gzip -c -9 - > "${PKG_BASE_DIR}/${PKG_NAME}.tgz" fi; - if [ "${ARG_RPM:-0}" -eq 1 ]\ - && [ -x "$(which rpmbuild 2>/dev/null)" ]; then - _pkg_version_rpm="${PKG_VERSION:-Unknown}"; - _pkg_version_rpm="${_pkg_version_rpm%%-*}"; - cat > "${PKG_BASE_DIR}/${PKG_NAME}-${_pkg_version_rpm}.spec" </dev/null)" ]; then + return 0; + fi; + if [ -n "${PKG_URLS_GIT}" ]; then + _pkg_version_rpm="$(cd "${PKG_BASE_DIR}/${PKG_SUBDIR}" && git rev-parse HEAD)"; + _pkg_version_full="${_pkg_version_rpm} ($(cd "${PKG_BASE_DIR}/${PKG_SUBDIR}" && git rev-parse --abbrev-ref HEAD))"; + _pkg_url="${PKG_URLS_GIT%% *}"; + _pkg_url="${_pkg_url##*=}"; _pkg_url="${_pkg_url%%@*}"; + if [ "${_pkg_url#${DEFAULT_GITROOT_HEAD}}" != "${_pkg_url}" ]; then + _pkg_url="Unknown"; + fi; + elif [ -n "${PKG_VERSION}" ]; then + _pkg_version_rpm="${PKG_VERSION%%-*}"; + _pkg_version_full="${PKG_VERSION}"; + _pkg_url="${PKG_URL}"; + else + _pkg_version_rpm="${PKG_VERSION}"; + _pkg_version_full="${PKG_VERSION}"; + _pkg_url="${PKG_URL}"; + fi; + cat > "${PKG_BASE_DIR}/${PKG_NAME}-${_pkg_version_rpm}.spec" <