Using a password-protected mirror

Ryan Schmidt ryandesign at macports.org
Sat Jan 10 19:00:23 PST 2009


Is there a way to use a password-protected mirror with MacPorts?


See, I've enjoyed using the new MacPorts 1.7.0 feature where you can  
easily add mirrors by editing dports/_resources/port1.0/fetch/ 
mirror_sites.tcl. I've set up each of the machines on my local  
network to make their distfiles available via http and have added  
their URLs to the file like this:


set portfetch::mirror_sites::sites(macports_distfiles) {
     http://machine1.local/distfiles/:mirror
     http://machine2.local/distfiles/:mirror
     http://distfiles.macports.org/:mirror
...


This works great: now if any of my machines already has the distfile  
downloaded, it'll get pulled from there instead of from the Internet.  
Neat.

But now I'd like to password-protect my servers. I've set up HTTP  
basic authentication and tried changing the mirror entries like this:


set portfetch::mirror_sites::sites(macports_distfiles) {
     http://username:password@machine1.local/distfiles/:mirror
     http://username:password@machine2.local/distfiles/:mirror
     http://distfiles.macports.org/:mirror
...


But this doesn't work.


--->  Fetching clex
DEBUG: Executing org.macports.fetch (clex)
--->  clex-4.0.tar.gz doesn't seem to exist in /mp/var/macports/ 
distfiles/clex
DEBUG: Pinging www.clex.sk...
DEBUG: Pinging usernameclex...
DEBUG: Pinging distfiles.macports.org...
DEBUG: Pinging trd.no.distfiles.macports.org...
DEBUG: Pinging arn.se.distfiles.macports.org...
DEBUG: www.clex.sk ping time is 164.769
DEBUG: usernameclex ping time is 55.002
DEBUG: distfiles.macports.org ping time is 63.104
DEBUG: trd.no.distfiles.macports.org ping time is 185.866
DEBUG: arn.se.distfiles.macports.org ping time is 169.125


See, it cut the URL at the colon after the username, and seems to  
have inserted the port name instead.


--->  Attempting to fetch clex-4.0.tar.gz from http://usernameclex
   % Total    % Received % Xferd  Average Speed   Time    Time      
Time  Current
                                  Dload  Upload   Total   Spent     
Left  Speed
21450   256  21450 42982    0     0  42783      0 --:--:--  0:00:01  
--:--:-- 42783
$ port checksum
--->  Verifying checksum(s) for clex
Error: Checksum (md5) mismatch for clex-4.0.tar.gz
Error: Checksum (sha1) mismatch for clex-4.0.tar.gz
Error: Checksum (rmd160) mismatch for clex-4.0.tar.gz
Error: Target org.macports.checksum returned: Unable to verify file  
checksums
Error: Status 1 encountered during processing.


And because my ISP has provided me with one of those wonderful DNS  
servers that can never say no, attempting to download from this  
nonexistent URL in fact succeeds with a 200 status code and gives me  
some awful search results page that I never wanted, so the checksums  
fail.

Sorry for that rant, I just hate those kinds of DNS servers so much.





More information about the macports-dev mailing list