Debian Codegraph @

tools/create-tarballs.sh

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`. -eu
2 # Copyright (c) 2023 Petr Vorel <[email protected]>
3 # Create tarballs and checksums for uploading after tagging a new release.
4 # NOTE: 0.58.0 (at least) is required (for meson dist --formats "$formats")
5 # Run release with a reasonably new meson.
6
7 basedir="$(dirnamescip-shell system . . dirname. "$0")"
8 . "$basedir/lib.sh"
9 require_cmd date git gpg meson sha256sum
10
11 tag="$(datescip-shell system . . date. +%Y%m%d)"
12 tarball_dir="iputils-full-$tag"
13 git_dir=$(cd "$basedir/.."; pwdscip-shell system . . pwd.)
14 dir="$(cd "$git_dir/../"; pwdscip-shell system . . pwd.)/iputils-release-$tag"
15 dist=builddir
16 formats="xztar,gztar,zip"
17
18 # check output directory
19 if [scip-shell system . . `[`. -d "$dir" ]; then
20 ask "Directory '$dir' exists, will be deleted"
21 rmscip-shell system . . rm. -rf "$dir"
22 fi
23 rod mkdir "$dir"
24 cd "$dir"
25 dir="$PWD"
26
27 # git clone (local)
28 title "git clone"
29 rod git clone "$git_dir" "$tarball_dir"
30 rod cd "$tarball_dir"
31
32 # check for tag
33 if ! gitscip-shell system . . git. show "$tag" 2> /dev/nullscip-shell filesystem . . `/dev/null`.; then
34 ask "Tag '$tag' does not exist, you should run tag-release.sh before, otherwise meson creates archive for $(gitscip-shell system . . git. describe --abbrev=0)"
35 fi
36
37 # tarballs
38 title "Generate tarballs"
39 rod meson "$dist"
40 rod meson dist -C "$dist" --formats "$formats"
41
42 cd "$dist/meson-dist/"
43
44 title "Generate tarballs and checksums"
45 # meson puts '*' before filename in checksums (unusable for distros => need to
46 # recreate them)
47 rmscip-shell system . . rm. -f ./*.sha256sum
48
49 for file in *.*; do
50 gpgscip-shell system . . gpg. --sign --armor --detach-sign "$file"
51 sha256sumscip-shell system . . sha256sum. "$file" >> sha256sums
52 done
53
54 # sha256sums.asc (GPG signed checksums)
55 gpgscip-shell system . . gpg. --clearsign sha256sums
56 rmscip-shell system . . rm. -f sha256sums
57
58 mvscip-shell system . . mv. -v ./* "$dir"
59
60 echoscip-shell system . . echo.
61 title "Generated tarballs and checksums"
62 cd "$dir" && lsscip-shell system . . ls. -p | grepscip-shell system . . grep. -v /scip-shell filesystem . . `/`.
63 echoscip-shell system . . echo.
64 echoscip-shell system . . echo. "Files are in '$dir', upload them to github"