diff options
author | mat <mat@FreeBSD.org> | 2016-06-19 19:24:39 +0800 |
---|---|---|
committer | mat <mat@FreeBSD.org> | 2016-06-19 19:24:39 +0800 |
commit | f3b7bc909dad478923eeefb92fdf5d952ed43b7b (patch) | |
tree | 2119ad3c5dc38ce59e8f59da0fd501f1074f28b4 /Mk | |
parent | 70fe9e15a6b271cfa7029c19a4d22cfc3b371110 (diff) | |
download | freebsd-ports-gnome-f3b7bc909dad478923eeefb92fdf5d952ed43b7b.tar.gz freebsd-ports-gnome-f3b7bc909dad478923eeefb92fdf5d952ed43b7b.tar.zst freebsd-ports-gnome-f3b7bc909dad478923eeefb92fdf5d952ed43b7b.zip |
Simplify do-fetch, and remove now unused code.
Turns out that the DEFAULT, and other groups sites were handled in
a different way, ending up having the same code twice, but in
slightly different places.
PR: 210198
Submitted by: mat
Exp-run by: antoine
Sponsored by: The FreeBSD Foundation, Absolight
Differential Revision: https://reviews.freebsd.org/D6779
Diffstat (limited to 'Mk')
-rw-r--r-- | Mk/Scripts/do-fetch.sh | 68 | ||||
-rw-r--r-- | Mk/bsd.port.mk | 60 |
2 files changed, 29 insertions, 99 deletions
diff --git a/Mk/Scripts/do-fetch.sh b/Mk/Scripts/do-fetch.sh index fb8e2d3621f8..ca28c86af120 100644 --- a/Mk/Scripts/do-fetch.sh +++ b/Mk/Scripts/do-fetch.sh @@ -11,9 +11,7 @@ validate_env dp_DEVELOPER dp_DISABLE_SIZE dp_DISTDIR dp_DISTINFO_FILE \ dp_DIST_SUBDIR dp_ECHO_MSG dp_FETCH_AFTER_ARGS dp_FETCH_BEFORE_ARGS \ dp_FETCH_CMD dp_FETCH_ENV dp_FORCE_FETCH_ALL dp_FORCE_FETCH_LIST \ dp_MASTER_SITE_BACKUP dp_MASTER_SITE_OVERRIDE dp_MASTER_SORT_AWK \ - dp_NO_CHECKSUM dp_RANDOMIZE_SITES dp_SITE_FLAVOR dp_SCRIPTSDIR \ - dp_SORTED_MASTER_SITES_DEFAULT_CMD dp_SORTED_PATCH_SITES_DEFAULT_CMD \ - dp_TARGET + dp_NO_CHECKSUM dp_RANDOMIZE_SITES dp_SITE_FLAVOR dp_TARGET [ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_DO_FETCH}" ] && set -x @@ -28,7 +26,7 @@ for _file in "${@}"; do # If this files has groups if [ "$_file" = "$file" ]; then - select='' + select=DEFAULT else select=$(echo "${_file##*:}" | sed -e 's/,/ /g') fi @@ -71,44 +69,34 @@ for _file in "${@}"; do fi ;; esac - if [ -n "$select" ] ; then - __MASTER_SITES_TMP= - for group in $select; do - # Disable nounset for this, it may come up empty. - set +u - eval ___MASTER_SITES_TMP="\${_${dp_SITE_FLAVOR}_SITES_${group}}" - set -u - if [ -n "${___MASTER_SITES_TMP}" ] ; then - __MASTER_SITES_TMP="${__MASTER_SITES_TMP} ${___MASTER_SITES_TMP}" - else - case ${dp_TARGET} in - do-fetch|makesum) - if [ -n "${dp_DEVELOPER}" ]; then - ${dp_ECHO_MSG} "===> /!\\ Error /!\\" - else - ${dp_ECHO_MSG} "===> /!\\ Warning /!\\" - fi - ${dp_ECHO_MSG} " The :${group} group used for $file is missing" - ${dp_ECHO_MSG} " from ${dp_SITE_FLAVOR}_SITES. Check for typos, or errors." - if [ -n "${dp_DEVELOPER}" ]; then - exit 1 - fi - ;; - esac - - fi - done - ___MASTER_SITES_TMP= - SORTED_MASTER_SITES_CMD_TMP="echo ${dp_MASTER_SITE_OVERRIDE} $(echo -n "${__MASTER_SITES_TMP}" | awk "${dp_MASTER_SORT_AWK}") ${dp_MASTER_SITE_BACKUP}" - else - if [ ${dp_SITE_FLAVOR} = "MASTER" ]; then - SORTED_MASTER_SITES_CMD_TMP="${dp_SORTED_MASTER_SITES_DEFAULT_CMD}" + __MASTER_SITES_TMP= + for group in $select; do + # Disable nounset for this, it may come up empty. + set +u + eval ___MASTER_SITES_TMP="\${_${dp_SITE_FLAVOR}_SITES_${group}}" + set -u + if [ -n "${___MASTER_SITES_TMP}" ] ; then + __MASTER_SITES_TMP="${__MASTER_SITES_TMP} ${___MASTER_SITES_TMP}" else - SORTED_MASTER_SITES_CMD_TMP="${dp_SORTED_PATCH_SITES_DEFAULT_CMD}" + case ${dp_TARGET} in + do-fetch|makesum) + if [ -n "${dp_DEVELOPER}" ]; then + ${dp_ECHO_MSG} "===> /!\\ Error /!\\" + else + ${dp_ECHO_MSG} "===> /!\\ Warning /!\\" + fi + ${dp_ECHO_MSG} " The :${group} group used for $file is missing" + ${dp_ECHO_MSG} " from ${dp_SITE_FLAVOR}_SITES. Check for typos, or errors." + if [ -n "${dp_DEVELOPER}" ]; then + exit 1 + fi + ;; + esac + fi - # Having this set when the next eval runs creates double entries. - unset _${dp_SITE_FLAVOR}_SITES_DEFAULT - fi + done + ___MASTER_SITES_TMP= + SORTED_MASTER_SITES_CMD_TMP="echo ${dp_MASTER_SITE_OVERRIDE} $(echo -n "${__MASTER_SITES_TMP}" | awk "${dp_MASTER_SORT_AWK}") ${dp_MASTER_SITE_BACKUP}" case ${dp_TARGET} in fetch-list) echo -n "mkdir -p ${dp_DISTDIR} && " diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk index 04dcfe4d9b26..a764db1b06bc 100644 --- a/Mk/bsd.port.mk +++ b/Mk/bsd.port.mk @@ -2468,47 +2468,6 @@ MASTER_SORT_AWK+= /${srt:S|/|\\/|g}/ { good["${srt:S|\\|\\\\|g}"] = good["${srt: .endfor MASTER_SORT_AWK+= { rest = rest " " $$0; } END { n=split(gl, gla); for(i=1;i<=n;i++) { print good[gla[i]]; } print rest; } -SORTED_MASTER_SITES_DEFAULT_CMD= cd ${.CURDIR} && ${MAKE} master-sites-DEFAULT -SORTED_PATCH_SITES_DEFAULT_CMD= cd ${.CURDIR} && ${MAKE} patch-sites-DEFAULT -SORTED_MASTER_SITES_ALL_CMD= cd ${.CURDIR} && ${MAKE} master-sites-ALL -SORTED_PATCH_SITES_ALL_CMD= cd ${.CURDIR} && ${MAKE} patch-sites-ALL - -# has similar effect to old targets, i.e., access only {MASTER,PATCH}_SITES, not working with the new _n variables -master-sites-DEFAULT: - @${ECHO_CMD} ${_MASTER_SITE_OVERRIDE} `${ECHO_CMD} '${_MASTER_SITES_DEFAULT}' | ${AWK} '${MASTER_SORT_AWK:S|\\|\\\\|g}'` ${_MASTER_SITE_BACKUP} -patch-sites-DEFAULT: - @${ECHO_CMD} ${_MASTER_SITE_OVERRIDE} `${ECHO_CMD} '${_PATCH_SITES_DEFAULT}' | ${AWK} '${MASTER_SORT_AWK:S|\\|\\\\|g}'` ${_MASTER_SITE_BACKUP} - -# -# Sort the master site list according to the patterns in MASTER_SORT -# according to grouping rules (:something) -# -# for use in the fetch targets -.for _S in ${MASTER_SITES} -_S_TEMP= ${_S:S/^${_S:C@/:[^/:]+$@/@}//} -. if !empty(_S_TEMP) -. for _group in ${_S_TEMP:S/^://:S/,/ /g} -. if !target(master-sites-${_group}) -SORTED_MASTER_SITES_${_group}_CMD= cd ${.CURDIR} && ${MAKE} master-sites-${_group} -master-sites-${_group}: - @${ECHO_CMD} ${_MASTER_SITE_OVERRIDE} `${ECHO_CMD} '${_MASTER_SITES_${_group}}' | ${AWK} '${MASTER_SORT_AWK:S|\\|\\\\|g}'` ${_MASTER_SITE_BACKUP} -. endif -. endfor -. endif -.endfor -.for _S in ${PATCH_SITES} -_S_TEMP= ${_S:S/^${_S:C@/:[^/:]+$@/@}//} -. if !empty(_S_TEMP) -. for _group in ${_S_TEMP:S/^://:S/,/ /g} -. if !target(patch-sites-${_group}) -SORTED_PATCH_SITES_${_group}_CMD= cd ${.CURDIR} && ${MAKE} patch-sites-${_group} -patch-sites-${_group}: - @${ECHO_CMD} ${_MASTER_SITE_OVERRIDE} `${ECHO_CMD} '${_PATCH_SITES_${_group}}' | ${AWK} '${MASTER_SORT_AWK:S|\\|\\\\|g}'` ${_MASTER_SITE_BACKUP} -. endif -. endfor -. endif -.endfor - # # Hackery to enable simple fetch targets with several dynamic MASTER_SITES # @@ -2535,21 +2494,6 @@ _PATCH_SITES_ENV+= _PATCH_SITES_${_group}="${_PATCH_SITES_${_group}}" . endif .endfor -master-sites-ALL: - @${ECHO_CMD} ${_MASTER_SITE_OVERRIDE} `${ECHO_CMD} '${_MASTER_SITES_ALL}' | ${AWK} '${MASTER_SORT_AWK:S|\\|\\\\|g}'` ${_MASTER_SITE_BACKUP} -patch-sites-ALL: - @${ECHO_CMD} ${_MASTER_SITE_OVERRIDE} `${ECHO_CMD} '${_PATCH_SITES_ALL}' | ${AWK} '${MASTER_SORT_AWK:S|\\|\\\\|g}'` ${_MASTER_SITE_BACKUP} - -# synonyms, mnemonics -master-sites-all: master-sites-ALL -patch-sites-all: patch-sites-ALL -master-sites-default: master-sites-DEFAULT -patch-sites-default: patch-sites-DEFAULT - -# compatibility with old behavior -master-sites: master-sites-DEFAULT -patch-sites: patch-sites-DEFAULT - CKSUMFILES= ${ALLFILES} # List of all files, with ${DIST_SUBDIR} in front. Used for checksum. @@ -3021,7 +2965,7 @@ options-message: @${ECHO_MSG} "===> Found saved configuration for ${_OPTIONS_READ}" .endif -${PKG_DBDIR} ${PREFIX} ${WRKDIR} ${EXTRACT_WRKDIR} ${WRKSRC}: +${PKG_DBDIR} ${PREFIX} ${WRKDIR} ${EXTRACT_WRKDIR}: @${MKDIR} ${.TARGET} # Warn user about deprecated packages. Advisory only. @@ -3094,8 +3038,6 @@ _DO_FETCH_ENV= \ dp_NO_CHECKSUM='${NO_CHECKSUM}' \ dp_RANDOMIZE_SITES='${_RANDOMIZE_SITES}' \ dp_SCRIPTSDIR='${SCRIPTSDIR}' \ - dp_SORTED_MASTER_SITES_DEFAULT_CMD='${SORTED_MASTER_SITES_DEFAULT_CMD}' \ - dp_SORTED_PATCH_SITES_DEFAULT_CMD='${SORTED_PATCH_SITES_DEFAULT_CMD}' \ dp_TARGET='${.TARGET}' .if defined(DEVELOPER) _DO_FETCH_ENV+= dp_DEVELOPER=yes |