When ${PKGDIR}/All/ doesn't exist, put packages in ${PKGDIR}/${CATEGORY}/ instead...
authorZac Medico <zmedico@gentoo.org>
Tue, 22 May 2007 06:27:32 +0000 (06:27 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 22 May 2007 06:27:32 +0000 (06:27 -0000)
svn path=/main/trunk/; revision=6568

bin/misc-functions.sh
pym/portage/__init__.py
pym/portage/dbapi/bintree.py

index d7aa9b05fbbe7f9cc161a179f11713dd80c4fee9..86d13292d9c60247c47915bf4e3fada892a20977 100755 (executable)
@@ -496,13 +496,18 @@ preinst_selinux_labels() {
 dyn_package() {
        cd "${PORTAGE_BUILDDIR}/image"
        install_mask "${PORTAGE_BUILDDIR}/image" ${PKG_INSTALL_MASK}
-       local pkg_dest="${PKGDIR}/All/${PF}.tbz2"
-       local pkg_tmp="${PKGDIR}/All/${PF}.tbz2.$$"
+       if [ -d "${PKGDIR}/All" ] ; then
+               local pkg_dest="${PKGDIR}/All/${PF}.tbz2"
+       else
+               local pkg_dest="${PKGDIR}/${CATEGORY}/${PF}.tbz2"
+       fi
+       local pkg_tmp="${pkg_dest}.$$"
        local tar_options=""
        [ "${PORTAGE_QUIET}" == "1" ] ||  tar_options="${tar_options} -v"
        # Sandbox is disabled in case the user wants to use a symlink
        # for $PKGDIR and/or $PKGDIR/All.
        export SANDBOX_ON="0"
+       mkdir -p "${pkg_tmp%/*}" || die "mkdir failed"
        tar ${tar_options} -cf - . | bzip2 -f > "${pkg_tmp}" || \
                die "Failed to create tarball"
        cd ..
@@ -513,7 +518,10 @@ dyn_package() {
                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}"
+       if [ -d "${PKGDIR}/All" ] ; then
+               ln -sf "../All/${PF}.tbz2" "${PKGDIR}/${CATEGORY}/${PF}.tbz2" || \
+                       die "Failed to create symlink in ${PKGDIR}/${CATEGORY}"
+       fi
        vecho ">>> Done."
        cd "${PORTAGE_BUILDDIR}"
        touch .packaged || die "Failed to 'touch .packaged' in ${PORTAGE_BUILDDIR}"
index 171806f7a356d72757533ab7e8e7a49d977434fe..f79b525edc10a5c9dd3f8008558ef8687f91c6df 100644 (file)
@@ -3816,11 +3816,6 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
                                actionmap[x]["dep"] = ' '.join(actionmap_deps[x])
 
                if mydo in actionmap.keys():
-                       if mydo=="package":
-                               portage.util.ensure_dirs(
-                                       os.path.join(mysettings["PKGDIR"], mysettings["CATEGORY"]))
-                               portage.util.ensure_dirs(
-                                       os.path.join(mysettings["PKGDIR"], "All"))
                        retval = spawnebuild(mydo,
                                actionmap, mysettings, debug, logfile=logfile)
                elif mydo=="qmerge":
index 4a0c70e18f4072e33ea3213dd754dacc452c1080..2a9651df5b4800536de35bb66aaed21f806e2e38 100644 (file)
@@ -113,6 +113,8 @@ class binarytree(object):
                        self.invalids = []
                        self.settings = settings
                        self._pkg_paths = {}
+                       self._all_directory = os.path.isdir(
+                               os.path.join(self.pkgdir, "All"))
 
        def move_ent(self, mylist):
                if not self.populated:
@@ -285,6 +287,8 @@ class binarytree(object):
                use for a given cpv.  If a collision will occur with an existing
                package from another category, the existing package will be bumped to
                ${PKGDIR}/${CATEGORY}/${PF}.tbz2 so that both can coexist."""
+               if not self._all_directory:
+                       return
                if not self.populated:
                        # Try to avoid the population routine when possible, so that
                        # FEATURES=buildpkg doesn't always force population.
@@ -357,8 +361,6 @@ class binarytree(object):
                "populates the binarytree"
                if (not os.path.isdir(self.pkgdir) and not getbinpkgs):
                        return 0
-               if (not os.path.isdir(self.pkgdir+"/All") and not getbinpkgs):
-                       return 0
 
                categories = set(self.settings.categories)
 
@@ -500,8 +502,11 @@ class binarytree(object):
                if mypath:
                        return os.path.join(self.pkgdir, mypath)
                mycat, mypkg = catsplit(mycpv)
-               mypath = os.path.join("All", mypkg + ".tbz2")
-               if mypath in self._pkg_paths.values():
+               if self._all_directory:
+                       mypath = os.path.join("All", mypkg + ".tbz2")
+                       if mypath in self._pkg_paths.values():
+                               mypath = os.path.join(mycat, mypkg + ".tbz2")
+               else:
                        mypath = os.path.join(mycat, mypkg + ".tbz2")
                self._pkg_paths[mycpv] = mypath # cache for future lookups
                return os.path.join(self.pkgdir, mypath)