blob: 53dd94e1d351dffc46fbd2af02fa9d244bec2a47 (
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
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
#!/bin/sh
set -e
CHANGELOGS="${@:-*/packages/*/*/*.changes}"
echo -n "Fixing "
Fix_size ()
{
CHANGES="${1}"
BUILDINFO="${2}"
OLD_SIZE="$(grep " [0-9]* $(basename ${BUILDINFO})$" ${CHANGES} | head -n1 | awk '{ print $2 }')"
NEW_SIZE="$(ls -l ${BUILDINFO} | awk '{ print $5 }')"
if [ -n "${OLD_SIZE}" ] && [ -n "${NEW_SIZE}" ] && grep -qs " ${OLD_SIZE} " "${CHANGES}"
then
sed -i -e "s| ${OLD_SIZE} | ${NEW_SIZE} |g" "${CHANGES}"
cd "$(dirname ${CHANGES})"
echo "Signing ${CHANGES}"
if grep -qs progress-linux.org ${CHANGES}
then
psign.sh > /dev/null 2>&1
elif grep -qs bfh.ch ${CHANGES}
then
bsign.sh > /dev/null 2>&1
fi
cd "${OLDPWD}"
fi
}
Fix_checksums ()
{
CHANGES="${1}"
BUILDINFO="${2}"
SIZE="${3}"
for HASHSUM in $(grep " ${SIZE} " "${CHANGES}")
do
OLD_HASH="$(echo ${HASHSUM} | awk '{ print $1 }')"
NEW_HASH=""
case $(echo ${OLD_HASH} | wc -c) in
41)
NEW_HASH="$(sha1sum ${BUILDINFO} | awk '{ print $1 }')"
;;
65)
NEW_HASH="$(sha256sum ${BUILDINFO} | awk '{ print $1 }')"
;;
33)
NEW_HASH="$(md5sum ${BUILDINFO} | awk '{ print $1 }')"
;;
esac
if [ -n "${NEW_HASH}" ] && ! grep -qs "^ ${NEW_HASH} ${SIZE} " "${CHANGES}"
then
sed -i -e "s|^ ${OLD_HASH} ${SIZE}| ${NEW_HASH} ${SIZE}|" "${CHANGES}"
cd "$(dirname ${CHANGES})"
echo "Signing ${CHANGES}"
psign.sh > /dev/null 2>&1
cd "${OLDPWD}"
fi
done
}
for CHANGES in ${CHANGELOGS}
do
BUILDINFO="$(echo ${CHANGES} | sed -e 's|.changes$|.buildinfo|')"
if grep -qs usr-local-has-programs "${BUILDINFO}" && grep -qs merged-usr-via-symlinks "${BUILDINFO}"
then
grep -v usr-local-has-programs "${BUILDINFO}" > "${BUILDINFO}".tmp
rm -f "${BUILDINFO}"
mv "${BUILDINFO}".tmp "${BUILDINFO}"
else
if grep -qs usr-local-has-programs "${BUILDINFO}" && ! grep -qs merged-usr-via-symlinks "${BUILDINFO}"
then
sed -i -e 's|usr-local-has-programs|merged-usr-via-symlinks|' "${BUILDINFO}"
fi
fi
if grep -qs DEB_BUILD_OPTIONS= "${BUILDINFO}"
then
grep -v DEB_BUILD_OPTIONS= "${BUILDINFO}" > "${BUILDINFO}".tmp
rm -f "${BUILDINFO}"
mv "${BUILDINFO}".tmp "${BUILDINFO}"
fi
DIRECTORY="$(basename ${BUILDINFO} | awk -F_ '{ print $1, $2 }' | sed -e 's| |-|' -e 's|~|_|g' -e 's|+|.|g')"
if ! grep -qs "Build-Path: /build/${DIRECTORY}|" "${BUILDINFO}"
then
echo "${CHANGES}: fix buildinfo build-path"
sed -i -e "s|Build-Path: .*|Build-Path: /build/${DIRECTORY}|" "${BUILDINFO}"
fi
if [ ! -e "${BUILDINFO}" ]
then
continue
fi
SIZE="$(ls -l ${BUILDINFO} | awk '{ print $5 }')"
if [ $(grep -c ".* ${SIZE} .*$(basename ${BUILDINFO})" ${CHANGES}) -ne 3 ]
then
echo
echo "${CHANGES}: fix buildinfo size"
Fix_size ${CHANGES} ${BUILDINFO}
fi
SHA1SUM="$(sha1sum ${BUILDINFO} | awk '{ print $1 }')"
if ! grep -qs "^ ${SHA1SUM} ${SIZE} $(basename ${BUILDINFO})$" "${CHANGES}"
then
echo
echo "${CHANGES}: fix buildinfo sha1"
Fix_checksums ${CHANGES} ${BUILDINFO} ${SIZE}
fi
SHA256SUM="$(sha256sum ${BUILDINFO} | awk '{ print $1 }')"
if ! grep -qs "^ ${SHA256SUM} ${SIZE} $(basename ${BUILDINFO})$" "${CHANGES}"
then
echo
echo "${CHANGES}: fix buildinfo sha256"
Fix_checksums ${CHANGES} ${BUILDINFO} ${SIZE}
fi
MD5SUM="$(md5sum ${BUILDINFO} | awk '{ print $1 }')"
if ! grep -qs "^ ${MD5SUM} ${SIZE} .*$(basename ${BUILDINFO})$" "${CHANGES}"
then
echo
echo "${CHANGES}: fix buildinfo md5"
Fix_checksums ${CHANGES} ${BUILDINFO} ${SIZE}
fi
echo -n "."
done
echo " done."
|