fix ebuild rpm command for rpm 4.10.0
authorLucas Bickel <hairmare@purplehaze.ch>
Thu, 15 Nov 2012 21:50:52 +0000 (22:50 +0100)
committerZac Medico <zmedico@gentoo.org>
Thu, 29 Nov 2012 05:58:25 +0000 (21:58 -0800)
* changes dyn_spec to use a sources_dir in the sandbox
* remove deprecated Buildroot from specfile
* call rpmbuild with --target instead of Buildroot
* grab machine_name from $CHOST and use as --target in rpmbuild
* use dir in sandbox instead of /usr/src/rpm/RPMS

bin/misc-functions.sh

index 853489a04218be589e56235291ffacb7d287b06d..6f84526014e8260b78a6056df60c0b026156538c 100755 (executable)
@@ -1199,7 +1199,7 @@ __dyn_package() {
 }
 
 __dyn_spec() {
-       local sources_dir=/usr/src/rpm/SOURCES
+       local sources_dir=${T}/rpmbuild/SOURCES
        mkdir -p "${sources_dir}"
        declare -a tar_args=("${EBUILD}")
        [[ -d ${FILESDIR} ]] && tar_args=("${EBUILD}" "${FILESDIR}")
@@ -1215,7 +1215,6 @@ Release: ${PR}
 License: GPL
 Group: portage/${CATEGORY}
 Source: ${PF}.tar.gz
-Buildroot: ${D}
 %description
 ${DESCRIPTION}
 
@@ -1242,12 +1241,12 @@ __dyn_rpm() {
        fi
 
        cd "${T}" || die "cd failed"
-       local machine_name=$(uname -m)
-       local dest_dir=${EPREFIX}/usr/src/rpm/RPMS/${machine_name}
-       addwrite ${EPREFIX}/usr/src/rpm
+       local machine_name=${CHOST%%-*}
+       local dest_dir=${T}/rpmbuild/RPMS/${machine_name}
        addwrite "${RPMDIR}"
        __dyn_spec
-       rpmbuild -bb --clean --rmsource "${PF}.spec" || die "Failed to integrate rpm spec file"
+       HOME=${T} \
+       rpmbuild -bb --clean --rmsource "${PF}.spec" --buildroot "${D}" --target "${CHOST}" || die "Failed to integrate rpm spec file"
        install -D "${dest_dir}/${PN}-${PV}-${PR}.${machine_name}.rpm" \
                "${RPMDIR}/${CATEGORY}/${PN}-${PV}-${PR}.rpm" || \
                die "Failed to move rpm"