File: make-release.sh

package info (click to toggle)
sphde 1.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 4,400 kB
  • sloc: ansic: 38,652; cpp: 20,246; sh: 11,427; makefile: 252
file content (83 lines) | stat: -rwxr-xr-x 1,690 bytes parent folder | download | duplicates (2)
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
#!/bin/bash

ENAME=$0

usage()
{
cat << EOF
Usage: $ENAME OPTION
  -x Clean git repository before preparing release
EOF
}

while getopts "x" opt; do
	case "$opt" in
	x )
		git clean -ffdx
		;;
	? )
		usage
		exit 1
		;;
	esac
done

logfile=release.$(date +%y-%m-%d-%T).log
echo "Logging to ${logfile}"

# TODO: Handle tagging?

# Ensure these all have a similar and sane timestamp to
# prevent autotools from trying to rebuild portions wrongly
touch configure.ac aclocal.m4 configure Makefile.am Makefile.in

if [ ! -e ./configure ]; then
	echo "Configure missing. Did you bootstrap?"
fi

config_opts=""
if ./configure --help | grep -- --enable-maintainer-mode > /dev/null; then
	config_opts+=" --enable-maintainer_mode";
fi

echo "Running configure with options '${config_opts}'"
if ! ./configure $config_opts >> ${logfile} 2>&1; then
	echo "Configuration failed. Aborting"
	exit 1
fi

if [ ! -e Makefile ]; then
	echo "Makefile missing. Aborting"
	exit 1
fi

echo "Running make distcheck"
make distcheck >> ${logfile} 2>&1

# Extract out the name of the tarball from the log.
# There is probably a saner method to do this.

tarballs=$(awk '
/^=+$/ && doprint == 1                 { exit 0 }
doprint == 1                           { print $0 }
$0 ~ /archives ready for distribution/ { doprint = 1 }
' ${logfile})

if [ "x${tarballs}" == "x" ]; then
	echo "Failed to build and verify tarballs"
	exit 1
fi

echo "Found tarballs: ${tarballs}"

# Generate some popular checksums for the tarball
for tarball in ${tarballs}; do
	for sum in sha256 md5; do
		echo "Generating ${tarball}.${sum}"
		${sum}sum ${tarball} > ${tarball}.${sum}
	done
done

# TODO: Support signing these releases

exit 0