blob: 434c98166d4bdd30781e9f371cad3cafe89ce2c2 (
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
|
#!/usr/bin/env bash
RSTAR_DEPS_BIN+=(
git
gpg
md5sum
sha1sum
sha224sum
sha256sum
sha384sum
sha512sum
tar
)
action() {
local LC_ALL
local SOURCE_DATE_EPOCH
local basename
local tarball
local version
# Prepare environment for a reproducible tarball
LC_ALL=C.UTF-8
SOURCE_DATE_EPOCH="$(git log -1 --pretty=format:%at)"
# Set a version if none was specified explicitly
version="${1:-$(datetime %Y.%m)}"
WORKDIR="$BASEDIR/tmp/rakudo-star-$version"
debug "SOURCE_DATE_EPOCH set to $SOURCE_DATE_EPOCH"
export LC_ALL
export SOURCE_DATE_EPOCH
info "Creating distribution contents at $WORKDIR"
chgdir "$BASEDIR"
# Include files from this project
for file in $(git ls-files)
do
dist_include "/$file"
done
# Include the component sources
dist_include "/src"
# Set the SOURCE_DATE_EPOCH for the installation phase
printf "%d\n" "$SOURCE_DATE_EPOCH" > "$WORKDIR/etc/epoch.txt"
# Add a MANIFEST.txt
chgdir "$WORKDIR"
touch MANIFEST.txt
find . -type f | sed 's|^./||' | sort > MANIFEST.txt
# Tar it all up into a distribution tarball
info "Creating tarball out of $WORKDIR"
basename="rakudo-star-$version"
tarball="$BASEDIR/dist/$basename.tar.gz"
mkdir -p -- "$(dirname "$tarball")"
chgdir "$BASEDIR/tmp"
awk '{ print "'"$basename"'/"$0 }' "$WORKDIR/MANIFEST.txt" \
| tar -c -T - \
--mtime @"$SOURCE_DATE_EPOCH" \
--mode=go=rX,u+rw,a-s \
--format=gnu \
--numeric-owner --owner=0 --group=0 \
| gzip -9cn \
> "$tarball"
touch -d"$(datetime)" "$tarball"
chgdir "$(dirname "$tarball")"
info "Generating checksums for $tarball"
for sum in md5 sha{1,224,256,384,512}
do
dist_checksum "$sum" "$tarball" >> "$tarball.checksums.txt"
done
info "Generating a PGP signature for $tarball"
gpg --armor --detach-sign --output "$tarball.asc" "$tarball"
info "Distribution tarball available at $tarball"
}
dist_include() {
mkdir -p -- "$(dirname "${WORKDIR}$1")"
cp -r -- "${BASEDIR}$1" "${WORKDIR}$1"
}
dist_checksum() {
printf "%-6s %s\n" \
"$1" \
"$("dist_checksum_$1" "$2")"
}
dist_checksum_md5() {
md5sum "$1" | awk '{print $1}'
}
dist_checksum_sha1() {
sha1sum "$1" | awk '{print $1}'
}
dist_checksum_sha224() {
sha224sum "$1" | awk '{print $1}'
}
dist_checksum_sha256() {
sha256sum "$1" | awk '{print $1}'
}
dist_checksum_sha384() {
sha384sum "$1" | awk '{print $1}'
}
dist_checksum_sha512() {
sha512sum "$1" | awk '{print $1}'
}
|