From 5dd90ef848e99e86601807fd829f6586dc2ab6fc Mon Sep 17 00:00:00 2001 From: Levente Polyak Date: Thu, 12 Sep 2019 23:34:22 +0200 Subject: 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 --- checkpkg.in | 12 +++++++++--- doc/checkpkg.1.asciidoc | 3 +++ makechrootpkg.in | 2 +- zsh_completion.in | 1 + 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/checkpkg.in b/checkpkg.in index e3d2c16..374c004 100644 --- a/checkpkg.in +++ b/checkpkg.in @@ -35,14 +35,16 @@ usage() { OPTIONS -r, --rmdir Remove the temporary directory + -w, --warn Print a warning in case of differences -h, --help Show this help text _EOF_ } RMDIR=0 +WARN=0 -OPT_SHORT='rh' -OPT_LONG=('rmdir' 'help') +OPT_SHORT='rwh' +OPT_LONG=('rmdir' 'warn' 'help') if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then exit 1 fi @@ -53,6 +55,9 @@ while :; do -r|--rmdir) RMDIR=1 ;; + -w|--warn) + WARN=1 + ;; -h|--help) usage 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 "$pkgfile" 2>/dev/null | sort > "$TEMPDIR/libraries-$_pkgname" 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" else msg "No soname differences for %s." "$_pkgname" diff --git a/doc/checkpkg.1.asciidoc b/doc/checkpkg.1.asciidoc index c51cac4..6a70dbb 100644 --- a/doc/checkpkg.1.asciidoc +++ b/doc/checkpkg.1.asciidoc @@ -26,6 +26,9 @@ Options Remove the temporary directory created to contain the file and library list of both packages. +*-w, --warn*:: + Print a warning instead of a regular message in case of soname differences. + *-h, --help*:: Show a help text diff --git a/makechrootpkg.in b/makechrootpkg.in index 4238fc3..f5a0e51 100644 --- a/makechrootpkg.in +++ b/makechrootpkg.in @@ -412,7 +412,7 @@ else msg2 "Downloading current versions" if pacman --noconfirm -Swdd --logfile /dev/null "${pkgnames[@]}"; then msg2 "Checking packages" - sudo -u "$makepkg_user" checkpkg --rmdir + sudo -u "$makepkg_user" checkpkg --rmdir --warn else warning "Skipped checkpkg due to missing packages" fi diff --git a/zsh_completion.in b/zsh_completion.in index 47719e5..f1d7f9d 100644 --- a/zsh_completion.in +++ b/zsh_completion.in @@ -56,6 +56,7 @@ _rebuildpkgs_args=( _checkpkg_args=( '(-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]' ) -- cgit v1.2.3-70-g09d2