mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-06-13 05:30:02 +00:00
socorro-syms: Add support for local repositories
This socorro-syms functionality tries to extract the host name out of the source code repository origin. This causes problems when the origin is a local repository. The solution is to look for the origin in two steps. If the origin in the first step is a local directory we assume it is a temporary download repository. In the second step we look for the origin to that download repository and if that also redirects to a local repository, we provide the absolute path instead of a Socorro repository link. Signed-off-by: Daniel Markus <daniel.markus@leica-geosystems.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
This commit is contained in:
committed by
Martin Jansa
parent
0c48853eb4
commit
d1084c78e7
@@ -108,6 +108,12 @@ def run_command(command, directory):
|
|||||||
return output.rstrip()
|
return output.rstrip()
|
||||||
|
|
||||||
|
|
||||||
|
def is_local_url(url):
|
||||||
|
|
||||||
|
return \
|
||||||
|
url.startswith("file:") or url.startswith("/") or url.startswith("./")
|
||||||
|
|
||||||
|
|
||||||
def git_repository_path(source_file_path):
|
def git_repository_path(source_file_path):
|
||||||
|
|
||||||
import re
|
import re
|
||||||
@@ -125,12 +131,18 @@ def git_repository_path(source_file_path):
|
|||||||
|
|
||||||
# The URL could be a local download directory. If so, get the URL again
|
# The URL could be a local download directory. If so, get the URL again
|
||||||
# using the local directory's config file.
|
# using the local directory's config file.
|
||||||
if os.path.isdir(source_long_url):
|
if is_local_url(source_long_url):
|
||||||
git_config_file = os.path.join(source_long_url, "config")
|
git_config_file = os.path.join(source_long_url, "config")
|
||||||
source_long_url = run_command(
|
source_long_url = run_command(
|
||||||
"git config --file %s --get remote.origin.url" % git_config_file,
|
"git config --file %s --get remote.origin.url" % git_config_file,
|
||||||
source_file_dir)
|
source_file_dir)
|
||||||
|
|
||||||
|
# If also the download directory redirects to a local git directory,
|
||||||
|
# then we're probably using source code from a local debug branch which
|
||||||
|
# won't be accessible by Socorro.
|
||||||
|
if is_local_url(source_long_url):
|
||||||
|
return None
|
||||||
|
|
||||||
# The URL can have several formats. A full list can be found using
|
# The URL can have several formats. A full list can be found using
|
||||||
# git help clone. Extract the server part with a regex.
|
# git help clone. Extract the server part with a regex.
|
||||||
url_match = re.search(".*(://|@)([^:/]*).*", source_long_url)
|
url_match = re.search(".*(://|@)([^:/]*).*", source_long_url)
|
||||||
|
|||||||
Reference in New Issue
Block a user