public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/layman:master commit in: pm_plugins/portage/sync/modules/laymansync/
@ 2015-02-08  0:35 Devan Franchini
  0 siblings, 0 replies; 6+ messages in thread
From: Devan Franchini @ 2015-02-08  0:35 UTC (permalink / raw
  To: gentoo-commits

commit:     c69868655e387bbeb646b6326d64380f8a4247be
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Sun Feb  8 00:34:57 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sun Feb  8 00:34:57 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=c6986865

laymansync.py: Changes output messages from laymanator to laymansync

---
 pm_plugins/portage/sync/modules/laymansync/laymansync.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/pm_plugins/portage/sync/modules/laymansync/laymansync.py b/pm_plugins/portage/sync/modules/laymansync/laymansync.py
index d5d81ee..1156c61 100644
--- a/pm_plugins/portage/sync/modules/laymansync/laymansync.py
+++ b/pm_plugins/portage/sync/modules/laymansync/laymansync.py
@@ -51,7 +51,7 @@ def create_overlay_package(config=None, repo=None, logger=None, xterm_titles=Non
         ovl = Overlay.Overlay(config=config, ovl_dict=overlay, ignore=1)
         return (repo.name, ovl)
 
-    msg = '!!! laymanator sez... Error: repo not found.'
+    msg = '!!! laymansync sez... Error: repo not found.'
     if logger and xterm_titles:
         logger(xterm_titles, msg)
     writemsg_level(msg + '\n', level=logging.ERROR, noiselevel=-1)
@@ -129,7 +129,7 @@ class Layman(NewBase):
             % ({'repo': self.repo.name})
         self.logger(self.xterm_titles, msg)
         writemsg_level(msg + "\n")
-        msg = '>>> laymanator sez... "Hasta la add ya, baby!"'
+        msg = '>>> laymansync sez... "Hasta la add ya, baby!"'
         self.logger(self.xterm_titles, msg)
         writemsg_level(msg + "\n")
 
@@ -176,7 +176,7 @@ class Layman(NewBase):
             % ({'repo': self.repo.name})
         self.logger(self.xterm_titles, msg)
         writemsg_level(msg + "\n")
-        msg = '>>> laymanator sez... "Hasta la sync ya, baby!"'
+        msg = '>>> laymansync sez... "Hasta la sync ya, baby!"'
         self.logger(self.xterm_titles, msg)
         writemsg_level(msg + "\n")
 
@@ -315,7 +315,7 @@ class PyLayman(NewBase):
             % ({'repo': self.repo.name})
         self.logger(self.xterm_titles, msg)
         writemsg_level(msg + '\n')
-        msg = '>>> laymanator sez... "Hasta la add ya, baby!"'
+        msg = '>>> laymansync sez... "Hasta la add ya, baby!"'
         self.logger(self.xterm_titles, msg)
         writemsg_level(msg + '\n')
 
@@ -351,7 +351,7 @@ class PyLayman(NewBase):
             % ({'repo': self.repo.name})
         self.logger(self.xterm_titles, msg)
         writemsg_level(msg + "\n")
-        msg = '>>> laymanator sez... "Hasta la sync ya, baby!"'
+        msg = '>>> laymansync sez... "Hasta la sync ya, baby!"'
         self.logger(self.xterm_titles, msg)
         writemsg_level(msg + "\n")
 


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/layman:master commit in: pm_plugins/portage/sync/modules/laymansync/
@ 2015-05-04 18:21 Brian Dolbec
  0 siblings, 0 replies; 6+ messages in thread
From: Brian Dolbec @ 2015-05-04 18:21 UTC (permalink / raw
  To: gentoo-commits

commit:     34be556371a0c40dfbf821996fc40f5720f4bf95
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon May  4 17:36:45 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon May  4 17:38:14 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=34be5563

pm_plugins/portage: Split up laymansync into sub-files to delay import of layman bug 548328

The laymansync module prevented emerge from operating due to the layman import in the module's __init__.py.
There was breakage in the cryptography import due to an openssl USE flag change and re-compile.
This caused the chain reaction traceback preventing emerge from running.

 .../portage/sync/modules/laymansync/__init__.py    |  11 +-
 .../portage/sync/modules/laymansync/laymansync.py  | 357 +--------------------
 .../laymansync/{laymansync.py => pylayman.py}      | 138 +-------
 .../portage/sync/modules/laymansync/subproc.py     | 136 ++++++++
 4 files changed, 147 insertions(+), 495 deletions(-)

diff --git a/pm_plugins/portage/sync/modules/laymansync/__init__.py b/pm_plugins/portage/sync/modules/laymansync/__init__.py
index de06b03..d80f885 100644
--- a/pm_plugins/portage/sync/modules/laymansync/__init__.py
+++ b/pm_plugins/portage/sync/modules/laymansync/__init__.py
@@ -5,26 +5,17 @@
 Performs layman sync actions for layman overlays.
 '''
 
-import os
 
 from portage.sync.config_checks import CheckSyncConfig
 
 
-try:
-    import layman
-    config_class = 'PyLayman'
-    del layman
-except ImportError:
-    config_class = 'Layman'
-
-
 module_spec = {
     'name': 'laymansync',
     'description': __doc__,
     'provides':{
         'layman-module': {
             'name': 'laymansync',
-            'class': config_class,
+            'class': 'CONFIG_CLASS',
             'description': __doc__,
             'functions': ['sync', 'new', 'exists'],
             'func_desc': {

diff --git a/pm_plugins/portage/sync/modules/laymansync/laymansync.py b/pm_plugins/portage/sync/modules/laymansync/laymansync.py
index 1156c61..9835beb 100644
--- a/pm_plugins/portage/sync/modules/laymansync/laymansync.py
+++ b/pm_plugins/portage/sync/modules/laymansync/laymansync.py
@@ -2,357 +2,12 @@
 # Distributed under the terms of the GNU General Public License v2
 '''Layman module for portage'''
 
-import logging
 
-import layman.overlays.overlay as Overlay
 
-from layman.api import LaymanAPI
-from layman.config import BareConfig, OptionConfig
-from layman.maker import Interactive
-from layman.output import Message
-from layman.utils import reload_config
+try:
+    from pylayman import PyLayman
+    CONFIG_CLASS = PyLayman
+except ImportError:
+    from subproc import Layman
+    CONFIG_CLASS = Layman
 
-import portage
-from portage import os
-from portage.util import writemsg_level
-from portage.output import create_color_func
-good = create_color_func("GOOD")
-bad = create_color_func("BAD")
-warn = create_color_func("WARN")
-from portage.sync.syncbase import NewBase
-
-import sys
-
-def create_overlay_package(config=None, repo=None, logger=None, xterm_titles=None):
-    '''
-    Creates a layman overlay object
-    from the given repos.conf repo info.
-
-    @params config: layman.config class object
-    @params repo: portage.repo class object
-    @rtype tuple: overlay name and layman.overlay object or None
-    '''
-    if repo:
-        overlay = {'sources': []}
-        desc = 'Defined and created from info in %(repo)s config file...'\
-                % ({'repo': repo.name})
-        if not config:
-            config = BareConfig()
-        if not repo.branch:
-            repo.branch = ''
-
-        overlay['name'] = repo.name
-        overlay['descriptions'] = [desc]
-        overlay['owner_name'] = 'repos.conf'
-        overlay['owner_email'] = '127.0.0.1'
-        overlay['sources'].append([repo.sync_uri, repo.layman_type, repo.branch])
-        overlay['priority'] = repo.priority
-
-        ovl = Overlay.Overlay(config=config, ovl_dict=overlay, ignore=1)
-        return (repo.name, ovl)
-
-    msg = '!!! laymansync sez... Error: repo not found.'
-    if logger and xterm_titles:
-        logger(xterm_titles, msg)
-    writemsg_level(msg + '\n', level=logging.ERROR, noiselevel=-1)
-    return None
-
-
-class Layman(NewBase):
-    '''
-    Layman sync class which makes use of a subprocess call to
-    execute desired layman actions.
-    '''
-
-    short_desc = "Perform sync operations on layman based repositories"
-
-    @staticmethod
-    def name():
-        '''
-        Returns sync plugin name.
-
-        @rtype str
-        '''
-        return "Layman"
-
-
-    def __init__(self):
-        NewBase.__init__(self, 'layman', 'app-portage/layman')
-
-
-    def _get_optargs(self, args):
-        '''
-        Gets optional layman arguments.
-
-        @params args: dict of current subprocess args.
-        '''
-        if self.settings:
-            if self.settings.get('NOCOLOR'):
-                args.append('-N')
-            if self.settings.get('PORTAGE_QUIET'):
-                args.append('-q')
-
-
-    def new(self, **kwargs):
-        '''Use layman to install the repository'''
-        if kwargs:
-            self._kwargs(kwargs)
-        emerge_config = self.options.get('emerge_config', None)
-        portdb = self.options.get('portdb', None)
-        args = []
-        msg = '>>> Starting to add new layman overlay %(repo)s'\
-            % ({'repo': self.repo.name})
-        self.logger(self.xterm_titles, msg)
-        writemsg_level(msg + '\n')
-
-        location = self.repo.location.replace(self.repo.name, '')
-
-        args.append('layman')
-        self._get_optargs(args)
-        args.append('--storage')
-        args.append(location)
-        args.append('-a')
-        args.append(self.repo.name)
-
-        command = ' '.join(args)
-
-        exitcode = portage.process.spawn_bash("%(command)s" % \
-            ({'command': command}),
-            **portage._native_kwargs(self.spawn_kwargs))
-        if exitcode != os.EX_OK:
-            msg = "!!! layman add error in %(repo)s"\
-                % ({'repo': self.repo.name})
-            self.logger(self.xterm_titles, msg)
-            writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
-            return (exitcode, False)
-        msg = ">>> Addition of layman repo succeeded: %(repo)s"\
-            % ({'repo': self.repo.name})
-        self.logger(self.xterm_titles, msg)
-        writemsg_level(msg + "\n")
-        msg = '>>> laymansync sez... "Hasta la add ya, baby!"'
-        self.logger(self.xterm_titles, msg)
-        writemsg_level(msg + "\n")
-
-        return (exitcode, True)
-
-
-    def update(self):
-        ''' Update existing repository'''
-        emerge_config = self.options.get('emerge_config', None)
-        portdb = self.options.get('portdb', None)
-        args = []
-
-        msg = '>>> Starting layman sync for %(repo)s...'\
-            % ({'repo': self.repo.name})
-        self.logger(self.xterm_titles, msg)
-        writemsg_level(msg + '\n')
-
-        location = self.repo.location.replace(self.repo.name, '')
-
-        args.append('layman')
-        self._get_optargs(args)
-        args.append('--storage')
-        args.append(location)
-        args.append('-s')
-        args.append(self.repo.name)
-
-        command = ' '.join(args)
-        exitcode = portage.process.spawn_bash("%(command)s" % \
-            ({'command': command}),
-            **portage._native_kwargs(self.spawn_kwargs))
-
-        if exitcode != os.EX_OK:
-            exitcode = self.new()[0]
-            if exitcode != os.EX_OK:
-                msg = "!!! layman sync error in %(repo)s"\
-                    % ({'repo': self.repo.name})
-                self.logger(self.xterm_titles, msg)
-                writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
-                return (exitcode, False)
-            else:
-                return (exitcode, True)
-
-        msg = ">>> layman sync succeeded: %(repo)s"\
-            % ({'repo': self.repo.name})
-        self.logger(self.xterm_titles, msg)
-        writemsg_level(msg + "\n")
-        msg = '>>> laymansync sez... "Hasta la sync ya, baby!"'
-        self.logger(self.xterm_titles, msg)
-        writemsg_level(msg + "\n")
-
-        return (exitcode, True)
-
-
-class PyLayman(NewBase):
-    '''
-    Layman sync class which makes use of layman's modules to
-    perform desired actions.
-    '''
-
-    short_desc = "Perform sync operations on layman based repositories"
-
-    @staticmethod
-    def name():
-        '''
-        Returns sync plugin name.
-
-        @rtype str
-        '''
-        return "Layman"
-
-    def __init__(self):
-        NewBase.__init__(self, 'layman', 'app-portage/layman')
-
-        self._layman = None
-        self.storage = ''
-        self.current_storage = ''
-
-
-    def _get_layman_api(self):
-        '''
-        Initializes layman api.
-
-        @rtype layman.api.LaymanAPI instance
-        '''
-        # Make it so that we aren't initializing the
-        # LaymanAPI instance if it already exists and
-        # if the current storage location hasn't been
-        # changed for the new repository.
-        self.storage = self.repo.location.replace(self.repo.name, '')
-
-        if self._layman and self.storage in self.current_storage:
-            return self._layman
-
-        config = BareConfig()
-        configdir = {'configdir': config.get_option('configdir')}
-
-        self.message = Message(out=sys.stdout, err=sys.stderr)
-        self.current_storage = self.storage
-        options = {
-            'config': config.get_option('config') % (configdir),
-            'quiet': self.settings.get('PORTAGE_QUIET'),
-            'quietness': config.get_option('quietness'),
-            'overlay_defs': config.get_option('overlay_defs') % (configdir),
-            'output': self.message,
-            'nocolor': self.settings.get('NOCOLOR'),
-            'root': self.settings.get('EROOT'),
-            'storage': self.current_storage,
-            'verbose': self.settings.get('PORTAGE_VERBOSE'),
-            'width': self.settings.get('COLUMNWIDTH'),
-
-        }
-        self.config = OptionConfig(options=options, root=options['root'])
-
-        # Reloads config to read custom overlay
-        # xml files.
-        reload_config(self.config)
-
-        layman_api = LaymanAPI(self.config,
-                               report_errors=True,
-                               output=self.config['output']
-                               )
-
-        self._layman = layman_api
-
-        return layman_api
-
-
-    def _eval_exitcode(self, exitcode):
-        '''
-        Evaluates the boolean returned by layman's API
-        when performing a task and returns the proper exitcode.
-
-        @params exitcode: boolean value reflecting the successful
-                          execution of a task.
-        @rtype int
-        '''
-        if exitcode == True:
-            return 0
-        return 1
-
-
-    def new(self, **kwargs):
-        '''Do the initial download and install of the repository'''
-        layman_inst = self._get_layman_api()
-        # Update the remote list before adding anything.
-        layman_inst.fetch_remote_list()
-        available_overlays = layman_inst.get_available(dbreload=True)
-        emerge_config = self.options.get('emerge_config', None)
-        portdb = self.options.get('portdb', None)
-
-        msg = '>>> Starting to add new layman overlay %(repo)s'\
-            % ({'repo': self.repo.name})
-        self.logger(self.xterm_titles, msg)
-        writemsg_level(msg + '\n')
-
-        if self.repo.name not in available_overlays:
-            overlay_package = create_overlay_package(repo=self.repo,\
-                                logger=self.logger,\
-                                xterm_titles=self.xter_titles)
-            create_overlay_xml = Interactive(config=self.config)
-            path = self.config.get_option('overlay_defs') + '/reposconf.xml'
-            result = create_overlay_xml(overlay_package=overlay_package,
-                        path=path)
-
-            if not result:
-                msg = '!!! layman add error in %(repo)s: Failed to add'\
-                      '%(repo)s to %(path)s' % ({'repo': self.repo.name,
-                                                  'path': path})
-                self.logger(self.xterm_titles, msg)
-                writemsg_level(msg + '\n', level=logging.ERROR, noiselevel=-1)
-                return (exitcode, False)
-
-        results = layman_inst.add_repos(self.repo.name)
-        exitcode = self._eval_exitcode(results)
-
-        if exitcode != os.EX_OK:
-            msg = "!!! layman add error in %(repo)s"\
-                % ({'repo': self.repo.name})
-            self.logger(self.xterm_titles, msg)
-            writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
-            return (exitcode, False)
-        msg = ">>> Addition of layman repo succeeded: %(repo)s"\
-            % ({'repo': self.repo.name})
-        self.logger(self.xterm_titles, msg)
-        writemsg_level(msg + '\n')
-        msg = '>>> laymansync sez... "Hasta la add ya, baby!"'
-        self.logger(self.xterm_titles, msg)
-        writemsg_level(msg + '\n')
-
-        return (exitcode, True)
-
-    def update(self):
-        ''' Update existing repository'''
-        layman_inst = self._get_layman_api()
-
-        emerge_config = self.options.get('emerge_config', None)
-        portdb = self.options.get('portdb', None)
-
-        msg = '>>> Starting layman sync for %(repo)s...'\
-            % ({'repo': self.repo.name})
-        self.logger(self.xterm_titles, msg)
-        writemsg_level(msg + '\n')
-
-        results = layman_inst.sync(self.repo.name)
-        exitcode = self._eval_exitcode(results)
-
-        if exitcode != os.EX_OK:
-            exitcode = self.new()[0]
-            if exitcode != os.EX_OK:
-                msg = "!!! layman sync error in %(repo)s"\
-                    % ({'repo': self.repo.name})
-                self.logger(self.xterm_titles, msg)
-                writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
-                return (exitcode, False)
-            else:
-                return (exitcode, True)
-
-        msg = ">>> layman sync succeeded: %(repo)s"\
-            % ({'repo': self.repo.name})
-        self.logger(self.xterm_titles, msg)
-        writemsg_level(msg + "\n")
-        msg = '>>> laymansync sez... "Hasta la sync ya, baby!"'
-        self.logger(self.xterm_titles, msg)
-        writemsg_level(msg + "\n")
-
-        return (exitcode, True)

diff --git a/pm_plugins/portage/sync/modules/laymansync/laymansync.py b/pm_plugins/portage/sync/modules/laymansync/pylayman.py
similarity index 64%
copy from pm_plugins/portage/sync/modules/laymansync/laymansync.py
copy to pm_plugins/portage/sync/modules/laymansync/pylayman.py
index 1156c61..5682135 100644
--- a/pm_plugins/portage/sync/modules/laymansync/laymansync.py
+++ b/pm_plugins/portage/sync/modules/laymansync/pylayman.py
@@ -1,18 +1,17 @@
-# Copyright 2014 Gentoo Foundation
+# Copyright 2014-2015 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-'''Layman module for portage'''
+'''Layman module for portage using the lyman api'''
 
 import logging
 
 import layman.overlays.overlay as Overlay
-
 from layman.api import LaymanAPI
 from layman.config import BareConfig, OptionConfig
 from layman.maker import Interactive
 from layman.output import Message
 from layman.utils import reload_config
 
-import portage
+
 from portage import os
 from portage.util import writemsg_level
 from portage.output import create_color_func
@@ -58,130 +57,6 @@ def create_overlay_package(config=None, repo=None, logger=None, xterm_titles=Non
     return None
 
 
-class Layman(NewBase):
-    '''
-    Layman sync class which makes use of a subprocess call to
-    execute desired layman actions.
-    '''
-
-    short_desc = "Perform sync operations on layman based repositories"
-
-    @staticmethod
-    def name():
-        '''
-        Returns sync plugin name.
-
-        @rtype str
-        '''
-        return "Layman"
-
-
-    def __init__(self):
-        NewBase.__init__(self, 'layman', 'app-portage/layman')
-
-
-    def _get_optargs(self, args):
-        '''
-        Gets optional layman arguments.
-
-        @params args: dict of current subprocess args.
-        '''
-        if self.settings:
-            if self.settings.get('NOCOLOR'):
-                args.append('-N')
-            if self.settings.get('PORTAGE_QUIET'):
-                args.append('-q')
-
-
-    def new(self, **kwargs):
-        '''Use layman to install the repository'''
-        if kwargs:
-            self._kwargs(kwargs)
-        emerge_config = self.options.get('emerge_config', None)
-        portdb = self.options.get('portdb', None)
-        args = []
-        msg = '>>> Starting to add new layman overlay %(repo)s'\
-            % ({'repo': self.repo.name})
-        self.logger(self.xterm_titles, msg)
-        writemsg_level(msg + '\n')
-
-        location = self.repo.location.replace(self.repo.name, '')
-
-        args.append('layman')
-        self._get_optargs(args)
-        args.append('--storage')
-        args.append(location)
-        args.append('-a')
-        args.append(self.repo.name)
-
-        command = ' '.join(args)
-
-        exitcode = portage.process.spawn_bash("%(command)s" % \
-            ({'command': command}),
-            **portage._native_kwargs(self.spawn_kwargs))
-        if exitcode != os.EX_OK:
-            msg = "!!! layman add error in %(repo)s"\
-                % ({'repo': self.repo.name})
-            self.logger(self.xterm_titles, msg)
-            writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
-            return (exitcode, False)
-        msg = ">>> Addition of layman repo succeeded: %(repo)s"\
-            % ({'repo': self.repo.name})
-        self.logger(self.xterm_titles, msg)
-        writemsg_level(msg + "\n")
-        msg = '>>> laymansync sez... "Hasta la add ya, baby!"'
-        self.logger(self.xterm_titles, msg)
-        writemsg_level(msg + "\n")
-
-        return (exitcode, True)
-
-
-    def update(self):
-        ''' Update existing repository'''
-        emerge_config = self.options.get('emerge_config', None)
-        portdb = self.options.get('portdb', None)
-        args = []
-
-        msg = '>>> Starting layman sync for %(repo)s...'\
-            % ({'repo': self.repo.name})
-        self.logger(self.xterm_titles, msg)
-        writemsg_level(msg + '\n')
-
-        location = self.repo.location.replace(self.repo.name, '')
-
-        args.append('layman')
-        self._get_optargs(args)
-        args.append('--storage')
-        args.append(location)
-        args.append('-s')
-        args.append(self.repo.name)
-
-        command = ' '.join(args)
-        exitcode = portage.process.spawn_bash("%(command)s" % \
-            ({'command': command}),
-            **portage._native_kwargs(self.spawn_kwargs))
-
-        if exitcode != os.EX_OK:
-            exitcode = self.new()[0]
-            if exitcode != os.EX_OK:
-                msg = "!!! layman sync error in %(repo)s"\
-                    % ({'repo': self.repo.name})
-                self.logger(self.xterm_titles, msg)
-                writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
-                return (exitcode, False)
-            else:
-                return (exitcode, True)
-
-        msg = ">>> layman sync succeeded: %(repo)s"\
-            % ({'repo': self.repo.name})
-        self.logger(self.xterm_titles, msg)
-        writemsg_level(msg + "\n")
-        msg = '>>> laymansync sez... "Hasta la sync ya, baby!"'
-        self.logger(self.xterm_titles, msg)
-        writemsg_level(msg + "\n")
-
-        return (exitcode, True)
-
 
 class PyLayman(NewBase):
     '''
@@ -277,8 +152,6 @@ class PyLayman(NewBase):
         # Update the remote list before adding anything.
         layman_inst.fetch_remote_list()
         available_overlays = layman_inst.get_available(dbreload=True)
-        emerge_config = self.options.get('emerge_config', None)
-        portdb = self.options.get('portdb', None)
 
         msg = '>>> Starting to add new layman overlay %(repo)s'\
             % ({'repo': self.repo.name})
@@ -300,7 +173,7 @@ class PyLayman(NewBase):
                                                   'path': path})
                 self.logger(self.xterm_titles, msg)
                 writemsg_level(msg + '\n', level=logging.ERROR, noiselevel=-1)
-                return (exitcode, False)
+                return (1, False)
 
         results = layman_inst.add_repos(self.repo.name)
         exitcode = self._eval_exitcode(results)
@@ -325,9 +198,6 @@ class PyLayman(NewBase):
         ''' Update existing repository'''
         layman_inst = self._get_layman_api()
 
-        emerge_config = self.options.get('emerge_config', None)
-        portdb = self.options.get('portdb', None)
-
         msg = '>>> Starting layman sync for %(repo)s...'\
             % ({'repo': self.repo.name})
         self.logger(self.xterm_titles, msg)

diff --git a/pm_plugins/portage/sync/modules/laymansync/subproc.py b/pm_plugins/portage/sync/modules/laymansync/subproc.py
new file mode 100644
index 0000000..1166841
--- /dev/null
+++ b/pm_plugins/portage/sync/modules/laymansync/subproc.py
@@ -0,0 +1,136 @@
+# Copyright 2014-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+'''Layman module for portage using a subprocess call'''
+
+import logging
+
+import portage
+from portage import os
+from portage.util import writemsg_level
+from portage.output import create_color_func
+good = create_color_func("GOOD")
+bad = create_color_func("BAD")
+warn = create_color_func("WARN")
+from portage.sync.syncbase import NewBase
+
+
+class Layman(NewBase):
+    '''
+    Layman sync class which makes use of a subprocess call to
+    execute desired layman actions.
+    '''
+
+    short_desc = "Perform sync operations on layman based repositories"
+
+    @staticmethod
+    def name():
+        '''
+        Returns sync plugin name.
+
+        @rtype str
+        '''
+        return "Layman"
+
+
+    def __init__(self):
+        NewBase.__init__(self, 'layman', 'app-portage/layman')
+
+
+    def _get_optargs(self, args):
+        '''
+        Gets optional layman arguments.
+
+        @params args: dict of current subprocess args.
+        '''
+        if self.settings:
+            if self.settings.get('NOCOLOR'):
+                args.append('-N')
+            if self.settings.get('PORTAGE_QUIET'):
+                args.append('-q')
+
+
+    def new(self, **kwargs):
+        '''Use layman to install the repository'''
+        if kwargs:
+            self._kwargs(kwargs)
+        args = []
+        msg = '>>> Starting to add new layman overlay %(repo)s'\
+            % ({'repo': self.repo.name})
+        self.logger(self.xterm_titles, msg)
+        writemsg_level(msg + '\n')
+
+        location = self.repo.location.replace(self.repo.name, '')
+
+        args.append('layman')
+        self._get_optargs(args)
+        args.append('--storage')
+        args.append(location)
+        args.append('-a')
+        args.append(self.repo.name)
+
+        command = ' '.join(args)
+
+        exitcode = portage.process.spawn_bash("%(command)s" % \
+            ({'command': command}),
+            **portage._native_kwargs(self.spawn_kwargs))
+        if exitcode != os.EX_OK:
+            msg = "!!! layman add error in %(repo)s"\
+                % ({'repo': self.repo.name})
+            self.logger(self.xterm_titles, msg)
+            writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
+            return (exitcode, False)
+        msg = ">>> Addition of layman repo succeeded: %(repo)s"\
+            % ({'repo': self.repo.name})
+        self.logger(self.xterm_titles, msg)
+        writemsg_level(msg + "\n")
+        msg = '>>> laymansync sez... "Hasta la add ya, baby!"'
+        self.logger(self.xterm_titles, msg)
+        writemsg_level(msg + "\n")
+
+        return (exitcode, True)
+
+
+    def update(self):
+        ''' Update existing repository'''
+        args = []
+
+        msg = '>>> Starting layman sync for %(repo)s...'\
+            % ({'repo': self.repo.name})
+        self.logger(self.xterm_titles, msg)
+        writemsg_level(msg + '\n')
+
+        location = self.repo.location.replace(self.repo.name, '')
+
+        args.append('layman')
+        self._get_optargs(args)
+        args.append('--storage')
+        args.append(location)
+        args.append('-s')
+        args.append(self.repo.name)
+
+        command = ' '.join(args)
+        exitcode = portage.process.spawn_bash("%(command)s" % \
+            ({'command': command}),
+            **portage._native_kwargs(self.spawn_kwargs))
+
+        if exitcode != os.EX_OK:
+            exitcode = self.new()[0]
+            if exitcode != os.EX_OK:
+                msg = "!!! layman sync error in %(repo)s"\
+                    % ({'repo': self.repo.name})
+                self.logger(self.xterm_titles, msg)
+                writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
+                return (exitcode, False)
+            else:
+                return (exitcode, True)
+
+        msg = ">>> layman sync succeeded: %(repo)s"\
+            % ({'repo': self.repo.name})
+        self.logger(self.xterm_titles, msg)
+        writemsg_level(msg + "\n")
+        msg = '>>> laymansync sez... "Hasta la sync ya, baby!"'
+        self.logger(self.xterm_titles, msg)
+        writemsg_level(msg + "\n")
+
+        return (exitcode, True)
+


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/layman:master commit in: pm_plugins/portage/sync/modules/laymansync/
@ 2015-05-06  1:13 Devan Franchini
  0 siblings, 0 replies; 6+ messages in thread
From: Devan Franchini @ 2015-05-06  1:13 UTC (permalink / raw
  To: gentoo-commits

commit:     8eea549fd4f61b55a3939a0da2682f1749e474fb
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Wed May  6 01:12:52 2015 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Wed May  6 01:12:52 2015 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=8eea549f

laymansync.py: Corrects importing of sync classes

 pm_plugins/portage/sync/modules/laymansync/laymansync.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pm_plugins/portage/sync/modules/laymansync/laymansync.py b/pm_plugins/portage/sync/modules/laymansync/laymansync.py
index 9835beb..12ebe2d 100644
--- a/pm_plugins/portage/sync/modules/laymansync/laymansync.py
+++ b/pm_plugins/portage/sync/modules/laymansync/laymansync.py
@@ -5,9 +5,9 @@
 
 
 try:
-    from pylayman import PyLayman
+    from portage.sync.modules.laymansync.pylayman import PyLayman
     CONFIG_CLASS = PyLayman
 except ImportError:
-    from subproc import Layman
+    from portage.sync.modules.laymansync.subproc import Layman
     CONFIG_CLASS = Layman
 


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/layman:master commit in: pm_plugins/portage/sync/modules/laymansync/
@ 2016-04-29 23:19 Brian Dolbec
  0 siblings, 0 replies; 6+ messages in thread
From: Brian Dolbec @ 2016-04-29 23:19 UTC (permalink / raw
  To: gentoo-commits

commit:     53b41cb4d01a7b6f31d09f7fdb0a0292b633b7e3
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 29 23:17:39 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Apr 29 23:17:39 2016 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=53b41cb4

laymansync: Update module_spec for the change in portage's module.py

 pm_plugins/portage/sync/modules/laymansync/__init__.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pm_plugins/portage/sync/modules/laymansync/__init__.py b/pm_plugins/portage/sync/modules/laymansync/__init__.py
index d80f885..c704011 100644
--- a/pm_plugins/portage/sync/modules/laymansync/__init__.py
+++ b/pm_plugins/portage/sync/modules/laymansync/__init__.py
@@ -15,6 +15,7 @@ module_spec = {
     'provides':{
         'layman-module': {
             'name': 'laymansync',
+            'sourcefile': 'laymansync',
             'class': 'CONFIG_CLASS',
             'description': __doc__,
             'functions': ['sync', 'new', 'exists'],


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/layman:master commit in: pm_plugins/portage/sync/modules/laymansync/
@ 2017-06-23  0:05 Devan Franchini
  0 siblings, 0 replies; 6+ messages in thread
From: Devan Franchini @ 2017-06-23  0:05 UTC (permalink / raw
  To: gentoo-commits

commit:     22e1bd138dbcf32ca50f9659c9d847fdae11a5f0
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Apr  9 21:54:17 2017 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Fri Jun 23 00:05:40 2017 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=22e1bd13

pm_plugins/portage: drop portage._native_kwargs usage (bug 613936)

The portage._native_kwargs function is not available since
portage-2.3.0.

X-Gentoo-Bug: 613936
X-Gentoo-Bug-URL: https://bugs.gentoo.org/613936

 pm_plugins/portage/sync/modules/laymansync/subproc.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pm_plugins/portage/sync/modules/laymansync/subproc.py b/pm_plugins/portage/sync/modules/laymansync/subproc.py
index 1166841..477bb46 100644
--- a/pm_plugins/portage/sync/modules/laymansync/subproc.py
+++ b/pm_plugins/portage/sync/modules/laymansync/subproc.py
@@ -72,7 +72,7 @@ class Layman(NewBase):
 
         exitcode = portage.process.spawn_bash("%(command)s" % \
             ({'command': command}),
-            **portage._native_kwargs(self.spawn_kwargs))
+            **self.spawn_kwargs)
         if exitcode != os.EX_OK:
             msg = "!!! layman add error in %(repo)s"\
                 % ({'repo': self.repo.name})
@@ -111,7 +111,7 @@ class Layman(NewBase):
         command = ' '.join(args)
         exitcode = portage.process.spawn_bash("%(command)s" % \
             ({'command': command}),
-            **portage._native_kwargs(self.spawn_kwargs))
+            **self.spawn_kwargs)
 
         if exitcode != os.EX_OK:
             exitcode = self.new()[0]


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/layman:master commit in: pm_plugins/portage/sync/modules/laymansync/
@ 2020-04-24 20:59 Brian Dolbec
  0 siblings, 0 replies; 6+ messages in thread
From: Brian Dolbec @ 2020-04-24 20:59 UTC (permalink / raw
  To: gentoo-commits

commit:     8241372090c46c4ac6393189051909950b056453
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 24 12:39:06 2020 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Apr 24 13:56:48 2020 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=82413720

laymansync.pylayman.py: Fix bug 674594  typo

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pm_plugins/portage/sync/modules/laymansync/pylayman.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pm_plugins/portage/sync/modules/laymansync/pylayman.py b/pm_plugins/portage/sync/modules/laymansync/pylayman.py
index 5682135..8e3bc24 100644
--- a/pm_plugins/portage/sync/modules/laymansync/pylayman.py
+++ b/pm_plugins/portage/sync/modules/laymansync/pylayman.py
@@ -161,7 +161,7 @@ class PyLayman(NewBase):
         if self.repo.name not in available_overlays:
             overlay_package = create_overlay_package(repo=self.repo,\
                                 logger=self.logger,\
-                                xterm_titles=self.xter_titles)
+                                xterm_titles=self.xterm_titles)
             create_overlay_xml = Interactive(config=self.config)
             path = self.config.get_option('overlay_defs') + '/reposconf.xml'
             result = create_overlay_xml(overlay_package=overlay_package,


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-04-24 20:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-04 18:21 [gentoo-commits] proj/layman:master commit in: pm_plugins/portage/sync/modules/laymansync/ Brian Dolbec
  -- strict thread matches above, loose matches on Subject: below --
2020-04-24 20:59 Brian Dolbec
2017-06-23  0:05 Devan Franchini
2016-04-29 23:19 Brian Dolbec
2015-05-06  1:13 Devan Franchini
2015-02-08  0:35 Devan Franchini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox