[PATCH] Make ccache use the same directory for repos that are clones

Jonathan Maw jonathan.maw at codethink.co.uk
Thu Jan 3 16:11:07 GMT 2013


On 2013-01-03 15:37, Lars Wirzenius wrote:
> On Thu, Jan 03, 2013 at 03:21:40PM +0000, Jonathan Maw wrote:
>> +        ccache_url = self.artifact.source.repo.url
>> +        ccache_path = urlparse(ccache_url).path
>> +        ccache_repobase = os.path.basename(ccache_path)
>> +        if ':' in ccache_repobase:
>> +            pos = ccache_repobase.find(':')
>> +            ccache_repobase = ccache_repobase[pos+1:]
>
> Instead of parsing for colons in the URL manually, it would be best
> to use the normal Morph routines for expanding an aliased URL into
> its unaliased form. If, after this, the basename of the path 
> component
> of the URL still has a colon, that should be escaped (replaced with
> an underscore).
>
> I thought the CachedRepo.url field was meant to have its alias
> already expanded. Am I wrong about this?

You're right. CachedRepo.url is definitely expanded. In which case, I
have three distinct formats that the url might take:
1. ssh://git@foo.bar/path/ends/with/repo-name
2. file:///workspace/system/branch/alias:repo-name
3. file:///workspace/system/branch/git@foo.bar/path/ends/with/repo-name

I'll be able to use the RepoAliasResolver on the second format.
It might look a bit messy getting the basename, resolving it, then
getting the path then basename, again, but it beats reinventing the
wheel.




More information about the baserock-dev mailing list