diff options
author | Mathieu Arnold <mat@FreeBSD.org> | 2016-05-25 15:58:31 +0000 |
---|---|---|
committer | Mathieu Arnold <mat@FreeBSD.org> | 2016-05-25 15:58:31 +0000 |
commit | 3255095c16f90548b77856b58d165a6c294064aa (patch) | |
tree | 5052979f1050541eeb40b6f4c0aac4514ea77e6b /Mk/Scripts/functions.sh | |
parent | c346ae95de4409e2b5fbf0a2557c520c45bdbce3 (diff) | |
download | ports-3255095c16f90548b77856b58d165a6c294064aa.tar.gz ports-3255095c16f90548b77856b58d165a6c294064aa.zip |
Notes
Diffstat (limited to 'Mk/Scripts/functions.sh')
-rw-r--r-- | Mk/Scripts/functions.sh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Mk/Scripts/functions.sh b/Mk/Scripts/functions.sh index e07919e6e1a4..2df4d37607d5 100644 --- a/Mk/Scripts/functions.sh +++ b/Mk/Scripts/functions.sh @@ -216,3 +216,37 @@ export_ports_env() { fi done } + +distinfo_data() { + local alg file + + alg=$1 + file=$2 + + if [ \( -n "${dp_DISABLE_SIZE}" -a -n "${dp_NO_CHECKSUM}" \) -o ! -f "${dp_DISTINFO_FILE}" ]; then + exit + fi + awk -v alg="$alg" -v file="${file}" \ + '$1 == alg && $2 == "(" file ")" {print $4}' "${dp_DISTINFO_FILE}" +} + +check_checksum_algorithms() { + for alg in ${dp_CHECKSUM_ALGORITHMS}; do + eval "alg_executable=\$dp_$alg" + if [ -z "$alg_executable" ]; then + ${dp_ECHO_MSG} "Checksum algorithm $alg: Couldn't find the executable." + ${dp_ECHO_MSG} "Set $alg=/path/to/$alg in /etc/make.conf and try again." + exit 1 + elif [ ! -x "$alg_executable" ]; then + ${dp_ECHO_MSG} "Checksum algorithm $alg: $alg_executable is not executable." + ${dp_ECHO_MSG} "Fix modes, or change $alg=$alg_executable in /etc/make.conf and try again." + exit 1 + fi + done +} +escape() { + echo "$1" | sed -e 's/[&;()!#]/\\&/g' +} +unescape() { + echo "$1" | sed -e 's/\\//g' +} |