[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/
commit: 932fa3f8295dcfb0bdbf3762161940d44d19d395 Author: Zac Medico gentoo org> AuthorDate: Tue Oct 21 01:13:45 2014 + Commit: Brian Dolbec gmail com> CommitDate: Thu Dec 4 19:56:35 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=932fa3f8 Remove obsolete git_sync_timestamps function. This function is no longer needed since we switched to the md5-cache format which does not use timestamps. --- pym/portage/sync/modules/git/git.py| 8 +- pym/portage/sync/modules/git/timestamps.py | 154 - 2 files changed, 1 insertion(+), 161 deletions(-) diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py index 5e0e5df..d8c5a32 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -10,7 +10,6 @@ from portage.output import create_color_func good = create_color_func("GOOD") bad = create_color_func("BAD") warn = create_color_func("WARN") -from .timestamps import git_sync_timestamps from portage.sync.syncbase import SyncBase @@ -116,9 +115,4 @@ class GitSync(SyncBase): # Reload the whole config from scratch. settings, trees, mtimedb = load_emerge_config(emerge_config=emerge_config) adjust_configs(emerge_config.opts, emerge_config.trees) - portdb = trees[settings['EROOT']]['porttree'].dbapi - updatecache_flg = False - exitcode = git_sync_timestamps(portdb, location) - if exitcode == os.EX_OK: - updatecache_flg = True - return (exitcode, updatecache_flg) + return (os.EX_OK, True) diff --git a/pym/portage/sync/modules/git/timestamps.py b/pym/portage/sync/modules/git/timestamps.py deleted file mode 100644 index 5e44845..000 --- a/pym/portage/sync/modules/git/timestamps.py +++ /dev/null @@ -1,154 +0,0 @@ -# Copyright 1999-2014 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -import logging -import stat -import subprocess - - -import portage -from portage import os -from portage import _unicode_decode -from portage.util import writemsg_level -from portage.cache.cache_errors import CacheError - - -def git_sync_timestamps(portdb, portdir): - """ - Since git doesn't preserve timestamps, synchronize timestamps between - entries and ebuilds/eclasses. Assume the cache has the correct timestamp - for a given file as long as the file in the working tree is not modified - (relative to HEAD). - """ - - cache_db = portdb._pregen_auxdb.get(portdir) - - try: - if cache_db is None: - # portdbapi does not populate _pregen_auxdb - # when FEATURES=metadata-transfer is enabled - cache_db = portdb._create_pregen_cache(portdir) - except CacheError as e: - writemsg_level("!!! Unable to instantiate cache: %s\n" % (e,), - level=logging.ERROR, noiselevel=-1) - return 1 - - if cache_db is None: - return os.EX_OK - - if cache_db.validation_chf != 'mtime': - # newer formats like md5-dict do not require mtime sync - return os.EX_OK - - writemsg_level(">>> Synchronizing timestamps...\n") - - ec_dir = os.path.join(portdir, "eclass") - try: - ec_names = set(f[:-7] for f in os.listdir(ec_dir) \ - if f.endswith(".eclass")) - except OSError as e: - writemsg_level("!!! Unable to list eclasses: %s\n" % (e,), - level=logging.ERROR, noiselevel=-1) - return 1 - - args = [portage.const.BASH_BINARY, "-c", - "cd %s && git diff-index --name-only --diff-filter=M HEAD" % \ - portage._shell_quote(portdir)] - proc = subprocess.Popen(args, stdout=subprocess.PIPE) - modified_files = set(_unicode_decode(l).rstrip("\n") for l in proc.stdout) - rval = proc.wait() - proc.stdout.close() - if rval != os.EX_OK: - return rval - - modified_eclasses = set(ec for ec in ec_names \ - if os.path.join("eclass", ec + ".eclass") in modified_files) - - updated_ec_mtimes = {} - - for cpv in cache_db: - cpv_split = portage.catpkgsplit(cpv) - if cpv_split is None: - writemsg_level("!!! Invalid cache entry: %s\n" % (cpv,), - level=logging.ERROR, noiselevel=-1) - continue - - cat, pn, ver, rev = cpv_split - cat, pf = portage.catsplit(cpv) - relative_eb_path = os.path.join(cat, pn, pf + ".ebuild") - if relative_eb_path in modified_files: - continue - - try: - cach
[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/
commit: 92c612d743907c89532247298f95cc64d956548a Author: Zac Medico gentoo org> AuthorDate: Wed Oct 22 11:01:03 2014 + Commit: Brian Dolbec gmail com> CommitDate: Thu Dec 4 19:56:35 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=92c612d7 GitSync: support file:// sync-uri This will be useful for unit tests that will sync from a local file:// sync-uri. --- pym/portage/sync/modules/git/git.py | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py index 7c28139..35943dd 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -60,10 +60,13 @@ class GitSync(SyncBase): msg = ">>> Cloning git repository from upstream into %s..." % self.repo.location self.logger(self.xterm_titles, msg) writemsg_level(msg + "\n") + 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 ." % \ (portage._shell_quote(self.repo.location), self.bin_command, - portage._shell_quote(self.repo.sync_uri)), + portage._shell_quote(sync_uri)), **portage._native_kwargs(self.spawn_kwargs)) if exitcode != os.EX_OK: msg = "!!! git clone error in %s" % self.repo.location
[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/
commit: 4514e80a40525dd87d84381e8869a5cd78b3f454 Author: Zac Medico gentoo org> AuthorDate: Tue Oct 21 01:49:35 2014 + Commit: Brian Dolbec gmail com> CommitDate: Thu Dec 4 19:56:35 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=4514e80a git sync: remove unneeded post_sync None of the remaining post_sync code is really needed. Also, fix indent of return near the end of the _sync method. --- pym/portage/sync/modules/git/git.py | 18 ++ 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py index d8c5a32..7c28139 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -69,11 +69,11 @@ class GitSync(SyncBase): msg = "!!! git clone error in %s" % self.repo.location self.logger(self.xterm_titles, msg) writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1) - return (exitcode, False) + return (exitcode, False) msg = ">>> Git clone successful" self.logger(self.xterm_titles, msg) writemsg_level(msg + "\n") - return self.post_sync(portdb, self.repo.location, emerge_config) + return (os.EX_OK, True) def _sync(self): @@ -101,18 +101,4 @@ class GitSync(SyncBase): msg = ">>> Git pull successful: %s" % self.repo.location self.logger(self.xterm_titles, msg) writemsg_level(msg + "\n") - return self.post_sync(portdb, self.repo.location, emerge_config) - - - def post_sync(self, portdb, location, emerge_config): - '''repo.sync_type == "git": - # NOTE: Do this after reloading the config, in case - # it did not exist prior to sync, so that the config - # and portdb properly account for its existence. - ''' - # avoid circular import for now - from _emerge.actions import load_emerge_config, adjust_configs - # Reload the whole config from scratch. - settings, trees, mtimedb = load_emerge_config(emerge_config=emerge_config) - adjust_configs(emerge_config.opts, emerge_config.trees) return (os.EX_OK, True)
[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/
commit: 3459c877af225a28658f09cb934d615d4d5ae694 Author: Zac Medico gentoo org> AuthorDate: Tue Oct 21 01:49:35 2014 + Commit: Michał Górny gentoo org> CommitDate: Mon Dec 1 21:49:41 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3459c877 git sync: remove unneeded post_sync None of the remaining post_sync code is really needed. Also, fix indent of return near the end of the _sync method. --- pym/portage/sync/modules/git/git.py | 18 ++ 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py index d8c5a32..7c28139 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -69,11 +69,11 @@ class GitSync(SyncBase): msg = "!!! git clone error in %s" % self.repo.location self.logger(self.xterm_titles, msg) writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1) - return (exitcode, False) + return (exitcode, False) msg = ">>> Git clone successful" self.logger(self.xterm_titles, msg) writemsg_level(msg + "\n") - return self.post_sync(portdb, self.repo.location, emerge_config) + return (os.EX_OK, True) def _sync(self): @@ -101,18 +101,4 @@ class GitSync(SyncBase): msg = ">>> Git pull successful: %s" % self.repo.location self.logger(self.xterm_titles, msg) writemsg_level(msg + "\n") - return self.post_sync(portdb, self.repo.location, emerge_config) - - - def post_sync(self, portdb, location, emerge_config): - '''repo.sync_type == "git": - # NOTE: Do this after reloading the config, in case - # it did not exist prior to sync, so that the config - # and portdb properly account for its existence. - ''' - # avoid circular import for now - from _emerge.actions import load_emerge_config, adjust_configs - # Reload the whole config from scratch. - settings, trees, mtimedb = load_emerge_config(emerge_config=emerge_config) - adjust_configs(emerge_config.opts, emerge_config.trees) return (os.EX_OK, True)
[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/
commit: 883f7ceb8b30f75d882e94074a3a3411875f6c31 Author: Zac Medico gentoo org> AuthorDate: Wed Oct 22 11:01:03 2014 + Commit: Michał Górny gentoo org> CommitDate: Mon Dec 1 21:49:42 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=883f7ceb GitSync: support file:// sync-uri This will be useful for unit tests that will sync from a local file:// sync-uri. --- pym/portage/sync/modules/git/git.py | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py index 7c28139..35943dd 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -60,10 +60,13 @@ class GitSync(SyncBase): msg = ">>> Cloning git repository from upstream into %s..." % self.repo.location self.logger(self.xterm_titles, msg) writemsg_level(msg + "\n") + 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 ." % \ (portage._shell_quote(self.repo.location), self.bin_command, - portage._shell_quote(self.repo.sync_uri)), + portage._shell_quote(sync_uri)), **portage._native_kwargs(self.spawn_kwargs)) if exitcode != os.EX_OK: msg = "!!! git clone error in %s" % self.repo.location
[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/
commit: bd30c829d20bb50bfcab3faa99261154281f3953 Author: Zac Medico gentoo org> AuthorDate: Tue Oct 21 01:13:45 2014 + Commit: Michał Górny gentoo org> CommitDate: Mon Dec 1 21:49:41 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=bd30c829 Remove obsolete git_sync_timestamps function. This function is no longer needed since we switched to the md5-cache format which does not use timestamps. --- pym/portage/sync/modules/git/git.py| 8 +- pym/portage/sync/modules/git/timestamps.py | 154 - 2 files changed, 1 insertion(+), 161 deletions(-) diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py index 5e0e5df..d8c5a32 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -10,7 +10,6 @@ from portage.output import create_color_func good = create_color_func("GOOD") bad = create_color_func("BAD") warn = create_color_func("WARN") -from .timestamps import git_sync_timestamps from portage.sync.syncbase import SyncBase @@ -116,9 +115,4 @@ class GitSync(SyncBase): # Reload the whole config from scratch. settings, trees, mtimedb = load_emerge_config(emerge_config=emerge_config) adjust_configs(emerge_config.opts, emerge_config.trees) - portdb = trees[settings['EROOT']]['porttree'].dbapi - updatecache_flg = False - exitcode = git_sync_timestamps(portdb, location) - if exitcode == os.EX_OK: - updatecache_flg = True - return (exitcode, updatecache_flg) + return (os.EX_OK, True) diff --git a/pym/portage/sync/modules/git/timestamps.py b/pym/portage/sync/modules/git/timestamps.py deleted file mode 100644 index 5e44845..000 --- a/pym/portage/sync/modules/git/timestamps.py +++ /dev/null @@ -1,154 +0,0 @@ -# Copyright 1999-2014 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -import logging -import stat -import subprocess - - -import portage -from portage import os -from portage import _unicode_decode -from portage.util import writemsg_level -from portage.cache.cache_errors import CacheError - - -def git_sync_timestamps(portdb, portdir): - """ - Since git doesn't preserve timestamps, synchronize timestamps between - entries and ebuilds/eclasses. Assume the cache has the correct timestamp - for a given file as long as the file in the working tree is not modified - (relative to HEAD). - """ - - cache_db = portdb._pregen_auxdb.get(portdir) - - try: - if cache_db is None: - # portdbapi does not populate _pregen_auxdb - # when FEATURES=metadata-transfer is enabled - cache_db = portdb._create_pregen_cache(portdir) - except CacheError as e: - writemsg_level("!!! Unable to instantiate cache: %s\n" % (e,), - level=logging.ERROR, noiselevel=-1) - return 1 - - if cache_db is None: - return os.EX_OK - - if cache_db.validation_chf != 'mtime': - # newer formats like md5-dict do not require mtime sync - return os.EX_OK - - writemsg_level(">>> Synchronizing timestamps...\n") - - ec_dir = os.path.join(portdir, "eclass") - try: - ec_names = set(f[:-7] for f in os.listdir(ec_dir) \ - if f.endswith(".eclass")) - except OSError as e: - writemsg_level("!!! Unable to list eclasses: %s\n" % (e,), - level=logging.ERROR, noiselevel=-1) - return 1 - - args = [portage.const.BASH_BINARY, "-c", - "cd %s && git diff-index --name-only --diff-filter=M HEAD" % \ - portage._shell_quote(portdir)] - proc = subprocess.Popen(args, stdout=subprocess.PIPE) - modified_files = set(_unicode_decode(l).rstrip("\n") for l in proc.stdout) - rval = proc.wait() - proc.stdout.close() - if rval != os.EX_OK: - return rval - - modified_eclasses = set(ec for ec in ec_names \ - if os.path.join("eclass", ec + ".eclass") in modified_files) - - updated_ec_mtimes = {} - - for cpv in cache_db: - cpv_split = portage.catpkgsplit(cpv) - if cpv_split is None: - writemsg_level("!!! Invalid cache entry: %s\n" % (cpv,), - level=logging.ERROR, noiselevel=-1) - continue - - cat, pn, ver, rev = cpv_split - cat, pf = portage.catsplit(cpv) - relative_eb_path = os.path.join(cat, pn, pf + ".ebuild") - if relative_eb_path in modified_files: - continue - - try: - cac
[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/
commit: b1d34a76a90edeb9839e3004ee2871b716e8965a Author: Zac Medico gentoo org> AuthorDate: Wed Oct 22 11:01:03 2014 + Commit: Zac Medico gentoo org> CommitDate: Wed Oct 22 11:01:03 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b1d34a76 GitSync: support file:// sync-uri This will be useful for unit tests that will sync from a local file:// sync-uri. --- pym/portage/sync/modules/git/git.py | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py index 7c28139..35943dd 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -60,10 +60,13 @@ class GitSync(SyncBase): msg = ">>> Cloning git repository from upstream into %s..." % self.repo.location self.logger(self.xterm_titles, msg) writemsg_level(msg + "\n") + 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 ." % \ (portage._shell_quote(self.repo.location), self.bin_command, - portage._shell_quote(self.repo.sync_uri)), + portage._shell_quote(sync_uri)), **portage._native_kwargs(self.spawn_kwargs)) if exitcode != os.EX_OK: msg = "!!! git clone error in %s" % self.repo.location
[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/
commit: 8902ca15d7b443a6fdfdc011eb968f2d10d2edbb Author: Zac Medico gentoo org> AuthorDate: Tue Oct 21 01:49:35 2014 + Commit: Zac Medico gentoo org> CommitDate: Tue Oct 21 05:04:08 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=8902ca15 git sync: remove unneeded post_sync None of the remaining post_sync code is really needed. Also, fix indent of return near the end of the _sync method. --- pym/portage/sync/modules/git/git.py | 18 ++ 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py index d8c5a32..7c28139 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -69,11 +69,11 @@ class GitSync(SyncBase): msg = "!!! git clone error in %s" % self.repo.location self.logger(self.xterm_titles, msg) writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1) - return (exitcode, False) + return (exitcode, False) msg = ">>> Git clone successful" self.logger(self.xterm_titles, msg) writemsg_level(msg + "\n") - return self.post_sync(portdb, self.repo.location, emerge_config) + return (os.EX_OK, True) def _sync(self): @@ -101,18 +101,4 @@ class GitSync(SyncBase): msg = ">>> Git pull successful: %s" % self.repo.location self.logger(self.xterm_titles, msg) writemsg_level(msg + "\n") - return self.post_sync(portdb, self.repo.location, emerge_config) - - - def post_sync(self, portdb, location, emerge_config): - '''repo.sync_type == "git": - # NOTE: Do this after reloading the config, in case - # it did not exist prior to sync, so that the config - # and portdb properly account for its existence. - ''' - # avoid circular import for now - from _emerge.actions import load_emerge_config, adjust_configs - # Reload the whole config from scratch. - settings, trees, mtimedb = load_emerge_config(emerge_config=emerge_config) - adjust_configs(emerge_config.opts, emerge_config.trees) return (os.EX_OK, True)
[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/
commit: 416a5e46c7ab108d24c65d8a89fcec31dcdf55f9 Author: Zac Medico gentoo org> AuthorDate: Tue Oct 21 01:13:45 2014 + Commit: Zac Medico gentoo org> CommitDate: Tue Oct 21 05:04:08 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=416a5e46 Remove obsolete git_sync_timestamps function. This function is no longer needed since we switched to the md5-cache format which does not use timestamps. --- pym/portage/sync/modules/git/git.py| 8 +- pym/portage/sync/modules/git/timestamps.py | 154 - 2 files changed, 1 insertion(+), 161 deletions(-) diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py index 5e0e5df..d8c5a32 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -10,7 +10,6 @@ from portage.output import create_color_func good = create_color_func("GOOD") bad = create_color_func("BAD") warn = create_color_func("WARN") -from .timestamps import git_sync_timestamps from portage.sync.syncbase import SyncBase @@ -116,9 +115,4 @@ class GitSync(SyncBase): # Reload the whole config from scratch. settings, trees, mtimedb = load_emerge_config(emerge_config=emerge_config) adjust_configs(emerge_config.opts, emerge_config.trees) - portdb = trees[settings['EROOT']]['porttree'].dbapi - updatecache_flg = False - exitcode = git_sync_timestamps(portdb, location) - if exitcode == os.EX_OK: - updatecache_flg = True - return (exitcode, updatecache_flg) + return (os.EX_OK, True) diff --git a/pym/portage/sync/modules/git/timestamps.py b/pym/portage/sync/modules/git/timestamps.py deleted file mode 100644 index 5e44845..000 --- a/pym/portage/sync/modules/git/timestamps.py +++ /dev/null @@ -1,154 +0,0 @@ -# Copyright 1999-2014 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -import logging -import stat -import subprocess - - -import portage -from portage import os -from portage import _unicode_decode -from portage.util import writemsg_level -from portage.cache.cache_errors import CacheError - - -def git_sync_timestamps(portdb, portdir): - """ - Since git doesn't preserve timestamps, synchronize timestamps between - entries and ebuilds/eclasses. Assume the cache has the correct timestamp - for a given file as long as the file in the working tree is not modified - (relative to HEAD). - """ - - cache_db = portdb._pregen_auxdb.get(portdir) - - try: - if cache_db is None: - # portdbapi does not populate _pregen_auxdb - # when FEATURES=metadata-transfer is enabled - cache_db = portdb._create_pregen_cache(portdir) - except CacheError as e: - writemsg_level("!!! Unable to instantiate cache: %s\n" % (e,), - level=logging.ERROR, noiselevel=-1) - return 1 - - if cache_db is None: - return os.EX_OK - - if cache_db.validation_chf != 'mtime': - # newer formats like md5-dict do not require mtime sync - return os.EX_OK - - writemsg_level(">>> Synchronizing timestamps...\n") - - ec_dir = os.path.join(portdir, "eclass") - try: - ec_names = set(f[:-7] for f in os.listdir(ec_dir) \ - if f.endswith(".eclass")) - except OSError as e: - writemsg_level("!!! Unable to list eclasses: %s\n" % (e,), - level=logging.ERROR, noiselevel=-1) - return 1 - - args = [portage.const.BASH_BINARY, "-c", - "cd %s && git diff-index --name-only --diff-filter=M HEAD" % \ - portage._shell_quote(portdir)] - proc = subprocess.Popen(args, stdout=subprocess.PIPE) - modified_files = set(_unicode_decode(l).rstrip("\n") for l in proc.stdout) - rval = proc.wait() - proc.stdout.close() - if rval != os.EX_OK: - return rval - - modified_eclasses = set(ec for ec in ec_names \ - if os.path.join("eclass", ec + ".eclass") in modified_files) - - updated_ec_mtimes = {} - - for cpv in cache_db: - cpv_split = portage.catpkgsplit(cpv) - if cpv_split is None: - writemsg_level("!!! Invalid cache entry: %s\n" % (cpv,), - level=logging.ERROR, noiselevel=-1) - continue - - cat, pn, ver, rev = cpv_split - cat, pf = portage.catsplit(cpv) - relative_eb_path = os.path.join(cat, pn, pf + ".ebuild") - if relative_eb_path in modified_files: - continue - - try: - cache
[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/
commit: 6bb883c7ef60f2ff6c036becd796dd86dc025b72 Author: Zac Medico gentoo org> AuthorDate: Tue Oct 21 01:49:35 2014 + Commit: Zac Medico gentoo org> CommitDate: Tue Oct 21 01:49:35 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=6bb883c7 git sync: remove unneeded post_sync None of the remaining post_sync code is really needed. Also, fix indent of return near the end of the _sync method. --- pym/portage/sync/modules/git/git.py | 18 ++ 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py index d8c5a32..7c28139 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -69,11 +69,11 @@ class GitSync(SyncBase): msg = "!!! git clone error in %s" % self.repo.location self.logger(self.xterm_titles, msg) writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1) - return (exitcode, False) + return (exitcode, False) msg = ">>> Git clone successful" self.logger(self.xterm_titles, msg) writemsg_level(msg + "\n") - return self.post_sync(portdb, self.repo.location, emerge_config) + return (os.EX_OK, True) def _sync(self): @@ -101,18 +101,4 @@ class GitSync(SyncBase): msg = ">>> Git pull successful: %s" % self.repo.location self.logger(self.xterm_titles, msg) writemsg_level(msg + "\n") - return self.post_sync(portdb, self.repo.location, emerge_config) - - - def post_sync(self, portdb, location, emerge_config): - '''repo.sync_type == "git": - # NOTE: Do this after reloading the config, in case - # it did not exist prior to sync, so that the config - # and portdb properly account for its existence. - ''' - # avoid circular import for now - from _emerge.actions import load_emerge_config, adjust_configs - # Reload the whole config from scratch. - settings, trees, mtimedb = load_emerge_config(emerge_config=emerge_config) - adjust_configs(emerge_config.opts, emerge_config.trees) return (os.EX_OK, True)
[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/
commit: af729048d35d3c7bde879c9d04d96cbd786798e2 Author: Zac Medico gentoo org> AuthorDate: Tue Oct 21 01:13:45 2014 + Commit: Zac Medico gentoo org> CommitDate: Tue Oct 21 01:13:45 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=af729048 Remove obsolete git_sync_timestamps function. This function is no longer needed since we switched to the md5-cache format which does not use timestamps. --- pym/portage/sync/modules/git/git.py| 8 +- pym/portage/sync/modules/git/timestamps.py | 154 - 2 files changed, 1 insertion(+), 161 deletions(-) diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py index 5e0e5df..d8c5a32 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -10,7 +10,6 @@ from portage.output import create_color_func good = create_color_func("GOOD") bad = create_color_func("BAD") warn = create_color_func("WARN") -from .timestamps import git_sync_timestamps from portage.sync.syncbase import SyncBase @@ -116,9 +115,4 @@ class GitSync(SyncBase): # Reload the whole config from scratch. settings, trees, mtimedb = load_emerge_config(emerge_config=emerge_config) adjust_configs(emerge_config.opts, emerge_config.trees) - portdb = trees[settings['EROOT']]['porttree'].dbapi - updatecache_flg = False - exitcode = git_sync_timestamps(portdb, location) - if exitcode == os.EX_OK: - updatecache_flg = True - return (exitcode, updatecache_flg) + return (os.EX_OK, True) diff --git a/pym/portage/sync/modules/git/timestamps.py b/pym/portage/sync/modules/git/timestamps.py deleted file mode 100644 index 5e44845..000 --- a/pym/portage/sync/modules/git/timestamps.py +++ /dev/null @@ -1,154 +0,0 @@ -# Copyright 1999-2014 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -import logging -import stat -import subprocess - - -import portage -from portage import os -from portage import _unicode_decode -from portage.util import writemsg_level -from portage.cache.cache_errors import CacheError - - -def git_sync_timestamps(portdb, portdir): - """ - Since git doesn't preserve timestamps, synchronize timestamps between - entries and ebuilds/eclasses. Assume the cache has the correct timestamp - for a given file as long as the file in the working tree is not modified - (relative to HEAD). - """ - - cache_db = portdb._pregen_auxdb.get(portdir) - - try: - if cache_db is None: - # portdbapi does not populate _pregen_auxdb - # when FEATURES=metadata-transfer is enabled - cache_db = portdb._create_pregen_cache(portdir) - except CacheError as e: - writemsg_level("!!! Unable to instantiate cache: %s\n" % (e,), - level=logging.ERROR, noiselevel=-1) - return 1 - - if cache_db is None: - return os.EX_OK - - if cache_db.validation_chf != 'mtime': - # newer formats like md5-dict do not require mtime sync - return os.EX_OK - - writemsg_level(">>> Synchronizing timestamps...\n") - - ec_dir = os.path.join(portdir, "eclass") - try: - ec_names = set(f[:-7] for f in os.listdir(ec_dir) \ - if f.endswith(".eclass")) - except OSError as e: - writemsg_level("!!! Unable to list eclasses: %s\n" % (e,), - level=logging.ERROR, noiselevel=-1) - return 1 - - args = [portage.const.BASH_BINARY, "-c", - "cd %s && git diff-index --name-only --diff-filter=M HEAD" % \ - portage._shell_quote(portdir)] - proc = subprocess.Popen(args, stdout=subprocess.PIPE) - modified_files = set(_unicode_decode(l).rstrip("\n") for l in proc.stdout) - rval = proc.wait() - proc.stdout.close() - if rval != os.EX_OK: - return rval - - modified_eclasses = set(ec for ec in ec_names \ - if os.path.join("eclass", ec + ".eclass") in modified_files) - - updated_ec_mtimes = {} - - for cpv in cache_db: - cpv_split = portage.catpkgsplit(cpv) - if cpv_split is None: - writemsg_level("!!! Invalid cache entry: %s\n" % (cpv,), - level=logging.ERROR, noiselevel=-1) - continue - - cat, pn, ver, rev = cpv_split - cat, pf = portage.catsplit(cpv) - relative_eb_path = os.path.join(cat, pn, pf + ".ebuild") - if relative_eb_path in modified_files: - continue - - try: - cache
[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/, pym/portage/sync/modules/websync/, ...
commit: af6fa72adecf92d60a4d84f02d839da41e82fa33 Author: Brian Dolbec gentoo org> AuthorDate: Mon Apr 21 18:25:55 2014 + Commit: Brian Dolbec gmail com> CommitDate: Tue Sep 30 00:42:24 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=af6fa72a sync/modules/*: Remove unused func_parameters in module_spec --- pym/portage/sync/modules/cvs/__init__.py | 10 -- pym/portage/sync/modules/git/__init__.py | 10 -- pym/portage/sync/modules/rsync/__init__.py | 10 -- pym/portage/sync/modules/websync/__init__.py | 10 -- 4 files changed, 40 deletions(-) diff --git a/pym/portage/sync/modules/cvs/__init__.py b/pym/portage/sync/modules/cvs/__init__.py index e1e0920..fd3b12a 100644 --- a/pym/portage/sync/modules/cvs/__init__.py +++ b/pym/portage/sync/modules/cvs/__init__.py @@ -40,16 +40,6 @@ module_spec = { 'exists': 'Returns a boolean of whether the specified dir ' + 'exists and is a valid CVS repository', }, - 'func_parameters': { - 'kwargs': { - 'type': dict, - 'description': 'Standard python **kwargs parameter format' + - 'Please refer to the sync modules specs at ' + - '"https://wiki.gentoo.org:Project:Portage"; for details', - 'required-keys': ['options', 'settings', 'logger', 'repo', - 'xterm_titles', 'spawn_kwargs'], - }, - }, 'validate_config': CheckCVSConfig, } } diff --git a/pym/portage/sync/modules/git/__init__.py b/pym/portage/sync/modules/git/__init__.py index 593e95d..304142e 100644 --- a/pym/portage/sync/modules/git/__init__.py +++ b/pym/portage/sync/modules/git/__init__.py @@ -24,16 +24,6 @@ module_spec = { 'exists': 'Returns a boolean of whether the specified dir ' + 'exists and is a valid Git repository', }, - 'func_parameters': { - 'kwargs': { - 'type': dict, - 'description': 'Standard python **kwargs parameter format' + - 'Please refer to the sync modules specs at ' + - '"https://wiki.gentoo.org:Project:Portage"; for details', - 'required-keys': ['options', 'settings', 'logger', 'repo', - 'xterm_titles', 'spawn_kwargs'], - }, - }, 'validate_config': CheckSyncConfig, } } diff --git a/pym/portage/sync/modules/rsync/__init__.py b/pym/portage/sync/modules/rsync/__init__.py index ce1daa1..9e19d85 100644 --- a/pym/portage/sync/modules/rsync/__init__.py +++ b/pym/portage/sync/modules/rsync/__init__.py @@ -23,16 +23,6 @@ module_spec = { 'new': 'Creates the new repository at the specified location', 'exists': 'Returns a boolean if the specified directory exists', }, - 'func_parameters': { - 'kwargs': { - 'type': dict, - 'description': 'Standard python **kwargs parameter format' + - 'Please refer to the sync modules specs at ' + - '"https://wiki.gentoo.org:Project:Portage"; for details', - 'required-keys': ['options', 'settings', 'logger', 'repo', - 'xterm_titles', 'spawn_kwargs'], - }, - }, 'validate_config': CheckSyncConfig, } } diff --git a/pym/portage/sync/modules/websync/__init__.py b/pym/portage/sync/modules/websync/__init__.py index 6251535..e93ee10 100644 --- a/pym/portage/sync/modules/websync/__init__.py +++ b/pym/portage/sync/modules/websync/__init__.py @@ -42,16 +42,6 @@ module_spec = { 'exists': 'Returns a boolean of whether the specified dir ' + 'exists and is a valid repository', }, - 'func_parameters': { - 'kwargs': { -
[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/
commit: 3f95400ea090c4f915eedbfaa4052cbcbf78e275 Author: Brian Dolbec gentoo org> AuthorDate: Fri Mar 14 15:55:07 2014 + Commit: Brian Dolbec gmail com> CommitDate: Wed Sep 3 23:34:52 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3f95400e portage/sync/modules/git: Use SyncBase class. Use self.bin_command for the binary call. --- pym/portage/sync/modules/git/git.py | 56 ++--- 1 file changed, 8 insertions(+), 48 deletions(-) diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py index 6806ef3..5e0e5df 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -11,9 +11,10 @@ good = create_color_func("GOOD") bad = create_color_func("BAD") warn = create_color_func("WARN") from .timestamps import git_sync_timestamps +from portage.sync.syncbase import SyncBase -class GitSync(object): +class GitSync(SyncBase): '''Git sync class''' short_desc = "Perform sync operations on git based repositories" @@ -23,34 +24,8 @@ class GitSync(object): return "GitSync" - def can_progressbar(self, func): - return False - - def __init__(self): - self.options = None - self.settings = None - self.logger = None - self.repo = None - self.xterm_titles = None - - self.has_git = True - if portage.process.find_binary("git") is None: - msg = ["Command not found: git", - "Type \"emerge %s\" to enable git support." % portage.const.GIT_PACKAGE_ATOM] - for l in msg: - writemsg_level("!!! %s\n" % l, - level=logging.ERROR, noiselevel=-1) - self.has_git = False - - - def _kwargs(self, kwargs): - '''Sets internal variables from kwargs''' - self.options = kwargs.get('options', {}) - self.settings = self.options.get('settings', None) - self.logger = self.options.get('logger', None) - self.repo = self.options.get('repo', None) - self.xterm_titles = self.options.get('xterm_titles', False) + SyncBase.__init__(self, "git", portage.const.GIT_PACKAGE_ATOM) def exists(self, **kwargs): @@ -59,37 +34,22 @@ class GitSync(object): self._kwargs(kwargs) elif not self.repo: return False - spawn_kwargs = self.options.get('spawn_kwargs', None) if not os.path.exists(self.repo.location): return False exitcode = portage.process.spawn_bash("cd %s ; git rev-parse" %\ (portage._shell_quote(self.repo.location),), - **portage._native_kwargs(spawn_kwargs)) + **portage._native_kwargs(self.spawn_kwargs)) if exitcode == 128: return False return True - def sync(self, **kwargs): - '''Sync/Clone the repository''' - if kwargs: - self._kwargs(kwargs) - - if not self.has_git: - return (1, False) - - if not self.exists(): - return self.new() - return self._sync() - - def new(self, **kwargs): '''Do the initial clone of the repository''' if kwargs: self._kwargs(kwargs) emerge_config = self.options.get('emerge_config', None) - spawn_kwargs = self.options.get('spawn_kwargs', None) portdb = self.options.get('portdb', None) try: if not os.path.exists(self.repo.location): @@ -101,10 +61,11 @@ class GitSync(object): msg = ">>> Cloning git repository from upstream into %s..." % self.repo.location self.logger(self.xterm_titles, msg) writemsg_level(msg + "\n") - exitcode = portage.process.spawn_bash("cd %s ; git clone %s ." % \ + exitcode = portage.process.spawn_bash("cd %s ; %s clone %s ." % \ (portage._shell_quote(self.repo.location), + self.bin_command, portage._shell_quote(self.repo.sync_uri)), - **portage._native_kwargs(spawn_kwargs)) + **portage._native_kwargs(self.spawn_kwargs)) if exitcode != os.EX_OK: msg = "!!! git clone error in %s" % self.repo.location self.logger(self.xterm_titles, msg) @@ -125,7 +86,6 @@ class GitSync(object): # No kwargs call here; this is internal,
[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/
commit: 2c41472a5d3dd5c23326538776e9149a6f71935b Author: Brian Dolbec gentoo org> AuthorDate: Fri Mar 14 15:55:07 2014 + Commit: Brian Dolbec gmail com> CommitDate: Mon Jun 16 22:43:10 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2c41472a portage/sync/modules/git: Use SyncBase class. Use self.bin_command for the binary call. --- pym/portage/sync/modules/git/git.py | 56 ++--- 1 file changed, 8 insertions(+), 48 deletions(-) diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py index 6806ef3..5e0e5df 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -11,9 +11,10 @@ good = create_color_func("GOOD") bad = create_color_func("BAD") warn = create_color_func("WARN") from .timestamps import git_sync_timestamps +from portage.sync.syncbase import SyncBase -class GitSync(object): +class GitSync(SyncBase): '''Git sync class''' short_desc = "Perform sync operations on git based repositories" @@ -23,34 +24,8 @@ class GitSync(object): return "GitSync" - def can_progressbar(self, func): - return False - - def __init__(self): - self.options = None - self.settings = None - self.logger = None - self.repo = None - self.xterm_titles = None - - self.has_git = True - if portage.process.find_binary("git") is None: - msg = ["Command not found: git", - "Type \"emerge %s\" to enable git support." % portage.const.GIT_PACKAGE_ATOM] - for l in msg: - writemsg_level("!!! %s\n" % l, - level=logging.ERROR, noiselevel=-1) - self.has_git = False - - - def _kwargs(self, kwargs): - '''Sets internal variables from kwargs''' - self.options = kwargs.get('options', {}) - self.settings = self.options.get('settings', None) - self.logger = self.options.get('logger', None) - self.repo = self.options.get('repo', None) - self.xterm_titles = self.options.get('xterm_titles', False) + SyncBase.__init__(self, "git", portage.const.GIT_PACKAGE_ATOM) def exists(self, **kwargs): @@ -59,37 +34,22 @@ class GitSync(object): self._kwargs(kwargs) elif not self.repo: return False - spawn_kwargs = self.options.get('spawn_kwargs', None) if not os.path.exists(self.repo.location): return False exitcode = portage.process.spawn_bash("cd %s ; git rev-parse" %\ (portage._shell_quote(self.repo.location),), - **portage._native_kwargs(spawn_kwargs)) + **portage._native_kwargs(self.spawn_kwargs)) if exitcode == 128: return False return True - def sync(self, **kwargs): - '''Sync/Clone the repository''' - if kwargs: - self._kwargs(kwargs) - - if not self.has_git: - return (1, False) - - if not self.exists(): - return self.new() - return self._sync() - - def new(self, **kwargs): '''Do the initial clone of the repository''' if kwargs: self._kwargs(kwargs) emerge_config = self.options.get('emerge_config', None) - spawn_kwargs = self.options.get('spawn_kwargs', None) portdb = self.options.get('portdb', None) try: if not os.path.exists(self.repo.location): @@ -101,10 +61,11 @@ class GitSync(object): msg = ">>> Cloning git repository from upstream into %s..." % self.repo.location self.logger(self.xterm_titles, msg) writemsg_level(msg + "\n") - exitcode = portage.process.spawn_bash("cd %s ; git clone %s ." % \ + exitcode = portage.process.spawn_bash("cd %s ; %s clone %s ." % \ (portage._shell_quote(self.repo.location), + self.bin_command, portage._shell_quote(self.repo.sync_uri)), - **portage._native_kwargs(spawn_kwargs)) + **portage._native_kwargs(self.spawn_kwargs)) if exitcode != os.EX_OK: msg = "!!! git clone error in %s" % self.repo.location self.logger(self.xterm_titles, msg) @@ -125,7 +86,6 @@ class GitSync(object): # No kwargs call here; this is inter
[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/
commit: c0ede14b45be10fe2c2c1ba41986bef31e8fe37b Author: Brian Dolbec gentoo org> AuthorDate: Wed Feb 19 15:32:32 2014 + Commit: Brian Dolbec gmail com> CommitDate: Mon Jun 16 22:41:59 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c0ede14b Git Sync: fix missing %s in the success message. --- 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 741daf3..6806ef3 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -139,7 +139,7 @@ class GitSync(object): self.logger(self.xterm_titles, msg) writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1) return (exitcode, False) - msg = ">>> Git pull successful" % self.repo.location + msg = ">>> Git pull successful: %s" % self.repo.location self.logger(self.xterm_titles, msg) writemsg_level(msg + "\n") return self.post_sync(portdb, self.repo.location, emerge_config)
[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/
commit: faa2b6eec24d01093ce97d6efc8da65f5084c3af Author: Brian Dolbec gentoo org> AuthorDate: Fri Mar 14 15:55:07 2014 + Commit: Brian Dolbec gmail com> CommitDate: Mon Jun 16 15:36:56 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=faa2b6ee portage/sync/modules/git: Use SyncBase class. Use self.bin_command for the binary call. --- pym/portage/sync/modules/git/git.py | 56 ++--- 1 file changed, 8 insertions(+), 48 deletions(-) diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py index 6806ef3..5e0e5df 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -11,9 +11,10 @@ good = create_color_func("GOOD") bad = create_color_func("BAD") warn = create_color_func("WARN") from .timestamps import git_sync_timestamps +from portage.sync.syncbase import SyncBase -class GitSync(object): +class GitSync(SyncBase): '''Git sync class''' short_desc = "Perform sync operations on git based repositories" @@ -23,34 +24,8 @@ class GitSync(object): return "GitSync" - def can_progressbar(self, func): - return False - - def __init__(self): - self.options = None - self.settings = None - self.logger = None - self.repo = None - self.xterm_titles = None - - self.has_git = True - if portage.process.find_binary("git") is None: - msg = ["Command not found: git", - "Type \"emerge %s\" to enable git support." % portage.const.GIT_PACKAGE_ATOM] - for l in msg: - writemsg_level("!!! %s\n" % l, - level=logging.ERROR, noiselevel=-1) - self.has_git = False - - - def _kwargs(self, kwargs): - '''Sets internal variables from kwargs''' - self.options = kwargs.get('options', {}) - self.settings = self.options.get('settings', None) - self.logger = self.options.get('logger', None) - self.repo = self.options.get('repo', None) - self.xterm_titles = self.options.get('xterm_titles', False) + SyncBase.__init__(self, "git", portage.const.GIT_PACKAGE_ATOM) def exists(self, **kwargs): @@ -59,37 +34,22 @@ class GitSync(object): self._kwargs(kwargs) elif not self.repo: return False - spawn_kwargs = self.options.get('spawn_kwargs', None) if not os.path.exists(self.repo.location): return False exitcode = portage.process.spawn_bash("cd %s ; git rev-parse" %\ (portage._shell_quote(self.repo.location),), - **portage._native_kwargs(spawn_kwargs)) + **portage._native_kwargs(self.spawn_kwargs)) if exitcode == 128: return False return True - def sync(self, **kwargs): - '''Sync/Clone the repository''' - if kwargs: - self._kwargs(kwargs) - - if not self.has_git: - return (1, False) - - if not self.exists(): - return self.new() - return self._sync() - - def new(self, **kwargs): '''Do the initial clone of the repository''' if kwargs: self._kwargs(kwargs) emerge_config = self.options.get('emerge_config', None) - spawn_kwargs = self.options.get('spawn_kwargs', None) portdb = self.options.get('portdb', None) try: if not os.path.exists(self.repo.location): @@ -101,10 +61,11 @@ class GitSync(object): msg = ">>> Cloning git repository from upstream into %s..." % self.repo.location self.logger(self.xterm_titles, msg) writemsg_level(msg + "\n") - exitcode = portage.process.spawn_bash("cd %s ; git clone %s ." % \ + exitcode = portage.process.spawn_bash("cd %s ; %s clone %s ." % \ (portage._shell_quote(self.repo.location), + self.bin_command, portage._shell_quote(self.repo.sync_uri)), - **portage._native_kwargs(spawn_kwargs)) + **portage._native_kwargs(self.spawn_kwargs)) if exitcode != os.EX_OK: msg = "!!! git clone error in %s" % self.repo.location self.logger(self.xterm_titles, msg) @@ -125,7 +86,6 @@ class GitSync(object): # No kwargs call here; this is inter
[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/
commit: b4007bbb3a5cb25d4360c21c34bfb4e9928f9383 Author: Brian Dolbec gentoo org> AuthorDate: Wed Feb 19 15:32:32 2014 + Commit: Brian Dolbec gmail com> CommitDate: Mon Jun 16 15:36:55 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b4007bbb Git Sync: fix missing %s in the success message. --- 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 741daf3..6806ef3 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -139,7 +139,7 @@ class GitSync(object): self.logger(self.xterm_titles, msg) writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1) return (exitcode, False) - msg = ">>> Git pull successful" % self.repo.location + msg = ">>> Git pull successful: %s" % self.repo.location self.logger(self.xterm_titles, msg) writemsg_level(msg + "\n") return self.post_sync(portdb, self.repo.location, emerge_config)
[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/
commit: 7955f98073945624f0aba2f2f8dbbd1c0ce4e80e Author: Chris Reffett <2011creffett tjhsst edu> AuthorDate: Mon Feb 10 04:06:46 2014 + Commit: Brian Dolbec gmail com> CommitDate: Wed Apr 30 07:38:46 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7955f980 Update module spec for git --- pym/portage/sync/modules/git/__init__.py | 19 +++ 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/pym/portage/sync/modules/git/__init__.py b/pym/portage/sync/modules/git/__init__.py index 09de13d..4ceaa84 100644 --- a/pym/portage/sync/modules/git/__init__.py +++ b/pym/portage/sync/modules/git/__init__.py @@ -14,10 +14,21 @@ module_spec = { 'name': "git", 'class': "GitSync", 'description': __doc__, - 'functions': ['sync',], + 'functions': ['sync', 'new', 'exists'], 'func_desc': { - 'sync', 'Performs a git pull on the repository', - } - } + 'sync': 'Performs a git pull on the repository', + 'new': 'Creates the new repository at the specified location', + 'exists': 'Returns a boolean of whether the specified dir ' + + 'exists and is a valid Git repository', + }, + 'func_parameters': { + 'kwargs': { + 'type': dict, + 'description': 'Standard python **kwargs parameter format' + + 'Please refer to the sync modules specs at ' + + '"https://wiki.gentoo.org:Project:Portage"; for details', + }, + }, } } +}
[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/
commit: 533f07434f5cb2671e01f6c4225494e910f2154f Author: Brian Dolbec gentoo org> AuthorDate: Fri Mar 14 15:55:07 2014 + Commit: Brian Dolbec gmail com> CommitDate: Fri May 2 23:08:10 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=533f0743 portage/sync/modules/git: Use SyncBase class. Use self.bin_command for the binary call. --- pym/portage/sync/modules/git/git.py | 56 ++--- 1 file changed, 8 insertions(+), 48 deletions(-) diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py index 6806ef3..5e0e5df 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -11,9 +11,10 @@ good = create_color_func("GOOD") bad = create_color_func("BAD") warn = create_color_func("WARN") from .timestamps import git_sync_timestamps +from portage.sync.syncbase import SyncBase -class GitSync(object): +class GitSync(SyncBase): '''Git sync class''' short_desc = "Perform sync operations on git based repositories" @@ -23,34 +24,8 @@ class GitSync(object): return "GitSync" - def can_progressbar(self, func): - return False - - def __init__(self): - self.options = None - self.settings = None - self.logger = None - self.repo = None - self.xterm_titles = None - - self.has_git = True - if portage.process.find_binary("git") is None: - msg = ["Command not found: git", - "Type \"emerge %s\" to enable git support." % portage.const.GIT_PACKAGE_ATOM] - for l in msg: - writemsg_level("!!! %s\n" % l, - level=logging.ERROR, noiselevel=-1) - self.has_git = False - - - def _kwargs(self, kwargs): - '''Sets internal variables from kwargs''' - self.options = kwargs.get('options', {}) - self.settings = self.options.get('settings', None) - self.logger = self.options.get('logger', None) - self.repo = self.options.get('repo', None) - self.xterm_titles = self.options.get('xterm_titles', False) + SyncBase.__init__(self, "git", portage.const.GIT_PACKAGE_ATOM) def exists(self, **kwargs): @@ -59,37 +34,22 @@ class GitSync(object): self._kwargs(kwargs) elif not self.repo: return False - spawn_kwargs = self.options.get('spawn_kwargs', None) if not os.path.exists(self.repo.location): return False exitcode = portage.process.spawn_bash("cd %s ; git rev-parse" %\ (portage._shell_quote(self.repo.location),), - **portage._native_kwargs(spawn_kwargs)) + **portage._native_kwargs(self.spawn_kwargs)) if exitcode == 128: return False return True - def sync(self, **kwargs): - '''Sync/Clone the repository''' - if kwargs: - self._kwargs(kwargs) - - if not self.has_git: - return (1, False) - - if not self.exists(): - return self.new() - return self._sync() - - def new(self, **kwargs): '''Do the initial clone of the repository''' if kwargs: self._kwargs(kwargs) emerge_config = self.options.get('emerge_config', None) - spawn_kwargs = self.options.get('spawn_kwargs', None) portdb = self.options.get('portdb', None) try: if not os.path.exists(self.repo.location): @@ -101,10 +61,11 @@ class GitSync(object): msg = ">>> Cloning git repository from upstream into %s..." % self.repo.location self.logger(self.xterm_titles, msg) writemsg_level(msg + "\n") - exitcode = portage.process.spawn_bash("cd %s ; git clone %s ." % \ + exitcode = portage.process.spawn_bash("cd %s ; %s clone %s ." % \ (portage._shell_quote(self.repo.location), + self.bin_command, portage._shell_quote(self.repo.sync_uri)), - **portage._native_kwargs(spawn_kwargs)) + **portage._native_kwargs(self.spawn_kwargs)) if exitcode != os.EX_OK: msg = "!!! git clone error in %s" % self.repo.location self.logger(self.xterm_titles, msg) @@ -125,7 +86,6 @@ class GitSync(object): # No kwargs call here; this is inter
[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/
commit: b12e14547f95417fe5e0d30c4ef4b8d01ac7925c Author: Brian Dolbec gentoo org> AuthorDate: Wed Feb 19 15:32:32 2014 + Commit: Brian Dolbec gmail com> CommitDate: Fri May 2 23:05:15 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b12e1454 Git Sync: fix missing %s in the success message. --- 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 741daf3..6806ef3 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -139,7 +139,7 @@ class GitSync(object): self.logger(self.xterm_titles, msg) writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1) return (exitcode, False) - msg = ">>> Git pull successful" % self.repo.location + msg = ">>> Git pull successful: %s" % self.repo.location self.logger(self.xterm_titles, msg) writemsg_level(msg + "\n") return self.post_sync(portdb, self.repo.location, emerge_config)
[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/
commit: 9f1e5834998fef10b7dd20cfa30f4418ca8c41a7 Author: Chris Reffett <2011creffett tjhsst edu> AuthorDate: Sat Feb 8 15:22:58 2014 + Commit: Brian Dolbec gmail com> CommitDate: Wed Apr 30 07:38:46 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9f1e5834 Fix mixed spaces/tabs, update _sync to not take kwargs since it's an internal function --- pym/portage/sync/modules/git/git.py | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py index baf43fe..741daf3 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -45,6 +45,7 @@ class GitSync(object): def _kwargs(self, kwargs): + '''Sets internal variables from kwargs''' self.options = kwargs.get('options', {}) self.settings = self.options.get('settings', None) self.logger = self.options.get('logger', None) @@ -53,7 +54,7 @@ class GitSync(object): def exists(self, **kwargs): -'''Tests whether the repo actually exists''' + '''Tests whether the repo actually exists''' if kwargs: self._kwargs(kwargs) elif not self.repo: @@ -87,7 +88,7 @@ class GitSync(object): '''Do the initial clone of the repository''' if kwargs: self._kwargs(kwargs) -emerge_config = self.options.get('emerge_config', None) + emerge_config = self.options.get('emerge_config', None) spawn_kwargs = self.options.get('spawn_kwargs', None) portdb = self.options.get('portdb', None) try: @@ -115,14 +116,14 @@ class GitSync(object): return self.post_sync(portdb, self.repo.location, emerge_config) - def _sync(self, **kwargs): + def _sync(self): ''' Update existing git repository, and ignore the syncuri. We are going to trust the user and assume that the user is in the branch that he/she wants updated. We'll let the user manage branches with git directly. ''' - if kwargs: - self._kwargs(kwargs) + # No kwargs call here; this is internal, so it should have been + # called by something which set the internal variables emerge_config = self.options.get('emerge_config', None) spawn_kwargs = self.options.get('spawn_kwargs', None) portdb = self.options.get('portdb', None)
[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/
commit: 5bbce62a42963edf643380adadf36fa4e0fb6daa Author: Brian Dolbec gentoo org> AuthorDate: Fri Mar 14 15:55:07 2014 + Commit: Brian Dolbec gmail com> CommitDate: Sat Mar 29 22:46:20 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=5bbce62a portage/sync/modules/git: Use SyncBase class. --- pym/portage/sync/modules/git/git.py | 53 + 1 file changed, 6 insertions(+), 47 deletions(-) diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py index 6806ef3..21394b9 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -11,9 +11,10 @@ good = create_color_func("GOOD") bad = create_color_func("BAD") warn = create_color_func("WARN") from .timestamps import git_sync_timestamps +from portage.sync.syncbase import SyncBase -class GitSync(object): +class GitSync(SyncBase): '''Git sync class''' short_desc = "Perform sync operations on git based repositories" @@ -23,34 +24,8 @@ class GitSync(object): return "GitSync" - def can_progressbar(self, func): - return False - - def __init__(self): - self.options = None - self.settings = None - self.logger = None - self.repo = None - self.xterm_titles = None - - self.has_git = True - if portage.process.find_binary("git") is None: - msg = ["Command not found: git", - "Type \"emerge %s\" to enable git support." % portage.const.GIT_PACKAGE_ATOM] - for l in msg: - writemsg_level("!!! %s\n" % l, - level=logging.ERROR, noiselevel=-1) - self.has_git = False - - - def _kwargs(self, kwargs): - '''Sets internal variables from kwargs''' - self.options = kwargs.get('options', {}) - self.settings = self.options.get('settings', None) - self.logger = self.options.get('logger', None) - self.repo = self.options.get('repo', None) - self.xterm_titles = self.options.get('xterm_titles', False) + SyncBase.__init__(self, "git", portage.const.GIT_PACKAGE_ATOM) def exists(self, **kwargs): @@ -59,37 +34,22 @@ class GitSync(object): self._kwargs(kwargs) elif not self.repo: return False - spawn_kwargs = self.options.get('spawn_kwargs', None) if not os.path.exists(self.repo.location): return False exitcode = portage.process.spawn_bash("cd %s ; git rev-parse" %\ (portage._shell_quote(self.repo.location),), - **portage._native_kwargs(spawn_kwargs)) + **portage._native_kwargs(self.spawn_kwargs)) if exitcode == 128: return False return True - def sync(self, **kwargs): - '''Sync/Clone the repository''' - if kwargs: - self._kwargs(kwargs) - - if not self.has_git: - return (1, False) - - if not self.exists(): - return self.new() - return self._sync() - - def new(self, **kwargs): '''Do the initial clone of the repository''' if kwargs: self._kwargs(kwargs) emerge_config = self.options.get('emerge_config', None) - spawn_kwargs = self.options.get('spawn_kwargs', None) portdb = self.options.get('portdb', None) try: if not os.path.exists(self.repo.location): @@ -104,7 +64,7 @@ class GitSync(object): exitcode = portage.process.spawn_bash("cd %s ; git clone %s ." % \ (portage._shell_quote(self.repo.location), portage._shell_quote(self.repo.sync_uri)), - **portage._native_kwargs(spawn_kwargs)) + **portage._native_kwargs(self.spawn_kwargs)) if exitcode != os.EX_OK: msg = "!!! git clone error in %s" % self.repo.location self.logger(self.xterm_titles, msg) @@ -125,7 +85,6 @@ class GitSync(object): # No kwargs call here; this is internal, so it should have been # called by something which set the internal variables emerge_config = self.options.get('emerge_config', None) - spawn_kwargs = self.options.get('spawn_kwargs', None) portdb = self.options.get('portdb', None) msg = ">>> Starting git pull in %s..." % self.
[gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/git/
commit: 622577261f03f23058f4fcc0a380322627448f86 Author: Brian Dolbec gentoo org> AuthorDate: Fri Mar 14 15:55:07 2014 + Commit: Brian Dolbec gmail com> CommitDate: Fri Mar 14 16:18:30 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=62257726 portage/sync/modules/git: Use SyncBase class. --- pym/portage/sync/modules/git/git.py | 53 + 1 file changed, 6 insertions(+), 47 deletions(-) diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py index 6806ef3..21394b9 100644 --- a/pym/portage/sync/modules/git/git.py +++ b/pym/portage/sync/modules/git/git.py @@ -11,9 +11,10 @@ good = create_color_func("GOOD") bad = create_color_func("BAD") warn = create_color_func("WARN") from .timestamps import git_sync_timestamps +from portage.sync.syncbase import SyncBase -class GitSync(object): +class GitSync(SyncBase): '''Git sync class''' short_desc = "Perform sync operations on git based repositories" @@ -23,34 +24,8 @@ class GitSync(object): return "GitSync" - def can_progressbar(self, func): - return False - - def __init__(self): - self.options = None - self.settings = None - self.logger = None - self.repo = None - self.xterm_titles = None - - self.has_git = True - if portage.process.find_binary("git") is None: - msg = ["Command not found: git", - "Type \"emerge %s\" to enable git support." % portage.const.GIT_PACKAGE_ATOM] - for l in msg: - writemsg_level("!!! %s\n" % l, - level=logging.ERROR, noiselevel=-1) - self.has_git = False - - - def _kwargs(self, kwargs): - '''Sets internal variables from kwargs''' - self.options = kwargs.get('options', {}) - self.settings = self.options.get('settings', None) - self.logger = self.options.get('logger', None) - self.repo = self.options.get('repo', None) - self.xterm_titles = self.options.get('xterm_titles', False) + SyncBase.__init__(self, "git", portage.const.GIT_PACKAGE_ATOM) def exists(self, **kwargs): @@ -59,37 +34,22 @@ class GitSync(object): self._kwargs(kwargs) elif not self.repo: return False - spawn_kwargs = self.options.get('spawn_kwargs', None) if not os.path.exists(self.repo.location): return False exitcode = portage.process.spawn_bash("cd %s ; git rev-parse" %\ (portage._shell_quote(self.repo.location),), - **portage._native_kwargs(spawn_kwargs)) + **portage._native_kwargs(self.spawn_kwargs)) if exitcode == 128: return False return True - def sync(self, **kwargs): - '''Sync/Clone the repository''' - if kwargs: - self._kwargs(kwargs) - - if not self.has_git: - return (1, False) - - if not self.exists(): - return self.new() - return self._sync() - - def new(self, **kwargs): '''Do the initial clone of the repository''' if kwargs: self._kwargs(kwargs) emerge_config = self.options.get('emerge_config', None) - spawn_kwargs = self.options.get('spawn_kwargs', None) portdb = self.options.get('portdb', None) try: if not os.path.exists(self.repo.location): @@ -104,7 +64,7 @@ class GitSync(object): exitcode = portage.process.spawn_bash("cd %s ; git clone %s ." % \ (portage._shell_quote(self.repo.location), portage._shell_quote(self.repo.sync_uri)), - **portage._native_kwargs(spawn_kwargs)) + **portage._native_kwargs(self.spawn_kwargs)) if exitcode != os.EX_OK: msg = "!!! git clone error in %s" % self.repo.location self.logger(self.xterm_titles, msg) @@ -125,7 +85,6 @@ class GitSync(object): # No kwargs call here; this is internal, so it should have been # called by something which set the internal variables emerge_config = self.options.get('emerge_config', None) - spawn_kwargs = self.options.get('spawn_kwargs', None) portdb = self.options.get('portdb', None) msg = ">>> Starting git pull in %s..." % self.