bsd_chflags = None
try:
- from cache.cache_errors import CacheError
+ from portage.cache.cache_errors import CacheError
import cvstree
import xpak
import getbinpkg
# XXX: This needs to get cleaned up.
import output
- from output import bold, colorize, green, red, yellow
+ from portage.output import bold, colorize, green, red, yellow
import portage.const
from portage.const import VDB_PATH, PRIVATE_PATH, CACHE_PATH, DEPCACHE_PATH, \
try:
# FIXME: ugly ad.hoc import code
# TODO: implement a common portage module loader
- logmodule = __import__("elog_modules.mod_"+s)
+ logmodule = __import__("portage.elog_modules.mod_"+s)
m = getattr(logmodule, "mod_"+s)
def timeout_handler(signum, frame):
raise portage.exception.PortageException(
if self.modules["user"] is None:
self.modules["user"] = {}
self.modules["default"] = {
- "portdbapi.metadbmodule": "cache.metadata.database",
- "portdbapi.auxdbmodule": "cache.flat_hash.database",
+ "portdbapi.metadbmodule": "portage.cache.metadata.database",
+ "portdbapi.auxdbmodule": "portage.cache.flat_hash.database",
}
self.usemask=[]
noiselevel=-1)
os.unlink(myfile_path)
else:
- eout = output.EOutput()
+ eout = portage.output.EOutput()
eout.quiet = \
mysettings.get("PORTAGE_QUIET", None) == "1"
for digest_name in mydigests[myfile]:
os.unlink(mysettings["DISTDIR"]+"/"+myfile)
fetched=0
else:
- eout = output.EOutput()
+ eout = portage.output.EOutput()
eout.quiet = mysettings.get("PORTAGE_QUIET", None) == "1"
for x_key in mydigests[myfile].keys():
eout.ebegin("%s %s ;-)" % (myfile, x_key))
cp = os.path.sep.join(mysettings["O"].split(os.path.sep)[-2:])
pkgs = myportdb.cp_list(cp, mytree=mytree)
pkgs.sort()
- writemsg_stdout(" digest.assumed" + output.colorize("WARN",
+ writemsg_stdout(" digest.assumed" + portage.output.colorize("WARN",
str(len(auto_assumed)).rjust(18)) + "\n")
for pkg_key in pkgs:
fetchlist = myportdb.getfetchlist(pkg_key,
if strict:
return 0
mf = Manifest(pkgdir, mysettings["DISTDIR"])
- eout = output.EOutput()
+ eout = portage.output.EOutput()
eout.quiet = mysettings.get("PORTAGE_QUIET", None) == "1"
try:
eout.ebegin("checking ebuild checksums ;-)")
# Allow color.map to control colors associated with einfo, ewarn, etc...
mycolors = []
for c in ("GOOD", "WARN", "BAD", "HILITE", "BRACKET"):
- mycolors.append("%s=$'%s'" % (c, output.codes[c]))
+ mycolors.append("%s=$'%s'" % (c, portage.output.codes[c]))
mysettings["PORTAGE_COLORMAP"] = "\n".join(mycolors)
def prepare_build_dirs(myroot, mysettings, cleanup):
mylist = []
tbz2name = mysplit[1]+".tbz2"
if self.bintree and not self.bintree.isremote(mycpv):
- tbz2 = xpak.tbz2(self.bintree.getname(mycpv))
+ tbz2 = portage.xpak.tbz2(self.bintree.getname(mycpv))
getitem = tbz2.getfile
else:
getitem = self.bintree.remotepkgs[tbz2name].get
tbz2path = self.bintree.getname(cpv)
if not os.path.exists(tbz2path):
raise KeyError(cpv)
- mytbz2 = xpak.tbz2(tbz2path)
+ mytbz2 = portage.xpak.tbz2(tbz2path)
mydata = mytbz2.get_data()
mydata.update(values)
- mytbz2.recompose_mem(xpak.xpak_mem(mydata))
+ mytbz2.recompose_mem(portage.xpak.xpak_mem(mydata))
def cp_list(self, *pargs, **kwargs):
if not self.bintree.populated:
if self.tmpfs and not os.access(self.tmpfs, os.R_OK):
self.tmpfs = None
- self.eclassdb = eclass_cache.cache(self.porttree_root,
+ self.eclassdb = portage.eclass_cache.cache(self.porttree_root,
overlays=self.mysettings["PORTDIR_OVERLAY"].split())
self.metadbmodule = self.mysettings.load_best_module("portdbapi.metadbmodule")
# ~harring
filtered_auxdbkeys = filter(lambda x: not x.startswith("UNUSED_0"), auxdbkeys)
if secpass < 1:
- from cache import metadata_overlay, volatile
+ from portage.cache import metadata_overlay, volatile
for x in self.porttrees:
db_ro = self.auxdbmodule(self.depcachedir, x,
filtered_auxdbkeys, gid=portage_gid, readonly=True)
#print ">>> Updating data in:",mycpv
writemsg_stdout("%")
- mytbz2 = xpak.tbz2(tbz2path)
+ mytbz2 = portage.xpak.tbz2(tbz2path)
mydata = mytbz2.get_data()
updated_items = update_dbentries([mylist], mydata)
mydata.update(updated_items)
mydata[mynewpkg+".ebuild"] = mydata[myoldpkg+".ebuild"]
del mydata[myoldpkg+".ebuild"]
mydata["PF"] = mynewpkg + "\n"
- mytbz2.recompose_mem(xpak.xpak_mem(mydata))
+ mytbz2.recompose_mem(portage.xpak.xpak_mem(mydata))
self.dbapi.cpv_remove(mycpv)
del self._pkg_paths[mycpv]
continue
#print ">>> Updating data in:",mycpv
- mytbz2 = xpak.tbz2(tbz2path)
+ mytbz2 = portage.xpak.tbz2(tbz2path)
mydata = mytbz2.get_data()
slot = mydata["SLOT"]
writemsg_stdout("S")
mydata["SLOT"] = newslot+"\n"
- mytbz2.recompose_mem(xpak.xpak_mem(mydata))
+ mytbz2.recompose_mem(portage.xpak.xpak_mem(mydata))
return 1
def update_ents(self, update_iter):
continue
#print ">>> Updating binary data:",mycpv
writemsg_stdout("*")
- mytbz2 = xpak.tbz2(tbz2path)
+ mytbz2 = portage.xpak.tbz2(tbz2path)
mydata = mytbz2.get_data()
updated_items = update_dbentries(update_iter, mydata)
if len(updated_items) > 0:
mydata.update(updated_items)
- mytbz2.recompose_mem(xpak.xpak_mem(mydata))
+ mytbz2.recompose_mem(portage.xpak.xpak_mem(mydata))
return 1
def prevent_collision(self, cpv):
dest_path = os.path.join(self.pkgdir, mypath)
if os.path.exists(dest_path):
# For invalid packages, other_cat could be None.
- other_cat = xpak.tbz2(dest_path).getfile("CATEGORY")
+ other_cat = portage.xpak.tbz2(dest_path).getfile("CATEGORY")
if other_cat:
other_cat = other_cat.strip()
self._move_from_all(other_cat + "/" + mypkg)
full_path = os.path.join(self.pkgdir, mypath)
if os.path.islink(full_path):
continue
- mytbz2 = xpak.tbz2(full_path)
+ mytbz2 = portage.xpak.tbz2(full_path)
# For invalid packages, mycat could be None.
mycat = mytbz2.getfile("CATEGORY")
mypf = mytbz2.getfile("PF")
chunk_size = 3000
writemsg(green("Fetching binary packages info...\n"))
- self.remotepkgs = getbinpkg.dir_get_metadata(
+ self.remotepkgs = portage.getbinpkg.dir_get_metadata(
self.settings["PORTAGE_BINHOST"], chunk_size=chunk_size)
writemsg(green(" -- DONE!\n\n"))
mysplit=pkgname.split("/")
if self.isremote(pkgname):
return self.remotepkgs[mysplit[1]+".tbz2"]["USE"][:].split()
- tbz2=xpak.tbz2(self.getname(pkgname))
+ tbz2=portage.xpak.tbz2(self.getname(pkgname))
return tbz2.getfile("USE").split()
def gettbz2(self,pkgname):
os.makedirs(mydest, 0775)
except (OSError, IOError):
pass
- return getbinpkg.file_get(
+ return portage.getbinpkg.file_get(
self.settings["PORTAGE_BINHOST"] + "/" + tbz2name,
mydest, fcmd=self.settings["RESUMECOMMAND"])
#tbz2_lock = portage.locks.lockfile(mytbz2, wantnewlockfile=1)
mypkg = os.path.basename(mytbz2)[:-5]
- xptbz2 = xpak.tbz2(mytbz2)
+ xptbz2 = portage.xpak.tbz2(mytbz2)
mycat = xptbz2.getfile("CATEGORY")
if not mycat:
writemsg("!!! CATEGORY info missing from info chunk, aborting...\n",
except ImportError:
import pickle
import os
-from cache import fs_template
-from cache import cache_errors
+from portage.cache import fs_template
+from portage.cache import cache_errors
class database(fs_template.FsBased):
# License: GPL2
# $Id$
-from cache import fs_template
-from cache import cache_errors
+from portage.cache import fs_template
+from portage.cache import cache_errors
import errno, os, stat
-from cache.template import reconstruct_eclasses
+from portage.cache.template import reconstruct_eclasses
# store the current key order *here*.
class database(fs_template.FsBased):
-from cache import fs_template
-from cache import cache_errors
+from portage.cache import fs_template
+from portage.cache import cache_errors
import errno, os, stat
# store the current key order *here*.
# $Id$
import os
-from cache import template
+from portage.cache import template
from portage.data import portage_gid
class FsBased(template.database):
# $Id$
import os, stat, types
-from cache import flat_hash
-import eclass_cache
-from cache.template import reconstruct_eclasses
-from cache.mappings import ProtectedDict
+from portage.cache import flat_hash
+import portage.eclass_portage.cache
+from portage.cache.template import reconstruct_eclasses
+from portage.cache.mappings import ProtectedDict
# this is the old cache format, flat_list. count maintained here.
magic_line_count = 22
loc = location
super(database, self).__init__(location, *args, **config)
self.location = os.path.join(loc, "metadata","cache")
- self.ec = eclass_cache.cache(loc)
+ self.ec = portage.eclass_cache.cache(loc)
def __getitem__(self, cpv):
return flat_hash.database.__getitem__(self, cpv)
import time
if not hasattr(__builtins__, "set"):
from sets import Set as set
-from cache import template
-from cache.cache_errors import CacheCorruption
-from cache.flat_hash import database as db_rw
-from cache.metadata import database as db_ro
+from portage.cache import template
+from portage.cache.cache_errors import CacheCorruption
+from portage.cache.flat_hash import database as db_rw
+from portage.cache.metadata import database as db_ro
class database(template.database):
# License: GPL2
# $Id$
-from cache import template, cache_errors
-from cache.template import reconstruct_eclasses
+from portage.cache import template, cache_errors
+from portage.cache.template import reconstruct_eclasses
class SQLDatabase(template.database):
"""template class for RDBM based caches
# Distributed under the terms of the GNU General Public License v2
# $Header: $
-from cache import fs_template
-from cache import cache_errors
+from portage.cache import fs_template
+from portage.cache import cache_errors
import os
-from cache.template import reconstruct_eclasses
+from portage.cache.template import reconstruct_eclasses
from portage.util import writemsg, apply_secpass_permissions
from portage.data import portage_gid
try:
# License: GPL2
# $Id$
-from cache import cache_errors
-from cache.cache_errors import InvalidRestriction
-from cache.mappings import ProtectedDict
+from portage.cache import cache_errors
+from portage.cache.cache_errors import InvalidRestriction
+from portage.cache.mappings import ProtectedDict
class database(object):
# this is for metadata/cache transfer.
if not hasattr(__builtins__, "set"):
from sets import Set as set
from itertools import chain
-from cache import cache_errors
+from portage.cache import cache_errors
def mirror_cache(valid_nodes_iterable, src_cache, trg_cache, eclass_cache=None, verbose_instance=None):
trg = None
try:
trg = trg_cache[x]
- if long(trg["_mtime_"]) == long(entry["_mtime_"]) and eclass_cache.is_eclass_data_valid(trg["_eclasses_"]):
+ if long(trg["_mtime_"]) == long(entry["_mtime_"]) and portage.eclass_cache.is_eclass_data_valid(trg["_eclasses_"]):
write_it = False
except (cache_errors.CacheError, KeyError):
pass
if not "_eclasses_" in entry:
noise.corruption(x,"missing _eclasses_ field")
continue
- if not eclass_cache.is_eclass_data_valid(entry["_eclasses_"]):
+ if not portage.eclass_cache.is_eclass_data_valid(entry["_eclasses_"]):
noise.eclass_stale(x)
continue
else:
- entry["_eclasses_"] = eclass_cache.get_eclass_data(entry["INHERITED"].split(), \
+ entry["_eclasses_"] = portage.eclass_cache.get_eclass_data(entry["INHERITED"].split(), \
from_master_only=True)
if not entry["_eclasses_"]:
noise.eclass_stale(x)
import copy
if not hasattr(__builtins__, "set"):
from sets import Set as set
-from cache import template
+from portage.cache import template
class database(template.database):
-# portage.checksum.py -- core Portage functionality
+# checksum.py -- core Portage functionality
# Copyright 1998-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
-# portage.data.py -- Calculated/Discovered Data Values
+# data.py -- Calculated/Discovered Data Values
# Copyright 1998-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
import os,pwd,grp
from portage.util import writemsg
-from output import green,red
-from output import create_color_func
+from portage.output import green,red
+from portage.output import create_color_func
bad = create_color_func("BAD")
ostype=os.uname()[0]
-import elog_modules.mod_save, portage.exec, portage.exception
+import portage.elog_modules.mod_save, portage.process, portage.exception
def process(mysettings, cpv, logentries, fulltext):
- elogfilename = elog_modules.mod_save.process(mysettings, cpv, logentries, fulltext)
+ elogfilename = portage.elog_modules.mod_save.process(mysettings, cpv, logentries, fulltext)
if (not "PORTAGE_ELOG_COMMAND" in mysettings.keys()) \
or len(mysettings["PORTAGE_ELOG_COMMAND"]) == 0:
mylogcmd = mysettings["PORTAGE_ELOG_COMMAND"]
mylogcmd = mylogcmd.replace("${LOGFILE}", elogfilename)
mylogcmd = mylogcmd.replace("${PACKAGE}", cpv)
- retval = portage.exec.spawn_bash(mylogcmd)
+ retval = portage.process.spawn_bash(mylogcmd)
if retval != 0:
raise portage.exception.PortageException("!!! PORTAGE_ELOG_COMMAND failed with exitcode %d" % retval)
return
import os,sys
-from output import bold, turquoise, green
+from portage.output import bold, turquoise, green
def shorthelp():
print
if not hasattr(__builtins__, "set"):
from sets import Set as set
-from output import red, yellow, green
-import htmllib,HTMLParser,formatter,sys,os,xpak,time,tempfile,base64,urllib2
+from portage.output import red, yellow, green
+import htmllib,HTMLParser,formatter,sys,os,portage.xpak,time,tempfile,base64,urllib2
try:
import cPickle
myid,myglob = data
mydict = {}
- for x in xpak.getindex_mem(myid):
- mydict[x] = xpak.getitem(data,x)
+ for x in portage.xpak.getindex_mem(myid):
+ mydict[x] = portage.xpak.getitem(data,x)
return mydict
raise TypeError, "Unknown protocol. '%s'" % protocol
if data:
- xpaksize = xpak.decodeint(data[-8:-4])
+ xpaksize = portage.xpak.decodeint(data[-8:-4])
if (xpaksize+8) > chunk_size:
myid = file_get_metadata(baseurl, conn, (xpaksize+8))
if not keepconnection:
xpak_data = data[len(data)-(xpaksize+8):-8]
del data
- myid = xpak.xsplit_mem(xpak_data)
+ myid = portage.xpak.xsplit_mem(xpak_data)
if not myid:
myid = None,None
del xpak_data
-# portage.gpg.py -- core Portage functionality
+# gpg.py -- core Portage functionality
# Copyright 2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
trustLevel = UNTRUSTED
if result == 0:
trustLevel = TRUSTED
- #if output.find("WARNING") != -1:
+ #if portage.output.find("WARNING") != -1:
# trustLevel = MARGINAL
- if output.find("BAD") != -1:
+ if portage.output.find("BAD") != -1:
raise portage.exception.InvalidSignature, filename
elif result == 1:
trustLevel = EXISTS
- if output.find("BAD") != -1:
+ if portage.output.find("BAD") != -1:
raise portage.exception.InvalidSignature, filename
elif result == 2:
trustLevel = UNTRUSTED
- if output.find("could not be verified") != -1:
+ if portage.output.find("could not be verified") != -1:
raise portage.exception.MissingSignature, filename
- if output.find("public key not found") != -1:
+ if portage.output.find("public key not found") != -1:
if self.keyringIsTrusted: # We trust the ring, but not the key specifically.
trustLevel = MARGINAL
else:
-# portage.localization.py -- Code to manage/help portage localization.
+# localization.py -- Code to manage/help portage localization.
# Copyright 2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
-# portage.versions.py -- core Portage functionality
+# versions.py -- core Portage functionality
# Copyright 1998-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$