import errno
import stat
from portage import os
+from portage import _encodings
from portage import _unicode_encode
class database(fs_template.FsBased):
def _getitem(self, cpv):
fp = os.path.join(self.location, cpv)
try:
- myf = codecs.open(_unicode_encode(fp),
- mode='r', encoding='utf_8', errors='replace')
+ myf = codecs.open(_unicode_encode(fp,
+ encoding=_encodings['fs'], errors='strict'),
+ mode='r', encoding=_encodings['repo.content'],
+ errors='replace')
try:
d = self._parse_data(myf.readlines(), cpv)
if '_mtime_' not in d:
s = cpv.rfind("/")
fp = os.path.join(self.location,cpv[:s],".update.%i.%s" % (os.getpid(), cpv[s+1:]))
try:
- myf = codecs.open(_unicode_encode(fp), mode='w',
- encoding='utf_8', errors='replace')
+ myf = codecs.open(_unicode_encode(fp,
+ encoding=_encodings['fs'], errors='strict'),
+ mode='w', encoding=_encodings['repo.content'],
+ errors='backslashreplace')
except (IOError, OSError), e:
if errno.ENOENT == e.errno:
try:
self._ensure_dirs(cpv)
- myf = codecs.open(_unicode_encode(fp), mode='w',
- encoding='utf_8', errors='replace')
+ myf = codecs.open(_unicode_encode(fp,
+ encoding=_encodings['fs'], errors='strict'),
+ mode='w', encoding=_encodings['repo.content'],
+ errors='backslashreplace')
except (OSError, IOError),e:
raise cache_errors.CacheCorruption(cpv, e)
else:
from portage.cache import fs_template
from portage.cache import cache_errors
from portage import os
+from portage import _encodings
from portage import _unicode_encode
import codecs
import errno
def _getitem(self, cpv):
d = {}
try:
- myf = codecs.open(_unicode_encode(os.path.join(self._base, cpv)),
- mode='r', encoding='utf_8', errors='replace')
+ myf = codecs.open(_unicode_encode(os.path.join(self._base, cpv),
+ encoding=_encodings['fs'], errors='strict'),
+ mode='r', encoding=_encodings['repo.content'],
+ errors='replace')
for k,v in zip(self.auxdbkey_order, myf):
d[k] = v.rstrip("\n")
except (OSError, IOError),e:
s = cpv.rfind("/")
fp=os.path.join(self._base,cpv[:s],".update.%i.%s" % (os.getpid(), cpv[s+1:]))
try:
- myf = codecs.open(_unicode_encode(fp), mode='w',
- encoding='utf_8', errors='replace')
+ myf = codecs.open(_unicode_encode(fp,
+ encoding=_encodings['fs'], errors='strict'),
+ mode='w', encoding=_encodings['repo.content'],
+ errors='backslashreplace')
except (OSError, IOError), e:
if errno.ENOENT == e.errno:
try:
self._ensure_dirs(cpv)
- myf = codecs.open(_unicode_encode(fp), mode='w',
- encoding='utf_8', errors='replace')
+ myf = codecs.open(_unicode_encode(fp,
+ encoding=_encodings['fs'], errors='strict'),
+ mode='w', encoding=_encodings['repo.content'],
+ errors='backslashreplace')
except (OSError, IOError),e:
raise cache_errors.CacheCorruption(cpv, e)
else:
import errno
import re
from portage import os
+from portage import _encodings
from portage import _unicode_encode
from portage.cache import cache_errors, flat_hash
import portage.eclass_cache
new_content = []
for k in self.auxdbkey_order:
- new_content.append(values.get(k, u''))
- new_content.append(u'\n')
+ new_content.append(values.get(k, ''))
+ new_content.append('\n')
for i in xrange(magic_line_count - len(self.auxdbkey_order)):
- new_content.append(u'\n')
- new_content = u''.join(new_content)
- new_content = _unicode_encode(new_content)
+ new_content.append('\n')
+ new_content = ''.join(new_content)
+ new_content = _unicode_encode(new_content,
+ _encodings['repo.content'], errors='backslashreplace')
new_fp = os.path.join(self.location, cpv)
try:
- f = open(_unicode_encode(new_fp), 'rb')
+ f = open(_unicode_encode(new_fp,
+ encoding=_encodings['fs'], errors='strict'), 'rb')
except EnvironmentError:
pass
else:
fp = os.path.join(self.location,cpv[:s],
".update.%i.%s" % (os.getpid(), cpv[s+1:]))
try:
- myf = open(_unicode_encode(fp), 'wb')
+ myf = open(_unicode_encode(fp,
+ encoding=_encodings['fs'], errors='strict'), 'wb')
except EnvironmentError, e:
if errno.ENOENT == e.errno:
try:
self._ensure_dirs(cpv)
- myf = open(_unicode_encode(fp), 'wb')
+ myf = open(_unicode_encode(fp,
+ encoding=_encodings['fs'], errors='strict'), 'wb')
except EnvironmentError, e:
raise cache_errors.CacheCorruption(cpv, e)
else: