aboutsummaryrefslogtreecommitdiff
path: root/layman
diff options
context:
space:
mode:
authorDevan Franchini <twitch153@gentoo.org>2015-07-17 12:21:37 -0400
committerDevan Franchini <twitch153@gentoo.org>2015-07-17 12:23:48 -0400
commit8fce6fd8a4057222edc07478c6ba19c68bb0aaa3 (patch)
tree28035032cdcd23b654b990a953bc081e043aa39f /layman
parentconstants.py: Adds constant DB_TYPES for supported db checking (diff)
downloadlayman-8fce6fd8a4057222edc07478c6ba19c68bb0aaa3.tar.gz
layman-8fce6fd8a4057222edc07478c6ba19c68bb0aaa3.tar.bz2
layman-8fce6fd8a4057222edc07478c6ba19c68bb0aaa3.zip
Removes unnecessary "_db" appendage to db_type var
To avoid namespace collisions in py2.7 the database modules needed to have "_db" appended to their name. In order to avoid having this ugliness in the user's config file and elsewhere in layman's code the DbBase class simply adds the "_db" portion of the name itself.
Diffstat (limited to 'layman')
-rw-r--r--layman/config.py2
-rw-r--r--layman/dbbase.py6
-rw-r--r--layman/remotedb.py2
-rwxr-xr-xlayman/tests/external.py20
4 files changed, 15 insertions, 15 deletions
diff --git a/layman/config.py b/layman/config.py
index 0ad975b..853e22f 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -100,7 +100,7 @@ class BareConfig(object):
'auto_sync': 'No',
'check_official': 'Yes',
'conf_type': 'repos.conf',
- 'db_type': 'xml_db',
+ 'db_type': 'xml',
'require_repoconfig': 'Yes',
'clean_archive': 'yes',
'make_conf' : '%(storage)s/make.conf',
diff --git a/layman/dbbase.py b/layman/dbbase.py
index 283d65c..7832565 100644
--- a/layman/dbbase.py
+++ b/layman/dbbase.py
@@ -105,7 +105,7 @@ class DbBase(object):
% {'db_types': self.db_type, 'db_type': self.db_type[0]}
self.output.warn(msg)
- self.db_type = self.db_type[0]
+ self.db_type = self.db_type[0] + '_db'
for path in self.paths:
if not os.path.exists(path):
@@ -182,7 +182,7 @@ class DbBase(object):
db_type = self.db_type
if text and text_type:
- db_type = text_type
+ db_type = text_type + '_db'
#Added to keep xml functionality for cached overlay XML definitions
if 'cache' in path and '.xml' in path:
@@ -204,7 +204,7 @@ class DbBase(object):
db_type = self.db_type
if migrate_type:
- db_type = migrate_type
+ db_type = migrate_type + '_db'
db_ctl = self.mod_ctl.get_class(db_type)(self.config,
self.overlays,
diff --git a/layman/remotedb.py b/layman/remotedb.py
index 89caf7a..b9c4ae0 100644
--- a/layman/remotedb.py
+++ b/layman/remotedb.py
@@ -280,7 +280,7 @@ class RemoteDB(DbBase):
def _check_download(self, olist, url):
try:
- self.read_db(url, text=olist, text_type="xml_db")
+ self.read_db(url, text=olist, text_type="xml")
except Exception as error:
self.output.debug("RemoteDB._check_download(), url=%s \nolist:\n"
% url,2)
diff --git a/layman/tests/external.py b/layman/tests/external.py
index 01cf5b3..e9f419a 100755
--- a/layman/tests/external.py
+++ b/layman/tests/external.py
@@ -154,7 +154,7 @@ class AddDeleteDB(unittest.TestCase):
my_opts = {'installed' : temp_xml_path,
'conf_type' : ['make.conf', 'repos.conf'],
- 'db_type' : 'xml_db',
+ 'db_type' : 'xml',
'nocheck' : 'yes',
'make_conf' : make_conf,
'repos_conf' : repo_conf,
@@ -556,7 +556,7 @@ class OverlayObjTest(unittest.TestCase):
overlays = document.findall('overlay') + document.findall('repo')
output = Message()
- ovl_a = Overlay({'output': output, 'db_type': 'xml_db'}, xml=overlays[0])
+ ovl_a = Overlay({'output': output, 'db_type': 'xml'}, xml=overlays[0])
self.assertEqual(ovl_a.name, 'wrobel')
self.assertEqual(ovl_a.is_official(), True)
url = ['https://overlays.gentoo.org/svn/dev/wrobel']
@@ -565,7 +565,7 @@ class OverlayObjTest(unittest.TestCase):
self.assertEqual(ovl_a.descriptions, ['Test'])
self.assertEqual(ovl_a.priority, 10)
- ovl_b = Overlay({'output': output, 'db_type': 'xml_db'}, xml=overlays[1])
+ ovl_b = Overlay({'output': output, 'db_type': 'xml'}, xml=overlays[1])
self.assertEqual(ovl_b.is_official(), False)
@@ -574,7 +574,7 @@ class OverlayObjTest(unittest.TestCase):
overlays = document.findall('overlay') + document.findall('repo')
output = Message()
- ovl = Overlay({'output': output, 'db_type': 'xml_db'}, xml=overlays[0])
+ ovl = Overlay({'output': output, 'db_type': 'xml'}, xml=overlays[0])
test_infostr = 'wrobel\n~~~~~~\nSource : '\
'https://overlays.gentoo.org/svn/dev/wrobel\nContact '\
': nobody@gentoo.org\nType : Subversion; Priority: '\
@@ -588,7 +588,7 @@ class OverlayObjTest(unittest.TestCase):
overlays = document.findall('overlay') + document.findall('repo')
output = Message()
- ovl = Overlay({'output': output, 'db_type': 'xml_db'}, xml=overlays[0])
+ ovl = Overlay({'output': output, 'db_type': 'xml'}, xml=overlays[0])
test_short_list = 'wrobel [Subversion] '\
'(https://o.g.o/svn/dev/wrobel )'
self.assertEqual(ovl.short_list(80).decode('utf-8'), test_short_list)
@@ -639,7 +639,7 @@ class ReadWriteSelectListDbBase(unittest.TestCase):
output = Message()
config = {
'output': output,
- 'db_type': 'xml_db',
+ 'db_type': 'xml',
'svn_command': '/usr/bin/svn',
'rsync_command':'/usr/bin/rsync'
}
@@ -674,7 +674,7 @@ class ReadWriteSelectListDbBase(unittest.TestCase):
def read_db(self):
output = Message()
config = {'output': output,
- 'db_type': 'xml_db',}
+ 'db_type': 'xml',}
db = DbBase(config, [HERE + '/testfiles/global-overlays.xml', ])
keys = sorted(db.overlays)
self.assertEqual(keys, ['wrobel', 'wrobel-stable'])
@@ -686,7 +686,7 @@ class ReadWriteSelectListDbBase(unittest.TestCase):
def select_db(self):
output = Message()
config = {'output': output,
- 'db_type': 'xml_db',}
+ 'db_type': 'xml',}
db = DbBase(config, [HERE + '/testfiles/global-overlays.xml', ])
url = ['rsync://gunnarwrobel.de/wrobel-stable']
self.assertEqual(list(db.select('wrobel-stable').source_uris()), url)
@@ -698,12 +698,12 @@ class ReadWriteSelectListDbBase(unittest.TestCase):
config = BareConfig()
a = DbBase(config, [HERE + '/testfiles/global-overlays.xml', ])
- b = DbBase({'output': Message(), 'db_type': 'xml_db'}, [test_xml,])
+ b = DbBase({'output': Message(), 'db_type': 'xml'}, [test_xml,])
b.overlays['wrobel-stable'] = a.overlays['wrobel-stable']
b.write(test_xml)
- c = DbBase({'output': Message(), 'db_type': 'xml_db'}, [test_xml,])
+ c = DbBase({'output': Message(), 'db_type': 'xml'}, [test_xml,])
keys = sorted(c.overlays)
self.assertEqual(keys, ['wrobel-stable'])