On Wed, Jan 16, 2013 at 7:25 PM, Ryan Schmidt <[email protected]> wrote:
>
> On Jan 16, 2013, at 19:04, Sean Farley wrote:
>
>> On Wed, Jan 16, 2013 at 4:17 PM, Ryan Schmidt wrote:
>>>
>>> On Jan 16, 2013, at 14:17, Sean Farley wrote:
>>>
>>>> I think it'll suffice to check for a tarball download + an empty tag
>>>> prefix + len(version) > 12. A hash can be looked up at any length as
>>>> long as it's match is unique, therefore the length of 12 is a soft
>>>> requirement. I didn't pull it out of thin air, though; it's from an
>>>> early version of git / mercurial of making 12 a lower bound until
>>>> better algorithms arose.
>>>
>>> I believe the committish should always be specified in full, with all 40 
>>> characters, to prevent overlap with possible future commits.
>>
>> The problem with this is that some sites (bitbucket) only specify 12
>> characters. I believe 12 is enough to provide uniques prefixes for a
>> SHA1 hash for up to 16^12 commits. My gut reaction is to go for 12 but
>> I don't feel strongly one way or the either.
>
> git hashes are sha1 checksums, which are 40-character strings. Substrings of 
> those might be suitably unique if a project doesn't have terribly many 
> commits, but I'm not a cryptography expert and wouldn't want to chance it. It 
> only takes a few clicks to get the full 40-character hash from github (or 
> presumably from the git command line), and the github portgroup isn't for 
> bitbucket or any other service.

Just a few comments:

- the livecheck can tell you the new commit hash, so not too bad
- 12 characters as a prefix (only the first 12, that is) is unique for
any repository in existence today (even for the linux kernel!)
- the bitbucket portgroup would only be able to show you the first 12
characters of the new commit

but as I said before, it's not a big issue to me so I'll go with 40
for github and 12<=x<=40 for bitbucket.

>>> The check should not include an empty tag prefix; there's no reason why you 
>>> couldn't have a tag prefix, to check if and when a future stable version is 
>>> tagged.
>>
>> Then how would be test the if-statement to determine checking the rss
>> feed or scrapping the tags page?
>
> That... is a good question.
>
> Ok, how's this: there could be a new portgroup option github.livecheck_type 
> which would default to "commits" if github.version matches ^[0-9a-f]{9,}$ and 
> github.tag_prefix is empty, or "tags" otherwise. And livecheck.url and 
> livecheck.regex would be set based on github.livecheck_type. So the default 
> github.livecheck_type would suit most uses, and could still be overridden if 
> necessary.

Sounds good. Though, with the regex you have listed any committish of
length 9 or more would work, so should the portfile check that length
during setup?
_______________________________________________
macports-dev mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo/macports-dev

Reply via email to