summaryrefslogtreecommitdiff
path: root/libre/parabolaweb-utils/helper.sh
blob: ce8638e7e20238a0fe62727f597836552ca38d68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
_mksource() {
	pushd "${startdir:-.}" >/dev/null
	if [[ -z $_DO_NOT_RUN_MKSOURCE && $0 =~ ^makepkg ]]; then
		local flags=(-o)
		(( EUID )) || flags+=(--asroot)
		_DO_NOT_RUN_MKSOURCE=true "${0}" "${flags[@]}"
	fi
	popd >/dev/null
}

_get_depends() {
	_mksource 1>&2
	if [[ -f "${srcdir:-${startdir:-.}/src}/parabolaweb/requirements_prod.txt" ]]; then
		pushd "${srcdir:-src}" >/dev/null
		< parabolaweb/requirements_prod.txt sed -r \
			-e 's/.*/\L&/' -e 's/==/>=/' \
			-e 's/^(python2?-)?/python2-/' \
			-e 's/python2-django/django/'
		popd >/dev/null
	fi
}

_get_depends_nover() {
	_get_depends | sed 's/[<>=].*//'
}