From ec5108ad87c690cbd7105ccd4ccdcf511f258b9f Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 24 Mar 2006 08:33:22 +0000 Subject: Create tbz2 package directly in ${PKGDIR}/All to avoid need for temp file (inefficient) and avoid selinux label issues for bug #127374. svn path=/main/trunk/; revision=2986 --- bin/misc-functions.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh index e5751e136..883658432 100644 --- a/bin/misc-functions.sh +++ b/bin/misc-functions.sh @@ -406,16 +406,17 @@ preinst_selinux_labels() { dyn_package() { cd "${PORTAGE_BUILDDIR}/image" install_mask "${PORTAGE_BUILDDIR}/image" ${PKG_INSTALL_MASK} - tar cpvf - ./ | bzip2 -f > ../bin.tar.bz2 || die "Failed to create tarball" - cd .. - xpak build-info inf.xpak - tbz2tool join bin.tar.bz2 inf.xpak "${PF}.tbz2" + local pkg_dest="${PKGDIR}/All/${PF}.tbz2" + local pkg_tmp="${PKGDIR}/All/${PF}.tbz2.$$" addwrite "${PKGDIR}" - mv -f "${PF}.tbz2" "${PKGDIR}/All" || die "Failed to move tbz2 to ${PKGDIR}/All" - rm -f inf.xpak bin.tar.bz2 - if [ ! -d "${PKGDIR}/${CATEGORY}" ]; then - install -d "${PKGDIR}/${CATEGORY}" + tar cpvf - ./ | bzip2 -f > "${pkg_tmp}" || die "Failed to create tarball" + cd .. + python -c "import xpak; t=xpak.tbz2('${pkg_tmp}'); t.recompose('${PORTAGE_BUILDDIR}/build-info')" + if [ $? -ne 0 ]; then + rm -f "${pkg_tmp}" + die "Failed to append metadata to the tbz2 file" fi + mv -f "${pkg_tmp}" "${pkg_dest}" || die "Failed to move tbz2 to ${pkg_dest}" ln -sf "../All/${PF}.tbz2" "${PKGDIR}/${CATEGORY}/${PF}.tbz2" || die "Failed to create symlink in ${PKGDIR}/${CATEGORY}" echo ">>> Done." cd "${PORTAGE_BUILDDIR}" -- cgit v1.2.3-1-g7c22