summaryrefslogtreecommitdiff
path: root/libre/parabolaweb-utils/helper.sh
blob: 5212571a82c3de4bec46a60f6bd19e7ee82ea35a (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/[<>=].*//'
}