Script to automate offline retrieval of distfiles etc, for internet challenged machines

Ryan Schmidt ryandesign at macports.org
Mon Mar 22 02:20:16 PDT 2010


On Mar 21, 2010, at 22:47, Dixon, Stephen wrote:

> Hi everyone, first post...
> 
> I've been trying for a while to get the IT department at work to open up port 873 so that macports could work there, but to no avail. Then I saw a post on the mailing list that explained how to collect the distfiles and other stuff needed to run macports without an internet connection.
> 
> http://lists.macosforge.org/pipermail/macports-users/2009-January/013619.html
> 
> The problem with that process was if the package you wanted to install had a big dependency tree you had to repeat it many times untill you'd got all the dependencies.
> 
> So I've written an applescript that recursively looks through a package's dependencies and downloads them for easy copying to the non-internet connected machine. It's available here
> http://stib.posterous.com/
> Let me know if you have any comments or suggestions. I'm merely a hacker with no formal training, so sometimes my code can be a little rough and ready.

I haven't looked at your script yet, but wanted to point out we already have a script that recursively finds dependencies: port-rdeps:

http://svn.macports.org/repository/macports/contrib/port-rdeps/

Nobody has made a port for it yet, however, so you have to install it manually.

Here's an example of running the script on fontconfig:


$ port-rdeps -r fontconfig
Dependencies of fontconfig:
  libiconv
    gperf
  expat
  freetype
    zlib


Here's how you could use it to fetch all needed distfiles recursively:


$ port-rdeps -r fontconfig | sed 1d | xargs sudo port fetch
Password:
--->  Computing dependencies for libiconv
--->  Fetching libiconv
--->  Computing dependencies for gperf
--->  Fetching gperf
--->  Computing dependencies for expat
--->  Fetching expat
--->  Computing dependencies for freetype
--->  Fetching freetype
--->  Computing dependencies for zlib
--->  Fetching zlib


(It doesn't show anything being fetched in my case because everything is already fetched on my system.)

The distfiles will of course then be in the standard location, which you can open in the Finder for example using:

open /opt/local/var/macports/distfiles




More information about the macports-users mailing list