|
@@ -75,6 +75,8 @@ setup-vbuilder(){
|
|
|
VBOOTSTRAP_DIR=@@VBUILDER_VBOOTSTRAP_DIR@@
|
|
|
[ -z "${DEFAULT_VERSION}" ] && \
|
|
|
DEFAULT_VERSION=@@VBUILDER_DEFAULT_VERSION@@
|
|
|
+ [ -z "${BUILT_RPMS_DIR}" ] && \
|
|
|
+ BUILT_RPMS_DIR=@@VBUILDER_BUILT_RPMS_DIR@@
|
|
|
[ -d $VBOOTSTRAP_DIR ] || mkdir -p $VBOOTSTRAP_DIR
|
|
|
VERSION=$DEFAULT_VERSION
|
|
|
|
|
@@ -246,12 +248,35 @@ RPM_Build(){
|
|
|
echo "$RPM_PKG: not source RPM package."
|
|
|
exit 1
|
|
|
fi
|
|
|
+
|
|
|
+ RPM_PKG_USER=$(stat -c %U $RPM_PKG)
|
|
|
+ local __install="install -p -v -o ${RPM_PKG_USER} -g ${RPM_PKG_USER}"
|
|
|
+ RPM_PKG_ARCH_LIST="RPMS/i386 RPMS/x86_64 RPMS/ppc RPMS/noarch SRPMS"
|
|
|
+
|
|
|
/usr/sbin/chroot ${BUILD_ROOT} \
|
|
|
- /bin/sh -c "cd ${BUILD_DIR} && apt-get -y build-dep $BASE_RPM_PKG"
|
|
|
+ /bin/sh -c "cd ${BUILD_DIR} && apt-get -y build-dep $BASE_RPM_PKG"
|
|
|
/usr/sbin/chroot ${BUILD_ROOT} \
|
|
|
- /bin/sh -c "cd ${BUILD_DIR} && su ${BUILD_USER} -c 'rpmbuild --rebuild $RPM_OPTS $BASE_RPM_PKG'"
|
|
|
+ /bin/sh -c "cd ${BUILD_DIR} && su ${BUILD_USER} -c 'rpmbuild --rebuild $RPM_OPTS $BASE_RPM_PKG'"
|
|
|
+ /usr/sbin/chroot ${BUILD_ROOT} \
|
|
|
+ /bin/sh -c "cd ${BUILD_DIR} && apt-get -y install $(find $BUILD_ROOT${BUILD_DIR}/RPMS -type f -regex '.*\.rpm' | sed -e s@${BUILD_ROOT}@@g -e 's|.*\/compat32-.*||g' -e 's|.*\/.*\.src\.rpm||g' -e 's/$/ \\/g')"
|
|
|
+
|
|
|
+ ## make src.rpm for $VERSION
|
|
|
/usr/sbin/chroot ${BUILD_ROOT} \
|
|
|
- /bin/sh -c "cd ${BUILD_DIR} && apt-get -y install $(find $BUILD_ROOT${BUILD_DIR}/RPMS -type f -regex '.*\.rpm' | sed -e s@${BUILD_ROOT}@@g -e 's|.*\/compat32-.*||g' -e 's/$/ \\/g')"
|
|
|
+ /bin/sh -c "cd ${BUILD_DIR} && su ${BUILD_USER} -c 'rpm -ivh $BASE_RPM_PKG'"
|
|
|
+ /usr/sbin/chroot ${BUILD_ROOT} \
|
|
|
+ /bin/sh -c "cd ${BUILD_DIR} && su ${BUILD_USER} -c 'rpmbuild -bs --nodeps --clean --rmsource --rmspec ${BUILD_DIR}/SPECS/*.spec'"
|
|
|
+
|
|
|
+ ## copy built rpms to ${HOME}/rpm/ for each archtectures
|
|
|
+ echo "Copying built rpms to ${HOME}/rpm/ for each archtectures ... "
|
|
|
+ for i in $RPM_PKG_ARCH_LIST; do \
|
|
|
+ if [ -d $BUILD_ROOT${BUILD_DIR}/${i} ]; then
|
|
|
+ [ -d ${BUILT_RPMS_DIR}/${i} ] || \
|
|
|
+ $__install -d ${BUILT_RPMS_DIR}/${i}/
|
|
|
+ find $BUILD_ROOT${BUILD_DIR}/${i} -type f -regex '.*\.rpm' \
|
|
|
+ -exec $__install -m0644 {} ${BUILT_RPMS_DIR}/${i}/ \;
|
|
|
+ fi
|
|
|
+ done
|
|
|
+ echo "done."
|
|
|
}
|
|
|
|
|
|
|