-
Notifications
You must be signed in to change notification settings - Fork 0
/
parsepkgbuild
executable file
·100 lines (89 loc) · 2.07 KB
/
parsepkgbuild
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash
mkdir -p /tmp/parsepkgbuild
source /etc/makepkg.conf
export CARCH
export PATH=/tmp/parsepkgbuild; exec /bin/bash --noprofile --norc -r << EOF
source $1
# ensure $pkgname and $pkgver variables were found
if [ -z "\$pkgname" -o -z "\$pkgver" ]; then
echo " error: invalid package file"
exit 1
fi
# create desc entry
echo -e "%NAME%\n\$pkgname\n"
echo -e "%VERSION%\n\$pkgver-\$pkgrel\n"
if [ -n "\$pkgdesc" ]; then
echo -e "%DESC%\n\$pkgdesc\n"
fi
if [ -n "\$groups" ]; then
echo "%GROUPS%"
for i in \${groups[@]}; do echo \$i; done
echo ""
fi
[ -n "\$url" ] && echo -e "%URL%\n\$url\n"
if [ -n "\$license" ]; then
echo "%LICENSE%"
for i in \${license[@]}; do echo \$i; done
echo ""
fi
if [ -n "\$arch" ]; then
echo "%ARCH%"
for i in \${arch[@]}; do echo \$i; done
echo ""
fi
[ -n "\$builddate" ] && echo -e "%BUILDDATE%\n\$builddate\n"
[ -n "\$packager" ] && echo -e "%PACKAGER%\n\$packager\n"
if [ -n "\$replaces" ]; then
echo "%REPLACES%"
for i in \${replaces[@]}; do echo \$i; done
echo ""
fi
[ -n "\$force" ] && echo -e "%FORCE%\n"
# create depends entry
if [ -n "\$depends" ]; then
echo "%DEPENDS%"
for i in \${depends[@]}; do echo \$i; done
echo ""
fi
if [ -n "\$makedepends" ]; then
echo "%MAKEDEPENDS%"
for i in \${makedepends[@]}; do echo \$i; done
echo ""
fi
if [ -n "\$optdepends" ]; then
echo "%OPTDEPENDS%"
for i in \${!optdepends[*]}; do echo \${optdepends[\$i]%:*}; done
echo ""
fi
if [ -n "\$conflicts" ]; then
echo "%CONFLICTS%"
for i in \${conflicts[@]}; do echo \$i; done
echo ""
fi
if [ -n "\$provides" ]; then
echo "%PROVIDES%"
for i in \${provides[@]}; do echo \$i; done
echo ""
fi
if [ -n "\$backup" ]; then
echo "%BACKUP%"
for i in \${backup[@]}; do echo \$i; done
echo ""
fi
if [ -n "\$options" ]; then
echo "%OPTIONS%"
for i in \${options[@]}; do echo \$i; done
echo ""
fi
if [ -n "\$source" ]; then
echo "%SOURCE%"
for i in \${source[@]}; do echo \$i; done
echo ""
fi
if [ -n "\$md5sums" ]; then
echo "%MD5SUMS%"
for i in \${md5sums[@]}; do echo \$i; done
echo ""
fi
[ -n "\$install" ] && echo -e "%INSTALL%\n\$install\n"
EOF