public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Brian Dolbec" <brian.dolbec@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/layman:master commit in: layman/, etc/
Date: Wed, 24 Aug 2011 14:02:47 +0000 (UTC)	[thread overview]
Message-ID: <6a7cf195966b9d809a9fe005ef3547503c02776b.dol-sen@gentoo> (raw)

commit:     6a7cf195966b9d809a9fe005ef3547503c02776b
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Wed Aug 24 13:48:33 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Aug 24 14:01:18 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=6a7cf195

rename local_list to installed, create an update function to migrate the change.

---
 etc/layman.cfg       |    4 ++++
 layman/argsparser.py |    4 ++--
 layman/config.py     |    5 +++--
 layman/db.py         |   44 +++++++++++++++++++++++++++++++++++---------
 layman/makeconf.py   |   10 +++++-----
 5 files changed, 49 insertions(+), 18 deletions(-)

diff --git a/etc/layman.cfg b/etc/layman.cfg
index 7b8128f..2bb275a 100644
--- a/etc/layman.cfg
+++ b/etc/layman.cfg
@@ -13,6 +13,10 @@ cache     : %(storage)s/cache
 #-----------------------------------------------------------
 # The list of locally installed overlays
 
+installed: %(storage)s/installed.xml
+
+# old variable and value use it for updating to new one above
+
 local_list: %(storage)s/overlays.xml
 
 #-----------------------------------------------------------

diff --git a/layman/argsparser.py b/layman/argsparser.py
index 8f0b45b..1cb71b3 100644
--- a/layman/argsparser.py
+++ b/layman/argsparser.py
@@ -62,8 +62,8 @@ class ArgsParser(BareConfig):
         >>> a['overlays']
         '\\nhttp://www.gentoo.org/proj/en/overlays/repositories.xml'
         >>> sorted(a.keys())
-        ['bzr_addopts', 'bzr_command', 'bzr_postsync', 'bzr_syncopts', 'cache', 'config', 'configdir', 'cvs_addopts', 'cvs_command', 'cvs_postsync', 'cvs_syncopts', 'darcs_addopts', 'darcs_command', 'darcs_postsync', 'darcs_syncopts', 'g-common_command', 'g-common_generateopts', 'g-common_postsync', 'g-common_syncopts', 'git_addopts', 'git_command', 'git_postsync', 'git_syncopts', 'local_list', 'make_conf', 'mercurial_addopts', 'mercurial_command', 'mercurial_postsync', 'mercurial_syncopts', 'nocheck', 'overlay_defs', 'overlays', 'proxy', 'quietness', 'rsync_command', 'rsync_postsync', 'rsync_syncopts', 'storage', 'svn_addopts', 'svn_command', 'svn_postsync', 'svn_syncopts', 't/f_options', 'tar_command', 'tar_postsync', 'umask', 'width']
-        '''
+        ['bzr_addopts', 'bzr_command', 'bzr_postsync', 'bzr_syncopts', 'cache', 'config', 'configdir', 'cvs_addopts', 'cvs_command', 'cvs_postsync', 'cvs_syncopts', 'darcs_addopts', 'darcs_command', 'darcs_postsync', 'darcs_syncopts', 'g-common_command', 'g-common_generateopts', 'g-common_postsync', 'g-common_syncopts', 'git_addopts', 'git_command', 'git_postsync', 'git_syncopts', 'installed', 'local_list', 'make_conf', 'mercurial_addopts', 'mercurial_command', 'mercurial_postsync', 'mercurial_syncopts', 'nocheck', 'overlay_defs', 'overlays', 'proxy', 'quietness', 'rsync_command', 'rsync_postsync', 'rsync_syncopts', 'storage', 'svn_addopts', 'svn_command', 'svn_postsync', 'svn_syncopts', 't/f_options', 'tar_command', 'tar_postsync', 'umask', 'width']
+                '''
 
         BareConfig.__init__(self, stdout=stdout, stderr=stderr, stdin=stdin)
         if args == None:

