MASTER_SITE defined by google search result

Emanuel Haupt ehaupt at FreeBSD.org
Thu Jul 22 10:17:35 UTC 2010


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 at foo: /usr/ports/x11/xorg/ $ make -DDISTFILE_SEARCH_OVERRIDE fetch

or add the search result as backup MASTER_SITES:

root at 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


More information about the freebsd-ports mailing list