summaryrefslogtreecommitdiff
path: root/list-depends
blob: 9b8b39e4f13bb2f7bb0cf0514914e8cc56159106 (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
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash

#   Copyright (c) 2013, 2015 Luke Shumaker <lukeshu@parabola.nu>
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.

[[ -n $stat_file ]] || stat_file='depends_static.txt'
[[ -n $prod_file ]] || prod_file='https://projects.parabolagnulinux.org/parabolaweb.git/plain/requirements_prod.txt'

cat "${stat_file}" |
sed -r \
	-e 's/\s*#.*//'

curl -s "${prod_file}" |
sed -r \
	-e 's|^-e .*/fredj/cssmin.git@master#egg=cssmin$|python2-cssmin-fredj|' \
	-e 's/.*/\L&/' \
	-e 's/^(python2?-)?/python2-/' \
	-e 's/jinja2?/jinja/' \
	-e 's/django.countries/django-countries/' |
while read -r dep; do
	# This one is a little more complicated, because with ==
	# depends, I don't want to actually lock to that precise of a
	# version; it would be a nightmare with keeping things in
	# sync.  So, let's turn == into >=, but also make sure the
	# first two segments match.
	if [[ $dep = *==* ]]; then
		name="${dep%%==*}"
		ver="${dep#*==}"
		IFS=.
		read major minor patch <<<"$ver"
		echo "$name>=$ver"
		echo "$name<$major.$((minor+1))"
	else
		echo "$dep"
	fi
done