Fix: scsi: sd: Atomic write support added in 6.11-rc1
[lttng-modules.git] / scripts / maintainer / do-release.sh
CommitLineData
5cfbaa8b 1#!/bin/bash
61baff6e
MJ
2# SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
3# SPDX-FileCopyrightText: 2020 EfficiOS Inc.
5cfbaa8b
MJ
4
5set -eu
6set -o pipefail
df79c0a0
MD
7
8# invoke with do-release 2.N.M, or 2.N.M-rcXX
9
5cfbaa8b
MJ
10# Default maintainer values
11SRCDIR="${HOME}/git/lttng-modules"
df79c0a0 12# The output files are created in ${HOME}/stable/
5cfbaa8b
MJ
13OUTPUTDIR="${HOME}/stable"
14SIGN="yes"
15VERBOSE=""
16
17usage() {
18 echo "Usage: do-release.sh [OPTION]... RELEASE"
19 echo
20 echo "Mandatory arguments to long options are mandatory for short options too."
21 echo " -s, --srcdir DIR source directory"
22 echo " -o, --outputdir DIR output directory, must exist"
23 echo " -n, --no-sign don't GPG sign the output archive"
24 echo " -v, --verbose verbose command output"
25}
26
27POS_ARGS=()
28while [[ $# -gt 0 ]]
29do
30 arg="$1"
31
32 case $arg in
33 -n|--no-sign)
34 SIGN="no"
35 shift 1
36 ;;
37
38 -s|--srcdir)
39 SRCDIR="$2"
40 shift 2
41 ;;
42
43 -o|--outputdir)
44 OUTPUTDIR="$2"
45 shift 2
46 ;;
47
48 -v|--verbose)
49 VERBOSE="-v"
50 shift 1
51 ;;
52
53 # Catch unknown arguments
54 -*)
55 usage
56 exit 1
57 ;;
58
59 *)
60 POS_ARGS+=("$1")
61 shift
62 ;;
63 esac
64done
65set -- "${POS_ARGS[@]}"
df79c0a0 66
5cfbaa8b
MJ
67REL=${1:-}
68
69if [ x"${REL}" = x"" ]; then
70 usage
df79c0a0
MD
71 exit 1;
72fi
73
5cfbaa8b
MJ
74echo "Doing LTTng modules release ${REL}"
75echo " Source dir: ${SRCDIR}"
76echo " Output dir: ${OUTPUTDIR}"
77echo " GPG sign: ${SIGN}"
df79c0a0 78
5cfbaa8b
MJ
79# Make sure the output directory exists
80if [ ! -d "${OUTPUTDIR}" ]; then
81 echo "Output directory '${OUTPUTDIR}' doesn't exist."
82 exit 1
83fi
df79c0a0 84
5cfbaa8b
MJ
85# Make sure the source directory is a git repository
86if [ ! -r "${SRCDIR}/.git/config" ]; then
87 echo "Source directory '${SRCDIR}' isn't a git repository."
88 exit 1
89fi
df79c0a0 90
5cfbaa8b
MJ
91# Set the git repo directory for all further git commands
92export GIT_DIR="${SRCDIR}/.git/"
df79c0a0 93
5cfbaa8b
MJ
94# Check if the release tag exists
95if ! git rev-parse "refs/tags/v${REL}" >/dev/null 2>&1; then
96 echo "Release tag 'v${REL}' doesn't exist."
97 exit 1
98fi
99
100# Generate the compressed tar archive, the git attributes from the tag will be used.
101git archive $VERBOSE --format=tar --prefix="lttng-modules-${REL}/" "v${REL}" | bzip2 > "${OUTPUTDIR}/lttng-modules-${REL}.tar.bz2"
df79c0a0 102
5cfbaa8b
MJ
103pushd "${OUTPUTDIR}" >/dev/null
104# Generate the hashes
105md5sum "lttng-modules-${REL}.tar.bz2" > "lttng-modules-${REL}.tar.bz2.md5"
106sha256sum "lttng-modules-${REL}.tar.bz2" > "lttng-modules-${REL}.tar.bz2.sha256"
107
108if [ "x${SIGN}" = "xyes" ]; then
109 # Sign with the default key
110 gpg --armor -b "lttng-modules-${REL}.tar.bz2"
111fi
112popd >/dev/null
This page took 0.039361 seconds and 5 git commands to generate.