commit: cab60718d849dec5e80b0126672ab0bb7724d0b0 Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> AuthorDate: Wed Feb 10 18:08:55 2016 +0000 Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org> CommitDate: Tue Mar 8 03:13:28 2016 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=cab60718
repoman: Migrate add items to the vcs modules pym/repoman/actions.py | 25 +------------------------ pym/repoman/modules/vcs/None/changes.py | 4 ++++ pym/repoman/modules/vcs/changes.py | 20 ++++++++++++++++++++ 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py index 4209d13..d2e4fc1 100644 --- a/pym/repoman/actions.py +++ b/pym/repoman/actions.py @@ -411,30 +411,7 @@ class Actions(object): if myautoadd: print(">>> Auto-Adding missing Manifest/ChangeLog file(s)...") - add_cmd = [self.vcs_settings.vcs, "add"] - add_cmd += myautoadd - if self.options.pretend: - portage.writemsg_stdout( - "(%s)\n" % " ".join(add_cmd), - noiselevel=-1) - else: - - if sys.hexversion < 0x3020000 and sys.hexversion >= 0x3000000 and \ - not os.path.isabs(add_cmd[0]): - # Python 3.1 _execvp throws TypeError for non-absolute executable - # path passed as bytes (see http://bugs.python.org/issue8513). - fullname = find_binary(add_cmd[0]) - if fullname is None: - raise portage.exception.CommandNotFound(add_cmd[0]) - add_cmd[0] = fullname - - add_cmd = [_unicode_encode(arg) for arg in add_cmd] - retcode = subprocess.call(add_cmd) - if retcode != os.EX_OK: - logging.error( - "Exiting on %s error code: %s\n" % (self.vcs_settings.vcs, retcode)) - sys.exit(retcode) - + self.vcs_settings.changes.add_items(myautoadd) myupdates += myautoadd return myupdates, broken_changelog_manifests diff --git a/pym/repoman/modules/vcs/None/changes.py b/pym/repoman/modules/vcs/None/changes.py index 37693ad..98beedb 100644 --- a/pym/repoman/modules/vcs/None/changes.py +++ b/pym/repoman/modules/vcs/None/changes.py @@ -22,3 +22,7 @@ class Changes(ChangesBase): def scan(self): '''VCS type scan function, looks for all detectable changes''' pass + + def add_items(self, myautoadd): + '''Nothing to add them to''' + pass diff --git a/pym/repoman/modules/vcs/changes.py b/pym/repoman/modules/vcs/changes.py index 948407c..ee94217 100644 --- a/pym/repoman/modules/vcs/changes.py +++ b/pym/repoman/modules/vcs/changes.py @@ -2,9 +2,14 @@ Base Changes class ''' +import logging import os +import subprocess +import sys from itertools import chain +from repoman._portage import portage +from portage import _unicode_encode class ChangesBase(object): '''Base Class object to scan and hold the resultant data @@ -89,3 +94,18 @@ class ChangesBase(object): def update_index(self, mymanifests, myupdates): '''Update the vcs's modified index if it is needed''' pass + + def add_items(self, myautoadd): + add_cmd = [self.vcs, "add"] + add_cmd += myautoadd + if self.options.pretend: + portage.writemsg_stdout( + "(%s)\n" % " ".join(add_cmd), + noiselevel=-1) + else: + add_cmd = [_unicode_encode(arg) for arg in add_cmd] + retcode = subprocess.call(add_cmd) + if retcode != os.EX_OK: + logging.error( + "Exiting on %s error code: %s\n" % (self.vcs_settings.vcs, retcode)) + sys.exit(retcode)