Blacklisting compiler versions or build numbers

Ryan Schmidt ryandesign at macports.org
Sun Nov 25 22:55:00 PST 2012


On Nov 25, 2012, at 20:11, Jeremy Huddleston Sequoia <jeremyhu at macports.org> wrote:

> for the parsing is essentially:
> if is-list(l):
>    if matches_all_versions(car(l), cdr(l))
>        refuse_compiler(l)
> else
>    refuse_compiler(l)
> 
> matches_all_versions(c, vl):
>    if is_empty_list(vl):
>        return true
>    if version_matches(c, car(vl), cadr(vl)):
>        return matches_all_versions(c, cddr(vl))
>    return false

This pseudocode was hard for me to read because I was not familiar with the lisp- and scheme-style functions used, so for anyone else having a hard time, I'll annotate what I think is meant:


> if is-list(l):

"l" would be the entry in compiler.blacklist to check, like "clang" or {clang < 444} or {clang >= 400 < 444}. The first of these examples is not a list and so would not proceed past this line, while the other two are.

>    if matches_all_versions(car(l), cdr(l))

"car" means "item 1 of the list" (the compiler name, e.g. "clang")
"cdr" means "items 2 through end of the list" (e.g. {< 444} or {>= 400 < 444})

So this function call might look like "matches_all_versions("clang", {< 444})" or "matches_all_versions("clang", {>= 400 < 444})"

http://www.cs.utexas.edu/ftp/garbage/cs345/schintro-v14/schintro_105.html#SEC117

http://en.wikipedia.org/wiki/CAR%5Fand%5FCDR

>        refuse_compiler(l)
> else
>    refuse_compiler(l)
> 
> matches_all_versions(c, vl):

"c" will be the name of the compiler
"vl" will be the list of versions (build numbers) to check

>    if is_empty_list(vl):
>        return true
>    if version_matches(c, car(vl), cadr(vl)):

"car" still means "item 1 of the list"
"cadr" means "item 2 of the list"

So this function call might look like "version_matches("clang", "<", "444")" or "version_matches("clang", ">=", "400")"

version_matches would be our existing vercmp function, called differently.

>        return matches_all_versions(c, cddr(vl))

"cddr" means "items 3 through end of the list"

So in the first example, this function call would be "matches_all_versions("clang", {})" (which will return true from the is_empty_list(vl) test above)

In the second example, it would be "matches_all_versions("clang", {< 444})" and go through the tests again with these new values.

>    return false




More information about the macports-dev mailing list