Debian Codegraph @

bin/build-rpm.sh

raw symbols SCIP
1 #!/bin/bash
2 # -*- coding: utf-8 -*-
3 # BSD 2-Clause License
4 #
5 # Apprise - Push Notification Library.
6 # Copyright (c) 2026, Chris Caron <[email protected]>
7 #
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions are met:
10 #
11 # 1. Redistributions of source code must retain the above copyright notice,
12 # this list of conditions and the following disclaimer.
13 #
14 # 2. Redistributions in binary form must reproduce the above copyright notice,
15 # this list of conditions and the following disclaimer in the documentation
16 # and/or other materials provided with the distribution.
17 #
18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 # POSSIBILITY OF SUCH DAMAGE.
29 #!/usr/bin/env bash
30 set -euo pipefail
31
32 # Set Apprise root directory
33 APPRISE_DIR="${APPRISE_DIR:-/apprise}"
34 DIST_DIR="${DIST_DIR:-$PWD/dist/rpm}"
35 SOURCES_DIR="$APPRISE_DIR/SOURCES"
36 SRPM_DIR="$DIST_DIR/"
37
38 PYTHON=python3
39 TOX="tox -c $APPRISE_DIR/tox.ini"
40
41 if [ ! -d "$DIST_DIR" ]; then
42 echo "==> Cleaning previous builds"
43 $TOX -e clean --notest
44
45 echo "==> Linting RPM spec"
46 rpmlint "$APPRISE_DIR/packaging/redhat/python-apprise.spec"
47
48 echo "==> Generating man pages"
49 ronn --roff --organization="Chris Caron <[email protected]>" \
50 "$APPRISE_DIR/packaging/man/apprise.md"
51
52 echo "==> Extracting translations"
53 $TOX -e i18n
54
55 echo "==> Compiling translations"
56 $TOX -e compile
57
58 echo "==> Building source distribution"
59 $TOX -e build-sdist
60 fi
61
62 VERSION=$(rpmspec -q --qf "%{version}\n" "$APPRISE_DIR/packaging/redhat/python-apprise.spec" | head -n1)
63 TARBALL="$APPRISE_DIR/dist/apprise-${VERSION}.tar.gz"
64
65 if [[ ! -f "$TARBALL" ]]; then
66 echo "❌ Tarball not found: $TARBALL"
67 exit 1
68 fi
69
70 echo "==> Preparing SOURCES directory"
71 mkdir -p "$SOURCES_DIR"
72 cp "$TARBALL" "$SOURCES_DIR/"
73 find $APPRISE_DIR/packaging/redhat/ -iname '*.patch' -exec cp {} "$SOURCES_DIR" \;
74
75 echo "==> Building RPM (source and binary)"
76 mkdir -p "$DIST_DIR"
77 rpmbuild --define "_topdir $APPRISE_DIR" \
78 --define "_sourcedir $SOURCES_DIR" \
79 --define "_specdir $APPRISE_DIR/packaging/redhat" \
80 --define "_srcrpmdir $DIST_DIR" \
81 --define "_rpmdir $DIST_DIR" \
82 -ba "$APPRISE_DIR/packaging/redhat/python-apprise.spec"
83
84 echo "✅ RPM build completed successfully"
85 echo "📦 Artifacts:"
86 find "$DIST_DIR" -type f -name "*.rpm"