checkpkg: add option to print a warning in case of differences

Sometimes its desired to be explicitly made aware of differences
reporter by checkpkg via printing a warning instead of a regular
message.

Automatically use --warn for makechrootpkg builds so packagers are made
visibly aware of a soname bump by simply looking out for colors
indicating non success messages.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
This commit is contained in:
Levente Polyak 2019-09-12 23:34:22 +02:00
parent 5246cb9aa5
commit 5dd90ef848
No known key found for this signature in database
GPG Key ID: FC1B547C8D8172C8
4 changed files with 14 additions and 4 deletions

View File

@ -35,14 +35,16 @@ usage() {
OPTIONS OPTIONS
-r, --rmdir Remove the temporary directory -r, --rmdir Remove the temporary directory
-w, --warn Print a warning in case of differences
-h, --help Show this help text -h, --help Show this help text
_EOF_ _EOF_
} }
RMDIR=0 RMDIR=0
WARN=0
OPT_SHORT='rh' OPT_SHORT='rwh'
OPT_LONG=('rmdir' 'help') OPT_LONG=('rmdir' 'warn' 'help')
if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
exit 1 exit 1
fi fi
@ -53,6 +55,9 @@ while :; do
-r|--rmdir) -r|--rmdir)
RMDIR=1 RMDIR=1
;; ;;
-w|--warn)
WARN=1
;;
-h|--help) -h|--help)
usage usage
exit 0 exit 0
@ -128,7 +133,8 @@ for _pkgname in "${pkgname[@]}"; do
find-libprovides "$TEMPDIR/$oldpkg" 2>/dev/null | sort > "$TEMPDIR/libraries-$_pkgname-old" find-libprovides "$TEMPDIR/$oldpkg" 2>/dev/null | sort > "$TEMPDIR/libraries-$_pkgname-old"
find-libprovides "$pkgfile" 2>/dev/null | sort > "$TEMPDIR/libraries-$_pkgname" find-libprovides "$pkgfile" 2>/dev/null | sort > "$TEMPDIR/libraries-$_pkgname"
if ! diff_output="$(sdiff -s "$TEMPDIR/libraries-$_pkgname-old" "$TEMPDIR/libraries-$_pkgname")"; then if ! diff_output="$(sdiff -s "$TEMPDIR/libraries-$_pkgname-old" "$TEMPDIR/libraries-$_pkgname")"; then
msg "Sonames differ in $_pkgname!" message="Sonames differ in $_pkgname!"
(( WARN )) && warning "$message" || msg "$message"
echo "$diff_output" echo "$diff_output"
else else
msg "No soname differences for %s." "$_pkgname" msg "No soname differences for %s." "$_pkgname"

View File

@ -26,6 +26,9 @@ Options
Remove the temporary directory created to contain the file and library list Remove the temporary directory created to contain the file and library list
of both packages. of both packages.
*-w, --warn*::
Print a warning instead of a regular message in case of soname differences.
*-h, --help*:: *-h, --help*::
Show a help text Show a help text

View File

@ -412,7 +412,7 @@ else
msg2 "Downloading current versions" msg2 "Downloading current versions"
if pacman --noconfirm -Swdd --logfile /dev/null "${pkgnames[@]}"; then if pacman --noconfirm -Swdd --logfile /dev/null "${pkgnames[@]}"; then
msg2 "Checking packages" msg2 "Checking packages"
sudo -u "$makepkg_user" checkpkg --rmdir sudo -u "$makepkg_user" checkpkg --rmdir --warn
else else
warning "Skipped checkpkg due to missing packages" warning "Skipped checkpkg due to missing packages"
fi fi

View File

@ -56,6 +56,7 @@ _rebuildpkgs_args=(
_checkpkg_args=( _checkpkg_args=(
'(-r --rmdir)'{-r,--rmdir}'[Remove the temporary directory]' '(-r --rmdir)'{-r,--rmdir}'[Remove the temporary directory]'
'(-w --warn)'{-w,--warn}'[Print a warning in case of differences]'
'(-h --help)'{-h,--help}'[Display usage]' '(-h --help)'{-h,--help}'[Display usage]'
) )