summaryrefslogtreecommitdiff
path: root/libre/parabolaweb-utils/helper.sh
blob: d00f83f7f405b7633d0667cd05a1af2e424d8a13 (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
26
27
28
29
30
31
32
33
34
35
36
37
_mksource() {
	if [[ -z _DO_NOT_RUN_MKSOURCE ]]; then
		_DO_NOT_RUN_MKSOURCE=true makepkg -o
	fi
}

_get_pkgver() {
	if [[ -n $pkgver ]] && [[ $pkgver != 0.bogus ]]; then
		echo $pkgver
	else
		_mksource 1>&2
		if [[ -f "${srcdir:-src}/parabolaweb/requirements_prod.txt" ]]; then
			pushd "${srcdir:-src}/parabolaweb" >/dev/null
			# get the date requirements_prod.txt was last modified 
			gitdate="$(git log -n1 --date=iso --format=format:'%cd' ./requirements_prod.txt)"
			date -u +%Y%m%d.%H%M -d "$gitdate"
			popd >/dev/null
		else
			echo 0.bogus
		fi
	fi
}

_get_depends() {
	_mksource 1>&2
	pushd "${srcdir:-src}" >/dev/null
	python2_packages='markdown|psycopg2|pyinotify|pytz|south'
	< parabolaweb/requirements_prod.txt sed -r \
		-e 's/.*/\L&/' -e 's/==/=/' \
		-e 's/^python-memcached/python2-memcached/' \
		-e "s/^(${python2_packages})/python2-&/"
	popd >/dev/null
}

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