-# Copyright 1998-2009 Gentoo Foundation
+# Copyright 1998-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
__all__ = ["bindbapi", "binarytree"]
import portage
portage.proxy.lazyimport.lazyimport(globals(),
+ 'portage.checksum:hashfunc_map,perform_multiple_checksums,verify_all',
'portage.dbapi.dep_expand:dep_expand',
'portage.dep:dep_getkey,isjustname,match_from_list',
'portage.output:EOutput,colorize',
+ 'portage.locks:lockfile,unlockfile',
'portage.package.ebuild.doebuild:_vdb_use_conditional_atoms',
+ 'portage.package.ebuild.fetch:_check_distfile',
'portage.update:update_dbentries',
'portage.util:atomic_ofstream,ensure_dirs,normalize_path,' + \
'writemsg,writemsg_stdout',
)
from portage.cache.mappings import slot_dict_class
+from portage.const import CACHE_PATH
from portage.dbapi.virtual import fakedbapi
from portage.dep import Atom, use_reduce, paren_enclose
from portage.exception import InvalidPackageName, \
PermissionDenied, PortageException
from portage.localization import _
-
from portage import _movefile
from portage import os
from portage import _encodings
from portage import _unicode_decode
from portage import _unicode_encode
-from portage.package.ebuild.fetch import _check_distfile
import codecs
import errno
import re
import stat
import sys
+import textwrap
from itertools import chain
+try:
+ from urllib.parse import urlparse
+ from urllib.request import urlopen as urllib_request_urlopen
+except ImportError:
+ from urlparse import urlparse
+ from urllib import urlopen as urllib_request_urlopen
if sys.hexversion >= 0x3000000:
basestring = str
if self._populating:
return
- from portage.locks import lockfile, unlockfile
+
pkgindex_lock = None
try:
if os.access(self.pkgdir, os.W_OK):
", ".join(missing_keys))
msg.append(_(" This binary package is not " \
"recoverable and should be deleted."))
- from textwrap import wrap
- for line in wrap("".join(msg), 72):
+ for line in textwrap.wrap("".join(msg), 72):
writemsg("!!! %s\n" % line, noiselevel=-1)
self.invalids.append(mypkg)
continue
if getbinpkgs and 'PORTAGE_BINHOST' in self.settings:
base_url = self.settings["PORTAGE_BINHOST"]
- from portage.const import CACHE_PATH
- try:
- from urllib.parse import urlparse
- except ImportError:
- from urlparse import urlparse
urldata = urlparse(base_url)
pkgindex_file = os.path.join(self.settings["EROOT"], CACHE_PATH, "binhost",
urldata[1] + urldata[2], "Packages")
if e.errno != errno.ENOENT:
raise
local_timestamp = pkgindex.header.get("TIMESTAMP", None)
- try:
- from urllib.request import urlopen as urllib_request_urlopen
- except ImportError:
- from urllib import urlopen as urllib_request_urlopen
rmt_idx = self._new_pkgindex()
try:
# urlparse.urljoin() only works correctly with recognized
# Reread the Packages index (in case it's been changed by another
# process) and then updated it, all while holding a lock.
- from portage.locks import lockfile, unlockfile
pkgindex_lock = None
created_symlink = False
try:
"""
pkg_path = self.getname(cpv)
- from portage.checksum import perform_multiple_checksums
d = dict(zip(self._pkgindex_aux_keys,
self.dbapi.aux_get(cpv, self._pkgindex_aux_keys)))
mydest = os.path.dirname(self.getname(pkgname))
self._ensure_dir(mydest)
- try:
- from urllib.parse import urlparse
- except ImportError:
- from urlparse import urlparse
# urljoin doesn't work correctly with unrecognized protocols like sftp
if self._remote_has_index:
rel_url = self._remotepkgs[pkgname].get("PATH")
return False
digests = {}
- from portage.checksum import hashfunc_map, verify_all
for k in hashfunc_map:
v = metadata.get(k)
if not v: