[gentoo-portage-dev] [PATCH] Document bugzilla workflow

2014-01-08 Thread SebastianLuther
From: Sebastian Luther sebastianlut...@gmx.de

---
 DEVELOPING | 28 
 1 file changed, 28 insertions(+)

diff --git a/DEVELOPING b/DEVELOPING
index a2c9ae1..7a97d3d 100644
--- a/DEVELOPING
+++ b/DEVELOPING
@@ -161,6 +161,34 @@ somewhat annoying because the import line needs to be 
modified when functions
 are needed and often unused functions are left in the import line until someone
 comes along with a linter to clean up (does not happen often).
 
+Bugzilla
+
+
+There always exists a tracker bug, named:
+[Tracker] sys-apps/portage-next version.
+
+This bug is renamed from X.Y.Z to X.Y.Z+1 after a release, until
+it gets closed when Y changes and a new one is opened.
+
+Whenever a commit for a specific bug is made to the git repo,
+the corresponding bug gets changed in the following ways:
+* InVCS is added to Keywords
+* The bug is marked as blocking the tracker for the next version
+* A comment is added saying: This is fixed in git: url to commit
+(note that the bug stays open)
+
+After a release all open bugs blocking the tracker are closed
+with the comment This is fixed in version..
+
+For individual open bugs it is encouraged to set UNCONFIRMED,
+CONFIRMED or IN_PROGESS as appropriate.
+
+There are a number of bugs named [TRACKER] * that collect bugs
+for specific topics. Confirmed bugs should be marked as blocking
+these tracker bugs if appropriate.
+
+It is encouraged to set the alias field for frequently used bugs.
+
 
 Releases
 
-- 
1.8.3.2




[gentoo-portage-dev] [PATCH 1/2] ResolverPlayground: Write layout.conf if needed

2014-01-06 Thread SebastianLuther
From: Sebastian Luther sebastianlut...@gmx.de

---
 pym/portage/tests/resolver/ResolverPlayground.py | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/pym/portage/tests/resolver/ResolverPlayground.py 
b/pym/portage/tests/resolver/ResolverPlayground.py
index e09e265..8487b9c 100644
--- a/pym/portage/tests/resolver/ResolverPlayground.py
+++ b/pym/portage/tests/resolver/ResolverPlayground.py
@@ -302,6 +302,13 @@ class ResolverPlayground(object):
#Create $profile_dir/eclass (we fail to digest the 
ebuilds if it's not there)
os.makedirs(os.path.join(repo_dir, eclass))
 
+   # Set masters key in layout.conf for all repos except 
'main-repo'
+   if repo != test_repo and (not repo_config or 
layout.conf not in repo_config):
+   layout_conf_path = os.path.join(repo_dir, 
metadata, layout.conf)
+   f = open(layout_conf_path, w)
+   f.write(masters = test_repo\n)
+   f.close()
+
if repo == test_repo:
#Create a minimal profile in /usr/portage
sub_profile_dir = os.path.join(profile_dir, 
default, linux, x86, test_profile)
-- 
1.8.3.2




[gentoo-portage-dev] [PATCH 2/2] Fix unecessary rebuild caused by equal versions in different repos

2014-01-06 Thread SebastianLuther
From: Sebastian Luther sebastianlut...@gmx.de

Fixes bug 497238.
---
 pym/_emerge/depgraph.py|  2 +-
 .../tests/resolver/test_slot_conflict_rebuild.py   | 42 ++
 2 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 763f3fd..2f01a56 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -1376,7 +1376,7 @@ class depgraph(object):
selective and \
dep.parent.installed and \
dep.child.installed and \
-   dep.parent.cpv == 
replacement_parent.cpv and \
+   dep.parent = 
replacement_parent and \
dep.child.cpv == pkg.cpv:
# Then can happen if the 
child's sub-slot changed
# without a revision bump. The 
sub-slot change is
diff --git a/pym/portage/tests/resolver/test_slot_conflict_rebuild.py 
b/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
index 5acdadb..714ef8e 100644
--- a/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
+++ b/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
@@ -364,3 +364,45 @@ class SlotConflictRebuildTestCase(TestCase):
self.assertEqual(test_case.test_success, True, 
test_case.fail_msg)
finally:
playground.cleanup()
+
+
+   def testSlotConflictMultiRepo(self):
+   
+   Bug 497238
+   Different repositories contain the same cpv with different 
sub-slots for
+   a slot operator child.
+   Downgrading the slot operator parent would result in a sub-slot 
change of
+   the installed package by changing the source repository.
+   Make sure we don't perform this undesirable rebuild.
+   
+   ebuilds = {
+   net-firewall/iptables-1.4.21::overlay : { EAPI: 
5, SLOT: 0/10 },
+   sys-apps/iproute2-3.11.0::overlay : { EAPI: 5, 
RDEPEND: net-firewall/iptables:= },
+
+   net-firewall/iptables-1.4.21 : { EAPI: 5, SLOT: 
0 },
+   sys-apps/iproute2-3.12.0: { EAPI: 5, RDEPEND: 
net-firewall/iptables:= },
+   }
+
+   installed = {
+   net-firewall/iptables-1.4.21::overlay : { EAPI: 
5, SLOT: 0/10 },
+   sys-apps/iproute2-3.12.0: { EAPI: 5, RDEPEND: 
net-firewall/iptables:0/10= },
+   }
+
+   world = [sys-apps/iproute2]
+
+   test_cases = (
+   ResolverPlaygroundTestCase(
+   [@world],
+   options = {--deep: True, --update: True, 
--verbose: True},
+   success = True,
+   mergelist = []),
+   )
+
+   playground = ResolverPlayground(ebuilds=ebuilds,
+   installed=installed, world=world, debug=False)
+   try:
+   for test_case in test_cases:
+   playground.run_TestCase(test_case)
+   self.assertEqual(test_case.test_success, True, 
test_case.fail_msg)
+   finally:
+   playground.cleanup()
-- 
1.8.3.2




[gentoo-portage-dev] [PATCH] ResolverPlayground: Write layout.conf if needed

2014-01-06 Thread SebastianLuther
From: Sebastian Luther sebastianlut...@gmx.de

---
 pym/portage/tests/resolver/ResolverPlayground.py | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/pym/portage/tests/resolver/ResolverPlayground.py 
b/pym/portage/tests/resolver/ResolverPlayground.py
index e09e265..d066428 100644
--- a/pym/portage/tests/resolver/ResolverPlayground.py
+++ b/pym/portage/tests/resolver/ResolverPlayground.py
@@ -302,6 +302,12 @@ class ResolverPlayground(object):
#Create $profile_dir/eclass (we fail to digest the 
ebuilds if it's not there)
os.makedirs(os.path.join(repo_dir, eclass))
 
+   # Set masters key in layout.conf for all repos except 
'main-repo'
+   if repo != test_repo and (not repo_config or 
layout.conf not in repo_config):
+   layout_conf_path = os.path.join(repo_dir, 
metadata, layout.conf)
+   with open(layout_conf_path, w) as f:
+   f.write(masters = test_repo\n)
+
if repo == test_repo:
#Create a minimal profile in /usr/portage
sub_profile_dir = os.path.join(profile_dir, 
default, linux, x86, test_profile)
-- 
1.8.3.2




[gentoo-portage-dev] [PATCH] Document layout.conf more (bug 395359)

2014-01-05 Thread SebastianLuther
From: Sebastian Luther sebastianlut...@gmx.de

---
 man/portage.5 | 24 +++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/man/portage.5 b/man/portage.5
index 9a191d0..0eb3c54 100644
--- a/man/portage.5
+++ b/man/portage.5
@@ -1002,42 +1002,61 @@ inherently \fBnot\fR \fIsite\-specific\fR.
 # profiles/repo_name, then this layout.conf setting will take precedence)
 repo\-name = foo-overlay
 
+# eclasses provided by the current repository take precedence over identically
+# named eclasses provided by java-overlay
 # eclasses provided by java-overlay take precedence over identically named
 # eclasses that are provided by gentoo
+# value: space delimited list of repository names
+# default: the 'main-repo' from repos.conf
+# use 'masters =' to set no master
 masters = gentoo java-overlay
 
 # indicate that this repo can be used as a substitute for foo-overlay
+# value: space delimited list of repository names (default: empty)
 aliases = foo-overlay
 
 # indicate that ebuilds with the specified EAPIs are banned
+# value: space delimited list of EAPIs (default: empty)
 eapis\-banned = 0 1
 
 # indicate that ebuilds with the specified EAPIs are deprecated
+# value: space delimited list of EAPIs (default: empty)
 eapis\-deprecated = 2 3
 
 # sign commits in this repo, which requires Git =1.7.9, and
 # key configured by `git config user.signingkey key_id`
+# value: true or false (default: false)
 sign\-commits = true
 
 # do not sign Manifest files in this repo
+# value: true or false (default: true)
 sign\-manifests = false
 
 # Manifest files only contain DIST entries
+# value: true or false (default: false)
 thin\-manifests = true
 
 # indicate that this repo requires manifests for each package, and is
 # considered a failure if a manifest file is missing/incorrect
+# value: strict or false (default: strict)
 use\-manifests = strict
 
 # customize the set of hashes generated for Manifest entries
+# value: space separated list of hash functions
+# supported hash functions: SHA256 SHA512 WHIRLPOOL
+# default: SHA256 SHA512 WHIRLPOOL
 manifest\-hashes = SHA256 SHA512 WHIRLPOOL
 
 # indicate that this repo enables repoman's --echangelog=y option automatically
+# value: true or false (default: false)
 update\-changelog = true
 
 # indicate that this repo contains both md5-dict and pms cache formats,
 # which may be generated by egencache(1)
-cache\-formats = md5-dict pms
+# value: space separated list of cache formats
+# supported cache formats: md5-dict pms
+# default: md5-dict, if avaiable, pms otherwise
+cache\-formats = md5-dict
 
 # indicate that this repo contains profiles that may use directories for
 # package.mask, package.provided, package.use, package.use.force,
@@ -1048,6 +1067,9 @@ cache\-formats = md5-dict pms
 # profile parent files can be used to express paths relative to the root
 # 'profiles' directory of a repository (when the repo name is omitted before
 # the colon, it refers to the current repository the parent file is inside)
+# value: space separated list of profile formats
+# supported profile formats: pms portage-1 portage-2
+# default: portage-1, but warns for incompatibilities with pms
 profile\-formats = portage-2
 .fi
 .RE
-- 
1.8.3.2




[gentoo-portage-dev] [PATCH] repoman: Add check for missing slot operators (bug 493742)

2014-01-02 Thread SebastianLuther
From: Sebastian Luther sebastianlut...@gmx.de

---
 bin/repoman | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/bin/repoman b/bin/repoman
index d1542e9..cb1d620 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -78,7 +78,7 @@ from portage.output import ConsoleStyleFile, StyleWriter
 from portage.util import writemsg_level
 from portage.util._argparse import ArgumentParser
 from portage.package.ebuild.digestgen import digestgen
