xref: /aosp_15_r20/external/libnl/tools/build_release.sh (revision 4dc78e53d49367fa8e61b07018507c90983a077d)
1#!/bin/bash
2
3# script to create libnl release.
4# Steps:
5# - create new commit, bumping version number
6# - run this script
7# - check all is good
8# - tag the commit (signed)
9#     git tag -m 'libnl-3.2.26-rc1' -s libnl3_2_26rc1 HEAD
10# - publish the tarballs
11# - push the commit to github
12# - publish the tag on github
13# - publish the tarballs on github
14# - send ANN email
15
16
17die() {
18    printf '%s\n' "$@"
19    exit 1
20}
21
22set -x
23set -e
24
25cd "$(dirname "$0")/.."
26git_dir="$(readlink -f "$(git rev-parse --show-toplevel)")"
27test -f "$git_dir/tools/build_release.sh"
28
29Build() {
30    test "$(git status --porcelain)" = "" || die "there are uncommited changes"
31    git clean -fdx
32    ./autogen.sh
33    ./configure
34    pushd ./doc/
35        ./configure --enable-doc
36    popd
37    make -j 5
38    make -C doc
39    make -C doc gendoc
40    make -j 5 distcheck
41    make -C doc dist
42    echo "Build: success"
43}
44
45Copy() {
46    local V="$(ls -1 ./libnl-*.tar.gz | sed -n 's/^\.\/libnl-\(3\.[0-9]\+\.[0-9]\+\(-rc[0-9]\)\?\).tar.gz$/\1/p')"
47    test -n "$V"
48    local REL="libnl-$V"
49    rm -rf "./$REL"
50    mkdir "./$REL"
51    ln "./libnl-$V.tar.gz" "./$REL/"
52    ln "./doc/libnl-doc-$V.tar.gz" "./$REL/"
53    (
54        cd "./$REL/"
55        for F in "libnl-$V.tar.gz" "libnl-doc-$V.tar.gz"; do
56            md5sum "./$F" > "./$F.md5sum"
57            sha256sum "./$F" > "./$F.sha256sum"
58            if [ "$NO_GPG_SIGN" != 1 ]; then
59                gpg ${GPG_USER--u thaller@redhat.com} --armor --verbose -o "./$F.sig" --detach-sign "./$F"
60            fi
61        done
62    )
63    tar -cvf "./$REL.tar" "./$REL/"
64    echo "Copy: success"
65}
66
67BuildAll() {
68     Build
69     Copy
70     echo "BuildAll: success"
71}
72
73case "$1" in
74    Build)
75        Build
76        ;;
77    Copy)
78        Copy
79        ;;
80    BuildAll)
81        BuildAll
82        ;;
83    *)
84        echo "SYNOPSIS: $0 Build|Copy|BuildAll"
85        echo "WARNING: does a git-clean first!!"
86        ;;
87esac
88