From 0cd9dc98ce290f00234bd200ea5b7905909622c9 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 7 Sep 2006 06:00:18 +0000 Subject: Optimize quickpkg so that it creates the binary package directly in $PKGDIR/All. This eliminates the need for tbz2tool and is the same approach used by the package phase in misc-functions.sh. svn path=/main/trunk/; revision=4420 --- bin/quickpkg | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'bin') diff --git a/bin/quickpkg b/bin/quickpkg index 6101ddc11..f90e73089 100755 --- a/bin/quickpkg +++ b/bin/quickpkg @@ -17,6 +17,8 @@ fi # We need to ensure a sane umask for the packages that will be created. umask 022 +# Make sure the xpak module is in PYTHONPATH +export PYTHONPATH=$(portageq envvar PORTAGE_PYM_PATH) export PORTAGE_DB=$(portageq vdb_path) export ROOT=$(portageq envvar ROOT) export ROOT=${ROOT%/}/ @@ -63,6 +65,9 @@ do_pkg() { # get pkg info files mkdir -p "${MYDIR}"/temp cp "${SRCDIR}"/* "${MYDIR}"/temp/ + [ -d "${PKGDIR}"/All ] || mkdir -p "${PKGDIR}"/All + local pkg_dest="${PKGDIR}/All/${1}.tbz2" + local pkg_tmp="${PKGDIR}/All/${1}.tbz2.$$" # create filelist and a basic tbz2 gawk '{ @@ -74,16 +79,14 @@ do_pkg() { } print }' "${SRCDIR}"/CONTENTS | cut -f2- -d" " - | sed -e 's:^/:./:' > "${MYDIR}"/filelist - tar vjcf "${MYDIR}"/bin.tar.bz2 -C "${ROOT}" --files-from="${MYDIR}"/filelist --no-recursion + tar vjcf "${pkg_tmp}" -C "${ROOT}" --files-from="${MYDIR}"/filelist --no-recursion # join together the basic tbz2 and the pkg info files - xpak "${MYDIR}"/temp "${MYDIR}"/inf.xpak - tbz2tool join "${MYDIR}"/bin.tar.bz2 "${MYDIR}"/inf.xpak "${MYDIR}"/$1.tbz2 + python -c "import xpak; t=xpak.tbz2('${pkg_tmp}'); t.recompose('${MYDIR}/temp')" # move the final binary package to PKGDIR - [ -d "${PKGDIR}"/All ] || mkdir -p "${PKGDIR}"/All + mv -f "${pkg_tmp}" "${pkg_dest}" [ -d "${PKGDIR}/$2" ] || mkdir -p "${PKGDIR}/$2" - mv "${MYDIR}"/$1.tbz2 "${PKGDIR}"/All ( cd "${PKGDIR}/$2" && ln -s ../All/$1.tbz2 ) # cleanup again -- cgit v1.2.3-1-g7c22