blob: 691fe04ce1049a63955662874325f64da591b742 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#
# set -o errexit -o noglob are assumed.
#
pkg_install_rpm() {
local _pkg_url="" _pkg_version_full="" _pkg_version_rpm="";
if ex_rtl_lmatch "${ARG_DIST}" , rpm \
&& [ "${PKG_RPM_DISABLE:-0}" -eq 0 ] \
&& [ -x "$(which rpmbuild 2>/dev/null)" ]; then
if [ -n "${PKG_URL}" ]; then
_pkg_version_rpm="${PKG_VERSION%%-*}";
_pkg_version_full="${PKG_VERSION}";
_pkg_url="${PKG_URL}";
elif [ -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;
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}/";
fi;
};
# vim:filetype=sh
|