[gentoo-portage-dev] Re: [PATCH] TestFakedbapi: override EPREFIX for bug #492932
On 12/20/2014 01:11 PM, Zac Medico wrote: For tests, override portage.const.EPREFIX in order to avoid unwanted access to /etc/portage. This override may seem evil, but it is a convenient way to simulate a prefix install, and it is reasonable to do this because tests should be self-contained such that the real value of portage.const.EPREFIX is entirely irrelevant. Any feedback on this? I think it's good to merge. I know it's ugly, but it's simple and it works. Maybe we'll come up with something fancier later on. -- Thanks, Zac
[gentoo-portage-dev] [PATCH] emerge: default --backtrack=3 (bug #536926)
The previous default emerge --backtrack=10 setting could lead to lots of wasted cpu time in cases where it will ultimately fail to find a valid solution anyway. Therefore, reduce the default to --backtrack=3. In order for the BacktrackingTestCase.testBacktrackNoWrongRebuilds to succeed, the test now needs to specify --backtrack=6. This is a rather obscure case though, so it does not seem worthwhile to increase the default because of it. X-Gentoo-Bug: 536926 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=536926 --- man/emerge.1| 2 +- pym/_emerge/depgraph.py | 2 +- pym/portage/tests/resolver/test_backtracking.py | 7 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/man/emerge.1 b/man/emerge.1 index aea7cae..fd9140f 100644 --- a/man/emerge.1 +++ b/man/emerge.1 @@ -384,7 +384,7 @@ precedence over existing changes. This option is automatically enabled with .BR \-\-backtrack=COUNT Specifies an integer number of times to backtrack if dependency calculation fails due to a conflict or an -unsatisfied dependency (default: \'10\'). +unsatisfied dependency (default: \'3\'). .TP .BR \-\-binpkg\-changed\-deps [ y | n ] Tells emerge to ignore binary packages for which the corresponding diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 1431779..5e94a04 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -8941,7 +8941,7 @@ def _backtrack_depgraph(settings, trees, myopts, myparams, myaction, myfiles, sp debug = --debug in myopts mydepgraph = None - max_retries = myopts.get('--backtrack', 10) + max_retries = myopts.get('--backtrack', 3) max_depth = max(1, (max_retries + 1) // 2) allow_backtracking = max_retries 0 backtracker = Backtracker(max_depth) diff --git a/pym/portage/tests/resolver/test_backtracking.py b/pym/portage/tests/resolver/test_backtracking.py index 3b69eda..f3592c9 100644 --- a/pym/portage/tests/resolver/test_backtracking.py +++ b/pym/portage/tests/resolver/test_backtracking.py @@ -154,7 +154,12 @@ class BacktrackingTestCase(TestCase): world = [dev-libs/B, dev-libs/C] - options = {'--update' : True, '--deep' : True, '--selective' : True} + options = { + '--backtrack': 6, + '--deep' : True, + '--selective' : True, + '--update' : True, + } test_cases = ( ResolverPlaygroundTestCase( -- 2.0.5
[gentoo-portage-dev] Re: [PATCH] bin/eapi.sh: default to EAPI=0 when EAPI is unset
On 01/17/2015 04:07 AM, Sergei Trofimovich wrote: For consistency and defense against future copy/paste errors converted all uses of ${EAPI} for ${EAPI-0} in 'bin/eapi.sh'. Signed-off-by: Sergei Trofimovich sly...@gentoo.org --- bin/eapi.sh | 90 ++--- 1 file changed, 45 insertions(+), 45 deletions(-) LGTM. -- Thanks, Zac
Re: [gentoo-portage-dev] [PATCH] sync: fix module_names enumeration
On 01/17/2015 05:16 AM, Michał Górny wrote: Fix module_names enumeration to consider all modules. Before, the first module on the list was omitted ('cvs' in this case). Another thing is, the CVS module is completely, utterly and inevitably broken. And the whole syncing thing is a great pile of terribly mis-designed, unnecessarily complex code which can't work unless it is worked around like git module does... --- pym/portage/sync/controller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) LGTM, except this commit message is not a proper place to rant about stuff... -- Thanks, Zac
Re: [gentoo-portage-dev] [PATCH] sync: unify syncing messages and reduce noise
On 01/17/2015 05:55 AM, Michał Górny wrote: Print single Syncing repository '%s' into '%s'... before syncing, and single === Sync completed for %s after successful sync. Remove duplicate in-module clone/pull messages. Instead, verbosely print git commands executed. Remove useless verbosity in pre-sync mkdir. --- pym/portage/sync/controller.py | 8 +--- pym/portage/sync/modules/cvs/cvs.py | 6 -- pym/portage/sync/modules/git/git.py | 31 +++-- pym/portage/sync/modules/rsync/rsync.py | 2 +- pym/portage/sync/modules/svn/svn.py | 6 -- pym/portage/sync/modules/websync/websync.py | 6 -- 6 files changed, 18 insertions(+), 41 deletions(-) LGTM. -- Thanks, Zac
Re: [gentoo-portage-dev] [PATCH] compression_probe: support lz4, lzip, lzop
On 01/17/2015 03:10 AM, Michał Górny wrote: --- pym/portage/util/compression_probe.py | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) LGTM. BTW, I've verified that all the the new entries in _decompressors support -c and -q, as required by BinpkgExtractorAsync. -- Thanks, Zac
Re: [gentoo-portage-dev] [PATCH] sync: support sync-clone-depth for DVCS-es (git --depth)
On 01/17/2015 03:58 AM, Michał Górny wrote: Support sync-clone-depth with the default set to 1. This allows the user to reduce the number of historical commits fetched along with the repository (git --depth). --- man/portage.5 | 4 pym/portage/repository/config.py| 19 ++- pym/portage/sync/modules/git/git.py | 6 +- 3 files changed, 27 insertions(+), 2 deletions(-) LGTM. -- Thanks, Zac
Re: [gentoo-portage-dev] [PATCH] git sync: silence 'git rev-parse' errors
On 01/17/2015 04:28 AM, Michał Górny wrote: Discard the git-rev-parse error output to avoid 'fatal: Not a git repository [...]' errors when checking whether the repository exists. --- pym/portage/sync/modules/git/git.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py index b97d501..02da037 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -36,7 +36,7 @@ class GitSync(SyncBase): if not os.path.exists(self.repo.location): return False - exitcode = portage.process.spawn_bash(cd %s ; git rev-parse %\ + exitcode = portage.process.spawn_bash(cd %s ; git rev-parse 2/dev/null %\ (portage._shell_quote(self.repo.location),), **portage._native_kwargs(self.spawn_kwargs)) if exitcode == 128: Why don't we just skip the git rev-parse call entirely, if not os.path.isdir(os.path.join(self.repo.location, .git))? -- Thanks, Zac
Re: [gentoo-portage-dev] [PATCH] Default MAKEOPTS to -j(ncpus+1) when unset
On 01/17/2015 02:45 AM, Michał Górny wrote: Default MAKEOPTS job number to (number of CPUs + 1) when it is not provided in the ebuild environment. Suggested-By: Daniel Robbins drobb...@funtoo.org --- pym/portage/package/ebuild/doebuild.py | 8 +++- pym/portage/util/cpuinfo.py| 19 +++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 pym/portage/util/cpuinfo.py LGTM. -- Thanks, Zac
Re: [gentoo-portage-dev] [PATCH] Default MAKEOPTS to -j(ncpus+1) when unset
On 01/17/2015 08:22 PM, Zac Medico wrote: On 01/17/2015 02:45 AM, Michał Górny wrote: Default MAKEOPTS job number to (number of CPUs + 1) when it is not provided in the ebuild environment. Suggested-By: Daniel Robbins drobb...@funtoo.org --- pym/portage/package/ebuild/doebuild.py | 8 +++- pym/portage/util/cpuinfo.py| 19 +++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 pym/portage/util/cpuinfo.py LGTM. Actually, Arfrever tells me that the multiprocessing module is not available if python is built without threading support. So, we need to handle the ImportError and either do nothing or parse /proc/cpuinfo or something like that. -- Thanks, Zac
[gentoo-portage-dev] Re: [PATCH] bin/eapi.sh: default to EAPI=0 when EAPI is unset
On 01/17/2015 12:20 PM, Zac Medico wrote: On 01/17/2015 04:07 AM, Sergei Trofimovich wrote: For consistency and defense against future copy/paste errors converted all uses of ${EAPI} for ${EAPI-0} in 'bin/eapi.sh'. Signed-off-by: Sergei Trofimovich sly...@gentoo.org --- bin/eapi.sh | 90 ++--- 1 file changed, 45 insertions(+), 45 deletions(-) LGTM. This was an important fix, so I've pushed it to the master branch: https://github.com/gentoo/portage/commit/a01d73c362fdbf9761835bd587345f5570276fbb -- Thanks, Zac
Re: [gentoo-portage-dev] [PATCH] svn sync: fix the module
On 01/17/2015 09:35 AM, Michał Górny wrote: Fix the svn sync module since it doesn't work at all right now. More specifically: 1. add exists() method that uses 'svn info' to determine whether the repository was checked out already. 2. Fix the initial clone to use valid svn commands. Do not remove the just-created directory to avoid permission issues, just run checkout on top of it. In case the reader is wondering, we could clarify that SyncManager.pre_sync creates the directory and sets the permissions. 3. Fix the sync method to run update unconditionally to whether the URI starts with svn:// or not. In fact, remove the whole check since it doesn't serve any purpose. --- pym/portage/sync/modules/svn/svn.py | 54 - 1 file changed, 29 insertions(+), 25 deletions(-) LGTM. -- Thanks, Zac
Re: [gentoo-portage-dev] [PATCH] git sync: silence 'git rev-parse' errors
Dnia 2015-01-17, o godz. 14:07:46 Zac Medico zmed...@gentoo.org napisał(a): On 01/17/2015 04:28 AM, Michał Górny wrote: Discard the git-rev-parse error output to avoid 'fatal: Not a git repository [...]' errors when checking whether the repository exists. --- pym/portage/sync/modules/git/git.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py index b97d501..02da037 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -36,7 +36,7 @@ class GitSync(SyncBase): if not os.path.exists(self.repo.location): return False - exitcode = portage.process.spawn_bash(cd %s ; git rev-parse %\ + exitcode = portage.process.spawn_bash(cd %s ; git rev-parse 2/dev/null %\ (portage._shell_quote(self.repo.location),), **portage._native_kwargs(self.spawn_kwargs)) if exitcode == 128: Why don't we just skip the git rev-parse call entirely, if not os.path.isdir(os.path.join(self.repo.location, .git))? I don't know ;). I guess the current magic is more 'correct', i.e. distinguishes broken repo. Of course, it all will probably fall apart if it's broken but...! -- Best regards, Michał Górny pgpToqPMACJf9.pgp Description: OpenPGP digital signature
Re: [gentoo-portage-dev] [PATCH] cvs sync: fix the module
On 01/17/2015 09:36 AM, Michał Górny wrote: Fix the cvs sync module since it doesn't work at all right now. More specifically: 1. add exists() method that checks for the 'CVS' sub-directory to determine whether the repository was checked out already. 2. Do not remove the just-created directory on initial clone, to avoid permission issues. Just run checkout on top of it. 3. Fix the sync method to run update unconditionally to whether the URI starts with cvs:// or not. In fact, remove the whole check since it doesn't serve any purpose. --- pym/portage/sync/modules/cvs/cvs.py | 36 ++-- 1 file changed, 14 insertions(+), 22 deletions(-) LGTM. -- Thanks, Zac
Re: [gentoo-portage-dev] [PATCH] git sync: silence 'git rev-parse' errors
On 01/17/2015 04:31 PM, Michał Górny wrote: Dnia 2015-01-17, o godz. 14:07:46 Zac Medico zmed...@gentoo.org napisał(a): On 01/17/2015 04:28 AM, Michał Górny wrote: Discard the git-rev-parse error output to avoid 'fatal: Not a git repository [...]' errors when checking whether the repository exists. --- pym/portage/sync/modules/git/git.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py index b97d501..02da037 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -36,7 +36,7 @@ class GitSync(SyncBase): if not os.path.exists(self.repo.location): return False - exitcode = portage.process.spawn_bash(cd %s ; git rev-parse %\ + exitcode = portage.process.spawn_bash(cd %s ; git rev-parse 2/dev/null %\ (portage._shell_quote(self.repo.location),), **portage._native_kwargs(self.spawn_kwargs)) if exitcode == 128: Why don't we just skip the git rev-parse call entirely, if not os.path.isdir(os.path.join(self.repo.location, .git))? I don't know ;). I guess the current magic is more 'correct', i.e. distinguishes broken repo. Of course, it all will probably fall apart if it's broken but...! Well, looking at the git-rev-parse man page, I'm wondering if it's an undocumented feature that it works without any arguments. Maybe we should use something like this instead: [ -z $(git rev-parse --show-prefix 2/dev/null || echo fail) ] This will only return 0 if the current working directory is a valid git repo (versus a parent directory). -- Thanks, Zac
Re: [gentoo-portage-dev] [PATCH] Default MAKEOPTS to -j(ncpus+1) when unset
On 2015-01-17 23:48, Zac Medico wrote: Actually, Arfrever tells me that the multiprocessing module is not available if python is built without threading support. So, we need to handle the ImportError and either do nothing or parse /proc/cpuinfo or something like that. Feel free to borrow/steal/copy the relevant methods from snakeoil.process since we parse /proc/cpuinfo there probably how you want. Patches/pull reqs welcome if you have improvements. Thanks, Tim pgpIcuXDxIxBS.pgp Description: PGP signature
[gentoo-portage-dev] [PATCH] More = atoms for autounmask USE changes (536392)
When checking for packages that will be matched by an autounmask USE change, account for package visibility (masking), so that we can generate more = atoms (as opposed to = atoms that only match very specific versions). Don't do this for keyword or mask changes, since that may cause undesired versions to be unmasked! X-Gentoo-Bug: 536392 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=536392 --- pym/_emerge/depgraph.py | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 1431779..3e9bfdd 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -7741,7 +7741,7 @@ class depgraph(object): pretend = --pretend in self._frozen_config.myopts enter_invalid = '--ask-enter-invalid' in self._frozen_config.myopts - def check_if_latest(pkg): + def check_if_latest(pkg, check_visibility=False): is_latest = True is_latest_in_slot = True dbs = self._dynamic_config._filtered_trees[pkg.root][dbs] @@ -7749,6 +7749,9 @@ class depgraph(object): for db, pkg_type, built, installed, db_keys in dbs: for other_pkg in self._iter_match_pkgs(root_config, pkg_type, Atom(pkg.cp)): + if (check_visibility and + not self._pkg_visibility_check(other_pkg)): + continue if other_pkg.cp != pkg.cp: # old-style PROVIDE virtual means there are no # normal matches for this pkg_type @@ -7848,7 +7851,13 @@ class depgraph(object): root = pkg.root roots.add(root) use_changes_msg.setdefault(root, []) - is_latest, is_latest_in_slot = check_if_latest(pkg) + # NOTE: For USE changes, call check_if_latest with + # check_visibility=True, since we want to generate + # a = atom if possible. Don't do this for keyword + # or mask changes, since that may cause undesired + # versions to be unmasked! See bug #536392. + is_latest, is_latest_in_slot = check_if_latest( + pkg, check_visibility=True) changes = needed_use_config_change[1] adjustments = [] for flag, state in changes.items(): -- 2.0.5
[gentoo-portage-dev] [PATCH] Default MAKEOPTS to -j(ncpus+1) when unset
Default MAKEOPTS job number to (number of CPUs + 1) when it is not provided in the ebuild environment. Suggested-By: Daniel Robbins drobb...@funtoo.org --- pym/portage/package/ebuild/doebuild.py | 8 +++- pym/portage/util/cpuinfo.py| 19 +++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 pym/portage/util/cpuinfo.py diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py index bf97660..f43dddc 100644 --- a/pym/portage/package/ebuild/doebuild.py +++ b/pym/portage/package/ebuild/doebuild.py @@ -1,4 +1,4 @@ -# Copyright 2010-2013 Gentoo Foundation +# Copyright 2010-2015 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from __future__ import unicode_literals @@ -66,6 +66,7 @@ from portage.package.ebuild.prepare_build_dirs import prepare_build_dirs from portage.util import apply_recursive_permissions, \ apply_secpass_permissions, noiselimit, normalize_path, \ writemsg, writemsg_stdout, write_atomic +from portage.util.cpuinfo import get_cpu_count from portage.util.lafilefixer import rewrite_lafile from portage.versions import _pkgsplit from _emerge.BinpkgEnvExtractor import BinpkgEnvExtractor @@ -463,6 +464,11 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None, mysettings[PATH] = os.path.join(os.sep, eprefix_lstrip, usr, libdir, ccache, bin) + : + mysettings[PATH] + if 'MAKEOPTS' not in mysettings: + nproc = get_cpu_count() + if nproc: + mysettings['MAKEOPTS'] = '-j%d' % (nproc + 1) + if not eapi_exports_KV(eapi): # Discard KV for EAPIs that don't support it. Cached KV is restored # from the backupenv whenever config.reset() is called. diff --git a/pym/portage/util/cpuinfo.py b/pym/portage/util/cpuinfo.py new file mode 100644 index 000..157e2e7 --- /dev/null +++ b/pym/portage/util/cpuinfo.py @@ -0,0 +1,19 @@ +# Copyright 2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +__all__ = ['get_cpu_count'] + +import multiprocessing + + +def get_cpu_count(): + + Try to obtain the number of CPUs available. + + @return: Number of CPUs or None if unable to obtain. + + + try: + return multiprocessing.cpu_count() + except NotImplementedError: + return None -- 2.2.1
[gentoo-portage-dev] [PATCH] compression_probe: support lz4, lzip, lzop
--- pym/portage/util/compression_probe.py | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pym/portage/util/compression_probe.py b/pym/portage/util/compression_probe.py index 1dc3547..74f74b1 100644 --- a/pym/portage/util/compression_probe.py +++ b/pym/portage/util/compression_probe.py @@ -14,14 +14,22 @@ from portage.exception import FileNotFound, PermissionDenied _decompressors = { bzip2: ${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d}, gzip: gzip -d, + lz4: lz4 -d, + lzip: lzip -d, + lzop: lzop -d, xz: xz -d, } _compression_re = re.compile(b'^(' + b'(?Pbzip2\x42\x5a\x68\x39)|' + b'(?Pgzip\x1f\x8b)|' + + b'(?Plz4(?:\x04\x22\x4d\x18|\x02\x21\x4c\x18))|' + + b'(?PlzipLZIP)|' + + b'(?Plzop\x89LZO\x00\x0d\x0a\x1a\x0a)|' + b'(?Pxz\xfd\x37\x7a\x58\x5a\x00))') +_max_compression_re_len = 9 + def compression_probe(f): Identify the compression type of a file. Returns one of the @@ -29,6 +37,9 @@ def compression_probe(f): bzip2 gzip + lz4 + lzip + lzop xz @param f: a file path, or file-like object @@ -59,7 +70,7 @@ def compression_probe(f): def _compression_probe_file(f): - m = _compression_re.match(f.read(6)) + m = _compression_re.match(f.read(_max_compression_re_len)) if m is not None: for k, v in m.groupdict().items(): if v is not None: -- 2.2.1
[gentoo-portage-dev] [PATCH] sync: support sync-clone-depth for DVCS-es (git --depth)
Support sync-clone-depth with the default set to 1. This allows the user to reduce the number of historical commits fetched along with the repository (git --depth). --- man/portage.5 | 4 pym/portage/repository/config.py| 19 ++- pym/portage/sync/modules/git/git.py | 6 +- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/man/portage.5 b/man/portage.5 index f0b0e20..3fb511c 100644 --- a/man/portage.5 +++ b/man/portage.5 @@ -903,6 +903,10 @@ since operations performed by these tools are inherently .B priority Specifies priority of given repository. .TP +.B sync\-clone\-depth +Specifies clone depth to use for DVCS repositories. Defaults to 1 (only +the newest commit). If set to 0, the depth is unlimited. +.TP .B sync\-cvs\-repo Specifies CVS repository. .TP diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py index 7e17e02..2c4ce8a 100644 --- a/pym/portage/repository/config.py +++ b/pym/portage/repository/config.py @@ -88,7 +88,8 @@ class RepoConfig(object): 'profile_formats', 'sign_commit', 'sign_manifest', 'sync_cvs_repo', 'sync_type', 'sync_umask', 'sync_uri', 'sync_user', 'thin_manifest', 'update_changelog', 'user_location', '_eapis_banned', - '_eapis_deprecated', '_masters_orig') + '_eapis_deprecated', '_masters_orig', + 'sync_clone_depth') def __init__(self, name, repo_opts, local_config=True): Build a RepoConfig with options in repo_opts @@ -176,6 +177,21 @@ class RepoConfig(object): auto_sync = auto_sync.strip().lower() self.auto_sync = auto_sync + sync_clone_depth = None + if self.sync_type in ('git',): + sync_clone_depth = repo_opts.get('sync-clone-depth') + if sync_clone_depth is not None: + try: + sync_clone_depth = int(sync_clone_depth) + except ValueError: + sync_clone_depth = None + else: + if sync_clone_depth == 0: + sync_clone_depth = None + else: + sync_clone_depth = 1 + self.sync_clone_depth = sync_clone_depth + # Not implemented. format = repo_opts.get('format') if format is not None: @@ -489,6 +505,7 @@ class RepoConfigLoader(object): for k in ('aliases', 'auto_sync', 'eclass_overrides', 'force', 'masters', 'priority', 'sync_cvs_repo', 'sync_type', 'sync_umask', 'sync_uri', 'sync_user', + 'sync_clone_depth', ): v = getattr(repos_conf_opts, k, None) if v is not None: diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py index 35943dd..b97d501 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -63,9 +63,13 @@ class GitSync(SyncBase): sync_uri = self.repo.sync_uri if sync_uri.startswith(file://): sync_uri = sync_uri[6:] - exitcode = portage.process.spawn_bash(cd %s ; %s clone %s . % \ + depth_arg = '' + if self.repo.sync_clone_depth is not None: + depth_arg = '--depth %d ' % self.repo.sync_clone_depth + exitcode = portage.process.spawn_bash(cd %s ; %s clone %s%s . % \ (portage._shell_quote(self.repo.location), self.bin_command, + depth_arg, portage._shell_quote(sync_uri)), **portage._native_kwargs(self.spawn_kwargs)) if exitcode != os.EX_OK: -- 2.2.1
[gentoo-portage-dev] [PATCH] bin/eapi.sh: default to EAPI=0 when EAPI is unset
Observed as a breakage on binutils ebuilds: ERROR: sys-devel/binutils-2.24-r3::gentoo failed (depend phase): use() calls are not allowed in global scope Call stack: ebuild.sh, line 584: Called source 'binutils-2.24-r3.ebuild, ebuild.sh, line 7: Called inherit 'toolchain-binutils' ebuild.sh, line 280: Called __qa_source '/gentoo-32k/gentoo-x86/eclass/toolchain-binutils.e ebuild.sh, line 80: Called source '/gentoo-32k/gentoo-x86/eclass/toolchain-binutils.eclass toolchain-binutils.eclass, line 106: Called use 'multislot' ebuild.sh, line 47: Called die The specific snippet of code: # These functions die because calls to them during the depend phase Zac confirms it's a safe thing to use ${EAPI-0} here: ebuild.sh unsets the EAPI just before it sources the ebuild, and then it does this after it sources the ebuild: [ ${EAPI+set} = set ] || EAPI=0 So, for any code that is called while the ebuild is being sourced, using ${EAPI-0} would be correct. For consistency and defense against future copy/paste errors converted all uses of ${EAPI} for ${EAPI-0} in 'bin/eapi.sh'. Signed-off-by: Sergei Trofimovich sly...@gentoo.org --- bin/eapi.sh | 90 ++--- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/bin/eapi.sh b/bin/eapi.sh index 7e7b54b..f1c677e 100644 --- a/bin/eapi.sh +++ b/bin/eapi.sh @@ -5,189 +5,189 @@ # PHASES ___eapi_has_pkg_pretend() { - [[ ! ${1-${EAPI}} =~ ^(0|1|2|3)$ ]] + [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]] } ___eapi_has_src_prepare() { - [[ ! ${1-${EAPI}} =~ ^(0|1)$ ]] + [[ ! ${1-${EAPI-0}} =~ ^(0|1)$ ]] } ___eapi_has_src_configure() { - [[ ! ${1-${EAPI}} =~ ^(0|1)$ ]] + [[ ! ${1-${EAPI-0}} =~ ^(0|1)$ ]] } ___eapi_default_src_test_disables_parallel_jobs() { - [[ ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi)$ ]] + [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi)$ ]] } ___eapi_has_S_WORKDIR_fallback() { - [[ ${1-${EAPI}} =~ ^(0|1|2|3)$ ]] + [[ ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]] } # VARIABLES ___eapi_has_prefix_variables() { - [[ ! ${1-${EAPI}} =~ ^(0|1|2)$ || ${FEATURES} == * force-prefix * ]] + [[ ! ${1-${EAPI-0}} =~ ^(0|1|2)$ || ${FEATURES} == * force-prefix * ]] } ___eapi_has_HDEPEND() { - [[ ${1-${EAPI}} =~ ^(5-hdepend)$ ]] + [[ ${1-${EAPI-0}} =~ ^(5-hdepend)$ ]] } ___eapi_has_RDEPEND_DEPEND_fallback() { - [[ ${1-${EAPI}} =~ ^(0|1|2|3)$ ]] + [[ ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]] } # HELPERS PRESENCE ___eapi_has_dohard() { - [[ ${1-${EAPI}} =~ ^(0|1|2|3)$ ]] + [[ ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]] } ___eapi_has_dosed() { - [[ ${1-${EAPI}} =~ ^(0|1|2|3)$ ]] + [[ ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]] } ___eapi_has_einstall() { - [[ ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]] + [[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]] } ___eapi_has_dohtml_deprecated() { - [[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]] + [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]] } ___eapi_has_docompress() { - [[ ! ${1-${EAPI}} =~ ^(0|1|2|3)$ ]] + [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]] } ___eapi_has_nonfatal() { - [[ ! ${1-${EAPI}} =~ ^(0|1|2|3)$ ]] + [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3)$ ]] } ___eapi_has_doheader() { - [[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi)$ ]] + [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi)$ ]] } ___eapi_has_usex() { - [[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi)$ ]] + [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi)$ ]] } ___eapi_has_get_libdir() { - [[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]] + [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]] } ___eapi_has_einstalldocs() { - [[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]] + [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]] } ___eapi_has_eapply() { - [[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]] + [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]] } ___eapi_has_eapply_user() { - [[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]] + [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]] } ___eapi_has_in_iuse() { - [[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]] + [[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]] } ___eapi_has_master_repositories() { - [[
[gentoo-portage-dev] [PATCH] git sync: silence 'git rev-parse' errors
Discard the git-rev-parse error output to avoid 'fatal: Not a git repository [...]' errors when checking whether the repository exists. --- pym/portage/sync/modules/git/git.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py index b97d501..02da037 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -36,7 +36,7 @@ class GitSync(SyncBase): if not os.path.exists(self.repo.location): return False - exitcode = portage.process.spawn_bash(cd %s ; git rev-parse %\ + exitcode = portage.process.spawn_bash(cd %s ; git rev-parse 2/dev/null %\ (portage._shell_quote(self.repo.location),), **portage._native_kwargs(self.spawn_kwargs)) if exitcode == 128: -- 2.2.1
[gentoo-portage-dev] [PATCH] sync: fix module_names enumeration
Fix module_names enumeration to consider all modules. Before, the first module on the list was omitted ('cvs' in this case). Another thing is, the CVS module is completely, utterly and inevitably broken. And the whole syncing thing is a great pile of terribly mis-designed, unnecessarily complex code which can't work unless it is worked around like git module does... --- pym/portage/sync/controller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py index 9001298..3d217db 100644 --- a/pym/portage/sync/controller.py +++ b/pym/portage/sync/controller.py @@ -119,7 +119,7 @@ class SyncManager(object): self.callback = callback or self._sync_callback self.repo = repo self.exitcode = 1 - if repo.sync_type in self.module_names[1:]: + if repo.sync_type in self.module_names: tasks = [self.module_controller.get_class(repo.sync_type)] else: msg = \n%s: Sync module '%s' is not an installed/known type'\n \ -- 2.2.1