MASTER_SITE defined by google search result

Chip Camden sterling at camdensoftware.com
Thu Jul 22 16:33:28 UTC 2010


Quoth Emanuel Haupt on Thursday, 22 July 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

Pretty cool!  Of course, if DISTFILE_SEARCH_BACKUP is defined, make will
always execute a search even if it isn't needed -- but it appears to be
fast so perhaps that isn't a problem.

-- 
Sterling (Chip) Camden    | sterling at camdensoftware.com | 2048D/3A978E4F
http://camdensoftware.com | http://chipstips.com        | http://chipsquips.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20100722/842872b5/attachment.pgp


More information about the freebsd-ports mailing list