Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Jul 2010 12:17:31 +0200
From:      Emanuel Haupt <ehaupt@FreeBSD.org>
To:        ports@FreeBSD.org
Subject:   MASTER_SITE defined by google search result
Message-ID:  <20100722121731.34b47a2a.ehaupt@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
Usually when I find that a port can't fetch the according distfile I
simply google for the distfile with the following search string (e.g.
for rsync):

	intitle:"index of" rsync-3.0.7.tar.gz

This approach almost always delivers plenty of results. I then manually
download one of the results into my DISTDIR and restart the normal
build process which then automatically takes care of the integrity
(checksum, size) of the distfile(s).

I thought, why not automate this and I came up with a simple perl
script (requires www/p5-Google-Search):

http://people.freebsd.org/~ehaupt/distfile-search/distfile-search

Adding the following make magic to /etc/make.conf

# distfile search
.if defined(DISTFILE_SEARCH_BACKUP)
pre-fetch-script:
MASTER_SITE_BACKUP+=    `/root/bin/distfile-search ${ALLFILES}`
.elif defined(DISTFILE_SEARCH_OVERRIDE)
pre-fetch-script:
MASTER_SITE_OVERRIDE=   `/root/bin/distfile-search ${ALLFILES}`
.endif

will let you choose whether you want to overwrite the pre defined
MASTER_SITES:

root@foo: /usr/ports/x11/xorg/ $ make -DDISTFILE_SEARCH_OVERRIDE fetch

or add the search result as backup MASTER_SITES:

root@foo: /usr/ports/x11/xorg/ $ make -DDISTFILE_SEARCH_BACKUP fetch

In the later example you even might want to define
DISTFILE_SEARCH_BACKUP globally.

As a proof of concept I was able to download all distfiles for x11/xorg
with this method (make -DDISTFILE_SEARCH_OVERRIDE fetch-recursive).

Please let me know what you think.

Emanuel



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100722121731.34b47a2a.ehaupt>