aboutsummaryrefslogtreecommitdiffstats
path: root/Mk
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2014-12-25 09:12:46 +0800
committerBaptiste Daroussin <bapt@FreeBSD.org>2014-12-25 09:12:46 +0800
commit1540367eb61a0e8031a75eddb243c797d207809c (patch)
tree0fafdce54ea280add8877665533f9d8d7d124846 /Mk
parentfc3d3dcbe9f807dfe05a49b74a28adcfcc5ba42c (diff)
downloadfreebsd-ports-gnome-1540367eb61a0e8031a75eddb243c797d207809c.tar.gz
freebsd-ports-gnome-1540367eb61a0e8031a75eddb243c797d207809c.tar.zst
freebsd-ports-gnome-1540367eb61a0e8031a75eddb243c797d207809c.zip
Allow PATCH_SITES to use the same abbreviations as MASTER_SITES
Differential Revision: https://reviews.freebsd.org/D1362
Diffstat (limited to 'Mk')
-rw-r--r--Mk/bsd.sites.mk41
1 files changed, 41 insertions, 0 deletions
diff --git a/Mk/bsd.sites.mk b/Mk/bsd.sites.mk
index e6fd7d54ad38..012e5a7a81c1 100644
--- a/Mk/bsd.sites.mk
+++ b/Mk/bsd.sites.mk
@@ -1580,3 +1580,44 @@ MASTER_SITES_EXP:= ${MASTER_SITES_EXP}
MASTER_SITES= ${MASTER_SITES_EXP}
.endif
+
+.if defined(PATCH_SITES) && ${PATCH_SITES:N*\:/*}
+
+.for _site__ in ${PATCH_SITES}
+_site_=${_site__}
+. if ${_site_:M*\:/*}
+PATCH_SITES_EXP+= ${_site_}
+PATCH_SITES_EXP:= ${PATCH_SITES_EXP}
+. else
+_site_urlpath_= ${_site_:C@^(.*):[^/:]+$@\1@}
+. if ${_site_urlpath_:M*/*}
+_site_url_= ${_site_urlpath_:C@^([^/]+)/.*$@\1@}
+_site_subdir_= ${_site_urlpath_:S/^${_site_urlpath_:C@^([^/]+)/.*$@\1@}//:S!^/!!:S!/$!!}
+. else
+_site_url_= ${_site_urlpath_}
+.undef _site_subdir_
+. endif
+_site_group_= ${_site_:S/^${_site_:C@^(.*):[^/:]+$@\1@}//:S/^://}
+. for _abbrev_ in ${MASTER_SITES_ABBREVS}
+. if ${_site_url_} == ${_abbrev_:C/:.*//}
+_site_url_= ${_abbrev_:C/.*://}
+. endif
+. endfor
+. for _subdir_ in ${MASTER_SITES_SUBDIRS}
+. if ${_site_url_} == ${_subdir_:C/:.*//} && !defined(MASTER_SITE_SUBDIR)
+_site_subdir_?= ${_subdir_:C/.*://}
+. endif
+. endfor
+. ifdef MASTER_SITE_${_site_url_}
+. ifdef _site_subdir_
+PATCH_SITES_EXP+= ${MASTER_SITE_${_site_url_}:S^%SUBDIR%^${_site_subdir_}^:S/$/:${_site_group_}/:S/:$//}
+. else
+PATCH_SITES_EXP+= ${MASTER_SITE_${_site_url_}:S/$/:${_site_group_}/:S/:$//}
+. endif
+PATCH_SITES_EXP:= ${PATCH_SITES_EXP}
+. endif
+. endif
+.endfor
+PATCH_SITES= ${PATCH_SITES_EXP}
+
+.endif