diff --git a/layman/config.py b/layman/config.py
index ff4bdd2..2af4069 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -79,7 +79,7 @@ class BareConfig(object):
         >>> a['overlays']
         'http://www.gentoo.org/proj/en/overlays/repositories.xml'
         >>> sorted(a.keys())
-        ['bzr_addopts', 'bzr_command', 'bzr_postsync', 'bzr_syncopts', 'cache', 'config', 'configdir', 'cvs_addopts', 'cvs_command', 'cvs_postsync', 'cvs_syncopts', 'darcs_addopts', 'darcs_command', 'darcs_postsync', 'darcs_syncopts', 'g-common_command', 'g-common_generateopts', 'g-common_postsync', 'g-common_syncopts', 'git_addopts', 'git_command', 'git_postsync', 'git_syncopts', 'local_list', 'make_conf', 'mercurial_addopts', 'mercurial_command', 'mercurial_postsync', 'mercurial_syncopts', 'nocheck', 'nocolor', 'output', 'overlay_defs', 'overlays', 'proxy', 'quiet', 'quietness', 'rsync_command', 'rsync_postsync', 'rsync_syncopts', 'stderr', 'stdin', 'stdout', 'storage', 'svn_addopts', 'svn_command', 'svn_postsync', 'svn_syncopts', 't/f_options', 'tar_command', 'tar_postsync', 'umask', 'verbose', 'width']
+        ['bzr_addopts', 'bzr_command', 'bzr_postsync', 'bzr_syncopts', 'cache', 'config', 'configdir', 'cvs_addopts', 'cvs_command', 'cvs_postsync', 'cvs_syncopts', 'darcs_addopts', 'darcs_command', 'darcs_postsync', 'darcs_syncopts', 'g-common_command', 'g-common_generateopts', 'g-common_postsync', 'g-common_syncopts', 'git_addopts', 'git_command', 'git_postsync', 'git_syncopts', 'installed', 'local_list', 'make_conf', 'mercurial_addopts', 'mercurial_command', 'mercurial_postsync', 'mercurial_syncopts', 'nocheck', 'nocolor', 'output', 'overlay_defs', 'overlays', 'proxy', 'quiet', 'quietness', 'rsync_command', 'rsync_postsync', 'rsync_syncopts', 'stderr', 'stdin', 'stdout', 'storage', 'svn_addopts', 'svn_command', 'svn_postsync', 'svn_syncopts', 't/f_options', 'tar_command', 'tar_postsync', 'umask', 'verbose', 'width']
         >>> a.get_option('nocheck')
         True
         '''
@@ -90,6 +90,7 @@ class BareConfig(object):
                     'storage'   : EPREFIX + '/var/lib/layman',
                     'cache'     : '%(storage)s/cache',
                     'local_list': '%(storage)s/overlays.xml',
+                    'installed': '%(storage)s/installed.xml',
                     'make_conf' : '%(storage)s/make.conf',
                     'nocheck'   : 'yes',
                     'proxy'     : '',
@@ -258,7 +259,7 @@ class OptionConfig(BareConfig):
         >>> a["configdir"]
         '/etc/test-dir'
         >>> sorted(a.keys())
-        ['bzr_addopts', 'bzr_command', 'bzr_postsync', 'bzr_syncopts', 'cache', 'config', 'configdir', 'cvs_addopts', 'cvs_command', 'cvs_postsync', 'cvs_syncopts', 'darcs_addopts', 'darcs_command', 'darcs_postsync', 'darcs_syncopts', 'g-common_command', 'g-common_generateopts', 'g-common_postsync', 'g-common_syncopts', 'git_addopts', 'git_command', 'git_postsync', 'git_syncopts', 'local_list', 'make_conf', 'mercurial_addopts', 'mercurial_command', 'mercurial_postsync', 'mercurial_syncopts', 'nocheck', 'nocolor', 'output', 'overlay_defs', 'overlays', 'proxy', 'quiet', 'quietness', 'rsync_command', 'rsync_postsync', 'rsync_syncopts', 'stderr', 'stdin', 'stdout', 'storage', 'svn_addopts', 'svn_command', 'svn_postsync', 'svn_syncopts', 't/f_options', 'tar_command', 'tar_postsync', 'umask', 'verbose', 'width']
+        ['bzr_addopts', 'bzr_command', 'bzr_postsync', 'bzr_syncopts', 'cache', 'config', 'configdir', 'cvs_addopts', 'cvs_command', 'cvs_postsync', 'cvs_syncopts', 'darcs_addopts', 'darcs_command', 'darcs_postsync', 'darcs_syncopts', 'g-common_command', 'g-common_generateopts', 'g-common_postsync', 'g-common_syncopts', 'git_addopts', 'git_command', 'git_postsync', 'git_syncopts', 'installed', 'local_list', 'make_conf', 'mercurial_addopts', 'mercurial_command', 'mercurial_postsync', 'mercurial_syncopts', 'nocheck', 'nocolor', 'output', 'overlay_defs', 'overlays', 'proxy', 'quiet', 'quietness', 'rsync_command', 'rsync_postsync', 'rsync_syncopts', 'stderr', 'stdin', 'stdout', 'storage', 'svn_addopts', 'svn_command', 'svn_postsync', 'svn_syncopts', 't/f_options', 'tar_command', 'tar_postsync', 'umask', 'verbose', 'width']
         """
         BareConfig.__init__(self)
 

diff --git a/layman/db.py b/layman/db.py
index 17453b8..49069b7 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -44,31 +44,57 @@ from   layman.version           import VERSION
 #-------------------------------------------------------------------------------
 
 class DB(DbBase):
-    ''' Handle the list of local overlays.'''
+    ''' Handle the list of installed overlays.'''
 
     def __init__(self, config):
 
         self.config = config
         self.output = config['output']
 
-        self.path = config['local_list']
-        self.output.debug("DB.__init__(): config['local_list'] = %s" % self.path, 3)
+        self.path = config['installed']
+        self.output.debug("DB.__init__(): config['installed'] = %s" % self.path, 3)
 
         if config['nocheck']:
             ignore = 2
         else:
             ignore = 1
 
-        #quiet = int(config['quietness']) < 3
+        # check and handle the name change
+        #if not os.access(self.path, os.F_OK):
+        #    self.rename_db()
 
         DbBase.__init__(self,
                           config,
-                          paths=[config['local_list'], ],
+                          paths=[config['installed'], ],
                           ignore=ignore,
                           )
 
         self.output.debug('DB handler initiated', 6)
 
+
+    def rename_db(self):
+        """small upgarde function to handle the name change
+        for the installed xml file"""
+        if os.access(self.config['local_list'], os.F_OK):
+            self.output.info("Automatic db rename, old name was: %s"
+                % self.config['local_list'],2)
+            try:
+                os.rename(self.config['local_list'], self.path)
+                self.output.info("Automatic db rename, new installed db "
+                    "name is: %s" %self.path, 2)
+                self.output.notice('')
+                return
+            except OSError, err:
+                self.output.error("Automatic db rename failed:\n%s" %str(err))
+        else:
+            self.output.info("Automatic db rename, failed access to: %s"
+                % self.config['local_list'],2)
+        self.output.die("Please check that /etc/layman.cfg is up"
+                " to date\nThen try running layman again.\n"
+                "You may need to rename the old 'local_list' config setting"
+                " to\nthe new 'installed' config setting's filename.\n")
+
+
     # overrider
     def _broken_catalog_hint(self):
         return ''
@@ -82,7 +108,7 @@ class DB(DbBase):
         >>> write3 = os.tmpnam()
         >>> here = os.path.dirname(os.path.realpath(__file__))
         >>> from layman.config import OptionConfig
-        >>> myoptions = {'local_list' :
+        >>> myoptions = {'installed' :
         ...           here + '/tests/testfiles/global-overlays.xml',
         ...           'make_conf' : write2,
         ...           'nocheck'    : 'yes',
@@ -91,7 +117,7 @@ class DB(DbBase):
         >>> config = OptionConfig(myoptions)
         >>> config.set_option('quietness', 3)
         >>> a = DB(config)
-        >>> config.set_option('local_list', write)
+        >>> config.set_option('installed', write)
         >>> b = DB(config)
         >>> config['output'].set_colorize(False)
 
@@ -161,7 +187,7 @@ class DB(DbBase):
         >>> write3 = os.tmpnam()
         >>> here = os.path.dirname(os.path.realpath(__file__))
         >>> from layman.config import OptionConfig
-        >>> myoptions = {'local_list' :
+        >>> myoptions = {'installed' :
         ...           here + '/tests/testfiles/global-overlays.xml',
         ...           'make_conf' : write2,
         ...           'nocheck'    : 'yes',
@@ -170,7 +196,7 @@ class DB(DbBase):
         >>> config = OptionConfig(myoptions)
         >>> config.set_option('quietness', 3)
         >>> a = DB(config)
-        >>> config.set_option('local_list', write)
+        >>> config.set_option('installed', write)
         >>> b = DB(config)
         >>> config['output'].set_colorize(False)
 

diff --git a/layman/makeconf.py b/layman/makeconf.py
index b6f5d90..9836a1a 100644
--- a/layman/makeconf.py
+++ b/layman/makeconf.py
@@ -36,7 +36,7 @@ class MakeConf:
     >>> import hashlib
     >>> write = os.tmpnam()
     >>> here = os.path.dirname(os.path.realpath(__file__))
-    >>> config = {'local_list' :
+    >>> config = {'installed' :
     ...           here + '/tests/testfiles/global-overlays.xml',
     ...           'make_conf' : here + '/tests/testfiles/make.conf',
     ...           'nocheck'    : True,
@@ -86,7 +86,7 @@ class MakeConf:
 
         >>> write = os.tmpnam()
         >>> here = os.path.dirname(os.path.realpath(__file__))
-        >>> config = {'local_list' :
+        >>> config = {'installed' :
         ...           here + '/tests/testfiles/global-overlays.xml',
         ...           'make_conf' : here + '/tests/testfiles/make.conf',
         ...           'nocheck'    : True,
@@ -114,7 +114,7 @@ class MakeConf:
 
         >>> write = os.tmpnam()
         >>> here = os.path.dirname(os.path.realpath(__file__))
-        >>> config = {'local_list' :
+        >>> config = {'installed' :
         ...           here + '/tests/testfiles/global-overlays.xml',
         ...           'make_conf' : here + '/tests/testfiles/make.conf',
         ...           'nocheck'    : True,
@@ -143,7 +143,7 @@ class MakeConf:
         Read the list of registered overlays from /etc/make.conf.
 
         >>> here = os.path.dirname(os.path.realpath(__file__))
-        >>> config = {'local_list' :
+        >>> config = {'installed' :
         ...           here + '/tests/testfiles/global-overlays.xml',
         ...           'make_conf' : here + '/tests/testfiles/make.conf',
         ...           'nocheck'    : True,
@@ -203,7 +203,7 @@ class MakeConf:
 
         >>> write = os.tmpnam()
         >>> here = os.path.dirname(os.path.realpath(__file__))
-        >>> config = {'local_list' :
+        >>> config = {'installed' :
         ...           here + '/tests/testfiles/global-overlays.xml',
         ...           'make_conf' : here + '/tests/testfiles/make.conf',
         ...           'nocheck'    : True,



             reply	other threads:[~2011-08-24 14:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-24 14:02 Brian Dolbec [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-03-07 21:55 [gentoo-commits] proj/layman:master commit in: layman/, etc/ Devan Franchini
2014-08-17  1:33 Devan Franchini
2014-08-19  1:49 ` Devan Franchini
2014-07-24  2:03 Devan Franchini
2013-08-10 17:17 Brian Dolbec
2013-07-29  1:46 Brian Dolbec
2012-11-18 22:15 Brian Dolbec
2012-03-26  3:43 Brian Dolbec
2011-08-09  2:46 Brian Dolbec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6a7cf195966b9d809a9fe005ef3547503c02776b.dol-sen@gentoo \
    --to=brian.dolbec@gmail.com \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox