-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #101 #102
Fix #101 #102
Conversation
src/rosdistro/rosdistro.py
Outdated
@@ -222,7 +224,22 @@ def _fetch_package_xml(self, rosdistro): | |||
self._release_tags[rosdistro] = release_tag | |||
return package_xml, release_tag | |||
else: | |||
raise Exception("Non-github repositories are net yet supported by the rosdistro tool") | |||
release_tag = 'release/{0}/{1}/{2}'.format(rosdistro, self.name, repo.version) | |||
for nongithub in supported_non_githubs: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, the loop isn't useful yet, but upon the addition of other potential repo types, the structure makes more sense.
Git history fixed. |
@dirk-thomas Any idea what's going on with the nose tests? They worked fine on my end... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code should either use a loop to check for different hosting providers or make the url replacement conditional. But not both imo.
So the reason I went with this structure has to do with the way GitLab urls work. They are, potentially, unidentifiable (they don't need to contain the word 'gitlab'). Maybe a loop over just the different types of extensions would be best? |
I don't think that trying N providers is feasible. Maybe if the provider is not identifiable by the url there needs to be a way to configure the mapping manually. The same is likely already the case for GitHub enterprise. |
So I removed the loop and left only the appropriate extension for BitBucket/GitLab. This would only be a temporary fix, however. I think it would be best to include a |
I am not convinced that just trying these URLs is a good idea.
I don't understand what you mean. Can you please clarify. |
I'm having a horrible time trying to articulate the idea, so I'll just show you what I would prefer to patch what I currently have with: diff --git a/src/rosdistro/rosdistro.py b/src/rosdistro/rosdistro.py
index baae642..4fb7dd1 100644
--- a/src/rosdistro/rosdistro.py
+++ b/src/rosdistro/rosdistro.py
@@ -197,9 +197,9 @@ class RosPackage:
def _fetch_package_xml(self, rosdistro):
repo = self.repository
- if 'github.com' in repo.url:
- url = repo.url
- release_tag = 'release/{0}/{1}/{2}'.format(rosdistro, self.name, repo.version)
+ url = repo.url
+ release_tag = 'release/{0}/{1}/{2}'.format(rosdistro, self.name, repo.version)
+ if 'github.com' in url:
url = url.replace('.git', '/{0}/package.xml'.format(release_tag))
url = url.replace('git://', 'https://')
url = url.replace('https://', 'https://raw.')
@@ -222,11 +222,11 @@ class RosPackage:
self._release_tags[rosdistro] = release_tag
return package_xml, release_tag
else:
- release_tag = 'release/{0}/{1}/{2}'.format(rosdistro, self.name, repo.version)
- url = repo.url
+ if repo.raw_infix is not None:
+ url = url.replace('.git', '/{0}/{1}/package.xml'.format(repo.raw_infix, release_tag))
+ else:
+ raise Exception('No raw_infix provided for non-github release repo!')
try:
- # URL extension for GitLab/BitBucket repos
- url = url.replace('.git', '/raw/{0}/package.xml'.format(release_tag))
package_xml = urlopen(url).read()
self._package_xmls[rosdistro] = package_xml
self._release_tags[rosdistro] = release_tag |
You want I am not sure if that is even the right place. In that case that many repos share e.g. the same hostname I don't think this |
Ya, I figured as much.
I'm rather unsure about it myself. I'm starting to understand why this issue still exists! @tfoote Do you have any ideas? I cannot think of a good way to generalize this. |
So the decision was to make a file in the |
This won't need a rep, it will be an optional extension point. Not a standard/required interface. I'd suggest using ~/.vcs_api_access Use sections for the url matching
Looking at the github implementation a slight variation that supports multiple remappings might be worth using. In the future API keys could potentially be added to the sections too. |
There's a bit of logic like this in rosinstall_generator as well, for getting repo tarballs. It's based on a very simple "does git URL contain string X heuristic", which was enough for our usage: It'd be cool to have this kind of abstraction is some kind of common dependency, but maintaining such a thing sounds like it'd be a gruelling, thankless task (see some related discussion in #77). |
I will go ahead and close this PR due to the long time of inactivity. Please feel free to comment and if necessary the ticket can be reopened. |
Fix #101, ros/ros-overlay#30
Please stand by while I correct the git history.