-from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use
+from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use, 
eapi_has_slot_operator
 
 if sys.hexversion = 0x300:
basestring = str
@@ -354,6 +354,7 @@ qahelp = {
portage.internal: The ebuild uses an internal Portage function or 
variable,
repo.eapi.banned: The ebuild uses an EAPI which is banned by the 
repository's metadata/layout.conf settings,
repo.eapi.deprecated: The ebuild uses an EAPI which is deprecated by 
the repository's metadata/layout.conf settings,
+   slot.operator.missing: The ebuild depends on a package with several 
slots and/or sub slots without specifying a slot operator,
virtual.oldstyle: The ebuild PROVIDEs an old-style virtual (see GLEP 
37),
virtual.suspect: Ebuild contains a package that usually should be 
pulled via virtual/, not directly.,
usage.obsolete: The ebuild makes use of an obsolete construct,
@@ -399,6 +400,7 @@ qawarnings = set((
 metadata.warning,
 portage.internal,
 repo.eapi.deprecated,
+slot.operator.missing,
 usage.obsolete,
 upstream.workaround,
 LIVEVCS.stable,
@@ -2070,6 +2072,16 @@ for x in effective_scanlist:
  with a non-zero 
revision: + \
  '%s') % (mytype, 
atom))
 
+   if runtime and not atom.blocker and not 
atom.slot_operator and \
+   eapi_has_slot_operator(eapi) 
and \
+   not (atom.slot and 
atom.sub_slot):
+   child_slots = set((child.slot, 
child.sub_slot) \
+   for child in 
portdb.xmatch(match-all, atom))
+   if len(child_slots)  1:
+   
stats['slot.operator.missing'] += 1
+   
fails['slot.operator.missing'].append(relative_path + \
+   : '%s' in %s 
missing slot/sub-slot or slot operator % (atom, mytype))
+
type_list.extend([mytype] * (len(badsyntax) - 
len(type_list)))
 
for m, b in zip(type_list, badsyntax):
-- 
1.8.3.2




[gentoo-portage-dev]

2014-01-02 Thread SebastianLuther
Changes:

* restrict check to runtime dependencies
* don't skip the check for atoms with slots, but only for slot+sub-slot
* fix typo found by Ryan




[gentoo-portage-dev] [PATCH 2/2] repoman: Add check for missing slot operators (bug 493742)

2014-01-01 Thread SebastianLuther
From: Sebastian Luther sebastianlut...@gmx.de

---
 bin/repoman | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/bin/repoman b/bin/repoman
index d1542e9..2a332a7 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -78,7 +78,7 @@ from portage.output import ConsoleStyleFile, StyleWriter
 from portage.util import writemsg_level
 from portage.util._argparse import ArgumentParser
 from portage.package.ebuild.digestgen import digestgen
-from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use
+from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use, 
eapi_has_slot_operator
 
 if sys.hexversion = 0x300:
basestring = str
@@ -354,6 +354,7 @@ qahelp = {
portage.internal: The ebuild uses an internal Portage function or 
variable,
repo.eapi.banned: The ebuild uses an EAPI which is banned by the 
repository's metadata/layout.conf settings,
repo.eapi.deprecated: The ebuild uses an EAPI which is deprecated by 
the repository's metadata/layout.conf settings,
+   slot.operator.missing: The ebuild depends on package with several 
slots and/or sub slots without specifying a slot operator,
virtual.oldstyle: The ebuild PROVIDEs an old-style virtual (see GLEP 
37),
virtual.suspect: Ebuild contains a package that usually should be 
pulled via virtual/, not directly.,
usage.obsolete: The ebuild makes use of an obsolete construct,
@@ -399,6 +400,7 @@ qawarnings = set((
 metadata.warning,
 portage.internal,
 repo.eapi.deprecated,
+slot.operator.missing,
 usage.obsolete,
 upstream.workaround,
 LIVEVCS.stable,
@@ -2070,6 +2072,14 @@ for x in effective_scanlist:
  with a non-zero 
revision: + \
  '%s') % (mytype, 
atom))
 
+   if not (atom.blocker or atom.slot or 
atom.slot_operator) and \
+   eapi_has_slot_operator(eapi):
+   child_slots = set((child.slot, 
child.sub_slot) for child in portdb.xmatch(match-all, atom))
+   if len(child_slots)  1:
+   
stats['slot.operator.missing'] += 1
+   
fails['slot.operator.missing'].append(relative_path + \
+   : '%s' missing 
slot or slot operator % atom)
+
type_list.extend([mytype] * (len(badsyntax) - 
len(type_list)))
 
for m, b in zip(type_list, badsyntax):
-- 
1.8.3.2




[gentoo-portage-dev] [PATCH] Don't filter USE for binary packages with IUSE (bug 485920)

2013-12-05 Thread SebastianLuther
From: Sebastian Luther sebastianlut...@gmx.de

USE may contain values that aren't present in IUSE for any
supported EAPI. This for example breaks use dependencies on
USE_EXPAND-values.

The behavior for binary packages is now in line with what is
done for installed packages.

Note that this filtering was not active during merge.

URL: https://bugs.gentoo.org/485920
---
 pym/portage/dbapi/bintree.py | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
index 61ac6b5..b1f67ae 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -1283,11 +1283,6 @@ class binarytree(object):
 
def _eval_use_flags(self, cpv, metadata):
use = frozenset(metadata[USE].split())
-   raw_use = use
-   iuse = set(f.lstrip(-+) for f in metadata[IUSE].split())
-   use = [f for f in use if f in iuse]
-   use.sort()
-   metadata[USE] =  .join(use)
for k in self._pkgindex_use_evaluated_keys:
if k.endswith('DEPEND'):
token_class = Atom
@@ -1296,7 +1291,7 @@ class binarytree(object):
 
try:
deps = metadata[k]
-   deps = use_reduce(deps, uselist=raw_use, 
token_class=token_class)
+   deps = use_reduce(deps, uselist=use, 
token_class=token_class)
deps = paren_enclose(deps)
except portage.exception.InvalidDependString as e:
writemsg(%s: %s\n % (k, str(e)),
-- 
1.8.3.2




[gentoo-portage-dev] [PATCH] Remove ban on installing *.a and *.la files in / (bug 492542)

2013-12-05 Thread SebastianLuther
From: Sebastian Luther sebastianlut...@gmx.de

---
 bin/misc-functions.sh | 10 --
 1 file changed, 10 deletions(-)

diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index bd99def..0eb1b3f 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -642,16 +642,6 @@ install_qa_check() {
done
[[ ${abort} == yes ]]  die add those ldscripts
 
-   # Make sure people don't store libtool files or static libs in /lib
-   f=$(ls ${ED}lib*/*.{a,la} 2/dev/null)
-   if [[ -n ${f} ]] ; then
-   __vecho -ne '\n'
-   eqawarn QA Notice: Excessive files found in the / partition
-   eqawarn ${f}
-   __vecho -ne '\n'
-   die static archives (*.a) and libtool library files (*.la) 
belong in /usr/lib*, not /lib*
-   fi
-
# Verify that the libtool files don't contain bogus $D entries.
local abort=no gentoo_bug=no always_overflow=no
for a in ${ED}usr/lib*/*.la ; do
-- 
1.8.3.2




[gentoo-portage-dev] [PATCH] Fix unnecessary rebuild (bug 487198)

2013-12-02 Thread SebastianLuther
From: Sebastian Luther sebastianlut...@gmx.de

This one was caused by a mix of = and  dependencies.
---
 pym/_emerge/depgraph.py| 92 +-
 .../tests/resolver/test_slot_conflict_rebuild.py   | 66 
 2 files changed, 139 insertions(+), 19 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index cd68db6..67b8881 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -1298,7 +1298,34 @@ class depgraph(object):
 
selected_atoms = None
 
-   for atom in replacement_parent.validated_atoms:
+   atoms = set()
+   invalid_metadata = False
+   for dep_key in (DEPEND, HDEPEND, RDEPEND, 
PDEPEND):
+   dep_string = 
replacement_parent._metadata[dep_key]
+   if not dep_string:
+   continue
+
+   try:
+   dep_string = 
portage.dep.use_reduce(dep_string,
+   
uselist=self._pkg_use_enabled(replacement_parent),
+   
is_valid_flag=replacement_parent.iuse.is_valid_flag,
+   flat=True, token_class=Atom,
+   eapi=replacement_parent.eapi)
+   except portage.exception.InvalidDependString:
+   invalid_metadata = True
+   break
+
+   atoms.update(token for token in dep_string if 
isinstance(token, Atom))
+
+   if invalid_metadata:
+   continue
+
+   # List of list of child,atom pairs for each atom.
+   replacement_candidates = []
+   # Set of all packages all atoms can agree on.
+   all_candidate_pkgs = None
+
+   for atom in atoms:
if atom.blocker or \
atom.cp != dep.atom.cp:
continue
@@ -1316,6 +1343,8 @@ class depgraph(object):
# parent and search for another.
break
 
+   candidate_pkg_atoms = []
+   candidate_pkgs = []
for pkg in self._iter_similar_available(
dep.child, atom):
if pkg.slot == dep.child.slot and \
@@ -1367,26 +1396,51 @@ class depgraph(object):
if unevaluated_atom not in 
selected_atoms:
continue
 
-   if debug:
-   msg = []
-   msg.append()
-   msg.append()
-   
msg.append(slot_operator_update_probe:)
-   msg.append(   existing child 
package:  %s % dep.child)
-   msg.append(   existing parent 
package: %s % dep.parent)
-   msg.append(   new child 
package:  %s % pkg)
-   msg.append(   new parent 
package: %s % replacement_parent)
-   if insignificant:
-   
msg.append(insignificant changes detected)
-   msg.append()
-   writemsg_level(\n.join(msg),
-   noiselevel=-1, 
level=logging.DEBUG)
+   if not insignificant:
+   
candidate_pkg_atoms.append((pkg, unevaluated_atom))
+   candidate_pkgs.append(pkg)
+
+   
replacement_candidates.append(candidate_pkg_atoms)
+   if all_candidate_pkgs is None:
+   all_candidate_pkgs = set(candidate_pkgs)
+   else:
+   
all_candidate_pkgs.intersection_update(candidate_pkgs)
+
+   if not all_candidate_pkgs:
+   # If the atoms that connect parent and child 
can't agree on
+   # any replacement child, we can't do anything.
+   continue
+
+ 

[gentoo-portage-dev] [PATCH] Fix crash in _ignore_dependency

2013-12-02 Thread SebastianLuther
From: Sebastian Luther sebastianlut...@gmx.de

---
 pym/_emerge/depgraph.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 67b8881..763f3fd 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -2337,6 +2337,7 @@ class depgraph(object):
(pkg.root, pkg.slot_atom) in 
self._dynamic_config._slot_operator_replace_installed and \
mypriority.satisfied is not child and \
mypriority.satisfied.installed and \
+   child and \
not child.installed and \
(child.slot != mypriority.satisfied.slot or 
child.sub_slot != mypriority.satisfied.sub_slot):
slot_operator_rebuild = True
-- 
1.8.3.2




[gentoo-portage-dev] [PATCH 2/2] Use portage.const.TIMESTAMP_FORMAT where appropriate

2013-11-29 Thread SebastianLuther
From: Sebastian Luther sebastianlut...@gmx.de

---
 pym/_emerge/actions.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index 86d67d2..19268cb 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -40,6 +40,7 @@ from portage import eapi_is_supported, _encodings, 
_unicode_decode
 from portage.cache.cache_errors import CacheError
 from portage.const import GLOBAL_CONFIG_PATH, VCS_DIRS, 
_DEPCLEAN_LIB_CHECK_DEFAULT
 from portage.const import SUPPORTED_BINPKG_FORMATS
+from portage.const import TIMESTAMP_FORMAT
 from portage.dbapi.dep_expand import dep_expand
 from portage.dbapi._expand_new_virt import expand_new_virt
 from portage.dep import Atom
@@ -2282,7 +2283,7 @@ def _sync_repo(emerge_config, repo):
if content:
try:
mytimestamp = 
time.mktime(time.strptime(content[0],
-   %a, %d %b %Y %H:%M:%S +))
+   TIMESTAMP_FORMAT))
except (OverflowError, ValueError):
pass
del content
@@ -2511,7 +2512,7 @@ def _sync_repo(emerge_config, repo):
if content:
try:
servertimestamp = 
time.mktime(time.strptime(
-   content[0], %a, %d %b 
%Y %H:%M:%S +))
+   content[0], 
TIMESTAMP_FORMAT))
except (OverflowError, ValueError):
pass
del mycommand, mypids, content
-- 
1.8.1.5




[gentoo-portage-dev] [PATCH 1/2] egencache: --write-timestamp to create metadata/timestamp.chk

2013-11-29 Thread SebastianLuther
From: Sebastian Luther sebastianlut...@gmx.de

This is required to sync repositories using rsnyc.

URL: https://bugs.gentoo.org/488972
---
 bin/egencache| 14 ++
 pym/portage/const.py |  4 
 2 files changed, 18 insertions(+)

diff --git a/bin/egencache b/bin/egencache
index 54c517e..5088bdf 100755
--- a/bin/egencache
+++ b/bin/egencache
@@ -48,6 +48,7 @@ portage._internal_caller = True
 from portage import os, _encodings, _unicode_encode, _unicode_decode
 from _emerge.MetadataRegen import MetadataRegen
 from portage.cache.cache_errors import CacheError, StatCollision
+from portage.const import TIMESTAMP_FORMAT
 from portage.manifest import guessManifestFileType
 from portage.package.ebuild._parallel_manifest.ManifestScheduler import 
ManifestScheduler
 from portage.util import cmp_sort_key, writemsg_level
@@ -133,6 +134,9 @@ def parse_args(args):
common.add_argument(--ignore-default-opts,
action=store_true,
help=do not use the EGENCACHE_DEFAULT_OPTS environment 
variable)
+   common.add_argument(--write-timestamp,
+   action=store_true,
+   help=write metdata/timestamp.chk as required for rsync 
repositories)
 
update = parser.add_argument_group('--update options')
update.add_argument(--cache-dir,
@@ -1063,6 +1067,16 @@ def egencache_main(args):
gen_clogs.run()
ret.append(gen_clogs.returncode)
 
+   if options.write_timestamp:
+   timestamp_path = os.path.join(repo_path, metadata, 
timestamp.chk)
+   try:
+   with open(timestamp_path, w) as f:
+   f.write(time.strftime(TIMESTAMP_FORMAT + \n, 
time.gmtime()))
+   except IOError:
+   ret.append(os.EX_IOERR)
+   else:
+   ret.append(os.EX_OK)
+
return max(ret)
 
 if __name__ == __main__:
diff --git a/pym/portage/const.py b/pym/portage/const.py
index 214ede4..02860e1 100644
--- a/pym/portage/const.py
+++ b/pym/portage/const.py
@@ -175,6 +175,10 @@ if PORTAGE_OVERRIDE_EPREFIX in os.environ:
 VCS_DIRS = (CVS, RCS, SCCS, .bzr, .git, .hg, .svn)
 
 SUPPORTED_BINPKG_FORMATS = (tar, rpm)
+
+# Time formats used in various places.
+TIMESTAMP_FORMAT = %a, %d %b %Y %H:%M:%S +   # to be used with 
time.gmtime()
+
 # ===
 # END OF CONSTANTS -- END OF CONSTANTS -- END OF CONSTANTS -- END OF CONSTANT
 # ===
-- 
1.8.1.5




[gentoo-portage-dev] [PATCH 1/2] Add list of live eclasses to portage.const

2013-11-29 Thread SebastianLuther
From: Sebastian Luther sebastianlut...@gmx.de

---
 bin/repoman   | 11 +--
 pym/_emerge/EbuildExecuter.py | 11 +--
 pym/portage/_sets/__init__.py |  2 +-
 pym/portage/const.py  | 12 
 4 files changed, 15 insertions(+), 21 deletions(-)

diff --git a/bin/repoman b/bin/repoman
index 1a02050..872b6e1 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -424,16 +424,7 @@ valid_restrict = frozenset([binchecks, bindist,
fetch, installsources, mirror, preserve-libs,
primaryuri, splitdebug, strip, test, userpriv])
 
-live_eclasses = frozenset([
-   bzr,
-   cvs,
-   darcs,
-   git,
-   git-2,
-   mercurial,
-   subversion,
-   tla,
-])
+live_eclasses = portage.const.LIVE_ECLASSES
 
 suspect_rdepend = frozenset([
app-arch/cabextract,
diff --git a/pym/_emerge/EbuildExecuter.py b/pym/_emerge/EbuildExecuter.py
index cfbc90d..5587d4e 100644
--- a/pym/_emerge/EbuildExecuter.py
+++ b/pym/_emerge/EbuildExecuter.py
@@ -16,16 +16,7 @@ class EbuildExecuter(CompositeTask):
 
_phases = (prepare, configure, compile, test, install)
 
-   _live_eclasses = frozenset([
-   bzr,
-   cvs,
-   darcs,
-   git,
-   git-2,
-   mercurial,
-   subversion,
-   tla,
-   ])
+   _live_eclasses = portage.const.LIVE_ECLASSES
 
def _start(self):
pkg = self.pkg
diff --git a/pym/portage/_sets/__init__.py b/pym/portage/_sets/__init__.py
index a545dba..75d1df7 100644
--- a/pym/portage/_sets/__init__.py
+++ b/pym/portage/_sets/__init__.py
@@ -140,7 +140,7 @@ class SetConfig(object):
parser.add_section(live-rebuild)
parser.set(live-rebuild, class, 
portage.sets.dbapi.VariableSet)
parser.set(live-rebuild, variable, INHERITED)
-   parser.set(live-rebuild, includes, bzr cvs darcs git git-2 
mercurial subversion tla)
+   parser.set(live-rebuild, includes,  
.join(sorted(portage.const.LIVE_ECLASSES)))
 
parser.remove_section(module-rebuild)
parser.add_section(module-rebuild)
diff --git a/pym/portage/const.py b/pym/portage/const.py
index 214ede4..04b5a57 100644
--- a/pym/portage/const.py
+++ b/pym/portage/const.py
@@ -174,6 +174,18 @@ if PORTAGE_OVERRIDE_EPREFIX in os.environ:
 
 VCS_DIRS = (CVS, RCS, SCCS, .bzr, .git, .hg, .svn)
 
+# List of known live eclasses. Keep it in sync with cnf/sets/protage.conf
+LIVE_ECLASSES = frozenset([
+   bzr,
+   cvs,
+   darcs,
+   git,
+   git-2,
+   mercurial,
+   subversion,
+   tla,
+])
+
 SUPPORTED_BINPKG_FORMATS = (tar, rpm)
 # ===
 # END OF CONSTANTS -- END OF CONSTANTS -- END OF CONSTANTS -- END OF CONSTANT
-- 
1.8.1.5




[gentoo-portage-dev] [PATCH 2/2] Add git-r3 to the list of live eclasses

2013-11-29 Thread SebastianLuther
From: Sebastian Luther sebastianlut...@gmx.de

---
 cnf/sets/portage.conf | 2 +-
 pym/portage/const.py  | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/cnf/sets/portage.conf b/cnf/sets/portage.conf
index c5c787b..b73afb1 100644
--- a/cnf/sets/portage.conf
+++ b/cnf/sets/portage.conf
@@ -51,7 +51,7 @@ class = portage.sets.libs.PreservedLibraryConsumerSet
 [live-rebuild]
 class = portage.sets.dbapi.VariableSet
 variable = INHERITED
-includes = bzr cvs darcs git git-2 mercurial subversion tla
+includes = bzr cvs darcs git git-2 git-r3 mercurial subversion tla
 
 # Installed packages that own files inside /lib/modules.
 [module-rebuild]
diff --git a/pym/portage/const.py b/pym/portage/const.py
index 04b5a57..5912f97 100644
--- a/pym/portage/const.py
+++ b/pym/portage/const.py
@@ -181,6 +181,7 @@ LIVE_ECLASSES = frozenset([
darcs,
git,
git-2,
+   git-r3,
mercurial,
subversion,
tla,
-- 
1.8.1.5




[gentoo-portage-dev] [PATCH] Another slot operator bug (bug 486580, try 2)

2013-11-28 Thread SebastianLuther
From: Sebastian Luther sebastianlut...@gmx.de

This time rebuilds are scheduled properly, but we
might still forget to install the package that caused
the rebuild.

URL: https://bugs.gentoo.org/486580
---
 pym/_emerge/depgraph.py| 30 ++-
 .../tests/resolver/test_slot_conflict_rebuild.py   | 63 ++
 2 files changed, 91 insertions(+), 2 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index da2e604..0f8f76d 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -2356,6 +2356,18 @@ class depgraph(object):
# discarded here. Try to discard as few as possible 
since
# discarded dependencies reduce the amount of 
information
# available for optimization of merge order.
+   # Don't ignore dependencies if pkg as a slot operator 
dependency on the child
+   # and the child has changed slot/sub_slot
+   slot_operator_rebuild = False
+   if atom.slot_operator == '=' and \
+   (pkg.root, pkg.slot_atom) in 
self._dynamic_config._slot_operator_replace_installed and \
+   mypriority.satisfied and \
+   mypriority.satisfied is not child and \
+   mypriority.satisfied.installed and \
+   not child.installed and \
+   (child.slot != mypriority.satisfied.slot or 
child.sub_slot != mypriority.satisfied.sub_slot):
+   slot_operator_rebuild = True
+
ignored = False
if not atom.blocker and \
not recurse_satisfied and \
@@ -2364,7 +2376,8 @@ class depgraph(object):
dep.child is not None and \
not dep.child.installed and \

self._dynamic_config._slot_pkg_map[dep.child.root].get(
-   dep.child.slot_atom) is None:
+   dep.child.slot_atom) is None and \
+   not slot_operator_rebuild:
myarg = None
try:
myarg = 
next(self._iter_atoms_for_pkg(dep.child), None)
@@ -2466,6 +2479,18 @@ class depgraph(object):
parent=virt_pkg, priority=mypriority, 
root=dep_root,
collapsed_parent=pkg, 
collapsed_priority=dep_priority)
 
+   # Don't ignore dependencies if pkg as a slot 
operator dependency on the child
+   # and the child has changed slot/sub_slot
+   slot_operator_rebuild = False
+   if atom.slot_operator == '=' and \
+   (pkg.root, pkg.slot_atom) in 
self._dynamic_config._slot_operator_replace_installed and \
+   mypriority.satisfied and \
+   mypriority.satisfied is not child and \
+   mypriority.satisfied.installed and \
+   not child.installed and \
+   (child.slot != 
mypriority.satisfied.slot or child.sub_slot != mypriority.satisfied.sub_slot):
+   slot_operator_rebuild = True
+
ignored = False
if not atom.blocker and \
not recurse_satisfied and \
@@ -2474,7 +2499,8 @@ class depgraph(object):
dep.child is not None and \
not dep.child.installed and \

self._dynamic_config._slot_pkg_map[dep.child.root].get(
-   dep.child.slot_atom) is None:
+   dep.child.slot_atom) is None and \
+   not slot_operator_rebuild:
myarg = None
try:
myarg = 
next(self._iter_atoms_for_pkg(dep.child), None)
diff --git a/pym/portage/tests/resolver/test_slot_conflict_rebuild.py 
b/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
index 74f5cc1..e3c517d 100644
--- a/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
+++ b/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
@@ -181,6 +181,69 @@ class SlotConflictRebuildTestCase(TestCase):
finally:
playground.cleanup()
 
+   def testSlotConflictForgottenChild(self):
+

[gentoo-portage-dev] [PATCH] Another slot operator bug (bug 486580, try 2)

2013-11-28 Thread SebastianLuther
From: Sebastian Luther sebastianlut...@gmx.de

This time rebuilds are scheduled properly, but we
might still forget to install the package that caused
the rebuild.

URL: https://bugs.gentoo.org/486580
---
 pym/_emerge/depgraph.py| 48 +++--
 .../tests/resolver/test_slot_conflict_rebuild.py   | 63 ++
 2 files changed, 95 insertions(+), 16 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index da2e604..0a998b5 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -2268,6 +2268,36 @@ class depgraph(object):
finally:
self._dynamic_config._autounmask = _autounmask_backup
 
+   def _ignore_dependency(self, atom, pkg, child, dep, mypriority, 
recurse_satisfied):
+   
+   In some cases, dep_check will return deps that shouldn't
+   be proccessed any further, so they are identified and
+   discarded here. Try to discard as few as possible since
+   discarded dependencies reduce the amount of information
+   available for optimization of merge order.
+   Don't ignore dependencies if pkg has a slot operator dependency 
on the child
+   and the child has changed slot/sub_slot.
+   
+   slot_operator_rebuild = False
+   if atom.slot_operator == '=' and \
+   (pkg.root, pkg.slot_atom) in 
self._dynamic_config._slot_operator_replace_installed and \
+   mypriority.satisfied and \
+   mypriority.satisfied is not child and \
+   mypriority.satisfied.installed and \
+   not child.installed and \
+   (child.slot != mypriority.satisfied.slot or 
child.sub_slot != mypriority.satisfied.sub_slot):
+   slot_operator_rebuild = True
+
+   return not atom.blocker and \
+   not recurse_satisfied and \
+   mypriority.satisfied and \
+   mypriority.satisfied.visible and \
+   dep.child is not None and \
+   not dep.child.installed and \
+   self._dynamic_config._slot_pkg_map[dep.child.root].get(
+   dep.child.slot_atom) is None and \
+   not slot_operator_rebuild
+
def _wrapped_add_pkg_dep_string(self, pkg, dep_root, dep_priority,
dep_string, allow_unsatisfied):
depth = pkg.depth + 1
@@ -2357,14 +2387,7 @@ class depgraph(object):
# discarded dependencies reduce the amount of 
information
# available for optimization of merge order.
ignored = False
-   if not atom.blocker and \
-   not recurse_satisfied and \
-   mypriority.satisfied and \
-   mypriority.satisfied.visible and \
-   dep.child is not None and \
-   not dep.child.installed and \
-   
self._dynamic_config._slot_pkg_map[dep.child.root].get(
-   dep.child.slot_atom) is None:
+   if self._ignore_dependency(atom, pkg, child, dep, 
mypriority, recurse_satisfied):
myarg = None
try:
myarg = 
next(self._iter_atoms_for_pkg(dep.child), None)
@@ -2467,14 +2490,7 @@ class depgraph(object):
collapsed_parent=pkg, 
collapsed_priority=dep_priority)
 
ignored = False
-   if not atom.blocker and \
-   not recurse_satisfied and \
-   mypriority.satisfied and \
-   mypriority.satisfied.visible and \
-   dep.child is not None and \
-   not dep.child.installed and \
-   
self._dynamic_config._slot_pkg_map[dep.child.root].get(
-   dep.child.slot_atom) is None:
+   if self._ignore_dependency(atom, pkg, child, 
dep, mypriority, recurse_satisfied):
myarg = None
try:
myarg = 
next(self._iter_atoms_for_pkg(dep.child), None)
diff --git a/pym/portage/tests/resolver/test_slot_conflict_rebuild.py 
b/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
index 74f5cc1..e3c517d 100644
--- a/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
+++ 

[gentoo-portage-dev] [PATCH] egencache: --write-timestamp to create metadata/timestamp.chk

2013-11-27 Thread SebastianLuther
From: Sebastian Luther sebastianlut...@gmx.de

This is required to sync repositories using rsnyc.

URL: https://bugs.gentoo.org/488972
---
 bin/egencache | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/bin/egencache b/bin/egencache
index 54c517e..6ff1dcb 100755
--- a/bin/egencache
+++ b/bin/egencache
@@ -133,6 +133,9 @@ def parse_args(args):
common.add_argument(--ignore-default-opts,
action=store_true,
help=do not use the EGENCACHE_DEFAULT_OPTS environment 
variable)
+   common.add_argument(--write-timestamp,
+   action=store_true,
+   help=write metdata/timestamp.chk as required for rsync 
repositories)
 
update = parser.add_argument_group('--update options')
update.add_argument(--cache-dir,
@@ -1063,6 +1066,21 @@ def egencache_main(args):
gen_clogs.run()
ret.append(gen_clogs.returncode)
 
+   if options.write_timestamp:
+   timestamp_path = os.path.join(repo_path, metadata, 
timestamp.chk)
+   try:
+   timestampfile = open(timestamp_path, w)
+   try:
+   timestampfile.write(
+   time.strftime(%a, %d %b %Y %H:%M:%S 
+, time.gmtime()))
+   timestampfile.write(\n)
+   finally:
+   timestampfile.close()
+   except IOError:
+   ret.append(1)
+   else:
+   ret.append(os.EX_OK)
+
return max(ret)
 
 if __name__ == __main__:
-- 
1.8.1.5




[gentoo-portage-dev] [PATCH 1/2] Fix a missing rebuild (bug 490362)

2013-11-26 Thread SebastianLuther
From: Sebastian Luther sebastianlut...@gmx.de

The dependency in the ebuild was changed from
slot operator to no slot operator. The vdb
contained the slot operator and emerge would
refuse to rebuild, causing a missed update.
---
 pym/_emerge/depgraph.py|  3 +-
 .../tests/resolver/test_slot_conflict_rebuild.py   | 55 ++
 2 files changed, 56 insertions(+), 2 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 033057b..da2e604 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -1301,8 +1301,7 @@ class depgraph(object):
selected_atoms = None
 
for atom in replacement_parent.validated_atoms:
-   if not atom.slot_operator == = or \
-   atom.blocker or \
+   if atom.blocker or \
atom.cp != dep.atom.cp:
continue
 
diff --git a/pym/portage/tests/resolver/test_slot_conflict_rebuild.py 
b/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
index 0fe8f5d..f39508c 100644
--- a/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
+++ b/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
@@ -180,3 +180,58 @@ class SlotConflictRebuildTestCase(TestCase):
self.assertEqual(test_case.test_success, True, 
test_case.fail_msg)
finally:
playground.cleanup()
+
+   def testSlotConflictDepChange(self):
+   
+   Bug 490362
+   The dependency in the ebuild was changed form slot operator to
+   no slot operator. The vdb contained the slot operator and emerge
+   would refuse to rebuild.
+   
+   ebuilds = {
+   app-misc/A-1 : {
+   EAPI: 5,
+   DEPEND: app-misc/B,
+   RDEPEND: app-misc/B
+   },
+
+   app-misc/B-1 : {
+   EAPI: 5,
+   SLOT: 0/1
+   },
+
+   app-misc/B-2 : {
+   EAPI: 5,
+   SLOT: 0/2
+   },
+   }
+
+   installed = {
+   app-misc/A-1 : {
+   EAPI: 5,
+   DEPEND: app-misc/B:0/1=,
+   RDEPEND: app-misc/B:0/1=
+   },
+   app-misc/B-1 : {
+   EAPI: 5,
+   SLOT: 0/1
+   },
+   }
+
+   test_cases = (
+   ResolverPlaygroundTestCase(
+   [app-misc/B],
+   success = True,
+   mergelist = ['app-misc/B-2', 'app-misc/A-1']),
+   )
+
+   world = [app-misc/A]
+
+   playground = ResolverPlayground(ebuilds=ebuilds,
+   installed=installed, world=world, debug=False)
+   try:
+   for test_case in test_cases:
+   playground.run_TestCase(test_case)
+   self.assertEqual(test_case.test_success, True, 
test_case.fail_msg)
+   finally:
+   playground.cleanup()
-- 
1.8.1.5




[gentoo-portage-dev] [PATCH 2/2] Suppress debug outout from tests

2013-11-26 Thread SebastianLuther
From: Sebastian Luther sebastianlut...@gmx.de

---
 pym/portage/tests/resolver/test_slot_conflict_rebuild.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/portage/tests/resolver/test_slot_conflict_rebuild.py 
b/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
index f39508c..cac8742 100644
--- a/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
+++ b/pym/portage/tests/resolver/test_slot_conflict_rebuild.py
@@ -173,7 +173,7 @@ class SlotConflictRebuildTestCase(TestCase):
world = []
 
playground = ResolverPlayground(ebuilds=ebuilds,
-   installed=installed, world=world, debug=True)
+   installed=installed, world=world, debug=False)
try:
for test_case in test_cases:
playground.run_TestCase(test_case)
-- 
1.8.1.5