summaryrefslogtreecommitdiffstats
path: root/meta-oe/classes/socorro-syms.bbclass
diff options
context:
space:
mode:
authorDaniel Markus <daniel.markus@leica-geosystems.com>2015-03-26 09:20:06 +0100
committerMartin Jansa <Martin.Jansa@gmail.com>2015-04-13 12:55:47 +0200
commitd1084c78e7fbe3910b36043c8b9c2b9274db90ca (patch)
treeb070a5c15b8a968162b90d6cbdce069ed3977ed2 /meta-oe/classes/socorro-syms.bbclass
parent0c48853eb47aa410a4198928048cfb8e302b150d (diff)
downloadmeta-openembedded-d1084c78e7fbe3910b36043c8b9c2b9274db90ca.tar.gz
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>
Diffstat (limited to 'meta-oe/classes/socorro-syms.bbclass')
-rw-r--r--meta-oe/classes/socorro-syms.bbclass14
1 files changed, 13 insertions, 1 deletions
diff --git a/meta-oe/classes/socorro-syms.bbclass b/meta-oe/classes/socorro-syms.bbclass
index c2729527d..0312031d0 100644
--- a/meta-oe/classes/socorro-syms.bbclass
+++ b/meta-oe/classes/socorro-syms.bbclass
@@ -108,6 +108,12 @@ def run_command(command, directory):
108 return output.rstrip() 108 return output.rstrip()
109 109
110 110
111def is_local_url(url):
112
113 return \
114 url.startswith("file:") or url.startswith("/") or url.startswith("./")
115
116
111def git_repository_path(source_file_path): 117def git_repository_path(source_file_path):
112 118
113 import re 119 import re
@@ -125,12 +131,18 @@ def git_repository_path(source_file_path):
125 131
126 # The URL could be a local download directory. If so, get the URL again 132 # The URL could be a local download directory. If so, get the URL again
127 # using the local directory's config file. 133 # using the local directory's config file.
128 if os.path.isdir(source_long_url): 134 if is_local_url(source_long_url):
129 git_config_file = os.path.join(source_long_url, "config") 135 git_config_file = os.path.join(source_long_url, "config")
130 source_long_url = run_command( 136 source_long_url = run_command(
131 "git config --file %s --get remote.origin.url" % git_config_file, 137 "git config --file %s --get remote.origin.url" % git_config_file,
132 source_file_dir) 138 source_file_dir)
133 139
140 # If also the download directory redirects to a local git directory,
141 # then we're probably using source code from a local debug branch which
142 # won't be accessible by Socorro.
143 if is_local_url(source_long_url):
144 return None
145
134 # The URL can have several formats. A full list can be found using 146 # The URL can have several formats. A full list can be found using
135 # git help clone. Extract the server part with a regex. 147 # git help clone. Extract the server part with a regex.
136 url_match = re.search(".*(://|@)([^:/]*).*", source_long_url) 148 url_match = re.search(".*(://|@)([^:/]*).*", source_long_url)