From 49549f4cad2097a6447ea349bff75c8bf2b49d30 Mon Sep 17 00:00:00 2001 From: Ciaran Gultnieks Date: Sun, 11 Jan 2015 17:46:10 +0000 Subject: [PATCH] Remove support for git-svn with authentication --- docs/fdroid.texi | 5 ----- fdroidserver/common.py | 27 ++++++++++++--------------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/docs/fdroid.texi b/docs/fdroid.texi index a1d01077..16990e20 100644 --- a/docs/fdroid.texi +++ b/docs/fdroid.texi @@ -774,11 +774,6 @@ root dir. Here's an example of a complex git-svn Repo URL: http://svn.code.sf.net/p/project/code/svn;trunk=trunk;tags=tags;branches=branches -For a Subversion repo that requires authentication, you can precede the repo -URL with username:password@ and those parameters will be passed as @option{--username} -and @option{--password} to the SVN checkout command. (This now works for both -svn and git-svn) - If the Repo Type is @code{srclib}, then you must specify the name of the according srclib .txt file. For example if @code{scrlibs/FooBar.txt} exist and you want to use this srclib, then you have to set Repo to diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 8a958704..3a95445a 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -427,6 +427,8 @@ class vcs: self.username = None if self.repotype() in ('git-svn', 'bzr'): if '@' in remote: + if self.repotype == 'git-svn': + raise VCSException("Authentication is not supported for git-svn") self.username, remote = remote.split('@') if ':' not in self.username: raise VCSException("Password required with username") @@ -639,13 +641,6 @@ class vcs_gitsvn(vcs): def repotype(self): return 'git-svn' - # Damn git-svn tries to use a graphical password prompt, so we have to - # trick it into taking the password from stdin - def userargs(self): - if self.username is None: - return ('', '') - return ('echo "%s" | DISPLAY="" ' % self.password, ' --username "%s"' % self.username) - # If the local directory exists, but is somehow not a git repository, git # will traverse up the directory tree until it finds one that is (i.e. # fdroidserver) and then we'll proceed to destory it! This is called as @@ -659,22 +654,24 @@ class vcs_gitsvn(vcs): def gotorevisionx(self, rev): if not os.path.exists(self.local): # Brand new checkout - gitsvn_cmd = '%sgit svn clone%s' % self.userargs() + gitsvn_args = ['git', 'svn', 'clone'] if ';' in self.remote: remote_split = self.remote.split(';') for i in remote_split[1:]: if i.startswith('trunk='): - gitsvn_cmd += ' -T %s' % i[6:] + gitsvn_args.extend(['-T', i[6:]]) elif i.startswith('tags='): - gitsvn_cmd += ' -t %s' % i[5:] + gitsvn_args.extend(['-t', i[5:]]) elif i.startswith('branches='): - gitsvn_cmd += ' -b %s' % i[9:] - p = FDroidPopen([gitsvn_cmd + " %s %s" % (remote_split[0], self.local)], shell=True, output=False) + gitsvn_args.extend(['-b', i[9:]]) + gitsvn_args.extend([remote_split[0], self.local]) + p = FDroidPopen(gitsvn_args, output=False) if p.returncode != 0: self.clone_failed = True raise VCSException("Git svn clone failed", p.output) else: - p = FDroidPopen([gitsvn_cmd + " %s %s" % (self.remote, self.local)], shell=True, output=False) + gitsvn_args.extend([remote_split[0], self.local]) + p = FDroidPopen(gitsvn_args, output=False) if p.returncode != 0: self.clone_failed = True raise VCSException("Git svn clone failed", p.output) @@ -692,10 +689,10 @@ class vcs_gitsvn(vcs): raise VCSException("Git clean failed", p.output) if not self.refreshed: # Get new commits, branches and tags from repo - p = FDroidPopen(['%sgit svn fetch %s' % self.userargs()], cwd=self.local, shell=True, output=False) + p = FDroidPopen(['git', 'svn', 'fetch'], cwd=self.local, output=False) if p.returncode != 0: raise VCSException("Git svn fetch failed") - p = FDroidPopen(['%sgit svn rebase %s' % self.userargs()], cwd=self.local, shell=True, output=False) + p = FDroidPopen(['git', 'svn', 'rebase'], cwd=self.local, output=False) if p.returncode != 0: raise VCSException("Git svn rebase failed", p.output) self.refreshed = True