* [gentoo-commits] proj/portage:master commit in: pym/portage/sync/modules/svn/
@ 2015-01-18 18:04 Michał Górny
0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2015-01-18 18:04 UTC (permalink / raw
To: gentoo-commits
commit: 7ca0672d4c95d2e07885460eee9ed41e882faf9f
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 17 17:13:09 2015 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Jan 18 18:04:25 2015 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7ca0672d
svn sync: fix the module
Fix the svn sync module since it doesn't work at all right now. More
specifically:
1. add exists() method that checks for the '.svn' directory to determine
whether the repository was checked out already.
2. Fix the initial clone to use valid svn commands. Do not remove
the just-created (in pre_sync()) directory to avoid permission issues,
just run checkout on top of it.
3. Fix the sync method to run update unconditionally to whether the URI
starts with svn:// or not. In fact, remove the whole check since it
doesn't serve any purpose.
---
pym/portage/sync/modules/svn/svn.py | 42 +++++++++++++++----------------------
1 file changed, 17 insertions(+), 25 deletions(-)
diff --git a/pym/portage/sync/modules/svn/svn.py b/pym/portage/sync/modules/svn/svn.py
index 73c4b83..60ead4b 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -24,23 +24,19 @@ class SVNSync(SyncBase):
SyncBase.__init__(self, "svn", "dev-vcs/subversion")
+ def exists(self, **kwargs):
+ '''Tests whether the repo actually exists'''
+ return os.path.exists(os.path.join(self.repo.location, '.svn'))
+
+
def new(self, **kwargs):
if kwargs:
self._kwargs(kwargs)
#initial checkout
- try:
- os.rmdir(self.repo.location)
- except OSError as e:
- if e.errno != errno.ENOENT:
- msg = "!!! existing '%s' directory; exiting." % self.repo.location
- self.logger(self.xterm_titles, msg)
- writemsg_level(msg + "\n", noiselevel=-1, level=logging.ERROR)
- return (1, False)
- del e
svn_root = self.repo.sync_uri
- exitcode = portage.process.spawn_bash(
- "cd %s; exec svn %s" %
- (portage._shell_quote(os.path.dirname(self.repo.location)),
+ exitcode = portage.process.spawn_bash(
+ "cd %s; exec svn co %s ." %
+ (portage._shell_quote(self.repo.location),
portage._shell_quote(svn_root)),
**portage._native_kwargs(self.spawn_kwargs))
if exitcode != os.EX_OK:
@@ -63,19 +59,15 @@ class SVNSync(SyncBase):
if exitcode != os.EX_OK:
return (exitcode, False)
- svn_root = self.repo.sync_uri
-
- if svn_root.startswith("svn://"):
- svn_root = svn_root[6:]
- #svn update
- exitcode = portage.process.spawn_bash(
- "cd %s; exec svn update" % \
- (portage._shell_quote(self.repo.location),),
- **portage._native_kwargs(self.spawn_kwargs))
- if exitcode != os.EX_OK:
- msg = "!!! svn update error; exiting."
- self.logger(self.xterm_titles, msg)
- writemsg_level(msg + "\n", noiselevel=-1, level=logging.ERROR)
+ #svn update
+ exitcode = portage.process.spawn_bash(
+ "cd %s; exec svn update" % \
+ (portage._shell_quote(self.repo.location),),
+ **portage._native_kwargs(self.spawn_kwargs))
+ if exitcode != os.EX_OK:
+ msg = "!!! svn update error; exiting."
+ self.logger(self.xterm_titles, msg)
+ writemsg_level(msg + "\n", noiselevel=-1, level=logging.ERROR)
return (exitcode, False)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/sync/modules/svn/
@ 2014-12-04 20:16 Brian Dolbec
0 siblings, 0 replies; 2+ messages in thread
From: Brian Dolbec @ 2014-12-04 20:16 UTC (permalink / raw
To: gentoo-commits
commit: 9831dd2fbd8889ee4c1738813b6a9c4c78c36e8c
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 16 17:58:09 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Dec 4 19:56:33 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9831dd2f
sync/modules/svn: Add snv upgrade to sync operation
This prevents errors when a newer svn has been installed that requires a db upgrade.
---
pym/portage/sync/modules/svn/svn.py | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/pym/portage/sync/modules/svn/svn.py b/pym/portage/sync/modules/svn/svn.py
index 182a7ac..0365e90 100644
--- a/pym/portage/sync/modules/svn/svn.py
+++ b/pym/portage/sync/modules/svn/svn.py
@@ -62,6 +62,10 @@ class SVNSync(SyncBase):
@rtype: (int, bool)
"""
+ exitcode, d = self._svn_upgrade()
+ if exitcode != os.EX_OK:
+ return (exitcode, False)
+
svn_root = self.repo.sync_uri
if svn_root.startswith("svn://"):
@@ -79,3 +83,22 @@ class SVNSync(SyncBase):
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, level=logging.ERROR)
return (exitcode, False)
+
+
+ def _svn_upgrade(self):
+ """
+ Internal function which performs an svn upgrade on the repo
+
+ @return: tuple of return code (0=success), whether the cache
+ needs to be updated
+ @rtype: (int, bool)
+ """
+ exitcode = portage.process.spawn_bash(
+ "cd %s; exec svn upgrade" %
+ (portage._shell_quote(self.repo.location),),
+ **portage._native_kwargs(self.spawn_kwargs))
+ if exitcode != os.EX_OK:
+ msg = "!!! svn upgrade error; exiting."
+ self.logger(self.xterm_titles, msg)
+ writemsg_level(msg + "\n", noiselevel=-1, level=logging.ERROR)
+ return (exitcode, False)
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-18 18:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-18 18:04 [gentoo-commits] proj/portage:master commit in: pym/portage/sync/modules/svn/ Michał Górny
-- strict thread matches above, loose matches on Subject: below --
2014-12-04 20:16 Brian Dolbec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox