[gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/

2018-05-17 Thread Zac Medico
commit: b2a5f03abc0c172b6189226e6f9a7491a002cf51
Author: Zac Medico  gentoo  org>
AuthorDate: Thu May 17 18:38:27 2018 +
Commit: Zac Medico  gentoo  org>
CommitDate: Thu May 17 18:38:27 2018 +
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  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)
 



[gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/emaint/modules/binhost/

2017-11-21 Thread Zac Medico
commit: 694419fc11af6cbda4944b21632acec9c641d1c3
Author: Zac Medico  gentoo  org>
AuthorDate: Tue Nov 21 18:37:33 2017 +
Commit: Zac Medico  gentoo  org>
CommitDate: Tue Nov 21 18:47:29 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=694419fc

emaint binhost: use _populate_local instead of _populate (bug 638320)

Fixes: 8267445cf2f8 ("binarytree.populate: avoid lock when possible (bug 
607872)")
Bug: https://bugs.gentoo.org/638320

 pym/portage/dbapi/bintree.py  | 2 +-
 pym/portage/emaint/modules/binhost/binhost.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
index ffac8d216..f4e8a1c66 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -532,7 +532,6 @@ class binarytree(object):
# prior to performing package moves since it only wants to
# operate on local packages (getbinpkgs=0).
self._remotepkgs = None
-   self.dbapi.clear()
 
self._populating = True
try:
@@ -568,6 +567,7 @@ class binarytree(object):
self.populated = True
 
def _populate_local(self):
+   self.dbapi.clear()
_instance_key = self.dbapi._instance_key
if True:
pkg_paths = {}

diff --git a/pym/portage/emaint/modules/binhost/binhost.py 
b/pym/portage/emaint/modules/binhost/binhost.py
index ebcc9054f..f18878c7c 100644
--- a/pym/portage/emaint/modules/binhost/binhost.py
+++ b/pym/portage/emaint/modules/binhost/binhost.py
@@ -123,7 +123,7 @@ class BinhostHandler(object):
self._pkgindex_file, wantnewlockfile=1)
try:
# Repopulate with lock held.
-   bintree._populate()
+   bintree._populate_local()
cpv_all = self._bintree.dbapi.cpv_all()
cpv_all.sort()
 



[gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/

2016-12-27 Thread Zac Medico
commit: 67109fe41df07c9fa0e588b81f37ff61a71470f6
Author: Zac Medico  gentoo  org>
AuthorDate: Tue Dec 27 20:29:11 2016 +
Commit: Zac Medico  gentoo  org>
CommitDate: Tue Dec 27 23:49:11 2016 +
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  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, 

[gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/repository/, pym/_emerge/, man/, ...

2015-12-09 Thread Arfrever Frehtes Taifersar Arahesis
commit: 78539500809043bba57d9f93ff379c2695c85359
Author: Arfrever Frehtes Taifersar Arahesis  Apache  Org>
AuthorDate: Wed Dec  9 11:54:45 2015 +
Commit: Arfrever Frehtes Taifersar Arahesis  apache  org>
CommitDate: Wed Dec  9 11:54:45 2015 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=78539500

Delete support for PORTDIR and PORTDIR_OVERLAY from make.conf and environment.

(SYNC variable was already not used.)

 man/make.conf.5|  61 +
 pym/_emerge/actions.py |  33 -
 pym/portage/dbapi/porttree.py  |   4 +-
 .../package/ebuild/_config/special_env_vars.py |   1 -
 pym/portage/package/ebuild/config.py   |  43 ++
 pym/portage/repository/config.py   | 149 +
 6 files changed, 24 insertions(+), 267 deletions(-)

diff --git a/man/make.conf.5 b/man/make.conf.5
index 1d1cfeb..f155c8e 100644
--- a/man/make.conf.5
+++ b/man/make.conf.5
@@ -1,4 +1,4 @@
-.TH "MAKE.CONF" "5" "Jan 2015" "Portage VERSION" "Portage"
+.TH "MAKE.CONF" "5" "Dec 2015" "Portage VERSION" "Portage"
 .SH "NAME"
 make.conf \- custom settings for Portage
 .SH "SYNOPSIS"
@@ -195,9 +195,8 @@ like to selectively prune obsolete files from this 
directory, see
 Use the \fBPORTAGE_RO_DISTDIRS\fR variable to specify one or
 more read-only directories containing distfiles.
 
-Note
-that locations under /usr/portage are not necessarily safe for data storage.
-See the \fBPORTDIR\fR documentation for more information.
+Note that locations under locations of repositories are not necessarily safe
+for data storage.
 .br
 Defaults to /usr/portage/distfiles.
 .TP
@@ -773,8 +772,8 @@ to it's category. However, for backward compatibility with 
the layout
 used by older versions of portage, if the \fI${PKGDIR}/All\fR directory
 exists then all packages will be stored inside of it and symlinks to
 the packages will be created in the category subdirectories. Note
-that locations under /usr/portage are not necessarily safe for data storage.
-See the \fBPORTDIR\fR documentation for more information.
+that locations under locations of repositories are not necessarily safe
+for data storage.
 .br
 Defaults to /usr/portage/packages.
 .TP
@@ -1001,30 +1000,6 @@ when \fBxattr\fR is in \fBFEATURES\fR.
 .br
 Defaults to "security.*" (security labels are special, see bug #461868).
 .TP
-\fBPORTDIR\fR = \fI[path]\fR
-Defines the location of main repository. This variable is deprecated in favor 
of
-settings in \fBrepos.conf\fR. If you change this, you must update
-your /etc/portage/make.profile symlink accordingly.
-.br
-Defaults to /usr/portage.
-.br
-\fB***Warning***\fR
-.br
-Data stored inside \fBPORTDIR\fR is in peril of being overwritten or deleted by
-the emerge \-\-sync command. The default value of
-\fBPORTAGE_RSYNC_OPTS\fR will protect the default locations of
-\fBDISTDIR\fR and \fBPKGDIR\fR, but users are warned that any other locations
-inside \fBPORTDIR\fR are not necessarily safe for data storage.  You should not
-put other data (such as overlays) in your \fBPORTDIR\fB.  Portage will walk
-directory structures and may arbitrarily add invalid categories as packages.
-.TP
-\fBPORTDIR_OVERLAY\fR = \fI"[path] [different\-path] [etc...]"\fR
-Defines the locations of other repositories. This variable is deprecated in
-favor of settings in \fBrepos.conf\fR. This variable is a space\-delimited 
list of
-directories.
-.br
-Defaults to no value.
-.TP
 \fBQA_STRICT_EXECSTACK = \fI"set"\fR
 Set this to cause portage to ignore any \fIQA_EXECSTACK\fR override
 settings from ebuilds.  See also \fBebuild\fR(5).
@@ -1072,32 +1047,6 @@ Defines the location where created RPM packages will be 
stored.
 .br
 Defaults to /usr/portage/rpm.
 .TP
-\fBSYNC\fR = \fI[RSYNC]\fR
-Insert your preferred rsync mirror here.  This rsync server
-is used to sync the local portage tree when `emerge \-\-sync` is run.
-
-Note that the \fBSYNC\fR variable is now deprecated, and instead the
-sync\-type and sync\-uri attributes in repos.conf should be used. See
-\fBportage\fR(5) for more information.
-
-Defaults to rsync://rsync.gentoo.org/gentoo\-portage
-.RS
-.TP
-.B Usage:
-(rsync|ssh)://[username@]hostname[:port]/(module|path)
-.TP
-.B Examples:
-rsync://private\-mirror.com/portage\-module
-.br
-rsync://rsync\-user@private\-mirror.com:873/gentoo\-portage
-.br
-ssh://ssh\-user@192.168.0.1:22/usr/portage
-.br
-ssh://ssh\-user@192.168.0.1:22/\\${HOME}/portage\-storage
-.TP
-Note: For the ssh:// scheme, key\-based authentication might be of interest.
-.RE
-.TP
 \fBUNINSTALL_IGNORE\fR = \fI[space delimited list of fnmatch patterns]\fR
 This variable prevents uninstallation of files that match
 specific \fBfnmatch\fR(3) patterns. In order to ignore file

diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index a080ba4..da7d90f 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -2693,38 +2693,6 

[gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/repository/, pym/portage/tests/sync/, ...

2015-12-09 Thread Michał Górny
commit: 367ab0c2e5c2cf06b142979dbd97ad6a79dbf69a
Author: Michał Górny  gentoo  org>
AuthorDate: Wed Dec  9 17:10:09 2015 +
Commit: Michał Górny  gentoo  org>
CommitDate: Wed Dec  9 17:13:51 2015 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=367ab0c2

Revert unreviewed and breaking changes done by Arfrever

Reverts: e7d95cb ("Support location with trailing whitespace [...]")
Reverts: 7853950 ("Delete support for PORTDIR and PORTDIR_OVERLAY [...]")
Reverts: 31923f4 ("Skip some warnings for Portage Python [...]")

 bin/ebuild |   2 +-
 bin/isolated-functions.sh  |  20 +--
 man/make.conf.5|  61 +++-
 man/portage.5  |   1 -
 pym/_emerge/actions.py |  33 +
 pym/portage/dbapi/porttree.py  |   4 +-
 .../package/ebuild/_config/special_env_vars.py |   1 +
 pym/portage/package/ebuild/config.py   |  46 --
 pym/portage/repository/config.py   | 163 +++--
 pym/portage/tests/dbapi/test_fakedbapi.py  |   2 +-
 pym/portage/tests/resolver/ResolverPlayground.py   |   2 +-
 pym/portage/tests/sync/test_sync_local.py  |   2 +-
 pym/repoman/repos.py   |   2 +-
 13 files changed, 284 insertions(+), 55 deletions(-)

diff --git a/bin/ebuild b/bin/ebuild
index a696adf..1afad25 100755
--- a/bin/ebuild
+++ b/bin/ebuild
@@ -158,7 +158,7 @@ if repo_location != vdb_path:
print("Appending repository '%s' located in '%s' to 
configuration of repositories" % (repo_name, repo_location))
tmp_conf_file = io.StringIO(textwrap.dedent("""
[%s]
-   location = "%s"
+   location = %s
""" % (repo_name, repo_location)))
repositories = 
portage.repository.config.load_repository_config(portage.settings, 
extra_files=[tmp_conf_file])
os.environ["PORTAGE_REPOSITORIES"] = 
repositories.config_string()

diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index a55d4a3..5766921 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH}/eapi.sh" || exit 1
@@ -473,23 +473,17 @@ has() {
 }
 
 __repo_attr() {
-   local appropriate_section=0 attribute=$2 exit_status=1 line 
repo_name=$1 saved_extglob_shopt=$(shopt -p extglob) value
+   local appropriate_section=0 exit_status=1 line 
saved_extglob_shopt=$(shopt -p extglob)
shopt -s extglob
while read line; do
-   [[ ${appropriate_section} == 0 && ${line} == "[${repo_name}]" 
]] && appropriate_section=1 && continue
+   [[ ${appropriate_section} == 0 && ${line} == "[$1]" ]] && 
appropriate_section=1 && continue
[[ ${appropriate_section} == 1 && ${line} == "["*"]" ]] && 
appropriate_section=0 && continue
-   # If a conditional expression like [[ ${line} == ${attribute}*( 
)=* ]] is used
-   # then bash <4.1 produces an error like the following when the 
file is
+   # If a conditional expression like [[ ${line} == $2*( )=* ]] is 
used
+   # then bash-3.2 produces an error like the following when the 
file is
# sourced: syntax error in conditional expression: unexpected 
token `('
# Therefore, use a regular expression for compatibility.
-   if [[ ${appropriate_section} == 1 && ${line} =~ 
^${attribute}[[:space:]]*= ]]; then
-   value="${line##${attribute}*( )=*( )}"
-   if [[ ${attribute} =~ ^(location)$ && (${value} == 
"'"*"'" || ${value} == '"'*'"') ]]; then
-   # bash >=4.2:
-   # value=${value:1:-1}
-   value=${value:1:$((${#value} - 2))}
-   fi
-   echo "${value}"
+   if [[ ${appropriate_section} == 1 && ${line} =~ 
^${2}[[:space:]]*= ]]; then
+   echo "${line##$2*( )=*( )}"
exit_status=0
break
fi

diff --git a/man/make.conf.5 b/man/make.conf.5
index f155c8e..1d1cfeb 100644
--- a/man/make.conf.5
+++ b/man/make.conf.5
@@ -1,4 +1,4 @@
-.TH "MAKE.CONF" "5" "Dec 2015" "Portage VERSION" "Portage"
+.TH "MAKE.CONF" "5" "Jan 2015" "Portage VERSION" "Portage"
 .SH "NAME"
 make.conf \- custom settings for Portage
 .SH "SYNOPSIS"
@@ -195,8 +195,9 @@ like to selectively prune obsolete files from this 
directory, see
 Use the \fBPORTAGE_RO_DISTDIRS\fR variable to specify one or
 more read-only directories 

[gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/util/, pym/portage/tests/util/, bin/

2015-09-03 Thread Mike Frysinger
commit: 717fc43b3b1daa021eca606bbaa59dea5f456163
Author: Mike Frysinger  gentoo  org>
AuthorDate: Wed Oct 16 20:48:58 2013 +
Commit: Mike Frysinger  gentoo  org>
CommitDate: Thu Sep  3 17:41:46 2015 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=717fc43b

xattr: centralize the various shims in one place

Rather than each module implementing its own shim around the various
methods for accessing extended attributes, start a dedicated module
that exports a consistent API.

 bin/quickpkg |  12 +-
 bin/xattr-helper.py  |  11 +-
 pym/portage/dbapi/vartree.py |  10 +-
 pym/portage/tests/util/test_xattr.py | 178 +++
 pym/portage/util/_xattr.py   | 228 +++
 pym/portage/util/movefile.py | 100 ---
 pym/portage/util/xattr.py|  20 ---
 7 files changed, 441 insertions(+), 118 deletions(-)

diff --git a/bin/quickpkg b/bin/quickpkg
index 726abff..262fda4 100755
--- a/bin/quickpkg
+++ b/bin/quickpkg
@@ -21,8 +21,8 @@ from portage.dbapi.dep_expand import dep_expand
 from portage.dep import Atom, use_reduce
 from portage.exception import (AmbiguousPackageName, InvalidAtom, InvalidData,
InvalidDependString, PackageSetNotFound, PermissionDenied)
-from portage.util import ConfigProtect, ensure_dirs, shlex_split
-import portage.util.xattr as _xattr
+from portage.util import ConfigProtect, ensure_dirs, shlex_split, _xattr
+xattr = _xattr.xattr
 from portage.dbapi.vartree import dblink, tar_contents
 from portage.checksum import perform_md5
 from portage._sets import load_default_config, SETPREFIX
@@ -36,7 +36,7 @@ def quickpkg_atom(options, infos, arg, eout):
vartree = trees["vartree"]
vardb = vartree.dbapi
bintree = trees["bintree"]
-   xattr = 'xattr' in settings.features
+   xattrs = 'xattr' in settings.features
 
include_config = options.include_config == "y"
include_unmodified_config = options.include_unmodified_config == "y"
@@ -137,8 +137,8 @@ def quickpkg_atom(options, infos, arg, eout):
# The tarfile module will write pax headers holding the
# xattrs only if PAX_FORMAT is specified here.
tar = tarfile.open(binpkg_tmpfile, "w:bz2",
-   format=tarfile.PAX_FORMAT if xattr else 
tarfile.DEFAULT_FORMAT)
-   tar_contents(contents, root, tar, protect=protect, 
xattr=xattr)
+   format=tarfile.PAX_FORMAT if xattrs else 
tarfile.DEFAULT_FORMAT)
+   tar_contents(contents, root, tar, protect=protect, 
xattrs=xattrs)
tar.close()
xpak.tbz2(binpkg_tmpfile).recompose_mem(xpdata)
finally:
@@ -238,7 +238,7 @@ def quickpkg_main(options, args, eout):
eout.eerror("No write access to '%s'" % bintree.pkgdir)
return errno.EACCES
 
-   if 'xattr' in portage.settings.features and not hasattr(_xattr, 
'getxattr'):
+   if 'xattr' in portage.settings.features and not _xattr.XATTRS_WORKS:
eout.eerror("No xattr support library was found, "
"so xattrs will not be preserved!")
portage.settings.unlock()

diff --git a/bin/xattr-helper.py b/bin/xattr-helper.py
index 3e9b81e..19f25f9 100755
--- a/bin/xattr-helper.py
+++ b/bin/xattr-helper.py
@@ -19,16 +19,7 @@ import re
 import sys
 
 from portage.util._argparse import ArgumentParser
-
-if hasattr(os, "getxattr"):
-
-   class xattr(object):
-   get = os.getxattr
-   set = os.setxattr
-   list = os.listxattr
-
-else:
-   import xattr
+from portage.util._xattr import xattr
 
 
 _UNQUOTE_RE = re.compile(br'\\[0-7]{3}')

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 927c645..5ba8d9d 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -35,7 +35,7 @@ portage.proxy.lazyimport.lazyimport(globals(),
'portage.util.movefile:movefile',
'portage.util.path:first_existing,iter_parents',
'portage.util.writeable_check:get_ro_checker',
-   'portage.util:xattr@_xattr',
+   'portage.util._xattr:xattr',
'portage.util._dyn_libs.PreservedLibsRegistry:PreservedLibsRegistry',
'portage.util._dyn_libs.LinkageMapELF:LinkageMapELF@LinkageMap',
'portage.util._async.SchedulerInterface:SchedulerInterface',
@@ -5268,7 +5268,7 @@ def write_contents(contents, root, f):
f.write(line)
 
 def tar_contents(contents, root, tar, protect=None, onProgress=None,
-   xattr=False):
+   xattrs=False):
os = _os_merge
encoding = _encodings['merge']
 
@@ -5390,13 +5390,13 @@ def tar_contents(contents, root, tar, protect=None, 
onProgress=None,

[gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/util/, bin/

2015-05-26 Thread Zac Medico
commit: 1032cbf4c218741df1c57767fead2d00cc6321d9
Author: Zac Medico zmedico AT gentoo DOT org
AuthorDate: Sat May 23 05:53:26 2015 +
Commit: Zac Medico zmedico AT gentoo DOT org
CommitDate: Tue May 26 19:07:20 2015 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=1032cbf4

quickpkg: support FEATURES=xattr (bug 550006)

The xattrs are preserved in pax headers, in the same way that GNU tar
preserves them.

X-Gentoo-Bug: 550006
X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=550006
Acked-by: Brian Dolbec dolsen AT gentoo.org

 bin/quickpkg | 16 ++--
 pym/portage/dbapi/vartree.py | 18 +++---
 pym/portage/util/xattr.py| 20 
 3 files changed, 49 insertions(+), 5 deletions(-)

diff --git a/bin/quickpkg b/bin/quickpkg
index 8b71c3e..726abff 100755
--- a/bin/quickpkg
+++ b/bin/quickpkg
@@ -22,6 +22,7 @@ from portage.dep import Atom, use_reduce
 from portage.exception import (AmbiguousPackageName, InvalidAtom, InvalidData,
InvalidDependString, PackageSetNotFound, PermissionDenied)
 from portage.util import ConfigProtect, ensure_dirs, shlex_split
+import portage.util.xattr as _xattr
 from portage.dbapi.vartree import dblink, tar_contents
 from portage.checksum import perform_md5
 from portage._sets import load_default_config, SETPREFIX
@@ -35,6 +36,7 @@ def quickpkg_atom(options, infos, arg, eout):
vartree = trees[vartree]
vardb = vartree.dbapi
bintree = trees[bintree]
+   xattr = 'xattr' in settings.features
 
include_config = options.include_config == y
include_unmodified_config = options.include_unmodified_config == y
@@ -132,8 +134,11 @@ def quickpkg_atom(options, infos, arg, eout):
binpkg_tmpfile = os.path.join(bintree.pkgdir,
cpv + .tbz2. + str(os.getpid()))
ensure_dirs(os.path.dirname(binpkg_tmpfile))
-   tar = tarfile.open(binpkg_tmpfile, w:bz2)
-   tar_contents(contents, root, tar, protect=protect)
+   # The tarfile module will write pax headers holding the
+   # xattrs only if PAX_FORMAT is specified here.
+   tar = tarfile.open(binpkg_tmpfile, w:bz2,
+   format=tarfile.PAX_FORMAT if xattr else 
tarfile.DEFAULT_FORMAT)
+   tar_contents(contents, root, tar, protect=protect, 
xattr=xattr)
tar.close()
xpak.tbz2(binpkg_tmpfile).recompose_mem(xpdata)
finally:
@@ -233,6 +238,13 @@ def quickpkg_main(options, args, eout):
eout.eerror(No write access to '%s' % bintree.pkgdir)
return errno.EACCES
 
+   if 'xattr' in portage.settings.features and not hasattr(_xattr, 
'getxattr'):
+   eout.eerror(No xattr support library was found, 
+   so xattrs will not be preserved!)
+   portage.settings.unlock()
+   portage.settings.features.remove('xattr')
+   portage.settings.lock()
+
infos = {}
infos[successes] = []
infos[missing] = []

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index a2fb325..62d880e 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -35,6 +35,7 @@ portage.proxy.lazyimport.lazyimport(globals(),
'portage.util.movefile:movefile',
'portage.util.path:first_existing,iter_parents',
'portage.util.writeable_check:get_ro_checker',
+   'portage.util:xattr@_xattr',
'portage.util._dyn_libs.PreservedLibsRegistry:PreservedLibsRegistry',
'portage.util._dyn_libs.LinkageMapELF:LinkageMapELF@LinkageMap',
'portage.util._async.SchedulerInterface:SchedulerInterface',
@@ -5266,7 +5267,8 @@ def write_contents(contents, root, f):
line = %s %s\n % (entry_type, relative_filename)
f.write(line)
 
-def tar_contents(contents, root, tar, protect=None, onProgress=None):
+def tar_contents(contents, root, tar, protect=None, onProgress=None,
+   xattr=False):
os = _os_merge
encoding = _encodings['merge']
 
@@ -5384,9 +5386,19 @@ def tar_contents(contents, root, tar, protect=None, 
onProgress=None):
tar.addfile(tarinfo, f)
f.close()
else:
-   with open(_unicode_encode(path,
+   path_bytes = _unicode_encode(path,
encoding=encoding,
-   errors='strict'), 'rb') as f:
+   errors='strict')
+
+   if xattr:
+   # Compatible with GNU tar, which saves 
the xattrs
+   

[gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/util/

2015-04-28 Thread Zac Medico
commit: fb421c04f4754b5cdc1101bd5c64d27c00e5ea8d
Author: Zac Medico zmedico AT gentoo DOT org
AuthorDate: Mon Apr 27 02:57:44 2015 +
Commit: Zac Medico zmedico AT gentoo DOT org
CommitDate: Tue Apr 28 23:40:00 2015 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=fb421c04

ro_checker: only check nearest parent (bug 547390)

The ro_checker code added in commit
47ef9a0969474f963dc8e52bfbbb8bc075e8d73c incorrectly asserts that all
parent directories be writable. Fix it to only assert that the nearest
parent directory be writable.

Fixes 47ef9a096947: (Test for read-only filesystems, fixes bug 378869)
X-Gentoo-Bug: 547390
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=547390
Acked-by: Brian Dolbec dolsen AT gentoo.org

 pym/portage/dbapi/vartree.py| 44 +
 pym/portage/util/writeable_check.py | 24 ++--
 2 files changed, 47 insertions(+), 21 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 1c0deab..c59d778 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -33,7 +33,7 @@ portage.proxy.lazyimport.lazyimport(globals(),
'portage.util.env_update:env_update',
'portage.util.listdir:dircache,listdir',
'portage.util.movefile:movefile',
-   'portage.util.path:first_existing',
+   'portage.util.path:first_existing,iter_parents',
'portage.util.writeable_check:get_ro_checker',
'portage.util._dyn_libs.PreservedLibsRegistry:PreservedLibsRegistry',
'portage.util._dyn_libs.LinkageMapELF:LinkageMapELF@LinkageMap',
@@ -3325,6 +3325,8 @@ class dblink(object):
showMessage = self._display_merge
stopmerge = False
collisions = []
+   dirs = set()
+   dirs_ro = set()
symlink_collisions = []
destroot = self.settings['ROOT']
showMessage(_( %s checking %d files for package 
collisions\n) % \
@@ -3337,6 +3339,18 @@ class dblink(object):
 
dest_path = normalize_path(
os.path.join(destroot, 
f.lstrip(os.path.sep)))
+
+   parent = os.path.dirname(dest_path)
+   if parent not in dirs:
+   for x in iter_parents(parent):
+   if x in dirs:
+   break
+   dirs.add(x)
+   if os.path.isdir(x):
+   if not os.access(x, 
os.W_OK):
+   dirs_ro.add(x)
+   break
+
try:
dest_lstat = os.lstat(dest_path)
except EnvironmentError as e:
@@ -3410,7 +3424,7 @@ class dblink(object):
break
if stopmerge:
collisions.append(f)
-   return collisions, symlink_collisions, plib_collisions
+   return collisions, dirs_ro, symlink_collisions, 
plib_collisions
 
def _lstat_inode_map(self, path_iter):

@@ -3759,7 +3773,6 @@ class dblink(object):
eagain_error = False
 
filelist = []
-   dirlist = []
linklist = []
paths_with_newlines = []
def onerror(e):
@@ -3792,13 +3805,6 @@ class dblink(object):

unicode_errors.append(new_parent[ed_len:])
break
 
-   relative_path = parent[srcroot_len:]
-   if len(relative_path) = eprefix_len:
-   # Files are never installed outside of 
the prefix,
-   # therefore we skip the readonly 
filesystem check for
-   # parent directories of the prefix (see 
bug 544624).
-   dirlist.append(os.path.join(destroot, 
relative_path))
-
for fname in files:
try:
fname = _unicode_decode(fname,
@@ -3911,9 +3917,17 @@ class dblink(object):
for other in others_in_slot])
prepare_build_dirs(settings=self.settings, cleanup=cleanup)
 
+   # check for package 

[gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/util/, pym/portage/tests/emerge/

2014-11-02 Thread Zac Medico
commit: 02417188225758b1822d176abd8902a92300a371
Author: Zac Medico zmedico AT gentoo DOT org
AuthorDate: Sun Oct 26 09:52:22 2014 +
Commit: Zac Medico zmedico AT gentoo DOT org
CommitDate: Mon Nov  3 04:17:09 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=02417188

CONFIG_PROTECT: protect symlinks, bug #485598

Users may not want some symlinks to get clobbered, so protect them
with CONFIG_PROTECT. Changes were required in the dblink.mergeme method
and the new_protect_filename function.

The changes to dblink.mergeme do 3 things:

 * Move the bulk of config protection logic from dblink.mergeme to a
   new dblink._protect method. The new method only returns 3 variables,
   which makes it easier to understand how config protection interacts
   with the dblink.mergeme code that uses those variables. This is
   important, since dblink.mergeme has so many variables.

 * Initialize more variables at the beginning of dblink.mergeme, since
   those variables are used by the dblink._protect method.

 * Use the variables returned from dblink._protect to trigger
   appropriate behavior later in dblink.mergeme.

The new_protect_filename changes are required since this function
compares the new file to old ._cfg* files that may already exist, in
order to avoid creating duplicate ._cfg* files. In these comparisons,
it needs to handle symlinks differently from regular files.

The unit tests demonstrate operation in many different scenarios,
including:

 * regular file replaces regular file
 * regular file replaces symlink
 * regular file replaces directory
 * symlink replaces symlink
 * symlink replaces regular file
 * symlink replaces directory
 * directory replaces regular file
 * directory replaces symlink

X-Gentoo-Bug: 485598
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=485598

---
 pym/portage/dbapi/vartree.py| 255 -
 pym/portage/tests/emerge/test_config_protect.py | 292 
 pym/portage/util/__init__.py|  35 ++-
 3 files changed, 463 insertions(+), 119 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index e21135a..8b06f4c 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -4461,21 +4461,17 @@ class dblink(object):
# stat file once, test using S_* macros many times 
(faster that way)
mystat = os.lstat(mysrc)
mymode = mystat[stat.ST_MODE]
-   # handy variables; mydest is the target object on the 
live filesystems;
-   # mysrc is the source object in the temporary install 
dir
-   try:
-   mydstat = os.lstat(mydest)
-   mydmode = mydstat.st_mode
-   except OSError as e:
-   if e.errno != errno.ENOENT:
-   raise
-   del e
-   #dest file doesn't exist
-   mydstat = None
-   mydmode = None
+   mymd5 = None
+   myto = None
 
-   if stat.S_ISLNK(mymode):
-   # we are merging a symbolic link
+   if sys.hexversion = 0x303:
+   mymtime = mystat.st_mtime_ns
+   else:
+   mymtime = mystat[stat.ST_MTIME]
+
+   if stat.S_ISREG(mymode):
+   mymd5 = perform_md5(mysrc, 
calc_prelink=calc_prelink)
+   elif stat.S_ISLNK(mymode):
# The file name of mysrc and the actual file 
that it points to
# will have earlier been forcefully converted 
to the 'merge'
# encoding if necessary, but the content of the 
symbolic link
@@ -4495,6 +4491,69 @@ class dblink(object):
os.unlink(mysrc)
os.symlink(myto, mysrc)
 
+   mymd5 = portage.checksum._new_md5(
+   _unicode_encode(myto)).hexdigest()
+
+   protected = False
+   if stat.S_ISLNK(mymode) or stat.S_ISREG(mymode):
+   protected = self.isprotected(mydest)
+
+   if stat.S_ISREG(mymode) and \
+   mystat.st_size == 0 and \
+   
os.path.basename(mydest).startswith(.keep):
+   protected = False
+
+   destmd5 = None
+   mydest_link = None
+   # handy variables; 

[gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/package/ebuild/, pym/portage/repository/, man/, ...

2014-10-24 Thread Zac Medico
commit: 803dafc462027d6015721f40513abb5f57dc1178
Author: Bertrand SIMONNET bsimonnet AT chromium DOT org
AuthorDate: Tue Sep 30 16:45:36 2014 +
Commit: Zac Medico zmedico AT gentoo DOT org
CommitDate: Fri Oct 24 20:39:10 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=803dafc4

package.bashrc: per profile, per-package bashrc mechanism

Profiles can define per-package bashrc files to be sourced before emerging.
Each line in package.bashrc must be an atom name then a list of space-delimited
bashrc files (stored in $profile/bashrc/).

---
 bin/ebuild.sh  |  6 ++--
 bin/phase-functions.sh |  2 +-
 bin/save-ebuild-env.sh |  2 +-
 man/portage.5  | 30 +++-
 pym/portage/dbapi/vartree.py   | 20 +--
 .../package/ebuild/_config/special_env_vars.py |  4 +--
 pym/portage/package/ebuild/config.py   | 40 ++
 pym/portage/package/ebuild/doebuild.py |  3 +-
 pym/portage/repository/config.py   |  2 +-
 9 files changed, 88 insertions(+), 21 deletions(-)

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 10119ae..658884a 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -373,10 +373,10 @@ __source_all_bashrcs() {
# source the existing profile.bashrcs.
save_IFS
IFS=$'\n'
-   local path_array=($PROFILE_PATHS)
+   local bashenv_files=($PORTAGE_BASHRC_FILES)
restore_IFS
-   for x in ${path_array[@]} ; do
-   [ -f $x/profile.bashrc ]  __qa_source 
$x/profile.bashrc
+   for x in ${bashenv_files[@]} ; do
+   __try_source ${x}
done
fi
 

diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index d292ad3..ee28c27 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -31,7 +31,7 @@ PORTAGE_READONLY_VARS=D EBUILD EBUILD_PHASE 
EBUILD_PHASE_FUNC \
PORTAGE_TMPDIR PORTAGE_UPDATE_ENV PORTAGE_USERNAME \
PORTAGE_VERBOSE PORTAGE_WORKDIR_MODE PORTAGE_XATTR_EXCLUDE \
PORTDIR \
-   PROFILE_PATHS REPLACING_VERSIONS REPLACED_BY_VERSION T WORKDIR \
+   REPLACING_VERSIONS REPLACED_BY_VERSION T WORKDIR \
__PORTAGE_HELPER __PORTAGE_TEST_HARDLINK_LOCKS
 
 PORTAGE_SAVED_READONLY_VARS=A CATEGORY P PF PN PR PV PVR

diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh
index 3930089..775c02c 100644
--- a/bin/save-ebuild-env.sh
+++ b/bin/save-ebuild-env.sh
@@ -97,7 +97,7 @@ __save_ebuild_env() {
GOOD HILITE HOME \
LAST_E_CMD LAST_E_LEN LD_PRELOAD MISC_FUNCTIONS_ARGS MOPREFIX \
NOCOLOR NORMAL PKGDIR PKGUSE PKG_LOGDIR PKG_TMPDIR \
-   PORTAGE_BASHRCS_SOURCED PORTAGE_COMPRESS \
+   PORTAGE_BASHRC_FILES PORTAGE_BASHRCS_SOURCED PORTAGE_COMPRESS \
PORTAGE_COMPRESS_EXCLUDE_SUFFIXES \
PORTAGE_DOHTML_UNWARNED_SKIPPED_EXTENSIONS \
PORTAGE_DOHTML_UNWARNED_SKIPPED_FILES \

diff --git a/man/portage.5 b/man/portage.5
index e399f0f..309e259 100644
--- a/man/portage.5
+++ b/man/portage.5
@@ -24,6 +24,7 @@ make.defaults
 packages
 packages.build
 package.accept_keywords
+package.bashrc
 package.keywords
 package.mask
 package.provided
@@ -358,6 +359,31 @@ a '\-'.
 A list of packages (one per line) that make up a stage1 tarball.  Really only
 useful for stage builders.
 .TP
+.BR package.bashrc
+Per-package bashrc mechanism.  Contains a list of bashrc files to be sourced
+before emerging a given atom.  The bashrc files must be stored in bashrc/, in
+the profile directory.
+
+.I Note:
+.nf
+\- The bashrc files will be sourced after profile.bashrc for the same profile.
+\- profile-formats in metadata/layout.conf must contain profile-bashrcs for 
this
+to be enabled.
+.fi
+
+.I Format:
+.nf
+\- comments begin with # (no inline comments).
+\- one atom per line with space-delimited list of bashrc files.
+.fi
+
+.I Example:
+.nf
+# By setting INSTALL_MASK in bashrc/nostandardconf.conf, we can avoid 
installing
+# the standard configuration and enable another package to install it.
+net-misc/dhcp nostardardconf.conf
+.fi
+.TP
 .BR package.provided
 A list of packages (one per line) that portage should assume have been
 provided.  Useful for porting to non-Linux systems. Basically, it's a
@@ -1047,11 +1073,13 @@ The default setting for repoman's --echangelog option.
 The cache formats supported in the metadata tree.  There is the old pms 
format
 and the newer/faster md5-dict format.  Default is to detect dirs.
 .TP
-.BR profile\-formats  = [pms|portage-1|portage-2]
+.BR profile\-formats  = [pms|portage-1|portage-2|profile-bashrcs]
 Control functionality available to profiles in this repo such as which files
 may be dirs, or the syntax available 

[gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/tests/emerge/

2014-09-20 Thread Zac Medico
commit: f31405557db59f7127a8bbeea52da36172a4b75b
Author: Zac Medico zmedico AT gentoo DOT org
AuthorDate: Fri Sep 19 23:00:43 2014 +
Commit: Zac Medico zmedico AT gentoo DOT org
CommitDate: Sat Sep 20 17:40:45 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f3140555

_quickpkg_dblink: fix bug #523152

This fixes the unmerge-backup and downgrade-backup features to be
compatible with the new setup.py quickpkg install location, while
preserving compatibility for running from a source tree (for unit tests
or developement purposes). If not running from a source tree, then the
PATH variable is used to locate the quickpkg binary.

X-Gentoo-Bug: 523152
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=523152

---
 pym/portage/dbapi/vartree.py| 10 ++
 pym/portage/tests/emerge/test_simple.py | 10 ++
 2 files changed, 20 insertions(+)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 8bc6073..b46ba0b 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -25,6 +25,7 @@ portage.proxy.lazyimport.lazyimport(globals(),
'_merge_unicode_error', '_spawn_phase',
'portage.package.ebuild.prepare_build_dirs:prepare_build_dirs',
'portage.package.ebuild._ipc.QueryCommand:QueryCommand',
+   'portage.process:find_binary',
'portage.util:apply_secpass_permissions,ConfigProtect,ensure_dirs,' + \

'writemsg,writemsg_level,write_atomic,atomic_ofstream,writedict,' + \
'grabdict,normalize_path,new_protect_filename',
@@ -5011,6 +5012,15 @@ class dblink(object):
quickpkg_binary = 
os.path.join(self.settings[PORTAGE_BIN_PATH],
quickpkg)
 
+   if not os.access(quickpkg_binary, os.X_OK):
+   # If not running from the source tree, use PATH.
+   quickpkg_binary = find_binary(quickpkg)
+   if quickpkg_binary is None:
+   self._display_merge(
+   _(%s: command not found) % 
quickpkg,
+   level=logging.ERROR, 
noiselevel=-1)
+   return 127
+
# Let quickpkg inherit the global vartree config's env.
env = dict(self.vartree.settings.items())
env[__PORTAGE_INHERIT_VARDB_LOCK] = 1

diff --git a/pym/portage/tests/emerge/test_simple.py 
b/pym/portage/tests/emerge/test_simple.py
index 9c1b1bf..0bb83ae 100644
--- a/pym/portage/tests/emerge/test_simple.py
+++ b/pym/portage/tests/emerge/test_simple.py
@@ -243,6 +243,12 @@ pkg_preinst() {
emerge_cmd + (--metadata,),
rm_cmd + (-rf, cachedir),
emerge_cmd + (--oneshot, virtual/foo),
+   lambda: self.assertFalse(os.path.exists(
+   os.path.join(pkgdir, virtual, foo-0.tbz2))),
+   ({FEATURES : unmerge-backup},) + \
+   emerge_cmd + (--unmerge, virtual/foo),
+   lambda: self.assertTrue(os.path.exists(
+   os.path.join(pkgdir, virtual, foo-0.tbz2))),
emerge_cmd + (--pretend, dev-libs/A),
ebuild_cmd + (test_ebuild, manifest, clean, 
package, merge),
emerge_cmd + (--pretend, --tree, 
--complete-graph, dev-libs/A),
@@ -395,6 +401,10 @@ move dev-util/git dev-vcs/git
 
for args in test_commands:
 
+   if hasattr(args, '__call__'):
+   args()
+   continue
+
if isinstance(args[0], dict):
local_env = env.copy()
local_env.update(args[0])



[gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/

2014-08-19 Thread Michał Górny
commit: 3e4b7a5128689697e87416293d9c45d4fa2fbf76
Author: Arfrever Frehtes Taifersar Arahesis Arfrever AT Apache DOT Org
AuthorDate: Mon Aug  4 21:40:44 2014 +
Commit: Michał Górny mgorny AT gentoo DOT org
CommitDate: Mon Aug  4 21:40:44 2014 +
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



[gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/

2014-08-19 Thread Michał Górny
commit: 96ded9cff423d773ee31a696a691dd6610c315b7
Author: Pavel Kazakov nullishzero AT gentoo DOT org
AuthorDate: Sun Aug  3 21:38:45 2014 +
Commit: Michał Górny mgorny AT gentoo DOT org
CommitDate: Sun Aug  3 21:38:45 2014 +
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



[gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/

2014-08-04 Thread Arfrever Frehtes Taifersar Arahesis
commit: 3e4b7a5128689697e87416293d9c45d4fa2fbf76
Author: Arfrever Frehtes Taifersar Arahesis Arfrever AT Apache DOT Org
AuthorDate: Mon Aug  4 21:40:44 2014 +
Commit: Arfrever Frehtes Taifersar Arahesis arfrever AT apache DOT org
CommitDate: Mon Aug  4 21:40:44 2014 +
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



[gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/

2014-08-03 Thread Pavel Kazakov
commit: 96ded9cff423d773ee31a696a691dd6610c315b7
Author: Pavel Kazakov nullishzero AT gentoo DOT org
AuthorDate: Sun Aug  3 21:38:45 2014 +
Commit: Pavel Kazakov nullishzero AT gentoo DOT org
CommitDate: Sun Aug  3 21:38:45 2014 +
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