diff -uNr /usr/lib/portage/bin/misc-functions.sh portage-patched/bin/misc-functions.sh --- /usr/lib/portage/bin/misc-functions.sh 2006-05-28 17:28:25.000000000 +0900 +++ portage-patched/bin/misc-functions.sh 2006-05-28 17:28:16.000000000 +0900 @@ -346,8 +346,9 @@ 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.$$" + [[ ! -d ${PKGDIR}/${CATEGORY} ]] && mkdir ${PKGDIR}/${CATEGORY} + local pkg_dest="${PKGDIR}/${CATEGORY}/${PF}.tbz2" + local pkg_tmp="${PKGDIR}/${CATEGORY}/${PF}.tbz2.$$" # Sandbox is disabled in case the user wants to use a symlink # for $PKGDIR and/or $PKGDIR/All. export SANDBOX_ON="0" @@ -359,7 +360,7 @@ 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}" + ln -sf "../${CATEGORY}/${PF}.tbz2" "${PKGDIR}/All/${PF}.tbz2" || die "Failed to create symlink in ${PKGDIR}/All" vecho ">>> Done." cd "${PORTAGE_BUILDDIR}" touch .packaged || die "Failed to 'touch .packaged' in ${PORTAGE_BUILDDIR}" diff -uNr /usr/lib/portage/pym/portage.py portage-patched/pym/portage.py --- /usr/lib/portage/pym/portage.py 2006-05-28 17:28:25.000000000 +0900 +++ portage-patched/pym/portage.py 2006-05-28 17:28:16.000000000 +0900 @@ -5383,7 +5383,7 @@ myoldpkg=mycpv.split("/")[1] mynewpkg=mynewcpv.split("/")[1] - if (mynewpkg != myoldpkg) and os.path.exists(self.getname(mynewcpv)): + if (mynewcpv != myoldcpv) and os.path.exists(self.getname(mynewcpv)): writemsg("!!! Cannot update binary: Destination exists.\n") writemsg("!!! "+mycpv+" -> "+mynewcpv+"\n") continue @@ -5475,31 +5475,22 @@ global settings 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 - if (not getbinpkgsonly) and os.path.exists(self.pkgdir+"/All"): - for mypkg in listdir(self.pkgdir+"/All"): - if mypkg[-5:]!=".tbz2": - continue - mytbz2=xpak.tbz2(self.pkgdir+"/All/"+mypkg) - mycat=mytbz2.getfile("CATEGORY") - if not mycat: - #old-style or corrupt package - writemsg("!!! Invalid binary package: "+mypkg+"\n") - writemsg("!!! This binary package is not recoverable and should be deleted.\n") - self.invalids.append(mypkg) - continue - mycat=string.strip(mycat) - fullpkg=mycat+"/"+mypkg[:-5] - mykey=dep_getkey(fullpkg) - try: - # invalid tbz2's can hurt things. - self.dbapi.cpv_inject(fullpkg) - except SystemExit, e: - raise - except: - continue + if (not getbinpkgsonly): + for mycat in settings.categories: + for mypkg in listdir(self.pkgdir+"/"+mycat): + if mypkg[-5:]!=".tbz2": + continue + mytbz2=xpak.tbz2(self.pkgdir+"/"+mycat+"/"+mypkg) + fullpkg=mycat+"/"+mypkg[:-5] + mykey=dep_getkey(fullpkg) + try: + # invalid tbz2's can hurt things. + self.dbapi.cpv_inject(fullpkg) + except SystemExit, e: + raise + except: + pass if getbinpkgs and not settings["PORTAGE_BINHOST"]: writemsg(red("!!! PORTAGE_BINHOST unset, but use is requested.\n")) @@ -5566,11 +5557,7 @@ def getname(self,pkgname): "returns file location for this particular package" - mysplit=string.split(pkgname,"/") - if len(mysplit)==1: - return self.pkgdir+"/All/"+self.resolve_specific(pkgname)+".tbz2" - else: - return self.pkgdir+"/All/"+mysplit[1]+".tbz2" + return self.pkgdir+"/"+pkgname+".tbz2" def isremote(self,pkgname): "Returns true if the package is kept remotely." @@ -5603,7 +5590,23 @@ raise except: pass - return getbinpkg.file_get(settings["PORTAGE_BINHOST"]+"/"+tbz2name, mydest, fcmd=settings["RESUMECOMMAND"]) + retval = getbinpkg.file_get(settings["PORTAGE_BINHOST"]+"/"+tbz2name, mydest, fcmd=settings["RESUMECOMMAND"]) + if not retval: + return 0 + mytbz2 = xpak.tbz2(mydest + tbz2name) + mycat = xpak.getfile("CATEGORY") + if not mycat: + return 0 + newdest = self.pkgdir+"/"+mycat+"/" + try: + os.makedirs(newdest, 0775) + except SystemExit, e: + raise + except: + pass + os.rename(mydest+tbz2name, newdest+tbz2name) + os.symlink("../"+mycat+"/"+tbz2name, mydest+tbz2name) + return retval def getslot(self,mycatpkg): "Get a slot for a catpkg; assume it exists."