git installation on osx 10.4.11 - fetch failures

I recently ran into trouble installing the Macports git-core on my Powerbook G4 with OS X version 10.4.11, so I followed the instructions at http://forums.macnn.com/82/applications/368517/macports-fixing-fetch-failed-manual-download/ to get started.

Since I found that each git-core dependency failed due to fetch errors, I decided to override that behavior, as described at http://guide.macports.org/#development.examples.eliminate.

Basically, it is a simple 3 step process to follow:

  1. Attempt to install the port
  2. Manually download the source file that could not be fetched
  3. Edit the Portfile and start the process again
===============================================================

Here's exactly how I did it...

1. Attempt to install the port

Here I am attempting to install the git-core port, but it fails on rsync:

chip-castles-powerbook-g4-17:/opt/local/var/macports/sources/rsync.macports.org/release/ports/devel/popt deploy$ sudo port install git-core
Portfile changed since last build; discarding previous state.
---> Fetching rsync
---> Attempting to fetch rsync-3.0.4.tar.gz from http://rsync.samba.org/ftp/rsync/
---> Attempting to fetch rsync-3.0.4.tar.gz from http://rsync.samba.org/ftp/rsync/src/
---> Attempting to fetch rsync-3.0.4.tar.gz from http://svn.macports.org/repository/macports/distfiles/rsync
---> Attempting to fetch rsync-3.0.4.tar.gz from http://svn.macports.org/repository/macports/distfiles/general/
---> Attempting to fetch rsync-3.0.4.tar.gz from http://svn.macports.org/repository/macports/downloads/rsync
Error: Target org.macports.fetch returned: fetch failed
Error: The following dependencies failed to build: rsync
Error: Status 1 encountered during processing.


2. Manually download the source file that could not be fetched

Based on the errors above, I pointed my web browser to http://rsync.samba.org/ftp/rsync/ and downloaded rsync-3.0.4.tar.gz.

Since it downloaded to ~/Desktop, I had to copy it to the appropriate location, which in my case was under:

/opt/local/var/macports/distfiles/
More specifically, I did this:

sudo cp ~/Desktop/rsync-3.0.4.tar.gz /opt/local/var/macports/distfiles/rsync/

As a precautionary measure, it is best to run md5 against the downloaded file to be sure that it matches the checksum listed in the Portfile.

3. Edit the Portfile and start the process again

Now I need to find the Portfile. It varies for each dependency, but on my laptop I always use this as a base directory:

/opt/local/var/macports/sources/rsync.macports.org/release/ports/
However, each dependency is not always neatly under this directory, as in the case of rsync, so I had to do a little searching, as follows:

chip-castles-powerbook-g4-17:/opt/local/var/macports/sources/rsync.macports.org/release/ports deploy$ find . -name "rsync*"

./net/rsync
./net/rsync/files/rsyncd.conf.example
./net/rsync-devel
./net/rsync-lart
So I cd into net/rsync and edit the Portfile by adding a "fetch {}" directive to override this stage in the port installation process. I found that it worked successfully when I put it as the first option with braces, generally found after the initial variables are set. In this example, it is between config.cflags and pre-configure directives.

Here's my rsync Portfile:

# $Id: Portfile 39822 2008-09-06 22:37:30Z simon@macports.org $

PortSystem 1.0

name rsync
version 3.0.4
categories net
platforms darwin freebsd sunos
maintainers simon openmaintainer
description Tool that provides fast incremental file transfer.
long_description rsync is an open source utility that provides fast \
incremental file transfer. rsync is freely available \
under the GNU General Public License and is currently \
being maintained by Wayne Davison. \
\
Rsync version 3.0.4 has been released. This is a \
bug-fix release. Related pages: \
http://rsync.samba.org/ftp/rsync/rsync-${version}-NEWS

homepage http://samba.org/rsync/
master_sites http://rsync.samba.org/ftp/rsync/ \
http://rsync.samba.org/ftp/rsync/src/
checksums ${distname}${extract.suffix} \
md5 2b2d159c9bd1b5f8adfd8b13da3a1f3f \
sha1 e89ed8d84fe0b6740208ba8183ee1dbc220ba5e5 \
rmd160 5e0082c7751205e16431471bdc5f48f87ae26b1a
distname rsync-${version}

depends_lib port:popt port:libiconv

patchfiles patch-fileflags.diff \
patch-crtimes.diff
patch.pre_args -p1

configure.args --mandir=${prefix}/share/man \
--with-rsyncd-conf=${prefix}/etc/rsyncd.conf \
--enable-ipv6 \
--enable-xattr-support
configure.cflags "-Os -I${prefix}/include"

fetch {}

pre-configure {
system "cd ${worksrcpath}; ./prepare-source"
}

post-destroot {
xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
xinstall -m 644 -W ${worksrcpath} \
COPYING INSTALL NEWS OLDNEWS TODO README doc/README-SGML \
doc/profile.txt doc/rsync.sgml \
${destroot}${prefix}/share/doc/${name}
}

platform darwin 7 {
configure.args-delete --enable-xattr-support
configure.args-append --disable-acl-support --disable-xattr-support
}

livecheck.check regex
livecheck.regex "Rsync version (\\d+(?:\\.\\d+)*) released"

variant no_macosx_metadata description {Don't preserve Mac OS X file \
flags and creation times} {
patchfiles-delete fileflags.diff \
crtimes.diff
}

variant rsyncd description {Installs rsyncd.conf and a StartupItem for rsyncd} {
post-destroot {
xinstall -m 644 ${filespath}/rsyncd.conf.example \
${destroot}${prefix}/etc/rsyncd.conf.example
reinplace "s|__PREFIX__|${prefix}|g" \
${destroot}${prefix}/etc/rsyncd.conf.example
}

post-install {
ui_msg "****************************************************************"
ui_msg "* *"
ui_msg "* To use the rsyncd server you must rename *"
ui_msg "* ${prefix}/etc/rsyncd.conf.example to rsyncd.conf and add *"
ui_msg "* your modules there. See 'man rsyncd.conf' for more *"
ui_msg "* information. *"
ui_msg "* *"
ui_msg "****************************************************************"
}

startupitem.create yes
startupitem.name rsyncd
startupitem.logfile ${prefix}/var/log/rsyncd.log
startupitem.start "${prefix}/bin/rsync --daemon --config=${prefix}/etc/rsyncd.conf"
startupitem.stop "kill `cat ${prefix}/var/run/rsyncd.pid`"
startupitem.pidfile auto ${prefix}/var/run/rsyncd.pid
}

==================================

Basically, I repeat this process for each fetch failure. For git-core, there were a good number of them. Off the top of my head: curl, expat, gettext, ncurses, openssh, perl5.10, perl5.8, pkgconfig, popt.

There were probably others, but I think you get the idea.

HTH/chip