]> git.pld-linux.org Git - packages/rpm-build-tools.git/commitdiff
add pldnotify script to inform about your ~/rpm packages only
authorElan Ruusamäe <glen@delfi.ee>
Wed, 18 Sep 2013 22:58:40 +0000 (01:58 +0300)
committerElan Ruusamäe <glen@delfi.ee>
Tue, 24 Dec 2013 20:31:35 +0000 (22:31 +0200)
pldnotify.sh [new file with mode: 0755]

diff --git a/pldnotify.sh b/pldnotify.sh
new file mode 100755 (executable)
index 0000000..78dc07d
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/sh
+# Walks your %_topdir (or any other dir specified by $1) and checks with pldnotify.awk for updates
+# and shows only relevant diffs of those packages only.
+#
+# Setup your cron to give you work early morning :)
+# 6 30 * * * /some/path/pldnotify.sh
+#
+# Idea based on PLD-doc/notify-specsupdate.sh script
+# Author: Elan Ruusamäe <glen@pld-linux.org>
+
+set -e
+dir=$(dirname "$0")
+topdir=${1:-$(rpm -E %_topdir)}
+pldnotify=${0%/*}/pldnotify.awk
+debug=0
+
+# run pldnotify with debug mode if this script executed with "-x"
+case "$-" in
+*x*)
+       debug=1
+       ;;
+esac
+
+xtitle() {
+       local prefix="[$(date '+%Y-%m-%d %H:%M:%S')] pldnotify: "
+       local msg="$prefix"$(echo "$*" | tr -d '\r\n')
+       case "$TERM" in
+       cygwin|xterm*)
+               echo >&2 -ne "\033]1;$msg\007\033]2;$msg\007"
+       ;;
+       screen*)
+               echo >&2 -ne "\033]0;$msg\007"
+       ;;
+       esac
+       echo "$msg"
+}
+
+xtitle "Checking packages in $topdir/*"
+for spec in $topdir/*/*.spec; do
+       pkg=${spec##*/}
+
+       xtitle "Checking $pkg"
+       out=$($pldnotify -vDEBUG=$debug < $spec); rc=$?
+       if [ $rc != 0 ]; then
+               echo >&2 "$out"
+               continue
+       fi
+
+       echo "$out" | grep -v "seems ok" || :
+done
This page took 1.333414 seconds and 4 git commands to generate.