summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLucio Andrés Illanes Albornoz (arab, vxp) <lucio@lucioillanes.de>2018-05-14 16:52:58 +0000
committerLucio Andrés Illanes Albornoz (arab, vxp) <lucio@lucioillanes.de>2018-05-14 16:52:58 +0000
commit729be50de92ca2500debe688a25e53dad1587e52 (patch)
tree3b55091b3651ba40f98242c1c391d9adddff1574
parent9b7922e6a3a3702c472298dc1285c2b5e69a0113 (diff)
downloadmidipix_build-729be50de92ca2500debe688a25e53dad1587e52.tar.bz2
midipix_build-729be50de92ca2500debe688a25e53dad1587e52.tar.xz
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.
-rw-r--r--subr/pkg_install.subr37
-rw-r--r--subr/pkg_install_rpm.subr61
-rw-r--r--vars/env.vars2
3 files changed, 62 insertions, 38 deletions
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" <<EOF
-Name: ${PKG_NAME}
-Version: ${_pkg_version_rpm}
-Release: 1
-Summary: ${PKG_NAME} ${PKG_VERSION:-Unknown}
-License: Unknown
-Group: Applications
-Url: ${PKG_URL:-${PKG_URLS_GIT:-Unknown}}
-
-%description
-${PKG_NAME} ${PKG_VERSION:-Unknown}
-
-%prep
-%build
-%install
-rm -rf "\${RPM_BUILD_ROOT}"
-mkdir -p "\${RPM_BUILD_ROOT}"
-cp -pPr "${PKG_DESTDIR}/." "\${RPM_BUILD_ROOT}"
-
-%post
-%postun
-%files
-/
-
-%changelog
-
-EOF
- rpmbuild -bb --define="_topdir ${PREFIX_RPM}/${PKG_NAME}-${_pkg_version_rpm}" --nodeps "${PKG_BASE_DIR}/${PKG_NAME}-${_pkg_version_rpm}.spec";
- find "${PREFIX_RPM}/${PKG_NAME}-${_pkg_version_rpm}/RPMS" -iname \*.rpm -exec cp -pP {} "${PREFIX_RPM}/" \;;
- ex_rtl_fileop rm "${PREFIX_RPM}/${PKG_NAME}-${_pkg_version_rpm}";
- ex_rtl_fileop cp "${PKG_BASE_DIR}/${PKG_NAME}-${_pkg_version_rpm}.spec" "${PREFIX_RPM}/";
- fi;
};
# vim:filetype=sh
diff --git a/subr/pkg_install_rpm.subr b/subr/pkg_install_rpm.subr
new file mode 100644
index 00000000..d9931fb3
--- /dev/null
+++ b/subr/pkg_install_rpm.subr
@@ -0,0 +1,61 @@
+#
+# set -o errexit -o noglob are assumed.
+#
+
+pkg_install_rpm() {
+ local _pkg_url="" _pkg_version_full="" _pkg_version_rpm="";
+ if [ "${ARG_RPM:-0}" -eq 0 ]\
+ || ! [ -x "$(which rpmbuild 2>/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" <<EOF
+Name: ${PKG_NAME}
+Version: ${_pkg_version_rpm}
+Release: 1
+Summary: ${PKG_NAME} ${_pkg_version_full}
+License: Unknown
+Group: Applications
+Url: ${_pkg_url}
+
+%description
+${PKG_NAME} ${_pkg_version_full}
+
+%prep
+%build
+%install
+rm -rf "\${RPM_BUILD_ROOT}"
+mkdir -p "\${RPM_BUILD_ROOT}"
+cp -pPr "${PKG_DESTDIR}/." "\${RPM_BUILD_ROOT}"
+
+%post
+%postun
+%files
+/
+
+%changelog
+
+EOF
+ rpmbuild -bb --define="_topdir ${PREFIX_RPM}/${PKG_NAME}-${_pkg_version_rpm}" --nodeps "${PKG_BASE_DIR}/${PKG_NAME}-${_pkg_version_rpm}.spec";
+ find "${PREFIX_RPM}/${PKG_NAME}-${_pkg_version_rpm}/RPMS" -iname \*.rpm -exec cp -pP {} "${PREFIX_RPM}/" \;;
+ ex_rtl_fileop rm "${PREFIX_RPM}/${PKG_NAME}-${_pkg_version_rpm}";
+ ex_rtl_fileop cp "${PKG_BASE_DIR}/${PKG_NAME}-${_pkg_version_rpm}.spec" "${PREFIX_RPM}/";
+};
+
+# vim:filetype=sh
diff --git a/vars/env.vars b/vars/env.vars
index 004691ca..785783de 100644
--- a/vars/env.vars
+++ b/vars/env.vars
@@ -3,7 +3,7 @@ DEFAULT_BUILD_STEPS="
configure_patch_pre configure_autotools configure_patch configure \
build \
install_subdirs install_make install_files install_libs \
- install_pkgconfig install_purge_la install_strip install clean";
+ install_pkgconfig install_purge_la install_strip install install_rpm clean";
DEFAULT_BUILD_VARS="
AR BASE_DIR BUILD_DIR BUILD_STEPS_DISABLE BUILD_TYPE CC \
CFLAGS_BUILD_EXTRA CFLAGS_CONFIGURE CFLAGS_CONFIGURE_EXTRA \