diff -u -r gentoo2/usr/bin/emerge gentoo3/usr/bin/emerge --- gentoo2/usr/bin/emerge 2007-07-20 21:49:09.000000000 -0700 +++ gentoo3/usr/bin/emerge 2007-07-22 15:52:41.000000000 -0700 @@ -1303,7 +1303,7 @@ return 1 def select_files(self,myfiles): - "given a list of .tbz2s, .ebuilds and deps, create the appropriate depgraph and return a favorite list" + "given a list of packages, .ebuilds and deps, create the appropriate depgraph and return a favorite list" myfavorites=[] myroot = self.target_root portdb = self.trees[myroot]["porttree"].dbapi @@ -1316,7 +1316,7 @@ if x in matches or not portdb.cpv_exists(x)] for x in myfiles: ext = os.path.splitext(x)[1] - if ext==".tbz2": + if (ext==".tbz2" or ext==".tgz"): if not os.path.exists(x): if os.path.exists( os.path.join(pkgsettings["PKGDIR"], "All", x)): @@ -1326,7 +1326,7 @@ x = os.path.join(pkgsettings["PKGDIR"], x) else: print "\n\n!!! Binary package '"+str(x)+"' does not exist." - print "!!! Please ensure the tbz2 exists as specified.\n" + print "!!! Please ensure the package exists as specified.\n" sys.exit(1) mytbz2=xpak.tbz2(x) mykey=mytbz2.getelements("CATEGORY")[0]+"/"+os.path.splitext(os.path.basename(x))[0] @@ -5252,7 +5252,7 @@ for x in myfiles: ext = os.path.splitext(x)[1] - if (ext == ".ebuild" or ext == ".tbz2") and os.path.exists(os.path.abspath(x)): + if (ext == ".ebuild" or ext == ".tbz2" or ext == ".tgz") and os.path.exists(os.path.abspath(x)): print "emerging by path implies --oneshot... adding --oneshot to options." print colorize("BAD", "\n*** emerging by path is broken and may not always work!!!\n") break diff -u -r gentoo2/usr/lib/portage/bin/emerge gentoo3/usr/lib/portage/bin/emerge --- gentoo2/usr/lib/portage/bin/emerge 2007-07-20 21:48:57.000000000 -0700 +++ gentoo3/usr/lib/portage/bin/emerge 2007-07-22 15:54:05.000000000 -0700 @@ -1303,7 +1303,7 @@ return 1 def select_files(self,myfiles): - "given a list of .tbz2s, .ebuilds and deps, create the appropriate depgraph and return a favorite list" + "given a list of packages, .ebuilds and deps, create the appropriate depgraph and return a favorite list" myfavorites=[] myroot = self.target_root portdb = self.trees[myroot]["porttree"].dbapi @@ -1316,7 +1316,7 @@ if x in matches or not portdb.cpv_exists(x)] for x in myfiles: ext = os.path.splitext(x)[1] - if ext==".tbz2": + if (ext==".tbz2" or ext==".tgz"): if not os.path.exists(x): if os.path.exists( os.path.join(pkgsettings["PKGDIR"], "All", x)): @@ -1326,7 +1326,7 @@ x = os.path.join(pkgsettings["PKGDIR"], x) else: print "\n\n!!! Binary package '"+str(x)+"' does not exist." - print "!!! Please ensure the tbz2 exists as specified.\n" + print "!!! Please ensure the package exists as specified.\n" sys.exit(1) mytbz2=xpak.tbz2(x) mykey=mytbz2.getelements("CATEGORY")[0]+"/"+os.path.splitext(os.path.basename(x))[0] @@ -5252,7 +5252,7 @@ for x in myfiles: ext = os.path.splitext(x)[1] - if (ext == ".ebuild" or ext == ".tbz2") and os.path.exists(os.path.abspath(x)): + if (ext == ".ebuild" or ext == ".tbz2" or ext == ".tgz") and os.path.exists(os.path.abspath(x)): print "emerging by path implies --oneshot... adding --oneshot to options." print colorize("BAD", "\n*** emerging by path is broken and may not always work!!!\n") break diff -u -r gentoo2/usr/lib/portage/bin/misc-functions.sh gentoo3/usr/lib/portage/bin/misc-functions.sh --- gentoo2/usr/lib/portage/bin/misc-functions.sh 2007-07-20 21:48:57.000000000 -0700 +++ gentoo3/usr/lib/portage/bin/misc-functions.sh 2007-07-22 16:39:09.000000000 -0700 @@ -501,25 +501,33 @@ 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 [[ "${PORTAGE_COMPRESS}" == "gzip" ]] + then + local compressor="gzip" + local extn="tgz" + else + local compressor="bzip2" + local extn="tbz2" + fi + local pkg_dest="${PKGDIR}/All/${PF}.${extn}" + local pkg_tmp="${PKGDIR}/All/${PF}.${extn}.$$" 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" - tar ${tar_options} -cf - . | bzip2 -f > "${pkg_tmp}" || \ + tar ${tar_options} -cf - . | $compressor -f > "${pkg_tmp}" || \ die "Failed to create tarball" cd .. export PYTHONPATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym} 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" + die "Failed to append metadata to the package 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}" - vecho ">>> Done." + mv -f "${pkg_tmp}" "${pkg_dest}" || die "Failed to move package to ${pkg_dest}" + ln -sf "../All/${PF}.$extn" "${PKGDIR}/${CATEGORY}/${PF}.$extn" || die "Failed to create symlink in ${PKGDIR}/${CATEGORY}" + echo ">>> Done." cd "${PORTAGE_BUILDDIR}" touch .packaged || die "Failed to 'touch .packaged' in ${PORTAGE_BUILDDIR}" } diff -u -r gentoo2/usr/lib/portage/pym/emergehelp.py gentoo3/usr/lib/portage/pym/emergehelp.py --- gentoo2/usr/lib/portage/pym/emergehelp.py 2007-07-20 21:48:57.000000000 -0700 +++ gentoo3/usr/lib/portage/pym/emergehelp.py 2007-07-22 15:55:04.000000000 -0700 @@ -160,7 +160,7 @@ print " be displayed as USE=\"-bar dar -foo\"" print print " "+green("--ask")+" ("+green("-a")+" short option)" - print " before performing the merge, display what ebuilds and tbz2s will" + print " before performing the merge, display what ebuilds and packages will" print " be installed, in the same format as when using --pretend; then" print " ask whether to continue with the merge or abort. Using --ask is" print " more efficient than using --pretend and then executing the same" @@ -175,7 +175,7 @@ print " Tell emerge to build binary packages for all ebuilds processed" print " (in addition to actually merging the packages. Useful for" print " maintainers or if you administrate multiple Gentoo Linux" - print " systems (build once, emerge tbz2s everywhere) as well as disaster" + print " systems (build once, emerge packages everywhere) as well as disaster" print " recovery." print print " "+green("--buildpkgonly")+" ("+green("-B")+" short option)" @@ -278,7 +278,7 @@ print print " "+green("--pretend")+" ("+green("-p")+" short option)" print " Instead of actually performing the merge, simply display what" - print " ebuilds and tbz2s *would* have been installed if --pretend" + print " ebuilds and packages *would* have been installed if --pretend" print " weren't used. Using --pretend is strongly recommended before" print " installing an unfamiliar package. In the printout, N = new," print " U = updating, R = replacing, F = fetch restricted, B = blocked" diff -u -r gentoo2/usr/lib/portage/pym/getbinpkg.py gentoo3/usr/lib/portage/pym/getbinpkg.py --- gentoo2/usr/lib/portage/pym/getbinpkg.py 2007-07-20 21:48:57.000000000 -0700 +++ gentoo3/usr/lib/portage/pym/getbinpkg.py 2007-07-22 15:56:28.000000000 -0700 @@ -446,7 +446,9 @@ metadata[baseurl]["data"]={} filelist = dir_get_list(baseurl, conn) - tbz2list = match_in_array(filelist, suffix=".tbz2") + binlist1 = match_in_array(filelist, suffix=".tbz2") + binlist2 = match_in_array(filelist, suffix=".tgz") + tbz2list = binlist1 + binlist2 metalist = match_in_array(filelist, prefix="metadata.idx") del filelist @@ -509,7 +511,7 @@ sys.stderr.write("!!! Failed to write binary metadata to disk!\n") sys.stderr.write("!!! "+str(e)+"\n") break - # We may have metadata... now we run through the tbz2 list and check. + # We may have metadata... now we run through the package list and check. sys.stderr.write(yellow("cache miss: 'x'")+" --- "+green("cache hit: 'o'")+"\n") binpkg_filenames = set() for x in tbz2list: diff -u -r gentoo2/usr/lib/portage/pym/portage.py gentoo3/usr/lib/portage/pym/portage.py --- gentoo2/usr/lib/portage/pym/portage.py 2007-07-20 21:48:57.000000000 -0700 +++ gentoo3/usr/lib/portage/pym/portage.py 2007-07-23 17:44:46.000000000 -0700 @@ -4906,7 +4906,12 @@ cache_me = True mysplit = mycpv.split("/") mylist = [] - tbz2name = mysplit[1]+".tbz2" + global settings + mysettings = config(config_incrementals=portage_const.INCREMENTALS) + if mysettings["PORTAGE_COMPRESS"] == "gzip": + tbz2name = mysplit[1]+".tgz" + else: + tbz2name = mysplit[1]+".tbz2" if self.bintree and not self.bintree.isremote(mycpv): tbz2 = xpak.tbz2(self.bintree.getname(mycpv)) getitem = tbz2.getfile @@ -4919,7 +4924,7 @@ for x in mykeys: myval = getitem(x) # myval is None if the key doesn't exist - # or the tbz2 is corrupt. + # or the package is corrupt. if myval: mydata[x] = " ".join(myval.split()) if "EAPI" in mykeys: @@ -6356,7 +6361,13 @@ the ${PKGDIR}/${CATEGORY} directory if empty. The file will not be removed if os.path.islink() returns False.""" mycat, mypkg = catsplit(cpv) - mylink = os.path.join(self.pkgdir, mycat, mypkg + ".tbz2") + global settings + mysettings = config(config_incrementals=portage_const.INCREMENTALS) + if mysettings["PORTAGE_COMPRESS"]== "gzip": + extn=".tgz" + else: + extn=".tbz2" + mylink = os.path.join(self.pkgdir, mycat, mypkg + extn) if os.path.islink(mylink): """Only remove it if it's really a link so that this method never removes a real package that was placed here to avoid a collision.""" @@ -6373,8 +6384,14 @@ """Create a ${PKGDIR}/${CATEGORY}/${PF}.tbz2 symlink (and ${PKGDIR}/${CATEGORY} directory, if necessary). Any file that may exist in the location of the symlink will first be removed.""" + global settings + mysettings = config(config_incrementals=portage_const.INCREMENTALS) + if mysettings["PORTAGE_COMPRESS"]== "gzip": + extn=".tgz" + else: + extn=".tbz2" mycat, mypkg = catsplit(cpv) - full_path = os.path.join(self.pkgdir, mycat, mypkg + ".tbz2") + full_path = os.path.join(self.pkgdir, mycat, mypkg + extn) try: os.makedirs(os.path.dirname(full_path)) except OSError, e: @@ -6387,7 +6404,7 @@ if e.errno != errno.ENOENT: raise del e - os.symlink(os.path.join("..", "All", mypkg + ".tbz2"), full_path) + os.symlink(os.path.join("..", "All", mypkg + extn), full_path) def move_slot_ent(self, mylist): if not self.populated: @@ -6458,7 +6475,13 @@ # Try to avoid the population routine when possible, so that # FEATURES=buildpkg doesn't always force population. mycat, mypkg = catsplit(cpv) - myfile = mypkg + ".tbz2" + global settings + mysettings = config(config_incrementals=portage_const.INCREMENTALS) + if mysettings["PORTAGE_COMPRESS"] == "gzip": + extn=".tgz" + else: + extn=".tbz2" + myfile = mypkg + extn full_path = os.path.join(self.pkgdir, "All", myfile) if not os.path.exists(full_path): return @@ -6471,7 +6494,7 @@ """Move a colliding package if it exists. Code below this point only executes in rare cases.""" mycat, mypkg = catsplit(cpv) - myfile = mypkg + ".tbz2" + myfile = mypkg + extn mypath = os.path.join("All", myfile) dest_path = os.path.join(self.pkgdir, mypath) if os.path.exists(dest_path): @@ -6487,8 +6510,14 @@ def _move_to_all(self, cpv): """If the file exists, move it. Whether or not it exists, update state for future getname() calls.""" + global settings + mysettings = config(config_incrementals=portage_const.INCREMENTALS) + if mysettings["PORTAGE_COMPRESS"]== "gzip": + extn=".tgz" + else: + extn=".tbz2" mycat , mypkg = catsplit(cpv) - myfile = mypkg + ".tbz2" + myfile = mypkg + extn src_path = os.path.join(self.pkgdir, mycat, myfile) try: mystat = os.lstat(src_path) @@ -6508,9 +6537,15 @@ def _move_from_all(self, cpv): """Move a package from ${PKGDIR}/All/${PF}.tbz2 to ${PKGDIR}/${CATEGORY}/${PF}.tbz2 and update state from getname calls.""" + global settings + mysettings = config(config_incrementals=portage_const.INCREMENTALS) + if mysettings["PORTAGE_COMPRESS"]== "gzip": + extn=".tgz" + else: + extn=".tbz2" self._remove_symlink(cpv) mycat , mypkg = catsplit(cpv) - myfile = mypkg + ".tbz2" + myfile = mypkg + extn mypath = os.path.join(mycat, myfile) dest_path = os.path.join(self.pkgdir, mypath) try: @@ -6540,7 +6575,7 @@ dirs.insert(0, "All") for mydir in dirs: for myfile in listdir(os.path.join(self.pkgdir, mydir)): - if not myfile.endswith(".tbz2"): + if not (myfile.endswith(".tbz2") or myfile.endswith(".tgz")): continue mypath = os.path.join(mydir, myfile) full_path = os.path.join(self.pkgdir, mypath) @@ -6550,7 +6585,10 @@ # For invalid packages, mycat could be None. mycat = mytbz2.getfile("CATEGORY") mypf = mytbz2.getfile("PF") - mypkg = myfile[:-5] + if myfile.endswith(".tgz"): + mypkg = myfile[:-4] + else: + mypkg = myfile[:-5] if not mycat or not mypf: #old-style or corrupt package writemsg("!!! Invalid binary package: '%s'\n" % full_path, @@ -6607,7 +6645,10 @@ del self.remotepkgs[mypkg] continue mycat=self.remotepkgs[mypkg]["CATEGORY"].strip() - fullpkg=mycat+"/"+mypkg[:-5] + if mypkg.endswith(".tgz"): + fullpkg = mycat+"/"+mypkg[:-4] + else: + fullpkg=mycat+"/"+mypkg[:-5] if mycat not in categories: writemsg(("!!! Remote binary package has an " + \ "unrecognized category: '%s'\n") % fullpkg, @@ -6668,36 +6709,60 @@ mypath = self._pkg_paths.get(mycpv, None) if mypath: return os.path.join(self.pkgdir, mypath) + global settings + mysettings = config(config_incrementals=portage_const.INCREMENTALS) + if mysettings["PORTAGE_COMPRESS"]== "gzip": + extn=".tgz" + else: + extn=".tbz2" mycat, mypkg = catsplit(mycpv) - mypath = os.path.join("All", mypkg + ".tbz2") + mypath = os.path.join("All", mypkg + extn) if mypath in self._pkg_paths.values(): - mypath = os.path.join(mycat, mypkg + ".tbz2") + mypath = os.path.join(mycat, mypkg + extn) self._pkg_paths[mycpv] = mypath # cache for future lookups return os.path.join(self.pkgdir, mypath) def isremote(self,pkgname): "Returns true if the package is kept remotely." + global settings + mysettings = config(config_incrementals=portage_const.INCREMENTALS) + if mysettings["PORTAGE_COMPRESS"]== "gzip": + extn=".tgz" + else: + extn=".tbz2" mysplit=pkgname.split("/") - remote = (not os.path.exists(self.getname(pkgname))) and self.remotepkgs.has_key(mysplit[1]+".tbz2") + remote = (not os.path.exists(self.getname(pkgname))) and self.remotepkgs.has_key(mysplit[1]+extn) return remote def get_use(self,pkgname): + global settings + mysettings = config(config_incrementals=portage_const.INCREMENTALS) + if mysettings["PORTAGE_COMPRESS"]== "gzip": + extn=".tgz" + else: + extn=".tbz2" mysplit=pkgname.split("/") if self.isremote(pkgname): - return self.remotepkgs[mysplit[1]+".tbz2"]["USE"][:].split() + return self.remotepkgs[mysplit[1]+extn]["USE"][:].split() tbz2=xpak.tbz2(self.getname(pkgname)) return tbz2.getfile("USE").split() def gettbz2(self,pkgname): "fetches the package from a remote site, if necessary." + global settings + mysettings = config(config_incrementals=portage_const.INCREMENTALS) + if mysettings["PORTAGE_COMPRESS"]== "gzip": + extn=".tgz" + else: + extn=".tbz2" print "Fetching '"+str(pkgname)+"'" mysplit = pkgname.split("/") - tbz2name = mysplit[1]+".tbz2" + tbz2name = mysplit[1]+extn if not self.isremote(pkgname): if (tbz2name not in self.invalids): return else: - writemsg("Resuming download of this tbz2, but it is possible that it is corrupt.\n", + writemsg("Resuming download of this binary, but it is possible that it is corrupt.\n", noiselevel=-1) mydest = self.pkgdir+"/All/" try: @@ -7904,7 +7969,7 @@ return self.portdb.cp_list(self.cp, mytree=self.mytree) def pkgmerge(mytbz2, myroot, mysettings, mydbapi=None, vartree=None, prev_mtimes=None): - """will merge a .tbz2 file, returning a list of runtime dependencies + """will merge a binary file, returning a list of runtime dependencies that must be satisfied, or None if there was a merge error. This code assumes the package exists.""" global db @@ -7912,8 +7977,14 @@ mydbapi = db[myroot]["bintree"].dbapi if vartree is None: vartree = db[myroot]["vartree"] - if mytbz2[-5:]!=".tbz2": - print "!!! Not a .tbz2 file" + global settings + mysettings = config(config_incrementals=portage_const.INCREMENTALS) + if mysettings["PORTAGE_COMPRESS"]== "gzip": + extn=".tgz" + else: + extn=".tbz2" + if mytbz2[-5:]!=extn: + print "!!! Not a package file" return 1 tbz2_lock = None @@ -7923,8 +7994,10 @@ """ Don't lock the tbz2 file because the filesytem could be readonly or shared by a cluster.""" #tbz2_lock = portage_locks.lockfile(mytbz2, wantnewlockfile=1) - - mypkg = os.path.basename(mytbz2)[:-5] + if os.path.basename(mytbz2).endswith(".tgz"): + mypkg = os.path.basename(mytbz2)[:-4] + else: + mypkg = os.path.basename(mytbz2)[:-5] xptbz2 = xpak.tbz2(mytbz2) mycat = xptbz2.getfile("CATEGORY") if not mycat: @@ -7939,8 +8012,13 @@ catdir = os.path.dirname(builddir) pkgloc = os.path.join(builddir, "image") infloc = os.path.join(builddir, "build-info") - myebuild = os.path.join( - infloc, os.path.basename(mytbz2)[:-4] + "ebuild") + + if os.path.basename(mytbz2).endswith(".tgz"): + myebuild = os.path.join( + infloc, os.path.basename(mytbz2)[:-3] + "ebuild") + else: + myebuild = os.path.join( + infloc, os.path.basename(mytbz2)[:-4] + "ebuild") portage_util.ensure_dirs(os.path.dirname(catdir), uid=portage_uid, gid=portage_gid, mode=070, mask=0) catdir_lock = portage_locks.lockdir(catdir) @@ -7978,9 +8056,16 @@ return retval writemsg_stdout(">>> Extracting %s\n" % mypkg) - retval = portage_exec.spawn_bash( - "bzip2 -dqc -- '%s' | tar -xp -C '%s' -f -" % (mytbz2, pkgloc), - env=mysettings.environ()) + global settings + mysettings = config(config_incrementals=portage_const.INCREMENTALS) + if mysettings["PORTAGE_COMPRESS"]== "gzip": + retval = portage_exec.spawn_bash( + "gzip -cdq -- '%s' | tar -xp -C '%s' -f -" % (mytbz2, pkgloc), + env=mysettings.environ()) + else: + retval = portage_exec.spawn_bash( + "bzip2 -dqc -- '%s' | tar -xp -C '%s' -f -" % (mytbz2, pkgloc), + env=mysettings.environ()) if retval != os.EX_OK: writemsg("!!! Error Extracting '%s'\n" % mytbz2, noiselevel=-1) return retval @@ -8163,7 +8248,7 @@ if do_upgrade_packagesmessage and \ listdir(os.path.join(mysettings["PKGDIR"], "All"), EmptyOnError=1): writemsg_stdout(" ** Skipping packages. Run 'fixpackages' or set it in FEATURES to fix the") - writemsg_stdout("\n tbz2's in the packages directory. "+bold("Note: This can take a very long time.")) + writemsg_stdout("\n binaries in the packages directory. "+bold("Note: This can take a very long time.")) writemsg_stdout("\n") if myupd: return myupd @@ -8229,8 +8314,7 @@ portdbapi.portdbapi_instances.remove(portdb) del trees[myroot]["porttree"], myroot, portdb - settings = config(config_root=config_root, target_root=target_root, - config_incrementals=portage_const.INCREMENTALS) + settings = config(config_root=config_root, target_root=target_root, config_incrementals=portage_const.INCREMENTALS) settings.lock() settings.validate()