1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-04 14:30:11 +01:00

Remove support for git-svn with authentication

This commit is contained in:
Ciaran Gultnieks 2015-01-11 17:46:10 +00:00
parent e8d7e69630
commit 49549f4cad
2 changed files with 12 additions and 20 deletions

View File

@ -774,11 +774,6 @@ root dir.
Here's an example of a complex git-svn Repo URL: 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 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 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 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 and you want to use this srclib, then you have to set Repo to

View File

@ -427,6 +427,8 @@ class vcs:
self.username = None self.username = None
if self.repotype() in ('git-svn', 'bzr'): if self.repotype() in ('git-svn', 'bzr'):
if '@' in remote: if '@' in remote:
if self.repotype == 'git-svn':
raise VCSException("Authentication is not supported for git-svn")
self.username, remote = remote.split('@') self.username, remote = remote.split('@')
if ':' not in self.username: if ':' not in self.username:
raise VCSException("Password required with username") raise VCSException("Password required with username")
@ -639,13 +641,6 @@ class vcs_gitsvn(vcs):
def repotype(self): def repotype(self):
return 'git-svn' 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 # 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. # 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 # 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): def gotorevisionx(self, rev):
if not os.path.exists(self.local): if not os.path.exists(self.local):
# Brand new checkout # Brand new checkout
gitsvn_cmd = '%sgit svn clone%s' % self.userargs() gitsvn_args = ['git', 'svn', 'clone']
if ';' in self.remote: if ';' in self.remote:
remote_split = self.remote.split(';') remote_split = self.remote.split(';')
for i in remote_split[1:]: for i in remote_split[1:]:
if i.startswith('trunk='): if i.startswith('trunk='):
gitsvn_cmd += ' -T %s' % i[6:] gitsvn_args.extend(['-T', i[6:]])
elif i.startswith('tags='): elif i.startswith('tags='):
gitsvn_cmd += ' -t %s' % i[5:] gitsvn_args.extend(['-t', i[5:]])
elif i.startswith('branches='): elif i.startswith('branches='):
gitsvn_cmd += ' -b %s' % i[9:] gitsvn_args.extend(['-b', i[9:]])
p = FDroidPopen([gitsvn_cmd + " %s %s" % (remote_split[0], self.local)], shell=True, output=False) gitsvn_args.extend([remote_split[0], self.local])
p = FDroidPopen(gitsvn_args, output=False)
if p.returncode != 0: if p.returncode != 0:
self.clone_failed = True self.clone_failed = True
raise VCSException("Git svn clone failed", p.output) raise VCSException("Git svn clone failed", p.output)
else: 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: if p.returncode != 0:
self.clone_failed = True self.clone_failed = True
raise VCSException("Git svn clone failed", p.output) raise VCSException("Git svn clone failed", p.output)
@ -692,10 +689,10 @@ class vcs_gitsvn(vcs):
raise VCSException("Git clean failed", p.output) raise VCSException("Git clean failed", p.output)
if not self.refreshed: if not self.refreshed:
# Get new commits, branches and tags from repo # 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: if p.returncode != 0:
raise VCSException("Git svn fetch failed") 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: if p.returncode != 0:
raise VCSException("Git svn rebase failed", p.output) raise VCSException("Git svn rebase failed", p.output)
self.refreshed = True self.refreshed = True