From 083ef760ae6a9464a137df327a7026a0fdf763e6 Mon Sep 17 00:00:00 2001 From: Rong Tao Date: Thu, 20 Jun 2024 10:37:37 +0800 Subject: [PATCH] rpmbuild.sh: Add arguments support and --nodebuginfo Signed-off-by: Rong Tao --- rpmbuild.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/rpmbuild.sh b/rpmbuild.sh index e84eb12f..410b9858 100755 --- a/rpmbuild.sh +++ b/rpmbuild.sh @@ -3,8 +3,44 @@ # Use half of CPU cores np=$(( $(nproc) / 2 )) +nodebuginfo= + +__usage__() { + echo -e " +--nodebuginfo skip debuginfo and debugsource packages +-h, --help print this info +" + exit ${1-0} +} + +TEMP=$( getopt --options h \ + --long help \ + --long nodebuginfo \ + --name rpmbuild-ulpatch -- "$@" ) +test $? != 0 && __usage__ 1 + +eval set -- "${TEMP}" + +while true ; do + case $1 in + -h | --help) + shift + __usage__ + ;; + --nodebuginfo) + shift + nodebuginfo=YES + ;; + --) + shift + break + ;; + esac +done + rpmbuild -ba \ --define "_topdir $PWD" \ --define "_sourcedir $PWD" \ --define "_smp_mflags -j${np}" \ + ${nodebuginfo:+--nodebuginfo} \ ulpatch.spec