Debian Codegraph @

tools/make-rpms

raw
1 #!/bin/bash
2 #
3 # Copyright (C) 2015 Red Hat, Inc.
4 # SPDX-License-Identifier: LGPL-2.1-or-later
5
6
7 set -euf
8
9 base=$(cd "$(dirname "$0")/../"; pwd -P)
10
11 usage()
12 {
13 echo "usage: make-rpms [--quick] [--verbose] [tarball]"
14 }
15
16 quiet="--quiet"
17 check=""
18
19 args=$(getopt -o "h,q,v" -l "help,quick,verbose" -- "$@")
20 eval set -- "$args"
21 while [ $# -gt 0 ]; do
22 case $1 in
23 -v|--verbose)
24 quiet=""
25 ;;
26 -q|--quick)
27 check="--nocheck"
28 ;;
29 -h|--help)
30 usage
31 exit 0
32 ;;
33 --)
34 shift
35 break
36 ;;
37 esac
38 shift
39 done
40
41 if [ $# -gt 1 ]; then
42 usage
43 exit 2
44 fi
45
46 if [ -z "${1-}" ]; then
47 # we specify the main tarball that contains the spec file;
48 # the others (-node) have to be next to it in the same directory
49 source="$("$base/tools/make-dist" | head -n1)"
50 else
51 source="$1"
52 fi
53
54 tmpdir=$(mktemp -d "$PWD/rpm-build.XXXXXX")
55 rpmbuild $check $quiet \
56 --define "_topdir $tmpdir" \
57 --define "_rpmdir $tmpdir/output" \
58 -tb "$source"
59
60 find "$tmpdir/output" -name '*.rpm' -printf '%f\n' -exec mv {} . \;
61 rm -r "$tmpdir"