-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgenspec
113 lines (101 loc) · 2.46 KB
/
genspec
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
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/bash
# This script should be run in the rootfs of loongnix DaoXiangHu-stable
set -e -o pipefail
sed -i '/deb-src/s/#//' /etc/apt/sources.list
apt-get update
apt-get install --no-install-recommends -y \
libgdk-pixbuf2.0-bin \
libgtk2.0-0 \
libgtk-3-0 \
librsvg2-common \
dconf-gsettings-backend \
gvfs \
glib-networking \
gvfs-libs \
fcitx-frontend-gtk2 \
fcitx-frontend-gtk3 \
ibus-gtk \
ibus-gtk3
exec 3> spec.new
echo "# AUTOGENERATED FILE from spec.main using genspec" >&3
cat spec.main >&3
fetch_pkg(){
local pkg="$1"
local tag="$2"
[ "$tag" ]
info=$(apt-get --print-uris download "$pkg")
if [ "$?" -ne 0 ]; then
return 1
fi
url=$(echo "$info" | sed "s/^[^']*'\([^']*\)'.*$/\1/" | sed 's/^.*\(pool.*\)$/\1/')
sum=$(echo "$info" | sed 's/^.*SHA256:\([^ ]*\) *.*$/\1/')
printf 'SRCS="$SRCS file::rename=%s%s.deb::${_mirror}/%s \\\n"\n' "$tag" "$pkg" "$url"
printf 'CHKSUMS="$CHKSUMS sha256::%s \\\n"\n' "$sum"
}
fetch_src(){
local pkg="$1"
info=$(apt-get --print-uris -qq source "$pkg")
if [ "$?" -ne 0 ]; then
return 1
fi
url=$(echo "$info" | sed "s/^[^']*'\([^']*\)'.*$/\1/" | sed 's/^.*\(pool.*\)$/\1/')
sum=$(echo "$info" | sed 's/^.*SHA256:\([^ ]*\) *.*$/\1/')
echo -n 'SRCS="$SRCS '
echo "$url" | sed 's@^\(.*/\([^/]*\)\)$@file::rename=\2::${_mirror}/\1@; s@$@ \\@'
echo '"'
echo -n 'CHKSUMS="$CHKSUMS '
echo "$sum" | sed 's@^@sha256::@; s@$@ \\@'
echo '"'
}
while read pkg; do
if [ -z "$pkg" ]; then
continue
fi
nodbg=0
dev=0
src=0
while :; do
case $pkg in
*:nodbg)
nodbg=1
pkg=${pkg%:nodbg}
;;
*:src)
src=1
pkg=${pkg%:src}
;;
*:dev)
dev=1
pkg=${pkg%:dev}
;;
*)
break
;;
esac
done
case $pkg in
*-dev)
devpkg=1
;;
*)
devpkg=0
;;
esac
if [ "$src" = "0" ]; then
tag=""
if [ "$devpkg" = 0 ]; then
tag="${tag}dist_"
fi
if [ "$dev" = 1 ]; then
tag="${tag}dev_"
fi
fetch_pkg "$pkg" "$tag">&3
if [ "$nodbg" = "0" ] && [ "$devpkg" = "0" ] ; then
fetch_pkg "$pkg-dbgsym" "dist_" >&3 || fetch_pkg "$pkg-dbg" "dist_" >&3
fi
else
fetch_src "$pkg" >&3
fi
done < manifest
exec 3>&-
mv spec.new spec