Blame subr/pkg_install_rpm.subr

Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
#
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
# set -o errexit -o noglob are assumed.
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
#
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
pkg_install_rpm() {
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
	local _pkg_url="" _pkg_version_full="" _pkg_version_rpm="";
Lucio Andrés Illanes Albornoz 0eaee4
	if ex_rtl_lmatch "${ARG_DIST}" , rpm	\
Lucio Andrés Illanes Albornoz 0eaee4
	&& [ "${PKG_RPM_DISABLE:-0}" -eq 0 ]	\
Lucio Andrés Illanes Albornoz 0eaee4
	&& [ -x "$(which rpmbuild 2>/dev/null)" ]; then
Lucio Andrés Illanes Albornoz 0eaee4
		if [ -n "${PKG_URL}" ]; then
Lucio Andrés Illanes Albornoz 0eaee4
			_pkg_version_rpm="${PKG_VERSION%%-*}";
Lucio Andrés Illanes Albornoz 0eaee4
			_pkg_version_full="${PKG_VERSION}";
Lucio Andrés Illanes Albornoz 0eaee4
			_pkg_url="${PKG_URL}";
Lucio Andrés Illanes Albornoz 0eaee4
		elif [ -n "${PKG_URLS_GIT}" ]; then
Lucio Andrés Illanes Albornoz 0eaee4
			_pkg_version_rpm="$(cd "${PKG_BASE_DIR}/${PKG_SUBDIR}" && git rev-parse HEAD)";
Lucio Andrés Illanes Albornoz 0eaee4
			_pkg_version_full="${_pkg_version_rpm} ($(cd "${PKG_BASE_DIR}/${PKG_SUBDIR}" && git rev-parse --abbrev-ref HEAD))";
Lucio Andrés Illanes Albornoz 0eaee4
			_pkg_url="${PKG_URLS_GIT%% *}";
Lucio Andrés Illanes Albornoz 0eaee4
			_pkg_url="${_pkg_url##*=}"; _pkg_url="${_pkg_url%%@*}";
Lucio Andrés Illanes Albornoz 0eaee4
			if [ "${_pkg_url#${DEFAULT_GITROOT_HEAD}}" != "${_pkg_url}" ]; then
Lucio Andrés Illanes Albornoz 0eaee4
				_pkg_url="Unknown";
Lucio Andrés Illanes Albornoz 0eaee4
			fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
		fi;
Lucio Andrés Illanes Albornoz 0eaee4
		cat > "${PKG_BASE_DIR}/${PKG_NAME}-${_pkg_version_rpm}.spec" <
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
Name:           ${PKG_NAME}
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
Version:        ${_pkg_version_rpm}
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
Release:        1
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
Summary:        ${PKG_NAME} ${_pkg_version_full}
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
License:        Unknown
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
Group:          Applications
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
Url:            ${_pkg_url}
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
%description
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
${PKG_NAME} ${_pkg_version_full}
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
%prep
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
%build
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
%install
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
rm -rf "\${RPM_BUILD_ROOT}"
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
mkdir -p "\${RPM_BUILD_ROOT}"
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
cp -pPr "${PKG_DESTDIR}/." "\${RPM_BUILD_ROOT}"
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
%post
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
%postun
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
%files
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
/
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
%changelog
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
EOF
Lucio Andrés Illanes Albornoz 1b271e
		rpmbuild									\
Lucio Andrés Illanes Albornoz 1b271e
			-bb									\
Lucio Andrés Illanes Albornoz 1b271e
			--define="_tmppath ${BUILD_WORKDIR}"					\
Lucio Andrés Illanes Albornoz 1b271e
			--define="_topdir ${PREFIX_RPM}/${PKG_NAME}-${_pkg_version_rpm}"	\
Lucio Andrés Illanes Albornoz 1b271e
			--nodeps "${PKG_BASE_DIR}/${PKG_NAME}-${_pkg_version_rpm}.spec";
Lucio Andrés Illanes Albornoz 0eaee4
		find "${PREFIX_RPM}/${PKG_NAME}-${_pkg_version_rpm}/RPMS" -iname \*.rpm -exec cp -pP {} "${PREFIX_RPM}/" \;;
Lucio Andrés Illanes Albornoz 0eaee4
		ex_rtl_fileop rm "${PREFIX_RPM}/${PKG_NAME}-${_pkg_version_rpm}";
Lucio Andrés Illanes Albornoz 0eaee4
		ex_rtl_fileop cp "${PKG_BASE_DIR}/${PKG_NAME}-${_pkg_version_rpm}.spec" "${PREFIX_RPM}/";
Lucio Andrés Illanes Albornoz 0eaee4
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
};
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
Lucio Andrés Illanes Albornoz (arab, vxp) 729be5
# vim:filetype=sh