#!/bin/bash## Copyright (C) 2015 Red Hat, Inc.# SPDX-License-Identifier: LGPL-2.1-or-laterset -eufbase=$(cd "$(dirname "$0")/../"; pwd -P)usage(){echo "usage: make-rpms [--quick] [--verbose] [tarball]"}quiet="--quiet"check=""args=$(getopt -o "h,q,v" -l "help,quick,verbose" -- "$@")eval set -- "$args"while [ $# -gt 0 ]; docase $1 in-v|--verbose)quiet="";;-q|--quick)check="--nocheck";;-h|--help)usageexit 0;;--)shiftbreak;;esacshiftdoneif [ $# -gt 1 ]; thenusageexit 2fiif [ -z "${1-}" ]; then# we specify the main tarball that contains the spec file;# the others (-node) have to be next to it in the same directorysource="$("$base/tools/make-dist" | head -n1)"elsesource="$1"fitmpdir=$(mktemp -d "$PWD/rpm-build.XXXXXX")rpmbuild $check $quiet \--define "_topdir $tmpdir" \--define "_rpmdir $tmpdir/output" \-tb "$source"find "$tmpdir/output" -name '*.rpm' -printf '%f\n' -exec mv {} . \;rm -r "$tmpdir"