summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLevente Polyak <anthraxx@archlinux.org>2019-09-12 23:34:22 +0200
committerLevente Polyak <anthraxx@archlinux.org>2019-09-28 00:15:51 +0200
commit5dd90ef848e99e86601807fd829f6586dc2ab6fc (patch)
treefbb28253133d5f4b7e088c925005f0bde2504f08
parent5246cb9aa5bdc390c793dc261b28f3439aaad4c0 (diff)
downloaddevtools-5dd90ef848e99e86601807fd829f6586dc2ab6fc.tar.xz
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>
-rw-r--r--checkpkg.in12
-rw-r--r--doc/checkpkg.1.asciidoc3
-rw-r--r--makechrootpkg.in2
-rw-r--r--zsh_completion.in1
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]'
)