]> git.pld-linux.org Git - packages/rpm-build-tools.git/blame - pldnotify.sh
Make sure readable file is uploaded.
[packages/rpm-build-tools.git] / pldnotify.sh
CommitLineData
338aaca9
ER
1#!/bin/sh
2# Walks your %_topdir (or any other dir specified by $1) and checks with pldnotify.awk for updates
3# and shows only relevant diffs of those packages only.
4#
5# Setup your cron to give you work early morning :)
6# 6 30 * * * /some/path/pldnotify.sh
7#
8# Idea based on PLD-doc/notify-specsupdate.sh script
9# Author: Elan Ruusamäe <glen@pld-linux.org>
10
11set -e
12dir=$(dirname "$0")
13topdir=${1:-$(rpm -E %_topdir)}
14pldnotify=${0%/*}/pldnotify.awk
15debug=0
16
17# run pldnotify with debug mode if this script executed with "-x"
18case "$-" in
19*x*)
20 debug=1
21 ;;
22esac
23
24xtitle() {
25 local prefix="[$(date '+%Y-%m-%d %H:%M:%S')] pldnotify: "
26 local msg="$prefix"$(echo "$*" | tr -d '\r\n')
27 case "$TERM" in
28 cygwin|xterm*)
29 echo >&2 -ne "\033]1;$msg\007\033]2;$msg\007"
30 ;;
31 screen*)
32 echo >&2 -ne "\033]0;$msg\007"
33 ;;
34 esac
35 echo "$msg"
36}
37
38xtitle "Checking packages in $topdir/*"
39for spec in $topdir/*/*.spec; do
40 pkg=${spec##*/}
41
42 xtitle "Checking $pkg"
43 out=$($pldnotify -vDEBUG=$debug < $spec); rc=$?
44 if [ $rc != 0 ]; then
45 echo >&2 "$out"
46 continue
47 fi
48
49 echo "$out" | grep -v "seems ok" || :
50done
This page took 0.043093 seconds and 4 git commands to generate.