* [gentoo-commits] proj/layman:master commit in: layman/, etc/
@ 2011-08-09 2:46 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2011-08-09 2:46 UTC (permalink / raw
To: gentoo-commits
commit: 0a03f32c1257af352bf9ffa2be324c53f2656aa3
Author: dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Tue Aug 9 01:14:18 2011 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Aug 9 01:14:18 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=0a03f32c
make it EPREFIX ready
---
etc/layman.cfg | 3 +--
layman/config.py | 31 ++++++++++++++++++++-----------
2 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/etc/layman.cfg b/etc/layman.cfg
index a3bce58..7b8128f 100644
--- a/etc/layman.cfg
+++ b/etc/layman.cfg
@@ -1,9 +1,8 @@
[MAIN]
-
#-----------------------------------------------------------
# Defines the directory where overlays should be installed
-storage : /var/lib/layman
+storage : @GENTOO_PORTAGE_EPREFIX@/var/lib/layman
#-----------------------------------------------------------
# Remote overlay lists will be stored here
diff --git a/layman/config.py b/layman/config.py
index 3873eef..1187f78 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -25,6 +25,7 @@
__version__ = "0.2"
+
import sys
import os
import ConfigParser
@@ -55,6 +56,14 @@ def read_layman_config(config=None, defaults=None):
config.set('MAIN', 'overlays', '\n'.join(overlays))
+# establish the eprefix, initially set so eprefixify can
+# set it on install
+EPREFIX = "@GENTOO_PORTAGE_EPREFIX@"
+
+# check and set it if it wasn't
+if EPREFIX == "@GENTOO_PORTAGE_EPREFIX@":
+ EPREFIX = ''
+
class BareConfig(object):
'''Handles the configuration only.'''
@@ -76,9 +85,9 @@ class BareConfig(object):
'''
self._defaults = {
- 'configdir': '/etc/layman',
+ 'configdir': EPREFIX + '/etc/layman',
'config' : '%(configdir)s/layman.cfg',
- 'storage' : '/var/lib/layman',
+ 'storage' : EPREFIX + '/var/lib/layman',
'cache' : '%(storage)s/cache',
'local_list': '%(storage)s/overlays.xml',
'make_conf' : '%(storage)s/make.conf',
@@ -88,15 +97,15 @@ class BareConfig(object):
'overlays' :
'http://www.gentoo.org/proj/en/overlays/repositories.xml',
'overlay_defs': '%(configdir)s/overlays',
- 'bzr_command': '/usr/bin/bzr',
- 'cvs_command': '/usr/bin/cvs',
- 'darcs_command': '/usr/bin/darcs',
- 'git_command': '/usr/bin/git',
- 'g-common_command': '/usr/bin/g-common',
- 'mercurial_command': '/usr/bin/hg',
- 'rsync_command': '/usr/bin/rsync',
- 'svn_command': '/usr/bin/svn',
- 'tar_command': '/bin/tar',
+ 'bzr_command': EPREFIX +'/usr/bin/bzr',
+ 'cvs_command': EPREFIX +'/usr/bin/cvs',
+ 'darcs_command': EPREFIX +'/usr/bin/darcs',
+ 'git_command': EPREFIX +'/usr/bin/git',
+ 'g-common_command': EPREFIX +'/usr/bin/g-common',
+ 'mercurial_command': EPREFIX +'/usr/bin/hg',
+ 'rsync_command': EPREFIX +'/usr/bin/rsync',
+ 'svn_command': EPREFIX +'/usr/bin/svn',
+ 'tar_command': EPREFIX +'/bin/tar',
't/f_options': ['nocheck'],
'bzr_addopts' : '',
'bzr_syncopts' : '',
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/, etc/
@ 2011-08-24 14:02 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2011-08-24 14:02 UTC (permalink / raw
To: gentoo-commits
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,
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/, etc/
@ 2012-03-26 3:43 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2012-03-26 3:43 UTC (permalink / raw
To: gentoo-commits
commit: 5c33fbc34acca869ec9fe80c4f470edfe560d9a0
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 11 00:14:09 2012 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Mar 11 00:14:09 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=5c33fbc3
Add news reporting capability to meet GLEP 42 requirement.
---
etc/layman.cfg | 26 ++++++++++++++++++++++++++
layman/api.py | 8 ++++++++
layman/config.py | 1 +
3 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/etc/layman.cfg b/etc/layman.cfg
index 1b74f96..7f7baab 100644
--- a/etc/layman.cfg
+++ b/etc/layman.cfg
@@ -81,6 +81,32 @@ nocheck : yes
#umask : 0022
#-----------------------------------------------------------
+# News reporting settings
+#
+# This is for when layman is adding/syncing overlays.
+# It is required for GLEP 42.
+# Currently there are 3 possible values:
+# portage, pkgcore, custom
+#
+# portage: uses portage to report news only from overlay(s) in
+# versions >=2.2.0_alpha72 or >=2.1.10.32
+# or all repositories (including gentoo) for older portage versions.
+# pkgcore: does not yet support glep 42, no news is reported
+# custom: requires that you provide a suitable python function
+# to 'custom_news_func' using the api's config.set_option()
+# or define the python package to import it from in custom_news_pkg
+
+news_reporter: portage
+
+#-----------------------------------------------------------
+# News reporting custom function setting
+#
+# the pkg name that contains the layman_news_function()
+# for it to import and use. It must be found in PYTHONPATH
+
+#custom_news_pkg :
+
+#-----------------------------------------------------------
# Command overrides
#
# You can have commands point to either a binary at a different
diff --git a/layman/api.py b/layman/api.py
index 4ff62dd..3f33a42 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -562,9 +562,17 @@ class LaymanAPI(object):
settings, trees, mtimedb = load_emerge_config()
display_news_notification(
trees[settings["ROOT"]]["root_config"], {})
+
elif self.config['news_reporter'] == 'custom':
+ if self.config['custom_news_func'] is None:
+ _temp = __import__(
+ 'custom_news_pkg', globals(), locals(),
+ ['layman_news_func'], -1)
+ self.config['custom_news_func'] = _temp.custom_news_func
self.config['custom_news_func'](repos)
+
elif self.config['news_reporter'] == 'pkgcore':
+ # pkgcore is not yet capable
return
except Exception as err:
msg = "update_news() failed running %s news reporter function\n" +\
diff --git a/layman/config.py b/layman/config.py
index c245853..0541d92 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -96,6 +96,7 @@ class BareConfig(object):
'proxy' : '',
'umask' : '0022',
'news_reporter': 'portage',
+ 'custom_news_pkg': '',
'overlays' :
'http://www.gentoo.org/proj/en/overlays/repositories.xml',
'overlay_defs': '%(configdir)s/overlays',
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/, etc/
@ 2012-11-18 22:15 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2012-11-18 22:15 UTC (permalink / raw
To: gentoo-commits
commit: e8e8cd689ccb12c36d27d75b8a4f8f9d8e9c6249
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 18 19:11:47 2012 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Nov 18 19:11:47 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=e8e8cd68
split out remotedb to it's own file, add gpg signed list support, some pyflakes cleanup
---
etc/layman.cfg | 36 +++++-
layman/api.py | 12 +-
layman/config.py | 8 +-
layman/db.py | 215 +---------------------------
layman/remotedb.py | 410 ++++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 457 insertions(+), 224 deletions(-)
diff --git a/etc/layman.cfg b/etc/layman.cfg
index a99ab9d..8a39ab9 100644
--- a/etc/layman.cfg
+++ b/etc/layman.cfg
@@ -36,8 +36,42 @@ make_conf : %(storage)s/make.conf
# http://dev.gentoo.org/~wrobel/layman/global-overlays.xml
# http://mydomain.org/my-layman-list.xml
# file:///var/lib/layman/my-list.xml
+#
+##### NEW ##### GPG signed lists #####
+#
+# gpg_signed_lists :
+# These can be clearsigned or signed (compressed) overlay lists
+# Each url will be one complete file to download, verify, decrypt.
+# layman will automatically verify and decrypt the list before saving
+# One url per line, indented
+#
+# e.g.:
+# gpg_signed_lists :
+# http://someserver.somewhere.com/someoverlays.xml.asc
+#
+gpg_signed_lists :
+
+#
+# gpg_detached_lists:
+# These url's involve downloading 2 files
+# The first url listed will be the overlays xml list.
+# The second url will be the detached signature file
+# with one of {.gpg, .asc, .sig} extension
+# Both url's must be on the same line space separated and indented
+#
+# e.g.:
+# gpg_detached_lists :
+# http://distfiles.gentoo.org/overlays.xml http://distfiles.gentoo.org/overlays.xml.asc
+# http://someserver.somewhere.com/someoverlays.xml http://someserver.somewhere.com/someoverlays.xml.gpg
+
+gpg_detached_lists :
+# http://distfiles.gentoo.org/overlays.xml http://distfiles.gentoo.org/overlays.xml.asc
+
+# original unsigned lists and definitions
+# one url per line, indented
-overlays : http://www.gentoo.org/proj/en/overlays/repositories.xml
+overlays :
+ http://www.gentoo.org/proj/en/overlays/repositories.xml
#-----------------------------------------------------------
# The directory to scan for xml overlay definition files to include
diff --git a/layman/api.py b/layman/api.py
index 8dda224..11534fd 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -13,16 +13,16 @@
# Brian Dolbec <dol-sen@sourceforge.net>
#
-from sys import stderr
import os
from layman.config import BareConfig
from layman.dbbase import UnknownOverlayException, UnknownOverlayMessage
-from layman.db import DB, RemoteDB
+from layman.db import DB
+from layman.remotedb import RemoteDB
from layman.overlays.source import require_supported
#from layman.utils import path, delete_empty_directory
-from layman.compatibility import encode, fileopen
+from layman.compatibility import encode
UNKNOWN_REPO_ID = "Repo ID '%s' " + \
@@ -499,8 +499,8 @@ class LaymanAPI(object):
def reload(self):
"""reloads the installed and remote db's to the data on disk"""
- result = self.get_available(dbreload=True)
- result = self.get_installed(dbreload=True)
+ self.get_available(dbreload=True)
+ self.get_installed(dbreload=True)
def _error(self, message):
@@ -599,7 +599,7 @@ def create_fd():
"""
fd_r, fd_w = os.pipe()
write = os.fdopen(fd_w, 'w')
- rread = os.fdopen(fd_r, 'r')
+ read = os.fdopen(fd_r, 'r')
return (read, write, fd_r, fd_w)
diff --git a/layman/config.py b/layman/config.py
index 1f5bc34..bb15abb 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -53,9 +53,9 @@ def read_layman_config(config=None, defaults=None, output=None):
filelist = [f for f in filelist if f.endswith('.xml')]
overlays = set(config.get('MAIN', 'overlays').split('\n'))
for _file in filelist:
- path = os.path.join(config.get('MAIN', 'overlay_defs'), _file)
- if os.path.isfile(path):
- overlays.update(["file://" + path])
+ _path = os.path.join(config.get('MAIN', 'overlay_defs'), _file)
+ if os.path.isfile(_path):
+ overlays.update(["file://" + _path])
config.set('MAIN', 'overlays', '\n'.join(overlays))
@@ -105,6 +105,8 @@ class BareConfig(object):
'umask' : '0022',
'news_reporter': 'portage',
'custom_news_pkg': '',
+ 'gpg_detached_lists': '',
+ 'gpg_signed_lists': '',
'overlays' :
'http://www.gentoo.org/proj/en/overlays/repositories.xml',
'overlay_defs': '%(configdir)s/overlays',
diff --git a/layman/db.py b/layman/db.py
index e2d740c..8dc968e 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -27,17 +27,11 @@ __version__ = "$Id: db.py 309 2007-04-09 16:23:38Z wrobel $"
#-------------------------------------------------------------------------------
import os, os.path
-import sys
-import urllib2
-import hashlib
-from layman.utils import path, delete_empty_directory, encoder
+from layman.utils import path, delete_empty_directory
from layman.dbbase import DbBase
from layman.makeconf import MakeConf
-from layman.version import VERSION
-from layman.compatibility import fileopen
-#from layman.debug import OUT
#===============================================================================
#
@@ -238,213 +232,6 @@ class DB(DbBase):
'" returned status ' + str(result) + '!' +
'\ndb.sync()')
-#===============================================================================
-#
-# Class RemoteDB
-#
-#-------------------------------------------------------------------------------
-
-class RemoteDB(DbBase):
- '''Handles fetching the remote overlay list.'''
-
- def __init__(self, config, ignore_init_read_errors=False):
-
- self.config = config
- self.output = config['output']
-
- self.proxies = {}
-
- if config['proxy']:
- self.proxies['http'] = config['proxy']
- elif os.getenv('http_proxy'):
- self.proxies['http'] = os.getenv('http_proxy')
-
- if self.proxies:
- proxy_handler = urllib2.ProxyHandler(self.proxies)
- opener = urllib2.build_opener(proxy_handler)
- urllib2.install_opener(opener)
-
- self.urls = [i.strip() for i in config['overlays'].split('\n') if len(i)]
-
- paths = [self.filepath(i) + '.xml' for i in self.urls]
-
- if config['nocheck']:
- ignore = 2
- else:
- ignore = 0
-
- #quiet = int(config['quietness']) < 3
-
- DbBase.__init__(self, config, paths=paths, ignore=ignore,
- ignore_init_read_errors=ignore_init_read_errors)
-
- # overrider
- def _broken_catalog_hint(self):
- return 'Try running "sudo layman -f" to re-fetch that file'
-
- def cache(self):
- '''
- Copy the remote overlay list to the local cache.
-
- >>> import tempfile
- >>> here = os.path.dirname(os.path.realpath(__file__))
- >>> tmpdir = tempfile.mkdtemp(prefix="laymantmp_")
- >>> cache = os.path.join(tmpdir, 'cache')
- >>> myoptions = {'overlays' :
- ... ['file://' + here + '/tests/testfiles/global-overlays.xml'],
- ... 'cache' : cache,
- ... 'nocheck' : 'yes',
- ... 'proxy' : None}
- >>> from layman.config import OptionConfig
- >>> config = OptionConfig(myoptions)
- >>> config.set_option('quietness', 3)
- >>> a = RemoteDB(config)
- >>> a.cache()
- (True, True)
- >>> b = fileopen(a.filepath(config['overlays'])+'.xml')
- >>> b.readlines()[24]
- ' A collection of ebuilds from Gunnar Wrobel [wrobel@gentoo.org].\\n'
-
- >>> b.close()
- >>> os.unlink(a.filepath(config['overlays'])+'.xml')
-
- >>> a.overlays.keys()
- [u'wrobel', u'wrobel-stable']
-
- >>> import shutil
- >>> shutil.rmtree(tmpdir)
- '''
- has_updates = False
- # succeeded reset when a failure is detected
- succeeded = True
- for url in self.urls:
-
- filepath = self.filepath(url)
- mpath = filepath + '.xml'
- tpath = filepath + '.timestamp'
-
- # check when the cache was last updated
- # and don't re-fetch it unless it has changed
- request = urllib2.Request(url)
- opener = urllib2.build_opener()
- opener.addheaders = [('User-Agent', 'Layman-' + VERSION)]
-
- if os.path.exists(tpath):
- with fileopen(tpath,'r') as previous:
- timestamp = previous.read()
- request.add_header('If-Modified-Since', timestamp)
-
- if not self.check_path([mpath]):
- continue
-
- try:
- connection = opener.open(request)
- # py2, py3 compatibility, since only py2 returns keys as lower()
- headers = dict((x.lower(), x) for x in connection.headers.keys())
- if 'last-modified' in headers:
- timestamp = connection.headers[headers['last-modified']]
- elif 'date' in headers:
- timestamp = connection.headers[headers['date']]
- else:
- timestamp = None
- except urllib2.HTTPError, e:
- if e.code == 304:
- self.output.info('Remote list already up to date: %s'
- % url, 4)
- self.output.info('Last-modified: %s' % timestamp, 4)
- else:
- self.output.error('RemoteDB.cache(); HTTPError was:\n'
- 'url: %s\n%s'
- % (url, str(e)))
- succeeded = False
- continue
- except IOError, error:
- self.output.error('RemoteDB.cache(); Failed to update the '
- 'overlay list from: %s\nIOError was:%s\n'
- % (url, str(error)))
- succeeded = False
- continue
- else:
- if url.startswith('file://'):
- quieter = 1
- else:
- quieter = 0
- self.output.info('Fetching new list... %s' % url, 4 + quieter)
- if timestamp is not None:
- self.output.info('Last-modified: %s' % timestamp, 4 + quieter)
- # Fetch the remote list
- olist = connection.read()
-
- # Create our storage directory if it is missing
- if not os.path.exists(os.path.dirname(mpath)):
- try:
- os.makedirs(os.path.dirname(mpath))
- except OSError, error:
- raise OSError('Failed to create layman storage direct'
- + 'ory ' + os.path.dirname(mpath) + '\n'
- + 'Error was:' + str(error))
-
- # Before we overwrite the old cache, check that the downloaded
- # file is intact and can be parsed
- try:
- self.read(olist, origin=url)
- except Exception, error:
- raise IOError('Failed to parse the overlays list fetched fr'
- 'om ' + url + '\nThis means that the download'
- 'ed file is somehow corrupt or there was a pr'
- 'oblem with the webserver. Check the content '
- 'of the file. Error was:\n' + str(error))
-
- # the folowing is neded for py3 only
- if sys.hexversion >= 0x3000000 and hasattr(olist, 'decode'):
- olist = olist.decode("UTF-8")
- # Ok, now we can overwrite the old cache
- try:
- out_file = fileopen(mpath, 'w')
- out_file.write(olist)
- out_file.close()
-
- if timestamp is not None:
- out_file = fileopen(tpath, 'w')
- out_file.write(str(timestamp))
- out_file.close()
-
- has_updates = True
-
- except Exception, error:
- raise IOError('Failed to temporarily cache overlays list in'
- ' ' + mpath + '\nError was:\n' + str(error))
- self.output.debug("RemoteDB.cache() returning: has_updates, succeeded"
- " %s, %s" % (str(has_updates), str(succeeded)), 4)
- return has_updates, succeeded
-
-
- def filepath(self, url):
- '''Return a unique file name for the url.'''
-
- base = self.config['cache']
-
- self.output.debug('Generating cache path.', 6)
- url_encoded = encoder(url, "UTF-8")
-
- return base + '_' + hashlib.md5(url_encoded).hexdigest()
-
-
- def check_path(self, paths, hint=True):
- '''Check for sufficient privileges'''
- self.output.debug('RemoteDB.check_path; paths = ' + str(paths), 8)
- is_ok = True
- for path in paths:
- if os.path.exists(path) and not os.access(path, os.W_OK):
- if hint:
- self.output.warn(
- 'You do not have permission to update the cache (%s).'
- % path)
- import getpass
- if getpass.getuser() != 'root':
- self.output.warn('Hint: You are not root.\n')
- is_ok = False
- return is_ok
#===============================================================================
#
diff --git a/layman/remotedb.py b/layman/remotedb.py
new file mode 100644
index 0000000..851b89b
--- /dev/null
+++ b/layman/remotedb.py
@@ -0,0 +1,410 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#################################################################################
+# LAYMAN OVERLAY DB
+#################################################################################
+# File: db.py
+#
+# Access to the db of overlays
+#
+# Copyright:
+# (c) 2005 - 2008 Gunnar Wrobel
+# Distributed under the terms of the GNU General Public License v2
+#
+# Author(s):
+# Gunnar Wrobel <wrobel@gentoo.org>
+#
+'''Handles different storage files.'''
+
+from __future__ import with_statement
+
+__version__ = "$Id: db.py 309 2007-04-09 16:23:38Z wrobel $"
+
+#===============================================================================
+#
+# Dependencies
+#
+#-------------------------------------------------------------------------------
+
+import os, os.path
+import sys
+import urllib2
+import hashlib
+
+from pygpg.config import GPGConfig
+from pygpg.gpg import GPG
+
+from layman.utils import encoder
+from layman.dbbase import DbBase
+from layman.version import VERSION
+from layman.compatibility import fileopen
+
+class RemoteDB(DbBase):
+ '''Handles fetching the remote overlay list.'''
+
+ def __init__(self, config, ignore_init_read_errors=False):
+
+ self.config = config
+ self.output = config['output']
+
+ self.proxies = {}
+
+ if config['proxy']:
+ self.proxies['http'] = config['proxy']
+ elif os.getenv('http_proxy'):
+ self.proxies['http'] = os.getenv('http_proxy')
+
+ if self.proxies:
+ proxy_handler = urllib2.ProxyHandler(self.proxies)
+ opener = urllib2.build_opener(proxy_handler)
+ urllib2.install_opener(opener)
+
+ self.urls = [i.strip()
+ for i in config['overlays'].split('\n') if len(i)]
+
+ #pair up the list url and detached sig url
+ d_urls = [i.strip()
+ for i in config['gpg_detached_lists'].split('\n') if len(i)]
+ self.detached_urls = []
+ #for index in range(0, len(d_urls), 2):
+ # self.detached_urls.append((d_urls[index], d_urls[index+1]))
+ for i in d_urls:
+ u = i.split()
+ self.detached_urls.append((u[0], u[1]))
+
+ self.signed_urls = [i.strip()
+ for i in config['gpg_signed_lists'].split('\n') if len(i)]
+
+ self.output.debug('RemoteDB.__init__(), url lists= \nself.urls: %s\nself.detached_urls: %s\nself.signed_urls: %s' % (str(self.urls), str(self.detached_urls), str(self.signed_urls)), 2)
+
+ # add up the lists to load for display, etc.
+ # unsigned overlay lists
+ paths = [self.filepath(i) + '.xml' for i in self.urls]
+ # detach-signed lists
+ paths.extend([self.filepath(i[0]) + '.xml' for i in self.detached_urls])
+ # single file signed, compressed, clearsigned
+ paths.extend([self.filepath(i) + '.xml' for i in self.signed_urls])
+
+ self.output.debug('RemoteDB.__init__(), paths to load = %s' %str(paths), 2)
+
+ if config['nocheck']:
+ ignore = 2
+ else:
+ ignore = 0
+
+ #quiet = int(config['quietness']) < 3
+
+ DbBase.__init__(self, config, paths=paths, ignore=ignore,
+ ignore_init_read_errors=ignore_init_read_errors)
+
+ self.gpg = None
+ self.gpg_config = None
+
+
+ # overrider
+ def _broken_catalog_hint(self):
+ return 'Try running "sudo layman -f" to re-fetch that file'
+
+
+ def cache(self):
+ '''
+ Copy the remote overlay list to the local cache.
+
+ >>> import tempfile
+ >>> here = os.path.dirname(os.path.realpath(__file__))
+ >>> tmpdir = tempfile.mkdtemp(prefix="laymantmp_")
+ >>> cache = os.path.join(tmpdir, 'cache')
+ >>> myoptions = {'overlays' :
+ ... ['file://' + here + '/tests/testfiles/global-overlays.xml'],
+ ... 'cache' : cache,
+ ... 'nocheck' : 'yes',
+ ... 'proxy' : None}
+ >>> from layman.config import OptionConfig
+ >>> config = OptionConfig(myoptions)
+ >>> config.set_option('quietness', 3)
+ >>> a = RemoteDB(config)
+ >>> a.cache()
+ (True, True)
+ >>> b = fileopen(a.filepath(config['overlays'])+'.xml')
+ >>> b.readlines()[24]
+ ' A collection of ebuilds from Gunnar Wrobel [wrobel@gentoo.org].\\n'
+
+ >>> b.close()
+ >>> os.unlink(a.filepath(config['overlays'])+'.xml')
+
+ >>> a.overlays.keys()
+ [u'wrobel', u'wrobel-stable']
+
+ >>> import shutil
+ >>> shutil.rmtree(tmpdir)
+ '''
+ has_updates = False
+ self._create_storage(self.config['storage'])
+ # succeeded reset when a failure is detected
+ succeeded = True
+ url_lists = [self.urls, self.detached_urls, self.signed_urls]
+ need_gpg = [False, True, True]
+ for index in range(0, 3):
+ self.output.debug("RemoteDB.cache() index = %s" %str(index),2)
+ urls = url_lists[index]
+ if need_gpg[index] and len(urls) and self.gpg is None:
+ #initialize our gpg instance
+ self.init_gpg()
+ # main working loop
+ for url in urls:
+ sig = ''
+ self.output.debug("RemoteDB.cache() url = %s is a tuple=%s"
+ %(str(url), str(isinstance(url, tuple))),2)
+ filepath, mpath, tpath, sig = self._paths(url)
+
+ if sig:
+ success, olist, timestamp = self._fetch_url(
+ url[0], mpath, tpath)
+ else:
+ success, olist, timestamp = self._fetch_url(
+ url, mpath, tpath)
+ if not success:
+ #succeeded = False
+ continue
+
+ self.output.debug("RemoteDB.cache() len(olist) = %s" %str(len(olist)),2)
+ # GPG handling
+ if need_gpg[index]:
+ olist, verified = self.verify_gpg(url, sig, olist)
+ if not verified:
+ self.output.debug("RemoteDB.cache() gpg returned "
+ "verified = %s" %str(verified),2)
+ succeeded = False
+ filename = os.path.join(self.config['storage'], "Failed-to-verify-sig")
+ self.write_cache(olist, filename)
+ continue
+
+ # Before we overwrite the old cache, check that the downloaded
+ # file is intact and can be parsed
+ if isinstance(url, tuple):
+ olist = self._check_download(olist, url[0])
+ else:
+ olist = self._check_download(olist, url)
+
+ # Ok, now we can overwrite the old cache
+ has_updates = max(has_updates,
+ self.write_cache(olist, mpath, tpath, timestamp))
+
+ self.output.debug("RemoteDB.cache() self.urls: has_updates, succeeded"
+ " %s, %s" % (str(has_updates), str(succeeded)), 4)
+ return has_updates, succeeded
+
+
+ def _paths(self, url):
+ self.output.debug("RemoteDB._paths(), url is tuple %s" % str(url),2)
+ if isinstance(url, tuple):
+ filepath = self.filepath(url[0])
+ sig = filepath + '.sig'
+ else:
+ filepath = self.filepath(url)
+ sig = ''
+ mpath = filepath + '.xml'
+ tpath = filepath + '.timestamp'
+ return filepath, mpath, tpath, sig
+
+
+ @staticmethod
+ def _create_storage(mpath):
+ # Create our storage directory if it is missing
+ if not os.path.exists(os.path.dirname(mpath)):
+ try:
+ os.makedirs(os.path.dirname(mpath))
+ except OSError, error:
+ raise OSError('Failed to create layman storage direct'
+ + 'ory ' + os.path.dirname(mpath) + '\n'
+ + 'Error was:' + str(error))
+ return
+
+
+ def filepath(self, url):
+ '''Return a unique file name for the url.'''
+
+ base = self.config['cache']
+
+ self.output.debug('Generating cache path.', 6)
+ url_encoded = encoder(url, "UTF-8")
+
+ return base + '_' + hashlib.md5(url_encoded).hexdigest()
+
+
+ def _fetch_url(self, url, mpath, tpath=None):
+ self.output.debug('RemoteDB._fetch_url() url = %s' % url, 2)
+ # check when the cache was last updated
+ # and don't re-fetch it unless it has changed
+ request = urllib2.Request(url)
+ opener = urllib2.build_opener()
+ opener.addheaders = [('Accept-Charset', 'utf-8'),
+ ('User-Agent', 'Layman-' + VERSION)]
+ #opener.addheaders[('User-Agent', 'Layman-' + VERSION)]
+
+ if tpath and os.path.exists(tpath):
+ with fileopen(tpath,'r') as previous:
+ timestamp = previous.read()
+ request.add_header('If-Modified-Since', timestamp)
+
+ if not self.check_path([mpath]):
+ return (False, '', '')
+
+ try:
+ self.output.debug('RemoteDB._fetch_url() connecting to opener', 2)
+ connection = opener.open(request)
+ # py2, py3 compatibility, since only py2 returns keys as lower()
+ headers = dict((x.lower(), x) for x in connection.headers.keys())
+ if 'last-modified' in headers:
+ timestamp = connection.headers[headers['last-modified']]
+ elif 'date' in headers:
+ timestamp = connection.headers[headers['date']]
+ else:
+ timestamp = None
+ except urllib2.HTTPError, e:
+ if e.code == 304:
+ self.output.info('Remote list already up to date: %s'
+ % url, 4)
+ self.output.info('Last-modified: %s' % timestamp, 4)
+ else:
+ self.output.error('RemoteDB.cache(); HTTPError was:\n'
+ 'url: %s\n%s'
+ % (url, str(e)))
+ return (False, '', '')
+ return (False, '', '')
+ except IOError, error:
+ self.output.error('RemoteDB.cache(); Failed to update the '
+ 'overlay list from: %s\nIOError was:%s\n'
+ % (url, str(error)))
+ return (False, '', '')
+ else:
+ if url.startswith('file://'):
+ quieter = 1
+ else:
+ quieter = 0
+ self.output.info('Fetching new list... %s' % url, 4 + quieter)
+ if timestamp is not None:
+ self.output.info('Last-modified: %s' % timestamp, 4 + quieter)
+ # Fetch the remote list
+ olist = connection.read()
+ self.output.debug('RemoteDB._fetch_url(), olist type = %s' %str(type(olist)),2)
+
+ return (True, olist, timestamp)
+
+
+ def check_path(self, paths, hint=True):
+ '''Check for sufficient privileges'''
+ self.output.debug('RemoteDB.check_path; paths = ' + str(paths), 8)
+ is_ok = True
+ for path in paths:
+ if os.path.exists(path) and not os.access(path, os.W_OK):
+ if hint:
+ self.output.warn(
+ 'You do not have permission to update the cache (%s).'
+ % path)
+ import getpass
+ if getpass.getuser() != 'root':
+ self.output.warn('Hint: You are not root.\n')
+ is_ok = False
+ return is_ok
+
+
+ def _check_download(self, olist, url):
+
+ try:
+ self.read(olist, origin=url)
+ except Exception, error:
+ self.output.debug("RemoteDB._check_download(), url=%s \nolist:\n" % url,2)
+ self.output.debug(olist,2)
+ raise IOError('Failed to parse the overlays list fetched fr'
+ 'om ' + url + '\nThis means that the download'
+ 'ed file is somehow corrupt or there was a pr'
+ 'oblem with the webserver. Check the content '
+ 'of the file. Error was:\n' + str(error))
+
+ # the folowing is neded for py3 only
+ if sys.hexversion >= 0x3000000 and hasattr(olist, 'decode'):
+ olist = olist.decode("UTF-8")
+ return olist
+
+
+ @staticmethod
+ def write_cache(olist, mpath, tpath=None, timestamp=None):
+ has_updates = False
+ try:
+ out_file = fileopen(mpath, 'w')
+ out_file.write(olist)
+ out_file.close()
+
+ if timestamp is not None and tpath is not None:
+ out_file = fileopen(tpath, 'w')
+ out_file.write(str(timestamp))
+ out_file.close()
+
+ has_updates = True
+
+ except Exception, error:
+ raise IOError('Failed to temporarily cache overlays list in'
+ ' ' + mpath + '\nError was:\n' + str(error))
+ return has_updates
+
+ def verify_gpg(self, url, sig, olist):
+ '''Verify and decode it.'''
+ self.output.debug("RemoteDB: verify_gpg(), verify & decrypt olist: "
+ " %s, type(olist)=%s" % (str(url),str(type(olist))), 2)
+ #self.output.debug(olist, 2)
+
+ # detached sig
+ if sig:
+ self.output.debug("RemoteDB.verify_gpg(), detached sig", 2)
+ self.dl_sig(url[1], sig)
+ gpg_result = self.gpg.verify(
+ inputtxt=olist,
+ inputfile=sig)
+ # armoured signed file, compressed or clearsigned
+ else:
+ self.output.debug("RemoteDB.verify_gpg(), single signed file", 2)
+ gpg_result = self.gpg.decrypt(
+ inputtxt=olist)
+ olist = gpg_result.output
+ # verify and report
+ self.output.debug("gpg_result, verified=%s, len(olist)=%s"
+ % (gpg_result.verified[0], str(len(olist))),1)
+ if gpg_result.verified[0]:
+ self.output.info("GPG verification succeeded for gpg-signed url.", 4)
+ self.output.info('\tSignature result:' + str(gpg_result.verified), 4)
+ else:
+ self.output.error("GPG verification failed for gpg-signed url.")
+ self.output.error('\tSignature result:' + str(gpg_result.verified))
+ olist = ''
+ return olist, gpg_result.verified[0]
+
+
+ def dl_sig(self, url, sig):
+ self.output.debug("RemoteDB.dl_sig() url=%s, sig=%s" % (url, sig),2)
+ success, newsig, timestamp = self._fetch_url(url, sig)
+ if success:
+ success = self.write_cache(newsig, sig)
+ return success
+
+
+ def init_gpg(self):
+ self.output.debug("RemoteDB.init_gpg(), initializing",2)
+ if not self.gpg_config:
+ self.gpg_config = GPGConfig()
+
+ if not self.gpg:
+ self.gpg = GPG(self.gpg_config)
+ self.output.debug("RemoteDB.init_gpg(), initialized :D",2)
+
+
+if __name__ == '__main__':
+ import doctest
+
+ # Ignore warnings here. We are just testing
+ from warnings import filterwarnings, resetwarnings
+ filterwarnings('ignore')
+
+ doctest.testmod(sys.modules[__name__])
+
+ resetwarnings()
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/, etc/
@ 2013-07-29 1:46 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2013-07-29 1:46 UTC (permalink / raw
To: gentoo-commits
commit: 52cf00ececc1a10cea679b096fffccf708d3ba34
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 29 01:21:16 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Jul 29 01:21:16 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=52cf00ec
Update the repositories.xml urls.
---
etc/layman.cfg | 4 ++--
layman/config.py | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/etc/layman.cfg b/etc/layman.cfg
index 8a39ab9..11ae1be 100644
--- a/etc/layman.cfg
+++ b/etc/layman.cfg
@@ -65,13 +65,13 @@ gpg_signed_lists :
# http://someserver.somewhere.com/someoverlays.xml http://someserver.somewhere.com/someoverlays.xml.gpg
gpg_detached_lists :
-# http://distfiles.gentoo.org/overlays.xml http://distfiles.gentoo.org/overlays.xml.asc
+# https://api.gentoo.org/overlays/repositories.xml https://api.gentoo.org/overlays/repositories.xml.asc
# original unsigned lists and definitions
# one url per line, indented
overlays :
- http://www.gentoo.org/proj/en/overlays/repositories.xml
+ https://api.gentoo.org/overlays/repositories.xml
#-----------------------------------------------------------
# The directory to scan for xml overlay definition files to include
diff --git a/layman/config.py b/layman/config.py
index bb15abb..77096e7 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -80,7 +80,7 @@ class BareConfig(object):
>>> a = BareConfig()
>>> a['overlays']
- 'http://www.gentoo.org/proj/en/overlays/repositories.xml'
+ 'https://api.gentoo.org/overlays/repositories.xml'
>>> sorted(a.keys())
['bzr_addopts', 'bzr_command', 'bzr_postsync', 'bzr_syncopts', 'cache', 'config', 'configdir', 'custom_news_func', 'custom_news_pkg', '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_email', 'git_postsync', 'git_syncopts', 'git_user', 'installed', 'local_list', 'make_conf', 'mercurial_addopts', 'mercurial_command', 'mercurial_postsync', 'mercurial_syncopts', 'news_reporter', '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')
@@ -105,10 +105,10 @@ class BareConfig(object):
'umask' : '0022',
'news_reporter': 'portage',
'custom_news_pkg': '',
- 'gpg_detached_lists': '',
+ 'gpg_detached_lists': 'https://api.gentoo.org/overlays/repositories.xml https://api.gentoo.org/overlays/repositories.xml.asc',
'gpg_signed_lists': '',
'overlays' :
- 'http://www.gentoo.org/proj/en/overlays/repositories.xml',
+ 'https://api.gentoo.org/overlays/repositories.xml',
'overlay_defs': '%(configdir)s/overlays',
'bzr_command': path([self.root, EPREFIX,'/usr/bin/bzr']),
'cvs_command': path([self.root, EPREFIX,'/usr/bin/cvs']),
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/, etc/
@ 2013-08-10 17:17 Brian Dolbec
0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2013-08-10 17:17 UTC (permalink / raw
To: gentoo-commits
commit: 3f82940636620e5a7970eb563a8bccc0656a8f2f
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 10 17:17:07 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Aug 10 17:17:07 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=3f829406
Add https connection verification.
---
etc/layman.cfg | 5 +-
layman/config.py | 3 +-
layman/remotedb.py | 157 +++++++++++++++++++++++++++++++++++++----------------
3 files changed, 115 insertions(+), 50 deletions(-)
diff --git a/etc/layman.cfg b/etc/layman.cfg
index 11ae1be..f1d730a 100644
--- a/etc/layman.cfg
+++ b/etc/layman.cfg
@@ -84,9 +84,10 @@ overlays :
#-----------------------------------------------------------
# Proxy support
-# If unset, layman will use the http_proxy environment variable.
+# If unset, layman will use the http_proxy/https_proxy environment variable.
#
-#proxy : http://[user:pass@]www.my-proxy.org:3128
+#http_proxy : http://[user:pass@]www.my-proxy.org:3128
+#https_proxy : https://[user:pass@]www.my-proxy.org:3128
#-----------------------------------------------------------
# Strict checking of overlay definitions
diff --git a/layman/config.py b/layman/config.py
index 77096e7..44a419d 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -101,7 +101,8 @@ class BareConfig(object):
'installed': '%(storage)s/installed.xml',
'make_conf' : '%(storage)s/make.conf',
'nocheck' : 'yes',
- 'proxy' : '',
+ 'http_proxy' : '',
+ 'https_proxy' : '',
'umask' : '0022',
'news_reporter': 'portage',
'custom_news_pkg': '',
diff --git a/layman/remotedb.py b/layman/remotedb.py
index cbe35b9..d623242 100644
--- a/layman/remotedb.py
+++ b/layman/remotedb.py
@@ -28,9 +28,29 @@ __version__ = "$Id: db.py 309 2007-04-09 16:23:38Z wrobel $"
import os, os.path
import sys
-import urllib2
import hashlib
+import requests
+from requests.exceptions import SSLError
+
+VERIFY_SSL = False
+# py3.2
+if sys.hexversion >= 0x30200f0:
+ VERIFY_SSL = True
+else:
+ try: # import and enable SNI support for py2
+ from requests.packages.urllib3.contrib import pyopenssl
+ pyopenssl.inject_into_urllib3()
+ VERIFY_SSL = True
+ VERIFY_MSGS = ["Successfully enabled ssl certificate verification."]
+ except ImportError as e:
+ VERIFY_MSGS = [
+ "Failed to import and inject pyopenssl/SNI support into urllib3",
+ "Disabling certificate verification",
+ "Error was:" + e
+ ]
+ VERIFY_SSL = False
+
GPG_ENABLED = False
try:
@@ -59,19 +79,19 @@ class RemoteDB(DbBase):
self.proxies = {}
- if config['proxy']:
- self.proxies['http'] = config['proxy']
- elif os.getenv('http_proxy'):
- self.proxies['http'] = os.getenv('http_proxy')
-
- if self.proxies:
- proxy_handler = urllib2.ProxyHandler(self.proxies)
- opener = urllib2.build_opener(proxy_handler)
- urllib2.install_opener(opener)
+ for proxy in ['http_proxy', 'https_proxy']:
+ if config[proxy]:
+ self.proxies[proxy.split('_')[0]] = config[proxy]
+ elif os.getenv(proxy):
+ self.proxies[proxy.split('_')[0]] = os.getenv(proxy)
self.urls = [i.strip()
for i in config['overlays'].split('\n') if len(i)]
+ if VERIFY_MSGS:
+ for msg in VERIFY_MSGS:
+ self.output.debug(msg, 2)
+
if GPG_ENABLED:
self.get_gpg_urls()
else:
@@ -158,8 +178,10 @@ class RemoteDB(DbBase):
self.output.debug("RemoteDB.cache() url = %s is a tuple=%s"
%(str(url), str(isinstance(url, tuple))),2)
filepath, mpath, tpath, sig = self._paths(url)
-
- if sig:
+ if 'file://' in url:
+ success, olist, timestamp = self._fetch_file(
+ url, mpath, tpath)
+ elif sig:
success, olist, timestamp = self._fetch_url(
url[0], mpath, tpath)
else:
@@ -234,64 +256,105 @@ class RemoteDB(DbBase):
return base + '_' + hashlib.md5(url_encoded).hexdigest()
- def _fetch_url(self, url, mpath, tpath=None):
- self.output.debug('RemoteDB._fetch_url() url = %s' % url, 2)
+ def _fetch_file(self, url, mpath, tpath=None):
+ self.output.debug('RemoteDB._fetch_file() url = %s' % url, 2)
# check when the cache was last updated
# and don't re-fetch it unless it has changed
- request = urllib2.Request(url)
- opener = urllib2.build_opener()
- opener.addheaders = [('Accept-Charset', 'utf-8'),
- ('User-Agent', 'Layman-' + VERSION)]
- #opener.addheaders[('User-Agent', 'Layman-' + VERSION)]
+
+ filepath = url.replace('file://','')
+ url_timestamp = None
+ timestamp = ''
if tpath and os.path.exists(tpath):
with fileopen(tpath,'r') as previous:
timestamp = previous.read()
- request.add_header('If-Modified-Since', timestamp)
if not self.check_path([mpath]):
return (False, '', '')
try:
- self.output.debug('RemoteDB._fetch_url() connecting to opener', 2)
- connection = opener.open(request)
- # py2, py3 compatibility, since only py2 returns keys as lower()
- headers = dict((x.lower(), x) for x in connection.headers.keys())
- if 'last-modified' in headers:
- timestamp = connection.headers[headers['last-modified']]
- elif 'date' in headers:
- timestamp = connection.headers[headers['date']]
+ url_timestamp = os.stat(filepath).st_mtime
+ if url_timestamp != timestamp:
+ self.output.debug('RemoteDB._fetch_file() opening file', 2)
+ # Fetch the remote list
+ with open(filepath) as connection:
+ olist = connection.read()
else:
- timestamp = None
- except urllib2.HTTPError, e:
- if e.code == 304:
self.output.info('Remote list already up to date: %s'
% url, 4)
self.output.info('Last-modified: %s' % timestamp, 4)
- else:
- self.output.error('RemoteDB.cache(); HTTPError was:\n'
- 'url: %s\n%s'
- % (url, str(e)))
- return (False, '', '')
- return (False, '', '')
except IOError, error:
- self.output.error('RemoteDB.cache(); Failed to update the '
+ self.output.error('RemoteDB._fetch_file(); Failed to update the '
'overlay list from: %s\nIOError was:%s\n'
% (url, str(error)))
return (False, '', '')
else:
- if url.startswith('file://'):
- quieter = 1
- else:
- quieter = 0
+ quieter = 1
self.output.info('Fetching new list... %s' % url, 4 + quieter)
- if timestamp is not None:
- self.output.info('Last-modified: %s' % timestamp, 4 + quieter)
- # Fetch the remote list
- olist = connection.read()
+ if url_timestamp is not None:
+ self.output.info('Last-modified: %s' % url_timestamp, 4 + quieter)
self.output.debug('RemoteDB._fetch_url(), olist type = %s' %str(type(olist)),2)
- return (True, olist, timestamp)
+ return (True, olist, url_timestamp)
+
+
+ def _fetch_url(self, url, mpath, tpath=None):
+ headers = {'Accept-Charset': 'utf-8',
+ 'User-Agent': 'Layman-' + VERSION}
+
+ if tpath and os.path.exists(tpath):
+ with fileopen(tpath,'r') as previous:
+ timestamp = previous.read()
+ headers['If-Modified-Since'] = timestamp
+ self.output.info('Current-modified: %s' % timestamp, 4)
+
+ verify = 'https' in url and VERIFY_SSL
+ self.output.debug("Enabled ssl certificate verification: %s, for: %s"
+ %(str(verify), url), 3)
+
+ if not self.check_path([mpath]):
+ return (False, '', '')
+ self.output.debug('RemoteDB._fetch_url(); headers = %s' %str(headers))
+ self.output.debug('RemoteDB._fetch_url(); connecting to opener', 2)
+ try:
+ connection = requests.get(
+ url,
+ headers=headers,
+ verify=verify,
+ proxies=self.proxies,
+ )
+ except SSLError, error:
+ self.output.error('RemoteDB._fetch_url(); Failed to update the '
+ 'overlay list from: %s\nSSLError was:%s\n'
+ % (url, str(error)))
+ except Exception as error:
+ self.output.error('RemoteDB._fetch_url(); Failed to update the '
+ 'overlay list from: %s\nError was:%s\n'
+ % (url, str(error)))
+ # py2, py3 compatibility, since only py2 returns keys as lower()
+ headers = dict((x.lower(), x) for x in list(connection.headers))
+ self.output.info('HEADERS = %s' %str(connection.headers), 4)
+ self.output.debug('Status_code = %i' % connection.status_code)
+ if connection.status_code in [304]:
+ self.output.info('Remote list already up to date: %s'
+ % url, 4)
+ self.output.info('Last-modified: %s' % timestamp, 4)
+ elif connection.status_code not in [200]:
+ self.output.error('RemoteDB._fetch_url(); HTTP Status-Code was:\n'
+ 'url: %s\n%s'
+ % (url, str(connection.status_code)))
+
+ if connection.status_code in [200]:
+ self.output.info('Remote new list downloaded for: %s'
+ % url, 4)
+ if 'last-modified' in headers:
+ timestamp = connection.headers[headers['last-modified']]
+ elif 'date' in headers:
+ timestamp = connection.headers[headers['date']]
+ else:
+ timestamp = None
+ return (True, connection.content, timestamp)
+ return (False, '', '')
def check_path(self, paths, hint=True):
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/, etc/
@ 2014-07-24 2:03 Devan Franchini
0 siblings, 0 replies; 10+ messages in thread
From: Devan Franchini @ 2014-07-24 2:03 UTC (permalink / raw
To: gentoo-commits
commit: fe3dd834e90b3aed6751767edcab1f6fb8db28c4
Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 24 02:02:38 2014 +0000
Commit: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Thu Jul 24 02:02:38 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=fe3dd834
remotedb.py: Internally disables GPG functionality
---
etc/layman.cfg | 5 +--
layman/remotedb.py | 92 ------------------------------------------------------
2 files changed, 3 insertions(+), 94 deletions(-)
diff --git a/etc/layman.cfg b/etc/layman.cfg
index 6b94c68..10e5d94 100644
--- a/etc/layman.cfg
+++ b/etc/layman.cfg
@@ -62,6 +62,7 @@ conf_type : make.conf
# file:///var/lib/layman/my-list.xml
#
#### GPG signed lists #### COMING SOON TO A DOWNLOAD SITE NEAR YOU #####
+# GPG config options are internally disabled for this release.
#
# gpg_signed_lists :
# These can be clearsigned or signed (compressed) overlay lists
@@ -73,7 +74,7 @@ conf_type : make.conf
# gpg_signed_lists :
# http://someserver.somewhere.com/someoverlays.xml.asc
#
-gpg_signed_lists :
+#gpg_signed_lists :
#
# gpg_detached_lists:
@@ -88,7 +89,7 @@ gpg_signed_lists :
# http://distfiles.gentoo.org/overlays.xml http://distfiles.gentoo.org/overlays.xml.asc
# http://someserver.somewhere.com/someoverlays.xml http://someserver.somewhere.com/someoverlays.xml.gpg
-gpg_detached_lists :
+#gpg_detached_lists :
# https://api.gentoo.org/overlays/repositories.xml https://api.gentoo.org/overlays/repositories.xml.asc
# original unsigned lists and definitions
diff --git a/layman/remotedb.py b/layman/remotedb.py
index 79f4ec6..7d20e8d 100644
--- a/layman/remotedb.py
+++ b/layman/remotedb.py
@@ -30,15 +30,6 @@ import os, os.path
import sys
import hashlib
-GPG_ENABLED = False
-try:
- from pygpg.config import GPGConfig
- from pygpg.gpg import GPG
- GPG_ENABLED = True
-except ImportError:
- pass
-
-
from layman.utils import encoder
from layman.dbbase import DbBase
from layman.version import VERSION
@@ -61,12 +52,6 @@ class RemoteDB(DbBase):
self.urls = [i.strip()
for i in config['overlays'].split('\n') if len(i)]
- if GPG_ENABLED:
- self.get_gpg_urls()
- else:
- self.output.debug('RemoteDB.__init__(), NOT GPG_ENABLED, '
- 'bypassing...', 2)
-
# add up the lists to load for display, etc.
# unsigned overlay lists
paths = [self.filepath(i) + '.xml' for i in self.urls]
@@ -92,9 +77,6 @@ class RemoteDB(DbBase):
DbBase.__init__(self, config, paths=paths, ignore=ignore,
ignore_init_read_errors=ignore_init_read_errors)
- self.gpg = None
- self.gpg_config = None
-
# overrider
def _broken_catalog_hint(self):
@@ -138,7 +120,6 @@ class RemoteDB(DbBase):
# succeeded reset when a failure is detected
succeeded = True
url_lists = [self.urls, self.detached_urls, self.signed_urls]
- need_gpg = [False, True, True]
# setup the ssl-fetch output map
connector_output = {
'info': self.output.debug,
@@ -151,9 +132,6 @@ class RemoteDB(DbBase):
for index in range(0, 3):
self.output.debug("RemoteDB.cache() index = %s" %str(index), 2)
urls = url_lists[index]
- if need_gpg[index] and len(urls) and self.gpg is None:
- #initialize our gpg instance
- self.init_gpg()
# main working loop
for url in urls:
sig = ''
@@ -175,17 +153,6 @@ class RemoteDB(DbBase):
self.output.debug("RemoteDB.cache() len(olist) = %s"
% str(len(olist)), 2)
- # GPG handling
- if need_gpg[index]:
- olist, verified = self.verify_gpg(url, sig, olist)
- if not verified:
- self.output.debug("RemoteDB.cache() gpg returned "
- "verified = %s" %str(verified), 2)
- succeeded = False
- filename = os.path.join(self.config['storage'],
- "Failed-to-verify-sig")
- self.write_cache(olist, filename)
- continue
# Before we overwrite the old cache, check that the downloaded
# file is intact and can be parsed
@@ -338,37 +305,6 @@ class RemoteDB(DbBase):
' ' + mpath + '\nError was:\n' + str(error))
return has_updates
- def verify_gpg(self, url, sig, olist):
- '''Verify and decode it.'''
- self.output.debug("RemoteDB: verify_gpg(), verify & decrypt olist: "
- " %s, type(olist)=%s" % (str(url),str(type(olist))), 2)
- #self.output.debug(olist, 2)
-
- # detached sig
- if sig:
- self.output.debug("RemoteDB.verify_gpg(), detached sig", 2)
- self.dl_sig(url[1], sig)
- gpg_result = self.gpg.verify(
- inputtxt=olist,
- inputfile=sig)
- # armoured signed file, compressed or clearsigned
- else:
- self.output.debug("RemoteDB.verify_gpg(), single signed file", 2)
- gpg_result = self.gpg.decrypt(
- inputtxt=olist)
- olist = gpg_result.output
- # verify and report
- self.output.debug("gpg_result, verified=%s, len(olist)=%s"
- % (gpg_result.verified[0], str(len(olist))), 1)
- if gpg_result.verified[0]:
- self.output.info("GPG verification succeeded for gpg-signed url.", 4)
- self.output.info('\tSignature result:' + str(gpg_result.verified), 4)
- else:
- self.output.error("GPG verification failed for gpg-signed url.")
- self.output.error('\tSignature result:' + str(gpg_result.verified))
- olist = ''
- return olist, gpg_result.verified[0]
-
def dl_sig(self, url, sig):
self.output.debug("RemoteDB.dl_sig() url=%s, sig=%s" % (url, sig), 2)
@@ -378,34 +314,6 @@ class RemoteDB(DbBase):
return success
- def init_gpg(self):
- self.output.debug("RemoteDB.init_gpg(), initializing", 2)
- if not self.gpg_config:
- self.gpg_config = GPGConfig()
-
- if not self.gpg:
- self.gpg = GPG(self.gpg_config)
- self.output.debug("RemoteDB.init_gpg(), initialized :D", 2)
-
- def get_gpg_urls(self):
- '''Extend paths with gpg signed url listings from the config
-
- @param paths: list or urls to fetch
- '''
- #pair up the list url and detached sig url
- d_urls = [i.strip()
- for i in self.config['gpg_detached_lists'].split('\n') if len(i)]
-
- #for index in range(0, len(d_urls), 2):
- # self.detached_urls.append((d_urls[index], d_urls[index+1]))
- for i in d_urls:
- u = i.split()
- self.detached_urls.append((u[0], u[1]))
-
- self.signed_urls = [i.strip()
- for i in self.config['gpg_signed_lists'].split('\n') if len(i)]
-
-
if __name__ == '__main__':
import doctest
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/, etc/
@ 2014-08-17 1:33 Devan Franchini
2014-08-19 1:49 ` Devan Franchini
0 siblings, 1 reply; 10+ messages in thread
From: Devan Franchini @ 2014-08-17 1:33 UTC (permalink / raw
To: gentoo-commits
commit: 70ae729d89ea25a2c6b8e0769368450317c30d1f
Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 17 01:31:16 2014 +0000
Commit: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sun Aug 17 01:31:16 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=70ae729d
config.py: Blanks out squashfs_command
Due to squashfs not needing to run a command aside from mount and
umount (which are handled by the Mounter() class), the config
option was set to a blank value.
layman.cfg: Reflects change to squashfs_command option with
explanation to user.
config.py: Also removes clean_tar from the true false check in favor
of the clean_archive config option.
---
etc/layman.cfg | 4 +++-
layman/config.py | 5 +++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/etc/layman.cfg b/etc/layman.cfg
index efd990c..4e9aad9 100644
--- a/etc/layman.cfg
+++ b/etc/layman.cfg
@@ -198,9 +198,11 @@ news_reporter: portage
#git_command : /usr/bin/git
#mercurial_command : /usr/bin/hg
#rsync_command : /usr/bin/rsync
+#left intentionally blank since squashfs only needs to
+#mount the squashfs image.
+#squashfs-command :
#svn_command : /usr/bin/svn
#tar_command : /bin/tar
-#g-common_command : /usr/bin/g-common
#g-sorcery_command : /usr/bin/g-sorcery
diff --git a/layman/config.py b/layman/config.py
index adfd2de..4fbff5d 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -123,11 +123,12 @@ class BareConfig(object):
'g-common_command': path([self.root, EPREFIX,'/usr/bin/g-common']),
'g-sorcery_command': path([self.root, EPREFIX,'/usr/bin/g-sorcery']),
'mercurial_command': path([self.root, EPREFIX,'/usr/bin/hg']),
- 'squashfs_command': path([self.root, EPREFIX,'/usr/bin/unsquashfs']),
+ # left blank due to squashfs only needing to mount the image.
+ 'squashfs_command': '',
'rsync_command': path([self.root, EPREFIX,'/usr/bin/rsync']),
'svn_command': path([self.root, EPREFIX,'/usr/bin/svn']),
'tar_command': path([self.root, EPREFIX,'/bin/tar']),
- 't/f_options': ['check_official', 'clean_tar', 'nocheck', 'require_repoconfig'],
+ 't/f_options': ['check_official', 'clean_archive', 'nocheck', 'require_repoconfig'],
'bzr_addopts' : '',
'bzr_syncopts' : '',
'cvs_addopts' : '',
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/, etc/
2014-08-17 1:33 Devan Franchini
@ 2014-08-19 1:49 ` Devan Franchini
0 siblings, 0 replies; 10+ messages in thread
From: Devan Franchini @ 2014-08-19 1:49 UTC (permalink / raw
To: gentoo-commits
commit: 70ae729d89ea25a2c6b8e0769368450317c30d1f
Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 17 01:31:16 2014 +0000
Commit: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sun Aug 17 01:31:16 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=70ae729d
config.py: Blanks out squashfs_command
Due to squashfs not needing to run a command aside from mount and
umount (which are handled by the Mounter() class), the config
option was set to a blank value.
layman.cfg: Reflects change to squashfs_command option with
explanation to user.
config.py: Also removes clean_tar from the true false check in favor
of the clean_archive config option.
---
etc/layman.cfg | 4 +++-
layman/config.py | 5 +++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/etc/layman.cfg b/etc/layman.cfg
index efd990c..4e9aad9 100644
--- a/etc/layman.cfg
+++ b/etc/layman.cfg
@@ -198,9 +198,11 @@ news_reporter: portage
#git_command : /usr/bin/git
#mercurial_command : /usr/bin/hg
#rsync_command : /usr/bin/rsync
+#left intentionally blank since squashfs only needs to
+#mount the squashfs image.
+#squashfs-command :
#svn_command : /usr/bin/svn
#tar_command : /bin/tar
-#g-common_command : /usr/bin/g-common
#g-sorcery_command : /usr/bin/g-sorcery
diff --git a/layman/config.py b/layman/config.py
index adfd2de..4fbff5d 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -123,11 +123,12 @@ class BareConfig(object):
'g-common_command': path([self.root, EPREFIX,'/usr/bin/g-common']),
'g-sorcery_command': path([self.root, EPREFIX,'/usr/bin/g-sorcery']),
'mercurial_command': path([self.root, EPREFIX,'/usr/bin/hg']),
- 'squashfs_command': path([self.root, EPREFIX,'/usr/bin/unsquashfs']),
+ # left blank due to squashfs only needing to mount the image.
+ 'squashfs_command': '',
'rsync_command': path([self.root, EPREFIX,'/usr/bin/rsync']),
'svn_command': path([self.root, EPREFIX,'/usr/bin/svn']),
'tar_command': path([self.root, EPREFIX,'/bin/tar']),
- 't/f_options': ['check_official', 'clean_tar', 'nocheck', 'require_repoconfig'],
+ 't/f_options': ['check_official', 'clean_archive', 'nocheck', 'require_repoconfig'],
'bzr_addopts' : '',
'bzr_syncopts' : '',
'cvs_addopts' : '',
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/layman:master commit in: layman/, etc/
@ 2015-03-07 21:55 Devan Franchini
0 siblings, 0 replies; 10+ messages in thread
From: Devan Franchini @ 2015-03-07 21:55 UTC (permalink / raw
To: gentoo-commits
commit: 5d790bb5cbbf675c1b6f6db02b7565c03dc8aefc
Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 13 07:45:08 2015 +0000
Commit: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Sat Mar 7 21:55:21 2015 +0000
URL: https://gitweb.gentoo.org/proj/layman.git/commit/?id=5d790bb5
Correct misspelling of "separate"
etc/layman.cfg | 2 +-
layman/utils.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/etc/layman.cfg b/etc/layman.cfg
index 2aa7dd7..f79270a 100644
--- a/etc/layman.cfg
+++ b/etc/layman.cfg
@@ -211,7 +211,7 @@ news_reporter: portage
#
# These commnad options will be added to the above commands
# when the overlay is added or synced.
-# Use spaces to seperate command line arguments
+# Use spaces to separate command line arguments
#
# note: there are some options hardcoded in the backend
# scripts already. All VCS types listed here are
diff --git a/layman/utils.py b/layman/utils.py
index b522759..b8e1e2a 100644
--- a/layman/utils.py
+++ b/layman/utils.py
@@ -175,7 +175,7 @@ def path(path_elements):
if isinstance(path_elements, STR):
path_elements = [path_elements]
- # Concatenate elements and seperate with /
+ # Concatenate elements and separate with /
for i in path_elements:
pathname += i + '/'
^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2015-03-07 21:55 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-24 2:03 [gentoo-commits] proj/layman:master commit in: layman/, etc/ Devan Franchini
-- strict thread matches above, loose matches on Subject: below --
2015-03-07 21:55 Devan Franchini
2014-08-17 1:33 Devan Franchini
2014-08-19 1:49 ` 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-24 14:02 Brian Dolbec
2011-08-09 2:46 Brian Dolbec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox