Mercurial > kallithea
comparison rhodecode/lib/middleware/pygrack.py @ 4116:ffd45b185016 rhodecode-2.2.5-gpl
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
This imports changes between changesets 21af6c4eab3d and 6177597791c2 in
RhodeCode's original repository, including only changes to Python files and HTML.
RhodeCode clearly licensed its changes to these files under GPLv3
in their /LICENSE file, which states the following:
The Python code and integrated HTML are licensed under the GPLv3 license.
(See:
https://code.rhodecode.com/rhodecode/files/v2.2.5/LICENSE
or
http://web.archive.org/web/20140512193334/https://code.rhodecode.com/rhodecode/files/f3b123159901f15426d18e3dc395e8369f70ebe0/LICENSE
for an online copy of that LICENSE file)
Conservancy reviewed these changes and confirmed that they can be licensed as
a whole to the Kallithea project under GPLv3-only.
While some of the contents committed herein are clearly licensed
GPLv3-or-later, on the whole we must assume the are GPLv3-only, since the
statement above from RhodeCode indicates that they intend GPLv3-only as their
license, per GPLv3ยง14 and other relevant sections of GPLv3.
author | Bradley M. Kuhn <bkuhn@sfconservancy.org> |
---|---|
date | Wed, 02 Jul 2014 19:03:13 -0400 |
parents | dc4644865e8b |
children | 7e5f8c12a3fc |
comparison
equal
deleted
inserted
replaced
4115:8b7294a804a0 | 4116:ffd45b185016 |
---|---|
1 import os | 1 import os |
2 import socket | 2 import socket |
3 import logging | 3 import logging |
4 import subprocess | |
5 import traceback | 4 import traceback |
6 | 5 |
7 from webob import Request, Response, exc | 6 from webob import Request, Response, exc |
8 | 7 |
9 import rhodecode | 8 import rhodecode |
84 packet_len = str(hex(len(server_advert) + 4)[2:].rjust(4, '0')).lower() | 83 packet_len = str(hex(len(server_advert) + 4)[2:].rjust(4, '0')).lower() |
85 _git_path = rhodecode.CONFIG.get('git_path', 'git') | 84 _git_path = rhodecode.CONFIG.get('git_path', 'git') |
86 try: | 85 try: |
87 out = subprocessio.SubprocessIOChunker( | 86 out = subprocessio.SubprocessIOChunker( |
88 r'%s %s --stateless-rpc --advertise-refs "%s"' % ( | 87 r'%s %s --stateless-rpc --advertise-refs "%s"' % ( |
89 _git_path, git_command[4:], self.content_path), | 88 _git_path, git_command[4:], self.content_path), |
90 starting_values=[ | 89 starting_values=[ |
91 packet_len + server_advert + '0000' | 90 packet_len + server_advert + '0000' |
92 ] | 91 ] |
93 ) | 92 ) |
94 except EnvironmentError, e: | 93 except EnvironmentError, e: |
105 WSGI Response producer for HTTP POST Git Smart HTTP requests. | 104 WSGI Response producer for HTTP POST Git Smart HTTP requests. |
106 Reads commands and data from HTTP POST's body. | 105 Reads commands and data from HTTP POST's body. |
107 returns an iterator obj with contents of git command's | 106 returns an iterator obj with contents of git command's |
108 response to stdout | 107 response to stdout |
109 """ | 108 """ |
109 _git_path = rhodecode.CONFIG.get('git_path', 'git') | |
110 git_command = self._get_fixedpath(request.path_info) | 110 git_command = self._get_fixedpath(request.path_info) |
111 if git_command not in self.commands: | 111 if git_command not in self.commands: |
112 log.debug('command %s not allowed' % git_command) | 112 log.debug('command %s not allowed' % git_command) |
113 return exc.HTTPMethodNotAllowed() | 113 return exc.HTTPMethodNotAllowed() |
114 | 114 |
122 gitenv = os.environ | 122 gitenv = os.environ |
123 # forget all configs | 123 # forget all configs |
124 gitenv['GIT_CONFIG_NOGLOBAL'] = '1' | 124 gitenv['GIT_CONFIG_NOGLOBAL'] = '1' |
125 opts = dict( | 125 opts = dict( |
126 env=gitenv, | 126 env=gitenv, |
127 cwd=os.getcwd() | 127 cwd=self.content_path, |
128 ) | 128 ) |
129 cmd = r'git %s --stateless-rpc "%s"' % (git_command[4:], | 129 cmd = r'%s %s --stateless-rpc "%s"' % (_git_path, git_command[4:], |
130 self.content_path), | 130 self.content_path), |
131 log.debug('handling cmd %s' % cmd) | 131 log.debug('handling cmd %s' % cmd) |
132 out = subprocessio.SubprocessIOChunker( | 132 out = subprocessio.SubprocessIOChunker( |
133 cmd, | 133 cmd, |
134 inputstream=inputstream, | 134 inputstream=inputstream, |
135 **opts | 135 **opts |
139 raise exc.HTTPExpectationFailed() | 139 raise exc.HTTPExpectationFailed() |
140 | 140 |
141 if git_command in [u'git-receive-pack']: | 141 if git_command in [u'git-receive-pack']: |
142 # updating refs manually after each push. | 142 # updating refs manually after each push. |
143 # Needed for pre-1.7.0.4 git clients using regular HTTP mode. | 143 # Needed for pre-1.7.0.4 git clients using regular HTTP mode. |
144 _git_path = rhodecode.CONFIG.get('git_path', 'git') | 144 from rhodecode.lib.vcs import get_repo |
145 cmd = (u'%s --git-dir "%s" ' | 145 from dulwich.server import update_server_info |
146 'update-server-info' % (_git_path, self.content_path)) | 146 repo = get_repo(self.content_path) |
147 log.debug('handling cmd %s' % cmd) | 147 if repo: |
148 subprocess.call(cmd, shell=True) | 148 update_server_info(repo._repo) |
149 | 149 |
150 resp = Response() | 150 resp = Response() |
151 resp.content_type = 'application/x-%s-result' % git_command.encode('utf8') | 151 resp.content_type = 'application/x-%s-result' % git_command.encode('utf8') |
152 resp.charset = None | 152 resp.charset = None |
153 resp.app_iter = out | 153 resp.app_iter = out |
195 return exc.HTTPNotFound()(environ, start_response) | 195 return exc.HTTPNotFound()(environ, start_response) |
196 return app(environ, start_response) | 196 return app(environ, start_response) |
197 | 197 |
198 | 198 |
199 def make_wsgi_app(repo_name, repo_root, extras): | 199 def make_wsgi_app(repo_name, repo_root, extras): |
200 return GitDirectory(repo_root, repo_name, extras) | 200 from dulwich.web import LimitedInputFilter, GunzipFilter |
201 app = GitDirectory(repo_root, repo_name, extras) | |
202 return GunzipFilter(LimitedInputFilter(app)) |