-
Notifications
You must be signed in to change notification settings - Fork 12
/
tools.sh
executable file
·81 lines (72 loc) · 1.63 KB
/
tools.sh
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
#!/bin/bash
#
# Tools to ease maintainance
#
generate_srcinfo() {
local vcs_protocols=(
'bzr://' 'bzr+http'
'git://' 'git+http'
'hg://' 'hg+http'
'svn://' 'svn+http'
)
for package in $(ls); do
if [ ! -d "$package" ]; then
continue
elif [ ! -e "$package/PKGBUILD" ]; then
continue
fi
cd "$package"
local srcinfo=$(makepkg --printsrcinfo)
local has_vcs_source=0
for protocol in "${vcs_protocols[@]}"; do
if echo "$srcinfo" | grep "$protocol" > /dev/null ; then
# dont skip vcs sources that point to a specific commit
if ! echo "$srcinfo" | grep "$protocol" | grep "#" > /dev/null ; then
# dont skip if already has a .SRCINFO
if [ ! -e ".SRCINFO" ]; then
has_vcs_source=1
break
fi
fi
fi
done
if [ $has_vcs_source -ne 1 ]; then
echo "$srcinfo" > .SRCINFO
echo "$package generated"
else
echo "$package skip"
fi
cd ../
done
}
print_no_srcinfo() {
for package in $(ls); do
if [ -e "$package/PKGBUILD" ]; then
if [ ! -e "$package/.SRCINFO" ]; then
echo "$package"
fi
fi
done
}
case $1 in
'mksrcinfo' )
generate_srcinfo
exit
;;
'nosrcinfo' )
print_no_srcinfo
exit
;;
* )
echo "Helper script."
echo ""
echo "COMMANDS"
echo " mksrcinfo Generate .SRCINFO for all applicable packages"
echo " skipping does that target a VCS."
echo ""
echo " nosrcinfo Display packages without a .SRCINFO file"
echo ""
echo " help print this help"
exit
;;
esac