* [gentoo-commits] proj/layman:gsoc2014 commit in: layman/overlays/
@ 2014-05-14 0:42 Devan Franchini
0 siblings, 0 replies; 16+ messages in thread
From: Devan Franchini @ 2014-05-14 0:42 UTC (permalink / raw
To: gentoo-commits
commit: 08762b404c86856d4794def0e3b4a1d68a1c424d
Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Wed May 14 00:41:21 2014 +0000
Commit: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Wed May 14 00:41:21 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=08762b40
Changes "Exception, error" to "Exception as error", part 2.
These compatibility changes were overlooked in the "overlay/"
directory and are applied in this commit.
---
layman/overlays/overlay.py | 2 +-
layman/overlays/source.py | 2 +-
layman/overlays/tar.py | 10 +++++-----
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/layman/overlays/overlay.py b/layman/overlays/overlay.py
index 65c148b..0c2d042 100755
--- a/layman/overlays/overlay.py
+++ b/layman/overlays/overlay.py
@@ -414,7 +414,7 @@ class Overlay(object):
# Worked, throw other sources away
self.sources = [s]
break
- except Exception, error:
+ except Exception as error:
self.output.warn(str(error), 4)
first_s = False
return res
diff --git a/layman/overlays/source.py b/layman/overlays/source.py
index 2b79f2c..69c59bb 100644
--- a/layman/overlays/source.py
+++ b/layman/overlays/source.py
@@ -177,7 +177,7 @@ class OverlaySource(object):
self.output.warn("Checking for cleanup actions to perform", 4)
self.cleanup()
result = 1
- except Exception, err:
+ except Exception as err:
self.output.error(
'Unknown exception running command: %s' % command_repr)
self.output.error('Original error was: %s' % str(err))
diff --git a/layman/overlays/tar.py b/layman/overlays/tar.py
index c6f2443..e57096d 100644
--- a/layman/overlays/tar.py
+++ b/layman/overlays/tar.py
@@ -111,7 +111,7 @@ class TarOverlay(OverlaySource):
try:
tar = urllib2.urlopen(tar_url).read()
- except Exception, error:
+ except Exception as error:
raise Exception('Failed to fetch the tar package from: '
+ self.src + '\nError was:' + str(error))
@@ -121,7 +121,7 @@ class TarOverlay(OverlaySource):
out_file = open(pkg, 'w+b')
out_file.write(tar)
out_file.close()
- except Exception, error:
+ except Exception as error:
raise Exception('Failed to store tar package in '
+ pkg + '\nError was:' + str(error))
@@ -140,7 +140,7 @@ class TarOverlay(OverlaySource):
try:
self.output.info('Deleting directory "%s"' % folder, 2)
shutil.rmtree(folder)
- except Exception, error:
+ except Exception as error:
raise Exception('Failed to remove unnecessary tar structure "'
+ folder + '"\nError was:' + str(error))
@@ -149,7 +149,7 @@ class TarOverlay(OverlaySource):
try:
result = self._extract(base=base, tar_url=self.src,
dest_dir=temp_path)
- except Exception, error:
+ except Exception as error:
try_to_wipe(temp_path)
raise error
@@ -165,7 +165,7 @@ class TarOverlay(OverlaySource):
try:
os.rename(source, final_path)
- except Exception, error:
+ except Exception as error:
raise Exception('Failed to rename tar subdirectory ' +
source + ' to ' + final_path +
'\nError was:' + str(error))
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [gentoo-commits] proj/layman:gsoc2014 commit in: layman/overlays/
@ 2014-05-14 1:14 Devan Franchini
0 siblings, 0 replies; 16+ messages in thread
From: Devan Franchini @ 2014-05-14 1:14 UTC (permalink / raw
To: gentoo-commits
commit: 0018a1dfc141166842f6859eff88ff30f9c41981
Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Wed May 14 01:13:31 2014 +0000
Commit: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Wed May 14 01:13:31 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=0018a1df
overlays/tar.py: Changes permissions integer to octal.
---
layman/overlays/tar.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/layman/overlays/tar.py b/layman/overlays/tar.py
index e57096d..9cb65a2 100644
--- a/layman/overlays/tar.py
+++ b/layman/overlays/tar.py
@@ -169,7 +169,7 @@ class TarOverlay(OverlaySource):
raise Exception('Failed to rename tar subdirectory ' +
source + ' to ' + final_path +
'\nError was:' + str(error))
- os.chmod(final_path, 0755)
+ os.chmod(final_path, 0o755)
else:
raise Exception('Given subpath "' + source + '" does not exist '
' in the tar package!')
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [gentoo-commits] proj/layman:gsoc2014 commit in: layman/overlays/
@ 2014-05-14 17:32 Devan Franchini
0 siblings, 0 replies; 16+ messages in thread
From: Devan Franchini @ 2014-05-14 17:32 UTC (permalink / raw
To: gentoo-commits
commit: da99dbd4942bfbaabffc7d0b0cc4565267ec0358
Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Wed May 14 01:13:31 2014 +0000
Commit: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Wed May 14 17:31:29 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=da99dbd4
overlays/tar.py: Changes permissions integer to octal.
---
layman/overlays/tar.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/layman/overlays/tar.py b/layman/overlays/tar.py
index e57096d..9cb65a2 100644
--- a/layman/overlays/tar.py
+++ b/layman/overlays/tar.py
@@ -169,7 +169,7 @@ class TarOverlay(OverlaySource):
raise Exception('Failed to rename tar subdirectory ' +
source + ' to ' + final_path +
'\nError was:' + str(error))
- os.chmod(final_path, 0755)
+ os.chmod(final_path, 0o755)
else:
raise Exception('Given subpath "' + source + '" does not exist '
' in the tar package!')
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [gentoo-commits] proj/layman:gsoc2014 commit in: layman/overlays/
@ 2014-05-14 23:49 Devan Franchini
0 siblings, 0 replies; 16+ messages in thread
From: Devan Franchini @ 2014-05-14 23:49 UTC (permalink / raw
To: gentoo-commits
commit: 1b84dd4870f4db0c836006b891f4bb0c3170777c
Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Wed May 14 01:13:31 2014 +0000
Commit: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Wed May 14 23:45:56 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=1b84dd48
overlays/tar.py: Changes permissions integer to octal
---
layman/overlays/tar.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/layman/overlays/tar.py b/layman/overlays/tar.py
index e57096d..9cb65a2 100644
--- a/layman/overlays/tar.py
+++ b/layman/overlays/tar.py
@@ -169,7 +169,7 @@ class TarOverlay(OverlaySource):
raise Exception('Failed to rename tar subdirectory ' +
source + ' to ' + final_path +
'\nError was:' + str(error))
- os.chmod(final_path, 0755)
+ os.chmod(final_path, 0o755)
else:
raise Exception('Given subpath "' + source + '" does not exist '
' in the tar package!')
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [gentoo-commits] proj/layman:gsoc2014 commit in: layman/overlays/
@ 2014-06-16 3:37 Brian Dolbec
0 siblings, 0 replies; 16+ messages in thread
From: Brian Dolbec @ 2014-06-16 3:37 UTC (permalink / raw
To: gentoo-commits
commit: a4ce4f5a312c08eb90ccb741f673780b8559d0c4
Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Fri May 23 21:33:47 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Jun 12 21:11:49 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=a4ce4f5a
git.py: adds update() function
Moves the fix_git_source() function to allow both add() and update()
to make use of it. While the update() function calls git remote
set-url, replacing the old url with the new url provided by
overlay.update().
---
layman/overlays/git.py | 38 ++++++++++++++++++++++++++++----------
1 file changed, 28 insertions(+), 10 deletions(-)
diff --git a/layman/overlays/git.py b/layman/overlays/git.py
index f3790ca..ee8c53b 100644
--- a/layman/overlays/git.py
+++ b/layman/overlays/git.py
@@ -46,21 +46,24 @@ class GitOverlay(OverlaySource):
_location, ignore)
self.subpath = None
+ def _fix_git_source(self, source):
+ '''
+ Adds trailing slash to http sources
+
+ @param source: source URL, string.
+ '''
+ # http:// should get trailing slash, other protocols shouldn't
+ if source.split(':')[:1] == 'http':
+ if not source.endswith('/'):
+ return source + '/'
+ return source
+
def add(self, base):
'''Add overlay.'''
if not self.supported():
return 1
- def fix_git_source(source):
- # http:// should get trailing slash, other protocols shouldn't
- if source.split(':')[0] == 'http':
- if source.endswith('/'):
- return source
- else:
- return source + '/'
- return source
-
cfg_opts = self.config["git_addopts"]
target = path([base, self.parent.name])
@@ -70,7 +73,7 @@ class GitOverlay(OverlaySource):
args.append('-q')
if len(cfg_opts):
args.append(cfg_opts)
- args.append(fix_git_source(self.src))
+ args.append(self._fix_git_source(self.src))
args.append(target)
success = False
# adding cwd=base due to a new git bug in selinux due to
@@ -95,6 +98,21 @@ class GitOverlay(OverlaySource):
self.output.debug("set git user info...args=%s" % ' '.join(args), 8)
return self.run_command(self.command(), args, cmd=self.type, cwd=target)
+ def update(self, base, src):
+ '''
+ Update overlay src-url
+
+ @params base: base location where all overlays are installed.
+ @params src: source URL.
+ '''
+ self.output.debug("git.update(); starting...%s" % self.parent.name, 6)
+ target = path([base, self.parent.name])
+
+ # git remote set-url <name> <newurl> <oldurl>
+ args = ['remote', 'set-url', 'origin', self._fix_git_source(src), self._fix_git_source(self.src)]
+
+ return self.run_command(self.command(), args, cmd=self.type, cwd=target)
+
def sync(self, base):
'''Sync overlay.'''
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [gentoo-commits] proj/layman:gsoc2014 commit in: layman/overlays/
@ 2014-06-16 3:37 Brian Dolbec
0 siblings, 0 replies; 16+ messages in thread
From: Brian Dolbec @ 2014-06-16 3:37 UTC (permalink / raw
To: gentoo-commits
commit: e44f6726b5162cbc3026e9047878e2def78a562a
Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Fri May 30 20:54:12 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Jun 12 21:11:49 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=e44f6726
cvs.py: Adds update() function
---
layman/overlays/cvs.py | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/layman/overlays/cvs.py b/layman/overlays/cvs.py
index b166dc8..bf54921 100644
--- a/layman/overlays/cvs.py
+++ b/layman/overlays/cvs.py
@@ -27,6 +27,7 @@ __version__ = "$Id$"
#-------------------------------------------------------------------------------
import xml.etree.ElementTree as ET # Python 2.5
+import re
from layman.utils import path
from layman.overlays.source import OverlaySource, require_supported
@@ -90,6 +91,42 @@ class CvsOverlay(OverlaySource):
env=dict(CVSROOT=self.src), cmd=self.type),
cwd=target)
+ def update(self, base, src):
+ '''
+ Updates overlay src-url.
+
+ @params base: base location where all overlays are installed.
+ @params src: source URL.
+ '''
+
+ if not self.supported():
+ return 1
+
+ target = path([base, self.parent.name])
+
+ # First echo the new repository to CVS/Root
+ args = [src, '>', '/CVS/Root']
+ result = self.run_command('echo', args, cmd='echo', cwd=target)
+
+ if result == 0:
+ location = src.split(':')[3]
+ old_location = self.src.split(':/')[3]
+
+ # Check if the repository location needs to be updated too.
+ if not location == old_location:
+ location = re.sub('/', '\/', location)
+ old_location = re.sub('/', '\/', old_location)
+
+ expression = 's/' + old_location + '/' + location + '/'
+
+ # sed -i 's/<old_location>/<new_location>/ <target>/CVS/Repository
+ args = ['-i', expression, '/CVS/Repository']
+
+ return self.run_command('sed', args, cmd='sed', cwd=target)
+
+ return result
+
+
def sync(self, base):
'''Sync overlay.'''
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [gentoo-commits] proj/layman:gsoc2014 commit in: layman/overlays/
@ 2014-06-16 3:37 Brian Dolbec
0 siblings, 0 replies; 16+ messages in thread
From: Brian Dolbec @ 2014-06-16 3:37 UTC (permalink / raw
To: gentoo-commits
commit: 323362ad64d9b0477a662c0d58eeec89e7e3948e
Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Thu May 29 23:12:58 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Jun 12 21:11:49 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=323362ad
bzr.py: Adds update() function
Also adds _fix_brz_source() function to be used by add() and update().
---
layman/overlays/bzr.py | 36 ++++++++++++++++++++++++++++++++----
1 file changed, 32 insertions(+), 4 deletions(-)
diff --git a/layman/overlays/bzr.py b/layman/overlays/bzr.py
index 9cfa8b5..20d2491 100644
--- a/layman/overlays/bzr.py
+++ b/layman/overlays/bzr.py
@@ -49,6 +49,16 @@ class BzrOverlay(OverlaySource):
config, _location, ignore)
self.subpath = None
+ def _fix_bzr_source(self, source):
+ '''
+ Adds trailing slash to source URL if needed.
+
+ @params source: source URL, string.
+ '''
+ if source.endswith("/"):
+ return source
+ return source + '/'
+
def add(self, base):
'''Add overlay.'''
@@ -58,10 +68,7 @@ class BzrOverlay(OverlaySource):
cfg_opts = self.config["bzr_addopts"]
target = path([base, self.parent.name])
- if self.src.endswith("/"):
- src = self.src
- else:
- src = self.src + '/'
+ src = self._fix_bzr_source(self.src)
# bzr get SOURCE TARGET
if len(cfg_opts):
@@ -73,6 +80,27 @@ class BzrOverlay(OverlaySource):
self.run_command(self.command(), args, cmd=self.type),
cwd=target)
+ def update(self, base, src):
+ '''
+ Updates overlay src-url.
+
+ @params base: base location where all overlays are installed.
+ @params src: source URL.
+ '''
+
+ if not self.supported():
+ return 1
+
+ target = path([base, self.parent.name])
+
+ # bzr bind SOURCE
+ args = ['bind', self._fix_bzr_source(src)]
+ if self.config['quiet']:
+ args.append('--quiet')
+ return self.postsync(
+ self.run_command(self.command(), args, cmd=self.type),
+ cwd=target)
+
def sync(self, base):
'''Sync overlay.'''
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [gentoo-commits] proj/layman:gsoc2014 commit in: layman/overlays/
2014-06-16 3:40 [gentoo-commits] proj/layman:master " Brian Dolbec
@ 2014-06-16 3:37 ` Brian Dolbec
0 siblings, 0 replies; 16+ messages in thread
From: Brian Dolbec @ 2014-06-16 3:37 UTC (permalink / raw
To: gentoo-commits
commit: 2c8417794872d797ef816760d5d9161c90f449fc
Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Fri May 30 01:19:52 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Jun 12 21:11:49 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=2c841779
mercurial.py: Adds update() function
Also adds _fix_mercurial_source() function to be used by add() and update().
---
layman/overlays/mercurial.py | 40 ++++++++++++++++++++++++++++++++++++----
1 file changed, 36 insertions(+), 4 deletions(-)
diff --git a/layman/overlays/mercurial.py b/layman/overlays/mercurial.py
index c188381..74f1934 100644
--- a/layman/overlays/mercurial.py
+++ b/layman/overlays/mercurial.py
@@ -27,6 +27,7 @@ __version__ = "$Id: mercurial.py 236 2006-09-05 20:39:37Z wrobel $"
#
#-------------------------------------------------------------------------------
+import re
from layman.utils import path
from layman.overlays.source import OverlaySource, require_supported
@@ -49,6 +50,16 @@ class MercurialOverlay(OverlaySource):
config, _location, ignore)
self.subpath = None
+ def _fix_mercurial_source(self, source):
+ '''
+ Adds trailing slash to source URL if needed.
+
+ @params source: source URL, string.
+ '''
+ if source.endswith("/"):
+ return source
+ return source + '/'
+
def add(self, base):
'''Add overlay.'''
@@ -58,10 +69,7 @@ class MercurialOverlay(OverlaySource):
cfg_opts = self.config["mercurial_addopts"]
target = path([base, self.parent.name])
- if self.src.endswith("/"):
- src = self.src
- else:
- src = self.src + '/'
+ src = self._fix_mercurial_source(self.src)
# hg clone SOURCE TARGET
if len(cfg_opts):
@@ -73,6 +81,30 @@ class MercurialOverlay(OverlaySource):
self.run_command(self.command(), args, cmd=self.type),
cwd=target)
+ def update(self, base, src):
+ '''
+ Updates overlay src-url.
+
+ @params base: base location where all overlays are installed.
+ @params src: source URL.
+ '''
+
+ if not self.supported():
+ return 1
+
+ target = path([base, self.parent.name])
+ hgrc = ".hg/hgrc"
+
+ old_src = re.sub('/', '\/', self._fix_mercurial_source(self.src))
+ new_src = re.sub('/', '\/', self._fix_mercurial_source(src))
+ expression = "s/" + old_src + "/" + new_src + "/"
+
+ # sed -i 's/oldurl/newurl/' <target>/.hg/hgrc
+ args = ['-i', expression, hgrc]
+
+ # Run sed.
+ return self.run_command('sed', args, cmd='sed', cwd=target)
+
def sync(self, base):
'''Sync overlay.'''
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [gentoo-commits] proj/layman:gsoc2014 commit in: layman/overlays/
2014-06-16 3:40 [gentoo-commits] proj/layman:master " Brian Dolbec
@ 2014-06-16 3:37 ` Brian Dolbec
0 siblings, 0 replies; 16+ messages in thread
From: Brian Dolbec @ 2014-06-16 3:37 UTC (permalink / raw
To: gentoo-commits
commit: ef6f5893a333684f3b73e04e486b02b60559c512
Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Mon May 26 22:22:33 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Jun 12 21:11:49 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=ef6f5893
svn.py: Adds update() function
Adds _fix_svn_source() function to correct the source url in
order to run the svn switch --relocate command.
---
layman/overlays/svn.py | 37 ++++++++++++++++++++++++++++++++-----
1 file changed, 32 insertions(+), 5 deletions(-)
diff --git a/layman/overlays/svn.py b/layman/overlays/svn.py
index 0244dd4..f494eba 100644
--- a/layman/overlays/svn.py
+++ b/layman/overlays/svn.py
@@ -53,6 +53,18 @@ class SvnOverlay(OverlaySource):
parent, config, _location, ignore)
self.subpath = None
+ def _fix_svn_source(self, source):
+ '''
+ Adds @ to all sources that don't already include it.
+
+ @params source: source URL, string.
+ '''
+ if source.endswith("/"):
+ source = source + '@'
+ else:
+ source = source +'/@'
+ return source
+
def add(self, base):
'''Add overlay.'''
@@ -70,11 +82,7 @@ class SvnOverlay(OverlaySource):
if len(cfg_opts):
args.append(cfg_opts)
- if self.src.endswith("/"):
- src = self.src + '@'
- else:
- src = self.src + '/@'
-
+ src = self._fix_svn_source(self.src)
args.append(src)
args.append(self.target)
@@ -82,6 +90,25 @@ class SvnOverlay(OverlaySource):
self.run_command(self.command(), args, cmd=self.type),
cwd=self.target)
+ def update(self, base, src):
+ '''
+ Update overlay src-url
+
+ @params base: base location where all overlays are installed.
+ @params src: source URL.
+ '''
+
+ self.output.debug("svn.update(); starting...%s" % self.parent.name, 6)
+ target = path([base, self.parent.name])
+
+ # svn switch --relocate <oldurl> <newurl>
+ args = ['switch', '--relocate', self._fix_svn_source(self.src), self._fix_svn_source(src)]
+
+ return self.postsync(
+ self.run_command(self.command(), args, cmd=self.type),
+ cwd=target)
+
+
def sync(self, base):
'''Sync overlay.'''
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [gentoo-commits] proj/layman:gsoc2014 commit in: layman/overlays/
@ 2014-06-16 3:37 Brian Dolbec
0 siblings, 0 replies; 16+ messages in thread
From: Brian Dolbec @ 2014-06-16 3:37 UTC (permalink / raw
To: gentoo-commits
commit: 70e221ba1921d2275bbd415e20a5d9923d329b44
Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 10 22:18:23 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Jun 15 00:36:41 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=70e221ba
git.py: Adds module branch support
---
layman/overlays/git.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/layman/overlays/git.py b/layman/overlays/git.py
index 2f4bd61..f3ada66 100644
--- a/layman/overlays/git.py
+++ b/layman/overlays/git.py
@@ -26,6 +26,8 @@ __version__ = "$Id: git.py 146 2006-05-27 09:52:36Z wrobel $"
#
#-------------------------------------------------------------------------------
+import xml.etree.ElementTree as ET
+
from layman.utils import path
from layman.overlays.source import OverlaySource, require_supported
@@ -44,7 +46,7 @@ class GitOverlay(OverlaySource):
def __init__(self, parent, config, _location, ignore = 0):
super(GitOverlay, self).__init__(parent, config,
_location, ignore)
- self.branch = None
+ self.branch = self.parent.branch
def _fix_git_source(self, source):
@@ -76,6 +78,10 @@ class GitOverlay(OverlaySource):
args.append(cfg_opts)
args.append(self._fix_git_source(self.src))
args.append(target)
+
+ if self.branch:
+ args.append('-b')
+ args.append(self.branch)
success = False
# adding cwd=base due to a new git bug in selinux due to
# not having user_home_dir_t and portage_fetch_t permissions
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [gentoo-commits] proj/layman:gsoc2014 commit in: layman/overlays/
@ 2014-06-16 3:37 Brian Dolbec
0 siblings, 0 replies; 16+ messages in thread
From: Brian Dolbec @ 2014-06-16 3:37 UTC (permalink / raw
To: gentoo-commits
commit: b5e16c46fd286a3df26923366dd2c4b0a4acaa9f
Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 11 18:43:08 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Jun 15 00:36:41 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=b5e16c46
{cvs, tar}.py: Fixes assignment for self.branch
Fixes commit: fix undefined 'subpath', update tests
SHA:0fde69e7ef993c3e5cca925cef35c8c895cfd834
Author: dol-sen <brian.dolbec <AT> gmail.com>
Date: Sat 23 Jul 2011 02:44:26 AM EDT
Fixes commit: removal of xml from the vcs class parameters.
SHA: ba5f0cd5c948bb7a65ab21008c940caf0fbe38e7
Author: Brian Dolbec <brian.dolbec <AT> gmail.com>
Date: Thu 24 Feb 2011 01:49:58 AM EST
---
layman/overlays/cvs.py | 2 +-
layman/overlays/tar.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/layman/overlays/cvs.py b/layman/overlays/cvs.py
index a8c6abb..70638e3 100644
--- a/layman/overlays/cvs.py
+++ b/layman/overlays/cvs.py
@@ -47,7 +47,7 @@ class CvsOverlay(OverlaySource):
def __init__(self, parent, config, _location, ignore = 0):
super(CvsOverlay, self).__init__(parent, config, _location, ignore)
- self.branch = None
+ self.branch = self.parent.branch
def add(self, base):
diff --git a/layman/overlays/tar.py b/layman/overlays/tar.py
index 884d527..acbeece 100644
--- a/layman/overlays/tar.py
+++ b/layman/overlays/tar.py
@@ -93,7 +93,7 @@ class TarOverlay(OverlaySource):
self.output = config['output']
self.proxies = config.proxies
- self.branch = None
+ self.branch = self.parent.branch
def _extract(self, base, tar_url, dest_dir):
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [gentoo-commits] proj/layman:gsoc2014 commit in: layman/overlays/
@ 2014-06-16 3:37 Brian Dolbec
0 siblings, 0 replies; 16+ messages in thread
From: Brian Dolbec @ 2014-06-16 3:37 UTC (permalink / raw
To: gentoo-commits
commit: 10881a57c8b438b4b4e984ebdb375d14fb63d474
Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 11 05:22:51 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Jun 15 00:36:41 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=10881a57
mercurial.py: Adds module branch support
---
layman/overlays/mercurial.py | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/layman/overlays/mercurial.py b/layman/overlays/mercurial.py
index 7a5fe08..a1b7846 100644
--- a/layman/overlays/mercurial.py
+++ b/layman/overlays/mercurial.py
@@ -28,6 +28,8 @@ __version__ = "$Id: mercurial.py 236 2006-09-05 20:39:37Z wrobel $"
#-------------------------------------------------------------------------------
import re
+import xml.etree.ElementTree as ET
+
from layman.utils import path
from layman.overlays.source import OverlaySource, require_supported
@@ -48,7 +50,8 @@ class MercurialOverlay(OverlaySource):
super(MercurialOverlay, self).__init__(parent,
config, _location, ignore)
- self.branch = None
+ self.branch = self.parent.branch
+
def _fix_mercurial_source(self, source):
'''
@@ -77,6 +80,10 @@ class MercurialOverlay(OverlaySource):
else:
args = ['clone', src, target]
+ if self.branch:
+ args.append('-r')
+ args.append(self.branch)
+
return self.postsync(
self.run_command(self.command(), args, cmd=self.type),
cwd=target)
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [gentoo-commits] proj/layman:gsoc2014 commit in: layman/overlays/
@ 2014-06-16 3:37 Brian Dolbec
0 siblings, 0 replies; 16+ messages in thread
From: Brian Dolbec @ 2014-06-16 3:37 UTC (permalink / raw
To: gentoo-commits
commit: a189742b6940cf15e078fd952c1fd9daa61951b0
Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 12 21:42:20 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Jun 15 00:36:41 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=a189742b
tar.py: Adds file:// support for tar overlays
---
layman/overlays/tar.py | 40 +++++++++++++++++++++++-----------------
1 file changed, 23 insertions(+), 17 deletions(-)
diff --git a/layman/overlays/tar.py b/layman/overlays/tar.py
index fc15c56..e5d10b6 100644
--- a/layman/overlays/tar.py
+++ b/layman/overlays/tar.py
@@ -99,6 +99,7 @@ class TarOverlay(OverlaySource):
def _extract(self, base, tar_url, dest_dir):
ext = '.tar.noidea'
+ clean_tar = True
for i in [('tar.%s' % e) for e in ('bz2', 'gz', 'lzma', 'xz', 'Z')] \
+ ['tgz', 'tbz', 'taz', 'tlz', 'txz']:
candidate_ext = '.%s' % i
@@ -106,33 +107,38 @@ class TarOverlay(OverlaySource):
ext = candidate_ext
break
- # setup the ssl-fetch output map
- connector_output = {
- 'info': self.output.debug,
- 'error': self.output.error,
- 'kwargs-info': {'level': 2},
- 'kwargs-error':{'level': None},
- }
+ if 'file://' not in tar_url:
+ # setup the ssl-fetch output map
+ connector_output = {
+ 'info': self.output.debug,
+ 'error': self.output.error,
+ 'kwargs-info': {'level': 2},
+ 'kwargs-error':{'level': None},
+ }
- fetcher = Connector(connector_output, self.proxies, USERAGENT)
+ fetcher = Connector(connector_output, self.proxies, USERAGENT)
- success, tar, timestamp = fetcher.fetch_content(tar_url)
+ success, tar, timestamp = fetcher.fetch_content(tar_url)
- pkg = path([base, self.parent.name + ext])
+ pkg = path([base, self.parent.name + ext])
- try:
- with fileopen(pkg, 'w+b') as out_file:
- out_file.write(tar)
+ try:
+ with fileopen(pkg, 'w+b') as out_file:
+ out_file.write(tar)
- except Exception as error:
- raise Exception('Failed to store tar package in '
- + pkg + '\nError was:' + str(error))
+ except Exception as error:
+ raise Exception('Failed to store tar package in '
+ + pkg + '\nError was:' + str(error))
+ else:
+ clean_tar = False
+ pkg = tar_url.replace('file://', '')
# tar -v -x -f SOURCE -C TARGET
args = ['-v', '-x', '-f', pkg, '-C', dest_dir]
result = self.run_command(self.command(), args, cmd=self.type)
- os.unlink(pkg)
+ if clean_tar:
+ os.unlink(pkg)
return result
def _add_unchecked(self, base):
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [gentoo-commits] proj/layman:gsoc2014 commit in: layman/overlays/
@ 2014-06-27 4:07 Devan Franchini
0 siblings, 0 replies; 16+ messages in thread
From: Devan Franchini @ 2014-06-27 4:07 UTC (permalink / raw
To: gentoo-commits
commit: 5762ca4893af37816d09a39b7254a85381d7fcc2
Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 18 02:20:14 2014 +0000
Commit: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Thu Jun 19 03:49:57 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=5762ca48
overlay.py: Improves dictionary checking logic
---
layman/overlays/overlay.py | 73 ++++++++++++++++++++++++++++------------------
1 file changed, 44 insertions(+), 29 deletions(-)
diff --git a/layman/overlays/overlay.py b/layman/overlays/overlay.py
index 72c5d53..176f146 100755
--- a/layman/overlays/overlay.py
+++ b/layman/overlays/overlay.py
@@ -150,13 +150,21 @@ class Overlay(object):
del s
def create_overlay_source(source_elem):
+ _branch = ''
_type = source_elem.attrib['type']
+ if 'branch' in source_elem.attrib:
+ _branch = source_elem.attrib['branch']
+
try:
_class = OVERLAY_TYPES[_type]
except KeyError:
raise Exception('Overlay from_xml(), "' + self.name + \
'Unknown overlay type "%s"!' % _type)
+
_location = encode(strip_text(source_elem))
+
+ self.branch = _branch
+
return _class(parent=self, config=self.config,
_location=_location, ignore=ignore)
@@ -240,9 +248,9 @@ class Overlay(object):
def from_dict(self, overlay, ignore):
- """Process an xml overlay definition
+ """Process an overlay dictionary definition
"""
- self.output.debug("Overlay from_dict(); overlay" + str(overlay))
+ self.output.debug("Overlay from_dict(); overlay" + str(overlay), 6)
_name = overlay['name']
if _name != None:
self.name = encode(_name)
@@ -264,19 +272,25 @@ class Overlay(object):
raise Exception('Overlay from_dict(), "' + self.name +
'Unknown overlay type "%s"!' % _type)
_location = encode(_src)
+ if _sub:
+ self.branch = encode(_sub)
+ else:
+ self.branch = None
+
return _class(parent=self, config=self.config,
_location=_location, ignore=ignore)
self.sources = [create_dict_overlay_source(e) for e in _sources]
- _owner = overlay['owner_name']
- if _owner == None:
- self.owner_name = None
- _email = None
- else:
+ if 'owner_name' in overlay:
+ _owner = overlay['owner_name']
self.owner_name = encode(_owner)
_email = overlay['owner_email']
- if _email != None:
+ else:
+ self.owner_name = None
+
+ if 'owner_email' in overlay:
+ _email = overlay['owner_email']
self.owner_email = encode(_email)
else:
self.owner_email = None
@@ -287,8 +301,8 @@ class Overlay(object):
self.output.warn('Overlay from_dict(), "' + self.name +
'" is missing an "owner.email" entry!', 4)
- _desc = overlay['description']
- if _desc != None:
+ if 'description' in overlay:
+ _desc = overlay['description']
d = WHITESPACE_REGEX.sub(' ', _desc)
self.description = encode(d)
del d
@@ -301,39 +315,39 @@ class Overlay(object):
self.output.warn('Overlay from_dict(), "' + self.name +
'" is missing a "description" entry!', 4)
- if overlay['status']:
+ if 'status' in overlay:
self.status = encode(overlay['status'])
else:
self.status = None
self.quality = 'experimental'
- if len(overlay['quality']):
+ if 'quality' in overlay:
if overlay['quality'] in set(QUALITY_LEVELS):
self.quality = encode(overlay['quality'])
- if overlay['priority']:
+ if 'priority' in overlay:
self.priority = int(overlay['priority'])
else:
self.priority = 50
- h = overlay['homepage']
- if h != None:
- self.homepage = encode(h)
+ if 'homepage' in overlay:
+ self.homepage = encode(overlay['homepage'])
else:
self.homepage = None
- self.feeds = [encode(e) \
- for e in overlay['feeds']]
+ if 'feed' in overlay:
+ self.feeds = [encode(e) \
+ for e in overlay['feeds']]
+ else:
+ self.feeds = None
- _irc = overlay['irc']
- if _irc != None:
- self.irc = encode(_irc)
+ if 'irc' in overlay:
+ self.irc = encode(overlay['irc'])
else:
self.irc = None
- _branch = overlay['branch']
- if _branch != None:
- self.branch = encode(_branch)
+ if 'branch' in overlay:
+ self.branch = encode(overlay['branch'])
else:
self.branch = None
#xml = self.to_xml()
@@ -405,11 +419,12 @@ class Overlay(object):
# NOTE: Two loops on purpose so the
# hooks are called with all sources in
i.to_xml_hook(repo)
- for i in self.feeds:
- feed = ET.Element('feed')
- feed.text = i
- repo.append(feed)
- del feed
+ if self.feeds != None:
+ for i in self.feeds:
+ feed = ET.Element('feed')
+ feed.text = i
+ repo.append(feed)
+ del feed
return repo
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [gentoo-commits] proj/layman:gsoc2014 commit in: layman/overlays/
@ 2014-08-15 22:32 Devan Franchini
0 siblings, 0 replies; 16+ messages in thread
From: Devan Franchini @ 2014-08-15 22:32 UTC (permalink / raw
To: gentoo-commits
commit: 4be4ecf142526e54ff052118aa856699a7251986
Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 1 21:05:54 2014 +0000
Commit: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Fri Aug 15 21:42:42 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=4be4ecf1
overlay.py: Adds plug-in module controller
This commit implements the module controller system for the overlay
plug-in modules.
---
layman/overlays/overlay.py | 45 +++++++++++++--------------------------------
1 file changed, 13 insertions(+), 32 deletions(-)
diff --git a/layman/overlays/overlay.py b/layman/overlays/overlay.py
index 81dadcd..8dd0b4b 100755
--- a/layman/overlays/overlay.py
+++ b/layman/overlays/overlay.py
@@ -35,38 +35,16 @@ import codecs
import locale
import xml.etree.ElementTree as ET # Python 2.5
-from layman.utils import pad, terminal_width, get_encoding, encoder
-from layman.compatibility import encode
-
-from layman.overlays.bzr import BzrOverlay
-from layman.overlays.darcs import DarcsOverlay
-from layman.overlays.git import GitOverlay
-from layman.overlays.g_common import GCommonOverlay
-from layman.overlays.g_sorcery import GSorceryOverlay
-from layman.overlays.mercurial import MercurialOverlay
-from layman.overlays.cvs import CvsOverlay
-from layman.overlays.svn import SvnOverlay
-from layman.overlays.rsync import RsyncOverlay
-from layman.overlays.tar import TarOverlay
+from layman.compatibility import encode
+from layman.module import Modules, InvalidModuleName
+from layman.utils import pad, terminal_width, get_encoding, encoder
#===============================================================================
#
# Constants
#
#-------------------------------------------------------------------------------
-
-OVERLAY_TYPES = dict((e.type_key, e) for e in (
- GitOverlay,
- GCommonOverlay,
- GSorceryOverlay,
- CvsOverlay,
- SvnOverlay,
- RsyncOverlay,
- TarOverlay,
- BzrOverlay,
- MercurialOverlay,
- DarcsOverlay
-))
+MOD_PATH = path = os.path.join(os.path.dirname(__file__), 'modules')
QUALITY_LEVELS = 'core|stable|testing|experimental|graveyard'.split('|')
@@ -80,6 +58,9 @@ class Overlay(object):
ignore = 0):
self.config = config
self.output = config['output']
+ self.module_controller = Modules(path=MOD_PATH,
+ namepath='layman.overlays.modules',
+ output=self.output)
self._encoding_ = get_encoding(self.output)
if xml is not None:
@@ -124,10 +105,10 @@ class Overlay(object):
_branch = source_elem.attrib['branch']
try:
- _class = OVERLAY_TYPES[_type]
- except KeyError:
+ _class = self.module_controller.get_class(_type)
+ except InvalidModuleName:
raise Exception('Overlay from_xml(), "' + self.name + \
- 'Unknown overlay type "%s"!' % _type)
+ '" Unknown overlay type "%s"!' % _type)
_location = encode(strip_text(source_elem))
@@ -236,10 +217,10 @@ class Overlay(object):
def create_dict_overlay_source(source_):
_src, _type, _sub = source_
try:
- _class = OVERLAY_TYPES[_type]
- except KeyError:
+ _class = self.module_controller.get_class(_type)
+ except InvalidModuleName:
raise Exception('Overlay from_dict(), "' + self.name +
- 'Unknown overlay type "%s"!' % _type)
+ '" Unknown overlay type "%s"!' % _type)
_location = encode(_src)
if _sub:
self.branch = encode(_sub)
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [gentoo-commits] proj/layman:gsoc2014 commit in: layman/overlays/
@ 2014-08-15 22:32 Devan Franchini
0 siblings, 0 replies; 16+ messages in thread
From: Devan Franchini @ 2014-08-15 22:32 UTC (permalink / raw
To: gentoo-commits
commit: aa264e4ef3c620f2dae3f8b3bccf38574412742c
Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 1 21:13:42 2014 +0000
Commit: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Fri Aug 15 21:42:42 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=aa264e4e
overlay.py: Adds self.ovl_type
To allow a stub function to tell the user the current overlay type
of the unsupported overlay, this variable will be passed in along
with the parent variable.
---
layman/overlays/overlay.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/layman/overlays/overlay.py b/layman/overlays/overlay.py
index ee2c279..bc57e2e 100755
--- a/layman/overlays/overlay.py
+++ b/layman/overlays/overlay.py
@@ -101,6 +101,7 @@ class Overlay(object):
def create_overlay_source(source_elem):
_branch = ''
_type = source_elem.attrib['type']
+ self.ovl_type = _type
if 'branch' in source_elem.attrib:
_branch = source_elem.attrib['branch']
@@ -215,6 +216,7 @@ class Overlay(object):
def create_dict_overlay_source(source_):
_src, _type, _sub = source_
+ self.ovl_type = _type
try:
_class = self.module_controller.get_class(_type)
except InvalidModuleName:
^ permalink raw reply related [flat|nested] 16+ messages in thread
end of thread, other threads:[~2014-08-15 22:32 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-15 22:32 [gentoo-commits] proj/layman:gsoc2014 commit in: layman/overlays/ Devan Franchini
-- strict thread matches above, loose matches on Subject: below --
2014-08-15 22:32 Devan Franchini
2014-06-27 4:07 Devan Franchini
2014-06-16 3:40 [gentoo-commits] proj/layman:master " Brian Dolbec
2014-06-16 3:37 ` [gentoo-commits] proj/layman:gsoc2014 " Brian Dolbec
2014-06-16 3:40 [gentoo-commits] proj/layman:master " Brian Dolbec
2014-06-16 3:37 ` [gentoo-commits] proj/layman:gsoc2014 " Brian Dolbec
2014-06-16 3:37 Brian Dolbec
2014-06-16 3:37 Brian Dolbec
2014-06-16 3:37 Brian Dolbec
2014-06-16 3:37 Brian Dolbec
2014-06-16 3:37 Brian Dolbec
2014-06-16 3:37 Brian Dolbec
2014-06-16 3:37 Brian Dolbec
2014-05-14 23:49 Devan Franchini
2014-05-14 17:32 Devan Franchini
2014-05-14 1:14 Devan Franchini
2014-05-14 0:42 Devan Franchini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox