Skip to content

Commit c16aba6

Browse files
committed
Meta/RelBuild: split signing phase into separate RelSign
1 parent cf7ee94 commit c16aba6

File tree

2 files changed

+110
-31
lines changed

2 files changed

+110
-31
lines changed

RelBuild

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,4 @@ make $j dist-doc || exit
1414
# The above used to be
1515
# MAN_BASE_URL="http://www.kernel.org/pub/software/scm/git/docs/"
1616

17-
files="
18-
git-$version.tar.gz
19-
git-htmldocs-$version.tar.gz
20-
git-manpages-$version.tar.gz
21-
"
22-
23-
for file in $files
24-
do
25-
test -f $file || exit
26-
done
27-
28-
# Use agent
29-
GPG_TTY=$(tty) &&
30-
export GPG_TTY &&
31-
eval $(gpg-agent --daemon) &&
32-
GPG_AGENT_PID=$(expr "$GPG_AGENT_INFO" : ".*:\([1-9][0-9]*\):[1-9][0-9]*$") &&
33-
trap 'kill -0 2>/dev/null $GPG_AGENT_PID && kill $GPG_AGENT_PID' 0 1 2 3 15 &&
34-
kill -0 "$GPG_AGENT_PID" &&
35-
gpg="gpg --use-agent --local-user 96AFE6CB!" || exit
36-
37-
sha1sum $files | $gpg --clearsign >git-$version.sign || exit
38-
39-
for file in $files
40-
do
41-
gzip -dc <"$file" >"${file%.gz}" &&
42-
$gpg -b "${file%.gz}" &&
43-
rm "${file%.gz}" || exit
44-
done
45-
46-
kill $GPG_AGENT_PID
47-
ls -l git-$version.sign $files git*-$version.tar.sig
17+
exit $?

RelSign

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
#!/bin/sh
2+
3+
# Use agent
4+
GPG_TTY=$(tty) &&
5+
export GPG_TTY &&
6+
eval $(gpg-agent --daemon) &&
7+
GPG_AGENT_PID=$(expr "$GPG_AGENT_INFO" : ".*:\([1-9][0-9]*\):[1-9][0-9]*$") &&
8+
trap 'kill -0 2>/dev/null $GPG_AGENT_PID && kill $GPG_AGENT_PID' 0 1 2 3 15 &&
9+
kill -0 "$GPG_AGENT_PID" &&
10+
gpg="gpg --use-agent --local-user 96AFE6CB!" || exit
11+
12+
formats='htmldocs manpages'
13+
14+
products () {
15+
with_sig=: with_src=echo
16+
case "$1" in
17+
with-sig)
18+
with_sig=echo
19+
shift
20+
;;
21+
only-sig)
22+
with_sig=echo with_src=:
23+
shift
24+
;;
25+
esac
26+
version=$1
27+
$with_src "git-$version.tar.gz"
28+
$with_sig "git-$version.tar.sig"
29+
for fmt in $formats
30+
do
31+
$with_src "git-$fmt-$version.tar.gz"
32+
$with_sig "git-$fmt-$version.tar.sig"
33+
done
34+
}
35+
36+
report () {
37+
ls -l "git-$1.sign" $(products with-sig "$1")
38+
}
39+
40+
41+
failed=
42+
for tar in git-[0-9]*.tar.gz
43+
do
44+
version=$(expr "$tar" : 'git-\(.*\)\.tar.gz$')
45+
46+
if test -f "git-$version.tar.sig"
47+
then
48+
can_skip=yes
49+
for file in $(products with-sig "$version")
50+
do
51+
if ! test -f "$file"
52+
then
53+
can_skip=no
54+
break
55+
fi
56+
done
57+
if test "$can_skip" = yes
58+
then
59+
report "$version"
60+
continue
61+
fi
62+
fi
63+
64+
rm -f $(products only-sig $version)
65+
66+
files="$tar"
67+
missing=
68+
for fmt in $formats
69+
do
70+
doc="git-$fmt-$version.tar.gz"
71+
if test -f "$doc"
72+
then
73+
files="$files $doc"
74+
else
75+
missing="$missing $doc"
76+
fi
77+
done
78+
case "$missing" in
79+
?*)
80+
echo >&2 "Missing files: $missing"
81+
failed="$failed $version"
82+
continue
83+
;;
84+
esac
85+
sha1sum $files | $gpg --clearsign >git-$version.sign || {
86+
failed="$failed $version"
87+
continue
88+
}
89+
90+
for file in $files
91+
do
92+
gzip -dc <"$file" >"${file%.gz}" &&
93+
$gpg -b "${file%.gz}" || {
94+
failed="$failed $version"
95+
rm -f "${file%.gz}.sig"
96+
}
97+
rm -f "${file%.gz}"
98+
done
99+
100+
case " $failed " in
101+
*" $version "*)
102+
continue
103+
;;
104+
esac
105+
106+
report "$version"
107+
done
108+
109+
kill $GPG_AGENT_PID

0 commit comments

Comments
 (0)