On Oct 19, 2011, at 23:17, Jeremy Lavergne wrote:

>> liblo: rewrite master_sites to avoid redirects
> 
> As you may have guessed, no one else if even looking for these.

Joshua is doing them too sometimes. But now he's rather busy with licenses and 
other buildbot errors; rewriting master_sites is a small optimization at best 
and so isn't really that important probably. I just do them when I notice them.


> I think it might be to our benefit to post such things to lint, if possible. 
> Obviously, not just this master_sites issue.
> Let me know if you want what you're doing added to lint (rather familiar with 
> it now). I've also been drinking a bit. :-) a bit much. but really, this is 
> the sort of thing link warning (not error) would be perfect for.

I'm hesitant, because "lint" is usually defined as a function that checks the 
syntax of a file.

http://en.wikipedia.org/wiki/Lint_(software)

I wouldn't really want "lint" to go and open network connections to see if 
there's an HTTP redirect.

I suppose you could check if a master_sites entry is written as "sourceforge" 
or "sourceforge:name" or "sourceforge:name:tag" and warn in that case. Most 
sourceforge projects store their files in directories on the server, and so 
these constructs would be non-optimal and cause a redirect, and the should be 
rewritten as "sourceforge:project/some/path/..." The test would probably be 
"starts with 'sourceforge' and doesn't contain a slash". But there are some 
ports for which that's not actually an error; some (very small number, I think) 
of projects actually do store their files in a flat structure. But even for 
those they could use expanded "project/" form sed to avoid the warning.



Here's an excerpt from my ~/.bashrc I'm using:


port() {
        unset PORT
        if [ -z "$2" ]; then
                if [ -f "$PWD/Portfile" ]; then
                        PORT=$(basename "$PWD")
                fi
        else
                PORT="$2"
        fi
        
        case "$1" in
                distfix)
                        DL="$(command port distfiles ${PORT} | awk 
'/downloads.sourceforge.net/ {print $1}')"
                        if [ -z "$DL" ]; then return; fi
                        DL2="$(curl -s -I -L "$DL" | awk '/^Location:/ {print 
$2}' | tail -n 1)"
                        if [ -z "$DL2" ]; then return; fi
                        V="$(port info --version --line ${PORT})"
                        B="$(echo "$V" | cut -d . -f 1-2)"
                        P="$(dirname "$(echo $DL2 | cut -d / -f 4-)" | sed -E 
-e "s,$V,\${version}," -e "s,$B,\${branch},")"
                        echo sourceforge:$P
                        ;;
        esac
}



_______________________________________________
macports-dev mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macports-dev

Reply via email to