* [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/
@ 2011-02-14 4:02 Zac Medico
0 siblings, 0 replies; 11+ messages in thread
From: Zac Medico @ 2011-02-14 4:02 UTC (permalink / raw
To: gentoo-commits
commit: 53f096c5d72dd15336fdf921f29ceae9b5842148
Author: David James <davidjames <AT> google <DOT> com>
AuthorDate: Fri Feb 11 17:25:26 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Feb 14 03:51:39 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=53f096c5
Add support for grabbing Packages files using external programs.
If the user specifies FETCHCOMMAND_*, Portage should honor this when grabbing
Packages files. This allows users to setup support for grabbing Packages files
from other protocols.
BUG=chrome-os-partner:2026
TEST=Try downloading prebuilts from gs:// when FETCHCOMMAND_GS is setup in make.conf
Change-Id: I96b239819351633dd02d608954e81a1c363a4687
Review URL: http://codereview.chromium.org/6458015
---
pym/portage/dbapi/bintree.py | 16 ++++++++++++++--
pym/portage/getbinpkg.py | 6 ++++--
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
index 993df77..78eb429 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -770,8 +770,9 @@ class binarytree(object):
# urlparse.urljoin() only works correctly with recognized
# protocols and requires the base url to have a trailing
# slash, so join manually...
+ url = base_url.rstrip("/") + "/Packages"
try:
- f = urllib_request_urlopen(base_url.rstrip("/") + "/Packages")
+ f = urllib_request_urlopen(url)
except IOError:
path = parsed_url.path.rstrip("/") + "/Packages"
@@ -796,7 +797,18 @@ class binarytree(object):
stdout=subprocess.PIPE)
f = proc.stdout
else:
- raise
+ setting = 'FETCHCOMMAND_' + parsed_url.scheme.upper()
+ fcmd = self.settings.get(setting)
+ if not fcmd:
+ raise
+ fd, tmp_filename = tempfile.mkstemp()
+ tmp_dirname, tmp_basename = os.path.split(tmp_filename)
+ os.close(fd)
+ success = portage.getbinpkg.file_get(url,
+ tmp_dirname, fcmd=fcmd, filename=tmp_basename)
+ if not success:
+ raise portage.exception.FileNotFound(url)
+ f = open(tmp_filename, 'rb')
f_dec = codecs.iterdecode(f,
_encodings['repo.content'], errors='replace')
diff --git a/pym/portage/getbinpkg.py b/pym/portage/getbinpkg.py
index f85b65c..43a6bf5 100644
--- a/pym/portage/getbinpkg.py
+++ b/pym/portage/getbinpkg.py
@@ -431,17 +431,19 @@ def file_get_metadata(baseurl,conn=None, chunk_size=3000):
return myid
-def file_get(baseurl,dest,conn=None,fcmd=None):
+def file_get(baseurl,dest,conn=None,fcmd=None,filename=None):
"""(baseurl,dest,fcmd=) -- Takes a base url to connect to and read from.
URI should be in the form <proto>://[user[:pass]@]<site>[:port]<path>"""
if not fcmd:
return file_get_lib(baseurl,dest,conn)
+ if not filename:
+ filename = os.path.basename(baseurl)
variables = {
"DISTDIR": dest,
"URI": baseurl,
- "FILE": os.path.basename(baseurl)
+ "FILE": filename
}
from portage.util import varexpand
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/
@ 2011-03-27 20:57 Zac Medico
0 siblings, 0 replies; 11+ messages in thread
From: Zac Medico @ 2011-03-27 20:57 UTC (permalink / raw
To: gentoo-commits
commit: 436c4629ffde8089b369fe58180b474a302b6630
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 27 20:55:11 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Mar 27 20:55:11 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=436c4629
UnsupportedAPIException: handle unicode in EAPI
Normally EAPI doesn't contain unicode, but as in bug #359675, it can
contain practically anything if files in /var/db/pkg are corrupt.
---
pym/portage/dbapi/vartree.py | 2 +-
pym/portage/exception.py | 17 ++++++++++++++---
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 45b5a69..dd041d8 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1539,7 +1539,7 @@ class dblink(object):
showMessage(_("!!! FAILED prerm: %s\n") % \
os.path.join(self.dbdir, "EAPI"),
level=logging.ERROR, noiselevel=-1)
- showMessage("%s\n" % (e,),
+ showMessage(_unicode_decode("%s\n") % (e,),
level=logging.ERROR, noiselevel=-1)
myebuildpath = None
diff --git a/pym/portage/exception.py b/pym/portage/exception.py
index 64d0f7b..7891120 100644
--- a/pym/portage/exception.py
+++ b/pym/portage/exception.py
@@ -1,4 +1,4 @@
-# Copyright 1998-2004 Gentoo Foundation
+# Copyright 1998-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import signal
@@ -150,13 +150,24 @@ class UnsupportedAPIException(PortagePackageException):
def __init__(self, cpv, eapi):
self.cpv, self.eapi = cpv, eapi
def __str__(self):
+ eapi = self.eapi
+ if not isinstance(eapi, basestring):
+ eapi = str(eapi)
+ eapi = eapi.lstrip("-")
msg = _("Unable to do any operations on '%(cpv)s', since "
"its EAPI is higher than this portage version's. Please upgrade"
" to a portage version that supports EAPI '%(eapi)s'.") % \
- {"cpv": self.cpv, "eapi": str(self.eapi).lstrip("-")}
- return msg
+ {"cpv": self.cpv, "eapi": eapi}
+ return _unicode_decode(msg,
+ encoding=_encodings['content'], errors='replace')
+ if sys.hexversion < 0x3000000:
+
+ __unicode__ = __str__
+ def __str__(self):
+ return _unicode_encode(self.__unicode__(),
+ encoding=_encodings['content'], errors='backslashreplace')
class SignatureException(PortageException):
"""Signature was not present in the checked file"""
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/
@ 2011-05-05 15:13 Zac Medico
0 siblings, 0 replies; 11+ messages in thread
From: Zac Medico @ 2011-05-05 15:13 UTC (permalink / raw
To: gentoo-commits
commit: 31cd3e14b04608ee19b0f12aa18a2864410baf6d
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu May 5 15:15:20 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 5 15:15:20 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=31cd3e14
Update timestamps in headers of modified files.
---
pym/portage/dbapi/cpv_expand.py | 2 +-
pym/portage/manifest.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/pym/portage/dbapi/cpv_expand.py b/pym/portage/dbapi/cpv_expand.py
index 9ce0d3d..26f9948 100644
--- a/pym/portage/dbapi/cpv_expand.py
+++ b/pym/portage/dbapi/cpv_expand.py
@@ -1,4 +1,4 @@
-# Copyright 2010 Gentoo Foundation
+# Copyright 2010-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
__all__ = ["cpv_expand"]
diff --git a/pym/portage/manifest.py b/pym/portage/manifest.py
index de7540f..f273cc2 100644
--- a/pym/portage/manifest.py
+++ b/pym/portage/manifest.py
@@ -1,4 +1,4 @@
-# Copyright 1999-2009 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import codecs
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/
@ 2011-09-06 18:35 Zac Medico
0 siblings, 0 replies; 11+ messages in thread
From: Zac Medico @ 2011-09-06 18:35 UTC (permalink / raw
To: gentoo-commits
commit: eab5a6ee1abff1fbf142cf1558ba940b6d4b270a
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 6 18:34:57 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Sep 6 18:34:57 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=eab5a6ee
merge: avoid abssymlink readlink call
This will avoid the "OSError: [Errno 2] No such file or directory" that
is triggered inside abssymlink if the merge encoding is not ascii or
utf_8, as shown in bug #382021.
---
pym/portage/__init__.py | 7 +++++--
pym/portage/dbapi/vartree.py | 7 ++++++-
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 901ea2c..d73ea6d 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -391,9 +391,12 @@ def getcwd():
return "/"
getcwd()
-def abssymlink(symlink):
+def abssymlink(symlink, target=None):
"This reads symlinks, resolving the relative symlinks, and returning the absolute."
- mylink=os.readlink(symlink)
+ if target is None:
+ mylink = target
+ else:
+ mylink = os.readlink(symlink)
if mylink[0] != '/':
mydir=os.path.dirname(symlink)
mylink=mydir+"/"+mylink
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index bafe138..4d0a6dd 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -4013,7 +4013,12 @@ class dblink(object):
os.unlink(mysrc)
os.symlink(myto, mysrc)
- myabsto = abssymlink(mysrc)
+ # Pass in the symlink target in order to bypass the
+ # os.readlink() call inside abssymlink(), since that
+ # call is unsafe if the merge encoding is not ascii
+ # or utf_8 (see bug #382021).
+ myabsto = abssymlink(mysrc, target=myto)
+
if myabsto.startswith(srcroot):
myabsto = myabsto[len(srcroot):]
myabsto = myabsto.lstrip(sep)
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/
@ 2011-10-16 21:13 Zac Medico
0 siblings, 0 replies; 11+ messages in thread
From: Zac Medico @ 2011-10-16 21:13 UTC (permalink / raw
To: gentoo-commits
commit: 5b8fdc7d3e4c64ce79d0218fd101f8292602d10b
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 16 21:13:45 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Oct 16 21:13:45 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=5b8fdc7d
hashed_path: convert stat OSError to FileNotFound
This makes it consistent with perform_checksum call which also raises
FileNotFound instead of OSError.
---
pym/portage/dbapi/porttree.py | 2 +-
pym/portage/eclass_cache.py | 11 ++++++++---
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index 0ade59a..a0b7d7e 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -424,7 +424,7 @@ class portdbapi(dbapi):
# snag mtime since we use it later, and to trigger stat failure
# if it doesn't exist
ebuild_hash.mtime
- except OSError:
+ except FileNotFound:
writemsg(_("!!! aux_get(): ebuild for " \
"'%s' does not exist at:\n") % (cpv,), noiselevel=-1)
writemsg("!!! %s\n" % ebuild_path, noiselevel=-1)
diff --git a/pym/portage/eclass_cache.py b/pym/portage/eclass_cache.py
index adfe69a..4a934f1 100644
--- a/pym/portage/eclass_cache.py
+++ b/pym/portage/eclass_cache.py
@@ -9,7 +9,7 @@ import sys
import operator
from portage.util import normalize_path
import errno
-from portage.exception import PermissionDenied
+from portage.exception import FileNotFound, PermissionDenied
from portage import os
from portage import checksum
@@ -30,7 +30,12 @@ class hashed_path(object):
# the straight c api.
# thus use the defacto python compatibility work around;
# access via index, which guarantees you get the raw long.
- self.mtime = obj = os.stat(self.location)[stat.ST_MTIME]
+ try:
+ self.mtime = obj = os.stat(self.location)[stat.ST_MTIME]
+ except OSError as e:
+ if e.errno in (errno.ENOENT, errno.ESTALE):
+ raise FileNotFound(self.location)
+ raise
return obj
if not attr.islower():
# we don't care to allow .mD5 as an alias for .md5
@@ -113,7 +118,7 @@ class cache(object):
obj.eclass_dir = x
try:
mtime = obj.mtime
- except OSError:
+ except FileNotFound:
continue
ys=y[:-eclass_len]
if x == self._master_eclass_root:
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/
@ 2014-08-03 21:53 Pavel Kazakov
0 siblings, 0 replies; 11+ messages in thread
From: Pavel Kazakov @ 2014-08-03 21:53 UTC (permalink / raw
To: gentoo-commits
commit: 96ded9cff423d773ee31a696a691dd6610c315b7
Author: Pavel Kazakov <nullishzero <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 3 21:38:45 2014 +0000
Commit: Pavel Kazakov <nullishzero <AT> gentoo <DOT> org>
CommitDate: Sun Aug 3 21:38:45 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=96ded9cf
Move -MERGING- string to a constant.
Remove extra whitespace.
---
pym/portage/const.py | 1 +
pym/portage/dbapi/__init__.py | 4 +++-
pym/portage/dbapi/vartree.py | 8 ++++----
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/pym/portage/const.py b/pym/portage/const.py
index 1785bff..50f0719 100644
--- a/pym/portage/const.py
+++ b/pym/portage/const.py
@@ -74,6 +74,7 @@ MOVE_BINARY = "/bin/mv"
PRELINK_BINARY = "/usr/sbin/prelink"
INVALID_ENV_FILE = "/etc/spork/is/not/valid/profile.env"
+MERGING_IDENTIFIER = "-MERGING-"
REPO_NAME_FILE = "repo_name"
REPO_NAME_LOC = "profiles" + "/" + REPO_NAME_FILE
diff --git a/pym/portage/dbapi/__init__.py b/pym/portage/dbapi/__init__.py
index a20a1e8..6638352 100644
--- a/pym/portage/dbapi/__init__.py
+++ b/pym/portage/dbapi/__init__.py
@@ -16,6 +16,8 @@ portage.proxy.lazyimport.lazyimport(globals(),
'portage.versions:catsplit,catpkgsplit,vercmp,_pkg_str',
)
+from portage.const import MERGING_IDENTIFIER
+
from portage import os
from portage import auxdbkeys
from portage.eapi import _get_eapi_attrs
@@ -278,7 +280,7 @@ class dbapi(object):
return True
def invalidentry(self, mypath):
- if '/-MERGING-' in mypath:
+ if MERGING_IDENTIFIER in mypath:
if os.path.exists(mypath):
writemsg(colorize("BAD", _("INCOMPLETE MERGE:"))+" %s\n" % mypath,
noiselevel=-1)
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 4a27092..1984a66 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -45,7 +45,7 @@ portage.proxy.lazyimport.lazyimport(globals(),
)
from portage.const import CACHE_PATH, CONFIG_MEMORY_FILE, \
- PORTAGE_PACKAGE_ATOM, PRIVATE_PATH, VDB_PATH
+ MERGING_IDENTIFIER, PORTAGE_PACKAGE_ATOM, PRIVATE_PATH, VDB_PATH
from portage.dbapi import dbapi
from portage.exception import CommandNotFound, \
InvalidData, InvalidLocation, InvalidPackageName, \
@@ -104,7 +104,7 @@ class vardbapi(dbapi):
_excluded_dirs = ["CVS", "lost+found"]
_excluded_dirs = [re.escape(x) for x in _excluded_dirs]
- _excluded_dirs = re.compile(r'^(\..*|-MERGING-.*|' + \
+ _excluded_dirs = re.compile(r'^(\..*|' + MERGING_IDENTIFIER + '.*|' + \
"|".join(_excluded_dirs) + r')$')
_aux_cache_version = "1"
@@ -446,7 +446,7 @@ class vardbapi(dbapi):
if self._excluded_dirs.match(y) is not None:
continue
subpath = x + "/" + y
- # -MERGING- should never be a cpv, nor should files.
+ # MERGING_IDENTIFIER should never be a cpv, nor should files.
try:
if catpkgsplit(subpath) is None:
self.invalidentry(self.getpath(subpath))
@@ -1504,7 +1504,7 @@ class dblink(object):
self.dbroot = normalize_path(os.path.join(self._eroot, VDB_PATH))
self.dbcatdir = self.dbroot+"/"+cat
self.dbpkgdir = self.dbcatdir+"/"+pkg
- self.dbtmpdir = self.dbcatdir+"/-MERGING-"+pkg
+ self.dbtmpdir = self.dbcatdir+MERGING_IDENTIFIER+pkg
self.dbdir = self.dbpkgdir
self.settings = mysettings
self._verbose = self.settings.get("PORTAGE_VERBOSE") == "1"
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/
@ 2014-08-04 21:41 Arfrever Frehtes Taifersar Arahesis
0 siblings, 0 replies; 11+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2014-08-04 21:41 UTC (permalink / raw
To: gentoo-commits
commit: 3e4b7a5128689697e87416293d9c45d4fa2fbf76
Author: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Mon Aug 4 21:40:44 2014 +0000
Commit: Arfrever Frehtes Taifersar Arahesis <arfrever <AT> apache <DOT> org>
CommitDate: Mon Aug 4 21:40:44 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3e4b7a51
Follow-up to commit 96ded9cff423d773ee31a696a691dd6610c315b7: Restore "/" characters.
---
pym/portage/const.py | 2 +-
pym/portage/dbapi/__init__.py | 4 ++--
pym/portage/dbapi/vartree.py | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/pym/portage/const.py b/pym/portage/const.py
index 50f0719..aab6e8a 100644
--- a/pym/portage/const.py
+++ b/pym/portage/const.py
@@ -1,5 +1,5 @@
# portage: Constants
-# Copyright 1998-2013 Gentoo Foundation
+# Copyright 1998-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import unicode_literals
diff --git a/pym/portage/dbapi/__init__.py b/pym/portage/dbapi/__init__.py
index 6638352..34dfaa7 100644
--- a/pym/portage/dbapi/__init__.py
+++ b/pym/portage/dbapi/__init__.py
@@ -1,4 +1,4 @@
-# Copyright 1998-2013 Gentoo Foundation
+# Copyright 1998-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import unicode_literals
@@ -280,7 +280,7 @@ class dbapi(object):
return True
def invalidentry(self, mypath):
- if MERGING_IDENTIFIER in mypath:
+ if "/" + MERGING_IDENTIFIER in mypath:
if os.path.exists(mypath):
writemsg(colorize("BAD", _("INCOMPLETE MERGE:"))+" %s\n" % mypath,
noiselevel=-1)
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 1984a66..2086d4c 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -446,7 +446,7 @@ class vardbapi(dbapi):
if self._excluded_dirs.match(y) is not None:
continue
subpath = x + "/" + y
- # MERGING_IDENTIFIER should never be a cpv, nor should files.
+ # -MERGING- should never be a cpv, nor should files.
try:
if catpkgsplit(subpath) is None:
self.invalidentry(self.getpath(subpath))
@@ -1504,7 +1504,7 @@ class dblink(object):
self.dbroot = normalize_path(os.path.join(self._eroot, VDB_PATH))
self.dbcatdir = self.dbroot+"/"+cat
self.dbpkgdir = self.dbcatdir+"/"+pkg
- self.dbtmpdir = self.dbcatdir+MERGING_IDENTIFIER+pkg
+ self.dbtmpdir = self.dbcatdir+"/"+MERGING_IDENTIFIER+pkg
self.dbdir = self.dbpkgdir
self.settings = mysettings
self._verbose = self.settings.get("PORTAGE_VERBOSE") == "1"
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/
@ 2014-08-19 7:01 Michał Górny
0 siblings, 0 replies; 11+ messages in thread
From: Michał Górny @ 2014-08-19 7:01 UTC (permalink / raw
To: gentoo-commits
commit: 96ded9cff423d773ee31a696a691dd6610c315b7
Author: Pavel Kazakov <nullishzero <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 3 21:38:45 2014 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Aug 3 21:38:45 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=96ded9cf
Move -MERGING- string to a constant.
Remove extra whitespace.
---
pym/portage/const.py | 1 +
pym/portage/dbapi/__init__.py | 4 +++-
pym/portage/dbapi/vartree.py | 8 ++++----
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/pym/portage/const.py b/pym/portage/const.py
index 1785bff..50f0719 100644
--- a/pym/portage/const.py
+++ b/pym/portage/const.py
@@ -74,6 +74,7 @@ MOVE_BINARY = "/bin/mv"
PRELINK_BINARY = "/usr/sbin/prelink"
INVALID_ENV_FILE = "/etc/spork/is/not/valid/profile.env"
+MERGING_IDENTIFIER = "-MERGING-"
REPO_NAME_FILE = "repo_name"
REPO_NAME_LOC = "profiles" + "/" + REPO_NAME_FILE
diff --git a/pym/portage/dbapi/__init__.py b/pym/portage/dbapi/__init__.py
index a20a1e8..6638352 100644
--- a/pym/portage/dbapi/__init__.py
+++ b/pym/portage/dbapi/__init__.py
@@ -16,6 +16,8 @@ portage.proxy.lazyimport.lazyimport(globals(),
'portage.versions:catsplit,catpkgsplit,vercmp,_pkg_str',
)
+from portage.const import MERGING_IDENTIFIER
+
from portage import os
from portage import auxdbkeys
from portage.eapi import _get_eapi_attrs
@@ -278,7 +280,7 @@ class dbapi(object):
return True
def invalidentry(self, mypath):
- if '/-MERGING-' in mypath:
+ if MERGING_IDENTIFIER in mypath:
if os.path.exists(mypath):
writemsg(colorize("BAD", _("INCOMPLETE MERGE:"))+" %s\n" % mypath,
noiselevel=-1)
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 4a27092..1984a66 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -45,7 +45,7 @@ portage.proxy.lazyimport.lazyimport(globals(),
)
from portage.const import CACHE_PATH, CONFIG_MEMORY_FILE, \
- PORTAGE_PACKAGE_ATOM, PRIVATE_PATH, VDB_PATH
+ MERGING_IDENTIFIER, PORTAGE_PACKAGE_ATOM, PRIVATE_PATH, VDB_PATH
from portage.dbapi import dbapi
from portage.exception import CommandNotFound, \
InvalidData, InvalidLocation, InvalidPackageName, \
@@ -104,7 +104,7 @@ class vardbapi(dbapi):
_excluded_dirs = ["CVS", "lost+found"]
_excluded_dirs = [re.escape(x) for x in _excluded_dirs]
- _excluded_dirs = re.compile(r'^(\..*|-MERGING-.*|' + \
+ _excluded_dirs = re.compile(r'^(\..*|' + MERGING_IDENTIFIER + '.*|' + \
"|".join(_excluded_dirs) + r')$')
_aux_cache_version = "1"
@@ -446,7 +446,7 @@ class vardbapi(dbapi):
if self._excluded_dirs.match(y) is not None:
continue
subpath = x + "/" + y
- # -MERGING- should never be a cpv, nor should files.
+ # MERGING_IDENTIFIER should never be a cpv, nor should files.
try:
if catpkgsplit(subpath) is None:
self.invalidentry(self.getpath(subpath))
@@ -1504,7 +1504,7 @@ class dblink(object):
self.dbroot = normalize_path(os.path.join(self._eroot, VDB_PATH))
self.dbcatdir = self.dbroot+"/"+cat
self.dbpkgdir = self.dbcatdir+"/"+pkg
- self.dbtmpdir = self.dbcatdir+"/-MERGING-"+pkg
+ self.dbtmpdir = self.dbcatdir+MERGING_IDENTIFIER+pkg
self.dbdir = self.dbpkgdir
self.settings = mysettings
self._verbose = self.settings.get("PORTAGE_VERBOSE") == "1"
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/
@ 2014-08-19 7:01 Michał Górny
0 siblings, 0 replies; 11+ messages in thread
From: Michał Górny @ 2014-08-19 7:01 UTC (permalink / raw
To: gentoo-commits
commit: 3e4b7a5128689697e87416293d9c45d4fa2fbf76
Author: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Mon Aug 4 21:40:44 2014 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Aug 4 21:40:44 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3e4b7a51
Follow-up to commit 96ded9cff423d773ee31a696a691dd6610c315b7: Restore "/" characters.
---
pym/portage/const.py | 2 +-
pym/portage/dbapi/__init__.py | 4 ++--
pym/portage/dbapi/vartree.py | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/pym/portage/const.py b/pym/portage/const.py
index 50f0719..aab6e8a 100644
--- a/pym/portage/const.py
+++ b/pym/portage/const.py
@@ -1,5 +1,5 @@
# portage: Constants
-# Copyright 1998-2013 Gentoo Foundation
+# Copyright 1998-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import unicode_literals
diff --git a/pym/portage/dbapi/__init__.py b/pym/portage/dbapi/__init__.py
index 6638352..34dfaa7 100644
--- a/pym/portage/dbapi/__init__.py
+++ b/pym/portage/dbapi/__init__.py
@@ -1,4 +1,4 @@
-# Copyright 1998-2013 Gentoo Foundation
+# Copyright 1998-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import unicode_literals
@@ -280,7 +280,7 @@ class dbapi(object):
return True
def invalidentry(self, mypath):
- if MERGING_IDENTIFIER in mypath:
+ if "/" + MERGING_IDENTIFIER in mypath:
if os.path.exists(mypath):
writemsg(colorize("BAD", _("INCOMPLETE MERGE:"))+" %s\n" % mypath,
noiselevel=-1)
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 1984a66..2086d4c 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -446,7 +446,7 @@ class vardbapi(dbapi):
if self._excluded_dirs.match(y) is not None:
continue
subpath = x + "/" + y
- # MERGING_IDENTIFIER should never be a cpv, nor should files.
+ # -MERGING- should never be a cpv, nor should files.
try:
if catpkgsplit(subpath) is None:
self.invalidentry(self.getpath(subpath))
@@ -1504,7 +1504,7 @@ class dblink(object):
self.dbroot = normalize_path(os.path.join(self._eroot, VDB_PATH))
self.dbcatdir = self.dbroot+"/"+cat
self.dbpkgdir = self.dbcatdir+"/"+pkg
- self.dbtmpdir = self.dbcatdir+MERGING_IDENTIFIER+pkg
+ self.dbtmpdir = self.dbcatdir+"/"+MERGING_IDENTIFIER+pkg
self.dbdir = self.dbpkgdir
self.settings = mysettings
self._verbose = self.settings.get("PORTAGE_VERBOSE") == "1"
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/
@ 2016-12-28 0:01 Zac Medico
0 siblings, 0 replies; 11+ messages in thread
From: Zac Medico @ 2016-12-28 0:01 UTC (permalink / raw
To: gentoo-commits
commit: 67109fe41df07c9fa0e588b81f37ff61a71470f6
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 27 20:29:11 2016 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Dec 27 23:49:11 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=67109fe4
binarytree._read_metadata: return empty strings for undefined values (bug 603826)
Fix the binarytree._read_metadata method to return empty strings for
undefined metadata values, in order to fulfill a contract with the
_pkg_str class. This prevents an AttributeError triggered by old
binary packages which have undefined repository metadata, as reported
in bug 603826.
X-Gentoo-bug: 603826
X-Gentoo-bug-url: https://bugs.gentoo.org/603826
Acked-by: Brian Dolbec <dolsen <AT> gentoo.org>
pym/portage/dbapi/bintree.py | 33 ++++++++++++++++++++++++++-------
pym/portage/versions.py | 8 +++++++-
2 files changed, 33 insertions(+), 8 deletions(-)
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
index f483059..ae9e7ca 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -1,4 +1,4 @@
-# Copyright 1998-2014 Gentoo Foundation
+# Copyright 1998-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import unicode_literals
@@ -743,7 +743,7 @@ class binarytree(object):
for k in self._pkgindex_allowed_pkg_keys:
v = pkg_metadata.get(k)
- if v is not None:
+ if v:
d[k] = v
d["CPV"] = mycpv
@@ -1041,12 +1041,12 @@ class binarytree(object):
noiselevel=-1)
return
metadata = self._read_metadata(full_path, s)
- slot = metadata.get("SLOT")
+ invalid_depend = False
try:
self._eval_use_flags(cpv, metadata)
except portage.exception.InvalidDependString:
- slot = None
- if slot is None:
+ invalid_depend = True
+ if invalid_depend or not metadata.get("SLOT"):
writemsg(_("!!! Invalid binary package: '%s'\n") % full_path,
noiselevel=-1)
return
@@ -1126,6 +1126,21 @@ class binarytree(object):
return cpv
def _read_metadata(self, filename, st, keys=None):
+ """
+ Read metadata from a binary package. The returned metadata
+ dictionary will contain empty strings for any values that
+ are undefined (this is important because the _pkg_str class
+ distinguishes between missing and undefined values).
+
+ @param filename: File path of the binary package
+ @type filename: string
+ @param st: stat result for the binary package
+ @type st: os.stat_result
+ @param keys: optional list of specific metadata keys to retrieve
+ @type keys: iterable
+ @rtype: dict
+ @return: package metadata
+ """
if keys is None:
keys = self.dbapi._aux_cache_keys
metadata = self.dbapi._aux_cache_slot_dict()
@@ -1139,10 +1154,14 @@ class binarytree(object):
metadata[k] = _unicode(st.st_size)
else:
v = binary_metadata.get(_unicode_encode(k))
- if v is not None:
+ if v is None:
+ if k == "EAPI":
+ metadata[k] = "0"
+ else:
+ metadata[k] = ""
+ else:
v = _unicode_decode(v)
metadata[k] = " ".join(v.split())
- metadata.setdefault("EAPI", "0")
return metadata
def _inject_file(self, pkgindex, cpv, filename):
diff --git a/pym/portage/versions.py b/pym/portage/versions.py
index a028d93..adfb1c3 100644
--- a/pym/portage/versions.py
+++ b/pym/portage/versions.py
@@ -1,5 +1,5 @@
# versions.py -- core Portage functionality
-# Copyright 1998-2014 Gentoo Foundation
+# Copyright 1998-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import unicode_literals
@@ -359,6 +359,12 @@ class _pkg_str(_unicode):
Instances are typically created in dbapi.cp_list() or the Atom contructor,
and propagate from there. Generally, code that pickles these objects will
manually convert them to a plain unicode object first.
+
+ Instances of this class will have missing attributes for metadata that
+ has not been passed into the constructor. The missing attributes are
+ used to distinguish missing metadata values from undefined metadata values.
+ For example, the repo attribute will be missing if the 'repository' key
+ is missing from the metadata dictionary.
"""
def __new__(cls, cpv, metadata=None, settings=None, eapi=None,
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/
@ 2018-05-17 18:40 Zac Medico
0 siblings, 0 replies; 11+ messages in thread
From: Zac Medico @ 2018-05-17 18:40 UTC (permalink / raw
To: gentoo-commits
commit: b2a5f03abc0c172b6189226e6f9a7491a002cf51
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu May 17 18:38:27 2018 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 17 18:38:27 2018 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=b2a5f03a
MergeProcess,spawn: unregister SIGCHLD and wakeup_fd (bug 655656)
In order to prevent forked processes from invoking the parent process's
SIGCHLD handler and writing to wakeup_fd (triggering BlockingIOError),
unregister the SIGCHLD and wakeup_fd.
Bug: https://bugs.gentoo.org/655656
Reported-by: Helmut Jarausch <jarausch <AT> igpm.rwth-aachen.de>
pym/portage/dbapi/_MergeProcess.py | 10 ++++++++++
pym/portage/process.py | 10 ++++++++++
2 files changed, 20 insertions(+)
diff --git a/pym/portage/dbapi/_MergeProcess.py b/pym/portage/dbapi/_MergeProcess.py
index fefdf8635..371550079 100644
--- a/pym/portage/dbapi/_MergeProcess.py
+++ b/pym/portage/dbapi/_MergeProcess.py
@@ -178,6 +178,16 @@ class MergeProcess(ForkProcess):
signal.signal(signal.SIGINT, signal.SIG_DFL)
signal.signal(signal.SIGTERM, signal.SIG_DFL)
+ # Unregister SIGCHLD handler and wakeup_fd for the parent
+ # process's event loop (bug 655656).
+ signal.signal(signal.SIGCHLD, signal.SIG_DFL)
+ try:
+ wakeup_fd = signal.set_wakeup_fd(-1)
+ if wakeup_fd > 0:
+ os.close(wakeup_fd)
+ except (ValueError, OSError):
+ pass
+
portage.locks._close_fds()
# We don't exec, so use close_fds=False
# (see _setup_pipes docstring).
diff --git a/pym/portage/process.py b/pym/portage/process.py
index 2af783e22..fd326731a 100644
--- a/pym/portage/process.py
+++ b/pym/portage/process.py
@@ -472,6 +472,16 @@ def _exec(binary, mycommand, opt_name, fd_pipes, env, gid, groups, uid, umask,
signal.signal(signal.SIGINT, signal.SIG_DFL)
signal.signal(signal.SIGTERM, signal.SIG_DFL)
+ # Unregister SIGCHLD handler and wakeup_fd for the parent
+ # process's event loop (bug 655656).
+ signal.signal(signal.SIGCHLD, signal.SIG_DFL)
+ try:
+ wakeup_fd = signal.set_wakeup_fd(-1)
+ if wakeup_fd > 0:
+ os.close(wakeup_fd)
+ except (ValueError, OSError):
+ pass
+
# Quiet killing of subprocesses by SIGPIPE (see bug #309001).
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
^ permalink raw reply related [flat|nested] 11+ messages in thread
end of thread, other threads:[~2018-05-17 18:40 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-14 4:02 [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/ Zac Medico
-- strict thread matches above, loose matches on Subject: below --
2011-03-27 20:57 Zac Medico
2011-05-05 15:13 Zac Medico
2011-09-06 18:35 Zac Medico
2011-10-16 21:13 Zac Medico
2014-08-03 21:53 Pavel Kazakov
2014-08-04 21:41 Arfrever Frehtes Taifersar Arahesis
2014-08-19 7:01 Michał Górny
2014-08-19 7:01 Michał Górny
2016-12-28 0:01 Zac Medico
2018-05-17 18:40 Zac Medico
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox